|
48 | 48 | from nautilus_trader.common.enums import LogColor
|
49 | 49 | from nautilus_trader.data.messages import RequestBars
|
50 | 50 | from nautilus_trader.data.messages import SubscribeBars
|
| 51 | +from nautilus_trader.data.messages import SubscribeInstrument |
| 52 | +from nautilus_trader.data.messages import SubscribeInstruments |
51 | 53 | from nautilus_trader.data.messages import SubscribeOrderBook
|
52 | 54 | from nautilus_trader.data.messages import SubscribeQuoteTicks
|
53 | 55 | from nautilus_trader.data.messages import SubscribeTradeTicks
|
54 | 56 | from nautilus_trader.data.messages import UnsubscribeBars
|
| 57 | +from nautilus_trader.data.messages import UnsubscribeInstrument |
| 58 | +from nautilus_trader.data.messages import UnsubscribeInstruments |
55 | 59 | from nautilus_trader.data.messages import UnsubscribeOrderBook
|
56 | 60 | from nautilus_trader.data.messages import UnsubscribeQuoteTicks
|
57 | 61 | from nautilus_trader.data.messages import UnsubscribeTradeTicks
|
@@ -152,8 +156,8 @@ def __init__(
|
152 | 156 | base_url=ws_base_url,
|
153 | 157 | loop=loop,
|
154 | 158 | max_send_retries=config.max_retries or 3,
|
155 |
| - delay_initial_ms=config.retry_delay_initial_ms or 1_000, |
156 |
| - delay_max_ms=config.retry_delay_max_ms or 10_000, |
| 159 | + delay_initial_ms=config.retry_delay_initial_ms or 100, |
| 160 | + delay_max_ms=config.retry_delay_max_ms or 5_000, |
157 | 161 | backoff_factor=2,
|
158 | 162 | )
|
159 | 163 |
|
@@ -773,6 +777,57 @@ def _handle_markets_subscribed(self, raw: bytes) -> None:
|
773 | 777 | except Exception as e:
|
774 | 778 | self._log.exception(f"Failed to parse market channel data: {raw.decode()}", e)
|
775 | 779 |
|
| 780 | + async def _subscribe_instruments(self, command: SubscribeInstruments) -> None: |
| 781 | + """ |
| 782 | + Subscribe to instruments updates. |
| 783 | +
|
| 784 | + Parameters |
| 785 | + ---------- |
| 786 | + command : SubscribeInstruments |
| 787 | + The command to subscribe to instruments. |
| 788 | +
|
| 789 | + """ |
| 790 | + self._log.info("Skipping subscribe_instruments, dYdX subscribes automatically") |
| 791 | + |
| 792 | + async def _subscribe_instrument(self, command: SubscribeInstrument) -> None: |
| 793 | + """ |
| 794 | + Subscribe to instrument updates. |
| 795 | +
|
| 796 | + Parameters |
| 797 | + ---------- |
| 798 | + command : SubscribeInstrument |
| 799 | + The command to subscribe to instrument. |
| 800 | +
|
| 801 | + """ |
| 802 | + self._log.info("Skipping subscribe_instrument, dYdX subscribes automatically") |
| 803 | + |
| 804 | + async def _unsubscribe_instruments( |
| 805 | + self, |
| 806 | + command: UnsubscribeInstruments, |
| 807 | + ) -> None: |
| 808 | + """ |
| 809 | + Unsubscribe from instruments updates. |
| 810 | +
|
| 811 | + Parameters |
| 812 | + ---------- |
| 813 | + command : UnsubscribeInstruments |
| 814 | + The command to unsubscribe from instruments updates. |
| 815 | +
|
| 816 | + """ |
| 817 | + self._log.info("Skipping unsubscribe_instruments, not applicable for dYdX") |
| 818 | + |
| 819 | + async def _unsubscribe_instrument(self, command: UnsubscribeInstrument) -> None: |
| 820 | + """ |
| 821 | + Unsubscribe from instrument updates. |
| 822 | +
|
| 823 | + Parameters |
| 824 | + ---------- |
| 825 | + command : UnsubscribeInstrument |
| 826 | + The command to unsubscribe from instrument updates. |
| 827 | +
|
| 828 | + """ |
| 829 | + self._log.info("Skipping unsubscribe_instrument, not applicable for dYdX") |
| 830 | + |
776 | 831 | async def _subscribe_trade_ticks(self, command: SubscribeTradeTicks) -> None:
|
777 | 832 | dydx_symbol = DYDXSymbol(command.instrument_id.symbol.value)
|
778 | 833 | await self._ws_client.subscribe_trades(dydx_symbol.raw_symbol)
|
|
0 commit comments