Skip to content

Commit

Permalink
Merge pull request #1426 from vishalg/bug_1425_addback_markets_fix
Browse files Browse the repository at this point in the history
Fixed removed_markets_addback function in duplicate_remove_markets.py
  • Loading branch information
bug-or-feature authored Oct 25, 2024
2 parents dbbc547 + 6a2f085 commit b264d6d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions sysproduction/reporting/data/duplicate_remove_markets.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class RemoveMarketData:
auto_parameters: parametersForAutoPopulation

existing_bad_markets: list
exclude_markets: list

@property
def str_existing_markets_to_remove(self) -> str:
Expand Down Expand Up @@ -118,12 +119,16 @@ def recommended_list_of_bad_markets(self):

def removed_markets_addback(self) -> list:
existing_bad_markets = self.existing_bad_markets
exclude_markets = self.exclude_markets

## To be allowed to trade an existing bad market must be well above the threshold for not being a bad market
bad_markets = self.bad_markets(apply_higher_threshold=True)

# Markets to be added back = (existing bad markets - new bad markets) - (ignored and stale instruments)
removed_bad_markets = list(
set(existing_bad_markets).difference(set(bad_markets))
set(existing_bad_markets)
.difference(set(bad_markets))
.difference(set(exclude_markets))
)

return removed_bad_markets
Expand Down Expand Up @@ -327,6 +332,7 @@ def get_remove_market_data(data) -> RemoveMarketData:
min_volume_contracts=min_volume_contracts,
existing_bad_markets=existing_bad_markets,
auto_parameters=auto_parameters,
exclude_markets=exclude_instruments,
)


Expand Down Expand Up @@ -426,13 +432,6 @@ def get_stale_instruments(data) -> list:
return stale_instruments


def get_ignored_instruments(data) -> list:
production_config = data.config
ignored_instruments = get_list_of_ignored_instruments_in_config(production_config)

return ignored_instruments


def get_list_of_bad_markets(data):
production_config = data.config
bad_markets = get_list_of_bad_instruments_in_config(production_config)
Expand Down

0 comments on commit b264d6d

Please sign in to comment.