File tree 2 files changed +13
-11
lines changed
2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 4
4
from typing import Union
5
5
6
6
from syscore .constants import missing_data , market_closed
7
+ from syscore .exceptions import missingData
7
8
from sysexecution .orders .named_order_objects import missing_order
8
9
9
10
from sysdata .data_blob import dataBlob
@@ -353,15 +354,17 @@ def required_to_switch_to_aggressive(reason):
353
354
def adverse_size_issue (
354
355
ticker_object : tickerObject , log : logger , wait_for_valid_tick = False
355
356
) -> 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
356
367
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
365
368
if current_tick_analysis is missing_data :
366
369
## serious problem with data, return True so switch to market order
367
370
## 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(
251
251
tick = self .current_tick ()
252
252
253
253
if qty is arg_not_supplied :
254
- return missing_data
254
+ raise missingData ( "Quantity must be specified" )
255
255
256
256
results = analyse_tick (tick , qty , replace_qty_nans = replace_qty_nans )
257
257
@@ -265,11 +265,10 @@ def wait_for_valid_bid_and_ask_and_analyse_current_tick(
265
265
current_tick = self .wait_for_valid_bid_and_ask_and_return_current_tick (
266
266
wait_time_seconds = wait_time_seconds
267
267
)
268
+ analysis = self .analyse_for_tick (current_tick , qty = qty )
268
269
except missingData :
269
270
return missing_data
270
271
271
- analysis = self .analyse_for_tick (current_tick , qty = qty )
272
-
273
272
return analysis
274
273
275
274
def wait_for_valid_bid_and_ask_and_return_current_tick (
You can’t perform that action at this time.
0 commit comments