MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_trades

Method fetch_trades

python/ccxt/ascendex.py:1355–1391  ·  view source on GitHub ↗

get the list of most recent trades for a particular symbol https://ascendex.github.io/ascendex-pro-api/#market-trades :param str symbol: unified symbol of the market to fetch trades for :param int [since]: timestamp in ms of the earliest trade to fetch :par

(self, symbol: str, since: Int = None, limit: Int = None, params={})

Source from the content-addressed store, hash-verified

1353 }, market)
1354
1355 def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
1356 """
1357 get the list of most recent trades for a particular symbol
1358
1359 https://ascendex.github.io/ascendex-pro-api/#market-trades
1360
1361 :param str symbol: unified symbol of the market to fetch trades for
1362 :param int [since]: timestamp in ms of the earliest trade to fetch
1363 :param int [limit]: the maximum amount of trades to fetch
1364 :param dict [params]: extra parameters specific to the exchange API endpoint
1365 :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=public-trades>`
1366 """
1367 self.load_markets()
1368 market = self.market(symbol)
1369 request = {
1370 'symbol': market['id'],
1371 }
1372 if limit is not None:
1373 request['n'] = limit # max 100
1374 response = self.v1PublicGetTrades(self.extend(request, params))
1375 #
1376 # {
1377 # "code":0,
1378 # "data":{
1379 # "m":"trades",
1380 # "symbol":"BTC-PERP",
1381 # "data":[
1382 # {"p":"9128.5","q":"0.0030","ts":1590229002385,"bm":false,"seqnum":180143985289898554},
1383 # {"p":"9129","q":"0.0030","ts":1590229002642,"bm":false,"seqnum":180143985289898587},
1384 # {"p":"9129.5","q":"0.0030","ts":1590229021306,"bm":false,"seqnum":180143985289899043}
1385 # ]
1386 # }
1387 # }
1388 #
1389 records = self.safe_dict(response, 'data', {})
1390 trades = self.safe_list(records, 'data', [])
1391 return self.parse_trades(trades, market, since, limit)
1392
1393 def parse_order_status(self, status: Str):
1394 statuses = {

Callers

nothing calls this directly

Calls 7

safe_dictMethod · 0.80
safe_listMethod · 0.80
parse_tradesMethod · 0.80
v1PublicGetTradesMethod · 0.65
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected