get the list of most recent trades for a particular symbol https://trade.cex.io/docs/#rest-public-api-calls-trade-history :param str symbol: unified symbol of the market to fetch trades for :param int [since]: timestamp in ms of the earliest trade to fetch
(self, symbol: str, since: Int = None, limit: Int = None, params={})
| 629 | }, market) |
| 630 | |
| 631 | def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]: |
| 632 | """ |
| 633 | get the list of most recent trades for a particular symbol |
| 634 | |
| 635 | https://trade.cex.io/docs/#rest-public-api-calls-trade-history |
| 636 | |
| 637 | :param str symbol: unified symbol of the market to fetch trades for |
| 638 | :param int [since]: timestamp in ms of the earliest trade to fetch |
| 639 | :param int [limit]: the maximum amount of trades to fetch |
| 640 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 641 | :param int [params.until]: timestamp in ms of the latest entry |
| 642 | :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=public-trades>` |
| 643 | """ |
| 644 | self.load_markets() |
| 645 | market = self.market(symbol) |
| 646 | request = { |
| 647 | 'pair': market['id'], |
| 648 | } |
| 649 | if since is not None: |
| 650 | request['fromDateISO'] = self.iso8601(since) |
| 651 | until = None |
| 652 | until, params = self.handle_param_integer_2(params, 'until', 'till') |
| 653 | if until is not None: |
| 654 | request['toDateISO'] = self.iso8601(until) |
| 655 | if limit is not None: |
| 656 | request['pageSize'] = min(limit, 10000) # has a bug, still returns more trades |
| 657 | response = self.publicPostGetTradeHistory(self.extend(request, params)) |
| 658 | # |
| 659 | # { |
| 660 | # "ok": "ok", |
| 661 | # "data": { |
| 662 | # "pageSize": "10", |
| 663 | # "trades": [ |
| 664 | # { |
| 665 | # "tradeId": "1728630559823-0", |
| 666 | # "dateISO": "2024-10-11T07:09:19.823Z", |
| 667 | # "side": "SELL", |
| 668 | # "price": "60879.5", |
| 669 | # "amount": "0.00165962" |
| 670 | # }, |
| 671 | # ... followed by older trades |
| 672 | # |
| 673 | data = self.safe_dict(response, 'data', {}) |
| 674 | trades = self.safe_list(data, 'trades', []) |
| 675 | return self.parse_trades(trades, market, since, limit) |
| 676 | |
| 677 | def parse_trade(self, trade: dict, market: Market = None) -> Trade: |
| 678 | # |
nothing calls this directly
no test coverage detected