Replies: 1 comment
-
So for the cache we generally store in dictionaries (IDs as keys e.g. If we were to call I will add some detail to the cache docs to explain the random order of returned lists where applicable. |
Beta Was this translation helpful? Give feedback.
-
Calling self.cache.orders() returns a list of orders. Below is an example. How is this list of orders... ordered? It doesn't appear to be by timestamp, as you might imagine.
If the ordering here is not being used elsewhere in Nautilus, my suggestion would be order the output by timestamp. I want to get the last trade for a specific tag, so that I can get the side and quantity, so that I can close the relative value trade precisely without impacting other ongoing trades on the same instrument. I can record the ClientOrderId on order submission, so this issue is generally avoidable. But wanted to discuss here how this cache is ordered, because it could be generally useful to be able to grab the Xth order.
MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220213-001-000-5444, venue_order_id=BINANCE-109-095, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(SELL 17 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220213-001-000-5140, venue_order_id=BINANCE-109-056, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220213-001-000-5097, venue_order_id=BINANCE-109-049, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220213-001-000-5306, venue_order_id=BINANCE-109-079, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220212-001-000-1373, venue_order_id=BINANCE-109-012, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220212-001-000-1721, venue_order_id=BINANCE-109-013, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220213-001-000-5163, venue_order_id=BINANCE-109-061, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220212-001-000-2502, venue_order_id=BINANCE-109-018, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220212-001-000-4006, venue_order_id=BINANCE-109-034, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220213-001-000-5326, venue_order_id=BINANCE-109-083, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220213-001-000-5101, venue_order_id=BINANCE-109-051, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(SELL 15 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220213-001-000-5399, venue_order_id=BINANCE-109-090, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220212-001-000-3139, venue_order_id=BINANCE-109-030, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(SELL 16 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220213-001-000-5493, venue_order_id=BINANCE-109-098, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220212-001-000-4322, venue_order_id=BINANCE-109-036, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220212-001-000-4374, venue_order_id=BINANCE-109-039, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 16 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220213-001-000-5562, venue_order_id=BINANCE-109-110, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(SELL 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220212-001-000-2887, venue_order_id=BINANCE-109-025, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220212-001-000-2853, venue_order_id=BINANCE-109-024, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(SELL 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220212-001-000-2840, venue_order_id=BINANCE-109-023, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL), MarketOrder(BUY 20 OXTUSDT.BINANCE MARKET GTC, status=FILLED, client_order_id=O-20220213-001-000-5496, venue_order_id=BINANCE-109-099, tags=OXTUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL+STXUSDT.BINANCE-1-MINUTE-LAST-EXTERNAL)]
Beta Was this translation helpful? Give feedback.
All reactions