diff --git a/server/exchanges/bittrex.js b/server/exchanges/bittrex.js index f8493a9..378e72a 100644 --- a/server/exchanges/bittrex.js +++ b/server/exchanges/bittrex.js @@ -1,5 +1,4 @@ import bittrex from 'node-bittrex-api' -import debug from 'debug' module.exports = class BittrexExchange { constructor (bitrexOpts) { @@ -17,8 +16,12 @@ module.exports = class BittrexExchange { }) } - getOrders (cb) { - bittrex.getorderhistory({}, function (data, err) { + getOrders (market, cb) { + const options = {} + if (market) { + options.market = market + } + bittrex.getorderhistory(options, function (data, err) { if (err) { cb(err) } diff --git a/server/models/order.js b/server/models/order.js index ae8e147..13cc573 100644 --- a/server/models/order.js +++ b/server/models/order.js @@ -1,11 +1,11 @@ import BittrexExchange from '../exchanges/bittrex' module.exports = function (Order) { - Order.getOrders = (cb) => { + Order.getOrders = (market, cb) => { const bitrexOpts = Order.app.get('bittrex') const exchange = new BittrexExchange(bitrexOpts) - exchange.getOrders((err, data) => { + exchange.getOrders(market, (err, data) => { if (err) { cb(err) } @@ -15,6 +15,9 @@ module.exports = function (Order) { } Order.remoteMethod('getOrders', { + accepts: [ + {arg: 'market', type: 'string'} + ], http: { verb: 'get', path: '/' }, returns: {type: 'array', root: true} })