Skip to content

Commit

Permalink
Merge pull request #403 from migueltg/slim_analysis_optional
Browse files Browse the repository at this point in the history
added slim_analysis parameter optional
  • Loading branch information
enarjord authored May 25, 2023
2 parents 2fdd227 + 755e763 commit c76d6a4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions configs/backtest/default.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
start_date: 2020-01-01
end_date: 2023-05-05

# Reduce disk usage and improve some optimize speed with the slim analysis
slim_analysis: true

# non default historical data path
# defaults to local dir if unspecified
# historical_data_path: "/media/e/Samsung_T5/"
Expand Down
2 changes: 2 additions & 0 deletions harmony_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def start_new_harmony(self, wi: int):
"latency_simulation_ms",
"market_type",
"adg_n_subdivisions",
"slim_analysis"
]
},
**{"symbol": self.symbols[0], "config_no": self.iter_counter},
Expand Down Expand Up @@ -337,6 +338,7 @@ def start_new_initial_eval(self, wi: int, hm_key: str):
"latency_simulation_ms",
"market_type",
"adg_n_subdivisions",
"slim_analysis"
]
},
**{"symbol": self.symbols[0], "initial_eval_key": hm_key, "config_no": self.iter_counter},
Expand Down
7 changes: 6 additions & 1 deletion optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
determine_passivbot_mode,
get_empty_analysis,
calc_scores,
analyze_fills,
)
from procedures import (
add_argparse_args,
Expand Down Expand Up @@ -57,6 +58,7 @@ def backtest_wrap(config_: dict, ticks_caches: dict):
"market_type",
"config_no",
"adg_n_subdivisions",
"slim_analysis",
]
},
**{k: v for k, v in config_["market_specific_settings"].items()},
Expand All @@ -68,7 +70,10 @@ def backtest_wrap(config_: dict, ticks_caches: dict):
try:
assert "adg_n_subdivisions" in config
fills_long, fills_short, stats = backtest(config, ticks)
analysis = analyze_fills_slim(fills_long, fills_short, stats, config)
if config["slim_analysis"]:
analysis = analyze_fills_slim(fills_long, fills_short, stats, config)
else:
longs, shorts, sdf, analysis = analyze_fills(fills_long, fills_short, stats, config)
except Exception as e:
analysis = get_empty_analysis()
logging.error(f'error with {config["symbol"]} {e}')
Expand Down
2 changes: 2 additions & 0 deletions particle_swarm_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def start_new_particle_position(self, wi: int):
"latency_simulation_ms",
"market_type",
"adg_n_subdivisions",
"slim_analysis"
]
},
**{"symbol": self.symbols[0], "config_no": self.iter_counter},
Expand Down Expand Up @@ -326,6 +327,7 @@ def start_new_initial_eval(self, wi: int, swarm_key: str):
"latency_simulation_ms",
"market_type",
"adg_n_subdivisions",
"slim_analysis"
]
},
**{
Expand Down

0 comments on commit c76d6a4

Please sign in to comment.