get the list of most recent trades for a particular symbol Default fetchTradesMethod https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#compressedaggregate-trades-list # publicGetAggTrades(spot) https://developers.binance.com/docs/d
(self, symbol: str, since: Int = None, limit: Int = None, params={})
| 5043 | }, market) |
| 5044 | |
| 5045 | def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]: |
| 5046 | """ |
| 5047 | get the list of most recent trades for a particular symbol |
| 5048 | Default fetchTradesMethod |
| 5049 | |
| 5050 | https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#compressedaggregate-trades-list # publicGetAggTrades(spot) |
| 5051 | https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Compressed-Aggregate-Trades-List # fapiPublicGetAggTrades(swap) |
| 5052 | https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Compressed-Aggregate-Trades-List # dapiPublicGetAggTrades(future) |
| 5053 | https://developers.binance.com/docs/derivatives/option/market-data/Recent-Trades-List # eapiPublicGetTrades(option) |
| 5054 | |
| 5055 | Other fetchTradesMethod |
| 5056 | |
| 5057 | https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#recent-trades-list # publicGetTrades(spot) |
| 5058 | https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Recent-Trades-List # fapiPublicGetTrades(swap) |
| 5059 | https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Recent-Trades-List # dapiPublicGetTrades(future) |
| 5060 | https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#old-trade-lookup # publicGetHistoricalTrades(spot) |
| 5061 | https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Old-Trades-Lookup # fapiPublicGetHistoricalTrades(swap) |
| 5062 | https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Old-Trades-Lookup # dapiPublicGetHistoricalTrades(future) |
| 5063 | https://developers.binance.com/docs/derivatives/option/market-data/Old-Trades-Lookup # eapiPublicGetHistoricalTrades(option) |
| 5064 | |
| 5065 | :param str symbol: unified symbol of the market to fetch trades for |
| 5066 | :param int [since]: only used when fetchTradesMethod is 'publicGetAggTrades', 'fapiPublicGetAggTrades', or 'dapiPublicGetAggTrades' |
| 5067 | :param int [limit]: default 500, max 1000 |
| 5068 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 5069 | :param int [params.until]: only used when fetchTradesMethod is 'publicGetAggTrades', 'fapiPublicGetAggTrades', or 'dapiPublicGetAggTrades' |
| 5070 | :param int [params.fetchTradesMethod]: 'publicGetAggTrades'(spot default), 'fapiPublicGetAggTrades'(swap default), 'dapiPublicGetAggTrades'(future default), 'eapiPublicGetTrades'(option default), 'publicGetTrades', 'fapiPublicGetTrades', 'dapiPublicGetTrades', 'publicGetHistoricalTrades', 'fapiPublicGetHistoricalTrades', 'dapiPublicGetHistoricalTrades', 'eapiPublicGetHistoricalTrades' |
| 5071 | :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) |
| 5072 | |
| 5073 | EXCHANGE SPECIFIC PARAMETERS |
| 5074 | :param int [params.fromId]: trade id to fetch from, default gets most recent trades, not used when fetchTradesMethod is 'publicGetTrades', 'fapiPublicGetTrades', 'dapiPublicGetTrades', or 'eapiPublicGetTrades' |
| 5075 | :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=public-trades>` |
| 5076 | """ |
| 5077 | self.load_markets() |
| 5078 | paginate = False |
| 5079 | paginate, params = self.handle_option_and_params(params, 'fetchTrades', 'paginate') |
| 5080 | if paginate: |
| 5081 | return self.fetch_paginated_call_dynamic('fetchTrades', symbol, since, limit, params) |
| 5082 | market = self.market(symbol) |
| 5083 | request = { |
| 5084 | 'symbol': market['id'], |
| 5085 | # 'fromId': 123, # ID to get aggregate trades from INCLUSIVE. |
| 5086 | # 'startTime': 456, # Timestamp in ms to get aggregate trades from INCLUSIVE. |
| 5087 | # 'endTime': 789, # Timestamp in ms to get aggregate trades until INCLUSIVE. |
| 5088 | # 'limit': 500, # default = 500, maximum = 1000 |
| 5089 | } |
| 5090 | if not market['option']: |
| 5091 | if since is not None: |
| 5092 | request['startTime'] = since |
| 5093 | # https://github.com/ccxt/ccxt/issues/6400 |
| 5094 | # https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#compressedaggregate-trades-list |
| 5095 | request['endTime'] = self.sum(since, 3600000) |
| 5096 | until = self.safe_integer(params, 'until') |
| 5097 | if until is not None: |
| 5098 | request['endTime'] = until |
| 5099 | method = self.safe_string(self.options, 'fetchTradesMethod') |
| 5100 | method = self.safe_string_2(params, 'fetchTradesMethod', 'method', method) |
| 5101 | if limit is not None: |
| 5102 | isFutureOrSwap = (market['swap'] or market['future']) |
nothing calls this directly
no test coverage detected