get the list of most recent trades for a particular symbol https://bybit-exchange.github.io/docs/v5/market/recent-trade :param str symbol: unified symbol of the market to fetch trades for :param int [since]: timestamp in ms of the earliest trade to fetch :p
(self, symbol: str, since: Int = None, limit: Int = None, params={})
| 3214 | }, market) |
| 3215 | |
| 3216 | def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]: |
| 3217 | """ |
| 3218 | get the list of most recent trades for a particular symbol |
| 3219 | |
| 3220 | https://bybit-exchange.github.io/docs/v5/market/recent-trade |
| 3221 | |
| 3222 | :param str symbol: unified symbol of the market to fetch trades for |
| 3223 | :param int [since]: timestamp in ms of the earliest trade to fetch |
| 3224 | :param int [limit]: the maximum amount of trades to fetch |
| 3225 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 3226 | :param str [params.type]: market type, ['swap', 'option', 'spot'] |
| 3227 | :param str [params.subType]: market subType, ['linear', 'inverse'] |
| 3228 | :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=public-trades>` |
| 3229 | """ |
| 3230 | if symbol is None: |
| 3231 | raise ArgumentsRequired(self.id + ' fetchTrades() requires a symbol argument') |
| 3232 | self.load_markets() |
| 3233 | market = self.market(symbol) |
| 3234 | request = { |
| 3235 | 'symbol': market['id'], |
| 3236 | # 'baseCoin': '', # Base coin. For option only. If not passed, return BTC data by default |
| 3237 | # 'optionType': 'Call', # Option type. Call or Put. For option only |
| 3238 | } |
| 3239 | if limit is not None: |
| 3240 | # spot: [1,60], default: 60. |
| 3241 | # others: [1,1000], default: 500 |
| 3242 | request['limit'] = limit |
| 3243 | type = None |
| 3244 | type, params = self.get_bybit_type('fetchTrades', market, params) |
| 3245 | request['category'] = type |
| 3246 | response = self.publicGetV5MarketRecentTrade(self.extend(request, params)) |
| 3247 | # |
| 3248 | # { |
| 3249 | # "retCode": 0, |
| 3250 | # "retMsg": "OK", |
| 3251 | # "result": { |
| 3252 | # "category": "spot", |
| 3253 | # "list": [ |
| 3254 | # { |
| 3255 | # "execId": "2100000000007764263", |
| 3256 | # "symbol": "BTCUSDT", |
| 3257 | # "price": "16618.49", |
| 3258 | # "size": "0.00012", |
| 3259 | # "side": "Buy", |
| 3260 | # "time": "1672052955758", |
| 3261 | # "isBlockTrade": False |
| 3262 | # } |
| 3263 | # ] |
| 3264 | # }, |
| 3265 | # "retExtInfo": {}, |
| 3266 | # "time": 1672053054358 |
| 3267 | # } |
| 3268 | # |
| 3269 | result = self.safe_dict(response, 'result', {}) |
| 3270 | trades = self.safe_list(result, 'list', []) |
| 3271 | return self.parse_trades(trades, market, since, limit) |
| 3272 | |
| 3273 | def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook: |
nothing calls this directly
no test coverage detected