bug fix - multiple dates
This commit is contained in:
parent
bcf4447cb6
commit
98a15d301a
File diff suppressed because one or more lines are too long
@ -77,9 +77,9 @@ def run_backtest(
|
|||||||
Run backtest for all pairs using the specified instruments.
|
Run backtest for all pairs using the specified instruments.
|
||||||
"""
|
"""
|
||||||
bt_result: BacktestResult = BacktestResult(config=config)
|
bt_result: BacktestResult = BacktestResult(config=config)
|
||||||
if len(datafiles) < 2:
|
# if len(datafiles) < 2:
|
||||||
print(f"WARNING: insufficient data files: {datafiles}")
|
# print(f"WARNING: insufficient data files: {datafiles}")
|
||||||
return bt_result
|
# return bt_result
|
||||||
|
|
||||||
if not all([os.path.exists(datafile) for datafile in datafiles]):
|
if not all([os.path.exists(datafile) for datafile in datafiles]):
|
||||||
print(f"WARNING: data file {datafiles} does not exist")
|
print(f"WARNING: data file {datafiles} does not exist")
|
||||||
|
|||||||
@ -73,12 +73,18 @@ def create_pairs(
|
|||||||
)
|
)
|
||||||
market_data_df = pd.concat([market_data_df, md_df])
|
market_data_df = pd.concat([market_data_df, md_df])
|
||||||
|
|
||||||
|
if len(set(market_data_df["symbol"])) != 2: # both symbols must be present for a pair
|
||||||
|
print(f"WARNING: insufficient data in files: {datafiles}")
|
||||||
|
return []
|
||||||
|
|
||||||
for a_index, b_index in unique_index_pairs:
|
for a_index, b_index in unique_index_pairs:
|
||||||
|
symbol_a=instruments[a_index]["symbol"]
|
||||||
|
symbol_b=instruments[b_index]["symbol"]
|
||||||
pair = fit_method.create_trading_pair(
|
pair = fit_method.create_trading_pair(
|
||||||
config=config_copy,
|
config=config_copy,
|
||||||
market_data=market_data_df,
|
market_data=market_data_df,
|
||||||
symbol_a=instruments[a_index]["symbol"],
|
symbol_a=symbol_a,
|
||||||
symbol_b=instruments[b_index]["symbol"],
|
symbol_b=symbol_b,
|
||||||
price_column=price_column,
|
price_column=price_column,
|
||||||
)
|
)
|
||||||
pairs.append(pair)
|
pairs.append(pair)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user