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

Extreme return values (billions %) in alternating long/short position backtests #737

Open
myuanz opened this issue Aug 5, 2024 · 0 comments

Comments

@myuanz
Copy link

myuanz commented Aug 5, 2024

Just run this:

import vectorbt as vbt
import pandas as pd

price = vbt.YFData.download(
    "BTC-USD", start="2024-03-01 UTC", end="2024-07-01 UTC"
).get("Close")
size = [1.0, -1.0] * (len(price) // 2)

pf = vbt.Portfolio.from_orders(
    close=price, 
    size=size,
    # lock_cash=True,
)

pf.plot().show()

图片

And if enable local_cache, the result will be normal:

图片

But the sequences $[1, -1, 1, -1, ...,, 1, -1]$ do not lead to oversold.


I use vetcotbt 0.26.2 and tested on Windows10 and Manjaro

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

1 participant