FinRL-Trading
FinRL-Trading copied to clipboard
backtest_plot Error with Crypto or any stock not listed in yfinance
So I was testing out one of the crypto notebooks, it came to my attention that new new project master branch has a new naming convention for the backtest methods, so old notebooks will need to be updated with that.
I also realized a few issues with the data intake of the methods. They are only accepting data formatted in a specific way, like the date column, needs to be named "date" (unlike in crypto "time").
One of the major issues with the project right now is the non standardized methods, classes, inputs and naming conventions used.
Also, there is a redundancy in the operations, for example the below method uses get_baseline, which typically redownloads the data that you have downloaded at the beginning of the notebook? is there something I am not seeing? can we not create a deepcopy of the data at the beginning once and for all and use that as the baseline?
All the above are just me writing down my thoughts, please do let me know what you all think and the best solution so we work on it together to reduce inefficiency and redundant fixes. would truly love to hear your thoughts!
@XiaoYangLiu-FinRL @BruceYanghy
def backtest_plot(
account_value,
baseline_start=config.START_TRADE_DATE,
baseline_end=config.END_DATE,
baseline_ticker="^DJI",
value_col_name="account_value",
):
df = deepcopy(account_value)
test_returns = get_daily_return(df, value_col_name=value_col_name)
baseline_df = get_baseline(
ticker=baseline_ticker, start=baseline_start, end=baseline_end
)
baseline_returns = get_daily_return(baseline_df, value_col_name="close")
with pyfolio.plotting.plotting_context(font_scale=1.1):
pyfolio.create_full_tear_sheet(
returns=test_returns, benchmark_rets=baseline_returns, set_context=False
)
def get_baseline(ticker, start, end):
dji = YahooDownloader(
start_date=start, end_date=end, ticker_list=[ticker]
).fetch_data()
return dji
Thanks very much for your detailed feedback! Would you like to work with us and improve it? We welcome your inputs!
Of course, thats why I am here!! quite impressed with all the hard work you guys have put in, would definitely like to help you further! @XiaoYangLiu-FinRL
Welcome to join our Slack channel to have more interactions with the community.
The slack channel is: https://ai4financeworkspace.slack.com/ssb/redirect
can i join your slack channel ?
Can i join the slack channel, it seems it needs an invitation
Will update the new link in one or two days. It needs monthly update.