File tree Expand file tree Collapse file tree 3 files changed +23
-17
lines changed Expand file tree Collapse file tree 3 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -23,23 +23,6 @@ def _setup_ssl_context():
2323 return ssl_context
2424
2525class RithmicClient (DelegateMixin ):
26- # Connection events
27- on_connected = Event ()
28- on_disconnected = Event ()
29-
30- # Real-time market updates events
31- on_tick = Event ()
32- on_time_bar = Event ()
33-
34- # Order updates events
35- on_rithmic_order_notification = Event ()
36- on_exchange_order_notification = Event ()
37- on_bracket_update = Event ()
38-
39- # Historical data events
40- on_historical_tick = Event ()
41- on_historical_time_bar = Event ()
42-
4326 def __init__ (
4427 self ,
4528 user : str ,
@@ -50,6 +33,23 @@ def __init__(
5033 gateway : Gateway = Gateway .TEST ,
5134 ** kwargs
5235 ):
36+ # Connection events
37+ self .on_connected = Event ()
38+ self .on_disconnected = Event ()
39+
40+ # Real-time market updates events
41+ self .on_tick = Event ()
42+ self .on_time_bar = Event ()
43+
44+ # Order updates events
45+ self .on_rithmic_order_notification = Event ()
46+ self .on_exchange_order_notification = Event ()
47+ self .on_bracket_update = Event ()
48+
49+ # Historical data events
50+ self .on_historical_tick = Event ()
51+ self .on_historical_time_bar = Event ()
52+
5353 self .credentials = dict (
5454 user = user ,
5555 password = password ,
Original file line number Diff line number Diff line change @@ -159,6 +159,9 @@ async def unsubscribe_from_time_bar_data(
159159 bar_type : TimeBarType ,
160160 bar_type_periods : int
161161 ):
162+ sub = (symbol , exchange , bar_type , bar_type_periods )
163+ self ._subscriptions ["time_bar" ].discard (sub )
164+
162165 return await self ._send_and_recv_immediate (
163166 template_id = 200 ,
164167 symbol = symbol ,
Original file line number Diff line number Diff line change @@ -67,6 +67,9 @@ async def unsubscribe_from_market_data(
6767 ):
6868 update_bits = data_type .value if isinstance (data_type , DataType ) else int (data_type )
6969
70+ sub = (symbol , exchange , update_bits )
71+ self ._subscriptions ["market_data" ].discard (sub )
72+
7073 await self ._send_request (
7174 template_id = 100 ,
7275 symbol = symbol ,
You can’t perform that action at this time.
0 commit comments