Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backtest_plot Error with Crypto or any stock not listed in yfinance #27

Open
Youbadawy opened this issue Feb 3, 2021 · 7 comments
Open

Comments

@Youbadawy
Copy link

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

@YangletLiu
Copy link
Contributor

Thanks very much for your detailed feedback! Would you like to work with us and improve it? We welcome your inputs!

@Youbadawy
Copy link
Author

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

@YangletLiu
Copy link
Contributor

Welcome to join our Slack channel to have more interactions with the community.

@YangletLiu
Copy link
Contributor

The slack channel is: https://ai4financeworkspace.slack.com/ssb/redirect

@oxful
Copy link

oxful commented Mar 26, 2021

can i join your slack channel ?

@yosoul93
Copy link

Can i join the slack channel, it seems it needs an invitation

@YangletLiu
Copy link
Contributor

Will update the new link in one or two days. It needs monthly update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants