enzoampil / fastquant

fastquant — Backtest and optimize your ML trading strategies with only 3 lines of code!
MIT License
1.52k stars 239 forks source link

How to get multiple dataframe and backtest at same time #405

Closed YASHGUPTA2611 closed 2 years ago

mikeejazmines commented 2 years ago

Please give more details on the issue/ask

YASHGUPTA2611 commented 2 years ago

I have read the two dataframe using get_crpto_data. Capture22 Capture21 Now i want to backtest both dataframe at once. So, how will i do it??

YASHGUPTA2611 commented 2 years ago

Capture2 and it is giving me this error

mikeejazmines commented 2 years ago

Hi! I don't think your all_dataframe is a list of dataframes. It looks to be a list of string. If you see your screenshot it says ['dataframe_BTCUSDT', 'dataframe_ETHUSDT'] which suggests its a string.

YASHGUPTA2611 commented 2 years ago

Hi @mikeejazmines Capture12 That i know, but in the above fig. it is also saying that if it is a string it will treat as a path. and i have saved the dataframe as csv file. But it is still showing me error

YASHGUPTA2611 commented 2 years ago

Or do you have any alternative?, means how do i convert my string of dataframe that will pass on the backtest function.

mikeejazmines commented 2 years ago

you can store the dataframes in an array and loop through that array and pass each element into the backtest function

YASHGUPTA2611 commented 2 years ago

But as far as i know, backtrader only read OHLC form of data. And also i have tried to combine many dataframes in one array, but it is showing me some error. So, it will be very helpful if you please provide the code for the same.

mikeejazmines commented 2 years ago

Yes, that is why i said store the dataframes in an array and loop through that array and pass each element into the backtest function

dataframes = []
for tick in tickers:
    dataframes.append(get_crypto(tick, .....))

results = []
for df in dataframes:
    result = backtest(df, ...)
    results.append(result)

This is also not a backtrader or fastquant specific question. Please do limit the issues to fastquant related issues.

YASHGUPTA2611 commented 2 years ago

Okay understood, Thank you for the reply.