Skip to content

Commit

Permalink
reduce excessive logging in 'trade_open' loop
Browse files Browse the repository at this point in the history
  • Loading branch information
bug-or-feature committed Nov 6, 2023
1 parent f8cbad7 commit 7dfea17
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sysproduction/data/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@


class dataBroker(productionDataLayerGeneric):
def __init__(self, data: dataBlob = arg_not_supplied):
super().__init__(data)
self._diag_controls = diagControlProcess()

def _add_required_classes_to_data(self, data) -> dataBlob:

# Add a list of broker specific classes that will be aliased as self.data.broker_fx_prices,
Expand Down Expand Up @@ -90,6 +94,10 @@ def broker_fx_handling_data(self) -> brokerFxHandlingData:
def broker_static_data(self) -> brokerStaticData:
return self.data.broker_static

@property
def diag_controls(self) -> diagControlProcess:
return self._diag_controls

## Methods

def get_list_of_contract_dates_for_instrument_code(
Expand Down Expand Up @@ -191,9 +199,8 @@ def less_than_N_hours_of_trading_left_for_contract(
self, contract: futuresContract, N_hours: float = 1.0
) -> bool:

diag_controls = diagControlProcess()
hours_left_before_process_finishes = (
diag_controls.how_long_in_hours_before_trading_process_finishes()
self.diag_controls.how_long_in_hours_before_trading_process_finishes()
)

if hours_left_before_process_finishes < N_hours:
Expand Down

0 comments on commit 7dfea17

Please sign in to comment.