Skip to content

Commit

Permalink
added since + limit params to fetchTrades, fetchOrders, fetchClosedOr…
Browse files Browse the repository at this point in the history
…ders, fetchOpenOrders
  • Loading branch information
kroitor committed Nov 6, 2017
1 parent 1cb10fc commit 4e382ff
Show file tree
Hide file tree
Showing 268 changed files with 574 additions and 586 deletions.
330 changes: 159 additions & 171 deletions build/ccxt.browser.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions doc/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ You can call the unified ``fetchTrades`` / ``fetch_trades`` method to get the li

::

async fetchTrades (symbol, params = {})
async fetchTrades (symbol, since = undefined, limit = undefined, params = {})

For example, if you want to print recent trades for all symbols one by one sequentially (mind the rateLimit!) you would do it like so:

Expand Down Expand Up @@ -1455,21 +1455,21 @@ All Orders

.. code:: javascript
exchange.fetchOrders (symbol = undefined, params = {})
exchange.fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {})
Open Orders
^^^^^^^^^^^

.. code:: javascript
exchange.fetchOpenOrders (symbol = undefined, params = {})
exchange.fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {})
Closed Orders
^^^^^^^^^^^^^

.. code:: javascript
exchange.fetchClosedOrders (symbol = undefined, params = {})
exchange.fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {})
Trades / Transactions / Fills / Executions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion js/_1btcxe.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ module.exports = class _1btcxe extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetTransactions (this.extend ({
'currency': market['id'],
Expand Down
2 changes: 1 addition & 1 deletion js/acx.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ module.exports = class acx extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let response = await this.publicGetTrades (this.extend ({
Expand Down
6 changes: 3 additions & 3 deletions js/binance.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ module.exports = class binance extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetAggTrades (this.extend ({
'symbol': market['id'],
Expand Down Expand Up @@ -467,7 +467,7 @@ module.exports = class binance extends Exchange {
return this.parseOrder (response, market);
}

async fetchOrders (symbol = undefined, params = {}) {
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
if (!symbol)
throw new ExchangeError (this.id + ' fetchOrders requires a symbol param');
let market = this.market (symbol);
Expand All @@ -477,7 +477,7 @@ module.exports = class binance extends Exchange {
return this.parseOrders (response, market);
}

async fetchOpenOrders (symbol = undefined, params = {}) {
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
if (!symbol)
throw new ExchangeError (this.id + ' fetchOpenOrders requires a symbol param');
let market = this.market (symbol);
Expand Down
2 changes: 1 addition & 1 deletion js/bit2c.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ module.exports = class bit2c extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetExchangesPairTrades (this.extend ({
'pair': market['id'],
Expand Down
2 changes: 1 addition & 1 deletion js/bitbay.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ module.exports = class bitbay extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetIdTrades (this.extend ({
'id': market['id'],
Expand Down
2 changes: 1 addition & 1 deletion js/bitcoincoid.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ module.exports = class bitcoincoid extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetPairTrades (this.extend ({
'pair': market['id'],
Expand Down
6 changes: 3 additions & 3 deletions js/bitfinex.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ module.exports = class bitfinex extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let response = await this.publicGetTradesSymbol (this.extend ({
Expand Down Expand Up @@ -303,13 +303,13 @@ module.exports = class bitfinex extends Exchange {
return result;
}

async fetchOpenOrders (symbol = undefined, params = {}) {
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let response = await this.privatePostOrders (params);
return this.parseOrders (response);
}

async fetchClosedOrders (symbol = undefined, params = {}) {
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let response = await this.privatePostOrdersHist (this.extend ({
'limit': 100, // default 100
Expand Down
2 changes: 1 addition & 1 deletion js/bitfinex2.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ module.exports = class bitfinex2 extends bitfinex {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetTradesSymbolHist (this.extend ({
'symbol': market['id'],
Expand Down
2 changes: 1 addition & 1 deletion js/bitflyer.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ module.exports = class bitflyer extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let response = await this.publicGetExecutions (this.extend ({
Expand Down
2 changes: 1 addition & 1 deletion js/bithumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ module.exports = class bithumb extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetRecentTransactionsCurrency (this.extend ({
'currency': market['base'],
Expand Down
2 changes: 1 addition & 1 deletion js/bitlish.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ module.exports = class bitlish extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let response = await this.publicGetTradesHistory (this.extend ({
Expand Down
2 changes: 1 addition & 1 deletion js/bitmarket.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ module.exports = class bitmarket extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetJsonMarketTrades (this.extend ({
'market': market['id'],
Expand Down
2 changes: 1 addition & 1 deletion js/bitmex.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ module.exports = class bitmex extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let response = await this.publicGetTrade (this.extend ({
Expand Down
2 changes: 1 addition & 1 deletion js/bitso.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ module.exports = class bitso extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let response = await this.publicGetTrades (this.extend ({
Expand Down
2 changes: 1 addition & 1 deletion js/bitstamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ module.exports = class bitstamp extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetTransactionsPair (this.extend ({
'pair': market['id'],
Expand Down
2 changes: 1 addition & 1 deletion js/bitstamp1.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ module.exports = class bitstamp1 extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
if (symbol != 'BTC/USD')
throw new ExchangeError (this.id + ' ' + this.version + " fetchTrades doesn't support " + symbol + ', use it for BTC/USD only');
let market = this.market (symbol);
Expand Down
8 changes: 4 additions & 4 deletions js/bittrex.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ module.exports = class bittrex extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let response = await this.publicGetMarkethistory (this.extend ({
Expand Down Expand Up @@ -312,7 +312,7 @@ module.exports = class bittrex extends Exchange {
return this.parseOHLCVs (response['result'], market, timeframe, since, limit);
}

async fetchOpenOrders (symbol = undefined, params = {}) {
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let request = {};
let market = undefined;
Expand Down Expand Up @@ -451,7 +451,7 @@ module.exports = class bittrex extends Exchange {
return this.parseOrder (response['result']);
}

async fetchOrders (symbol = undefined, params = {}) {
async fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let request = {};
let market = undefined;
Expand All @@ -464,7 +464,7 @@ module.exports = class bittrex extends Exchange {
return this.filterOrdersBySymbol (orders, symbol);
}

async fetchClosedOrders (symbol = undefined, params = {}) {
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
let orders = await this.fetchOrders (symbol, params);
return this.filterBy (orders, 'status', 'closed');
}
Expand Down
2 changes: 1 addition & 1 deletion js/bl3p.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ module.exports = class bl3p extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetMarketTrades (this.extend ({
'market': market['id'],
Expand Down
2 changes: 1 addition & 1 deletion js/btcbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ module.exports = class btcbox extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let request = {};
Expand Down
2 changes: 1 addition & 1 deletion js/btcchina.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ module.exports = class btcchina extends Exchange {
return result;
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let method = market['api'] + 'GetTrade';
Expand Down
2 changes: 1 addition & 1 deletion js/btcmarkets.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ module.exports = class btcmarkets extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let response = await this.publicGetMarketIdTrades (this.extend ({
Expand Down
4 changes: 2 additions & 2 deletions js/btctradeua.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ module.exports = class btctradeua extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetDealsSymbol (this.extend ({
'symbol': market['id'],
Expand Down Expand Up @@ -285,7 +285,7 @@ module.exports = class btctradeua extends Exchange {
};
}

async fetchOpenOrders (symbol = undefined, params = {}) {
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
if (!symbol)
throw new ExchangeError (this.id + ' fetchOpenOrders requires a symbol param');
let market = this.market (symbol);
Expand Down
2 changes: 1 addition & 1 deletion js/btcturk.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ module.exports = class btcturk extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
// let maxCount = 50;
let response = await this.publicGetTrades (this.extend ({
Expand Down
2 changes: 1 addition & 1 deletion js/btcx.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ module.exports = class btcx extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetTradeIdLimit (this.extend ({
'id': market['id'],
Expand Down
2 changes: 1 addition & 1 deletion js/bter.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ module.exports = class bter extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
await this.loadMarkets ();
let response = await this.publicGetTradeHistoryId (this.extend ({
Expand Down
2 changes: 1 addition & 1 deletion js/bxinth.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ module.exports = class bxinth extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let response = await this.publicGetTrade (this.extend ({
Expand Down
2 changes: 1 addition & 1 deletion js/ccex.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ module.exports = class ccex extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let response = await this.publicGetMarkethistory (this.extend ({
Expand Down
4 changes: 2 additions & 2 deletions js/cex.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ module.exports = class cex extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let response = await this.publicGetTradeHistoryPair (this.extend ({
Expand Down Expand Up @@ -356,7 +356,7 @@ module.exports = class cex extends Exchange {
};
}

async fetchOpenOrders (symbol = undefined, params = {}) {
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let request = {};
let method = 'privatePostOpenOrders';
Expand Down
2 changes: 1 addition & 1 deletion js/chbtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ module.exports = class chbtc extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
let market = this.market (symbol);
let response = await this.publicGetTrades (this.extend ({
Expand Down
2 changes: 1 addition & 1 deletion js/coincheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ module.exports = class coincheck extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
if (symbol != 'BTC/JPY')
throw new NotSupported (this.id + ' fetchTrades () supports BTC/JPY only');
let market = this.market (symbol);
Expand Down
2 changes: 1 addition & 1 deletion js/coinfloor.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ module.exports = class coinfloor extends Exchange {
};
}

async fetchTrades (symbol, params = {}) {
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
let market = this.market (symbol);
let response = await this.publicGetIdTransactions (this.extend ({
'id': market['id'],
Expand Down
Loading

0 comments on commit 4e382ff

Please sign in to comment.