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

Method fetch_trades

python/ccxt/extended.py:907–942  ·  view source on GitHub ↗

get the list of most recent trades for a particular symbol https://api.docs.extended.exchange/#get-market-last-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

905 return orderbook
906
907 def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
908 """
909 get the list of most recent trades for a particular symbol
910
911 https://api.docs.extended.exchange/#get-market-last-trades
912
913 :param str symbol: unified symbol of the market to fetch trades for
914 :param int [since]: timestamp in ms of the earliest trade to fetch
915 :param int [limit]: the maximum amount of trades to fetch
916 :param dict [params]: extra parameters specific to the exchange API endpoint
917 :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=public-trades>`
918 """
919 self.load_markets()
920 market = self.market(symbol)
921 request = {
922 'market': market['id'],
923 }
924 response = self.v1PublicGetInfoMarketsMarketTrades(self.extend(request, params))
925 #
926 # {
927 # "status": "OK",
928 # "data": [
929 # {
930 # "i": 2.049676905958871e+18,
931 # "m": "BTC-USD",
932 # "S": "SELL",
933 # "tT": "TRADE",
934 # "T": 1777516030193,
935 # "p": "76140",
936 # "q": "0.00165"
937 # }
938 # ]
939 # }
940 #
941 data = self.safe_list(response, 'data', [])
942 return self.parse_trades(data, market, since, limit)
943
944 def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
945 """

Callers

nothing calls this directly

Calls 6

load_marketsMethod · 0.95
safe_listMethod · 0.80
parse_tradesMethod · 0.80
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected