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

Options trading backtest fails #514

Open
adamjbradley opened this issue Aug 9, 2024 · 0 comments
Open

Options trading backtest fails #514

adamjbradley opened this issue Aug 9, 2024 · 0 comments

Comments

@adamjbradley
Copy link

A comparison of a str and float64 resulted in an error. Fixed by casting to a float!
backtesting_broker.py line 446:

    # Calculate profit/loss per contract
    # TODO AJB cast position.asset.strike to float (was a string)
    if position.asset.right == "CALL":
        profit_loss_per_contract = underlying_price - float(position.asset.strike)
    else:
        profit_loss_per_contract = float(position.asset.strike) - underlying_price
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