File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 44from typing import Union
55
66from syscore .constants import missing_data , market_closed
7+ from syscore .exceptions import missingData
78from sysexecution .orders .named_order_objects import missing_order
89
910from sysdata .data_blob import dataBlob
@@ -353,15 +354,17 @@ def required_to_switch_to_aggressive(reason):
353354def adverse_size_issue (
354355 ticker_object : tickerObject , log : logger , wait_for_valid_tick = False
355356) -> bool :
357+ try :
358+ if wait_for_valid_tick :
359+ # FIXME: THIS CAN RETURN missing_data; REFACTOR TO DEAL WITH EXCEPTIONS INSTEAD
360+ current_tick_analysis = (
361+ ticker_object .wait_for_valid_bid_and_ask_and_analyse_current_tick ()
362+ )
363+ else :
364+ current_tick_analysis = ticker_object .current_tick_analysis
365+ except missingData :
366+ current_tick_analysis = missing_data
356367
357- if wait_for_valid_tick :
358- current_tick_analysis = (
359- ticker_object .wait_for_valid_bid_and_ask_and_analyse_current_tick ()
360- )
361- else :
362- current_tick_analysis = ticker_object .current_tick_analysis
363-
364- ## FIXME: REFACTOR SO DEALS WITH EXCEPTIONS
365368 if current_tick_analysis is missing_data :
366369 ## serious problem with data, return True so switch to market order
367370 ## most likely case is order will be cancelled which is fine
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ def analyse_for_tick(
251251 tick = self .current_tick ()
252252
253253 if qty is arg_not_supplied :
254- return missing_data
254+ raise missingData ( "Quantity must be specified" )
255255
256256 results = analyse_tick (tick , qty , replace_qty_nans = replace_qty_nans )
257257
@@ -265,11 +265,10 @@ def wait_for_valid_bid_and_ask_and_analyse_current_tick(
265265 current_tick = self .wait_for_valid_bid_and_ask_and_return_current_tick (
266266 wait_time_seconds = wait_time_seconds
267267 )
268+ analysis = self .analyse_for_tick (current_tick , qty = qty )
268269 except missingData :
269270 return missing_data
270271
271- analysis = self .analyse_for_tick (current_tick , qty = qty )
272-
273272 return analysis
274273
275274 def wait_for_valid_bid_and_ask_and_return_current_tick (
You can’t perform that action at this time.
0 commit comments