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

Commissions for futures trades not calculated - always None #198

Open
ktan636 opened this issue Jun 23, 2023 · 0 comments
Open

Commissions for futures trades not calculated - always None #198

ktan636 opened this issue Jun 23, 2023 · 0 comments

Comments

@ktan636
Copy link

ktan636 commented Jun 23, 2023

Dear Zipline Maintainers,

Before I tell you about my issue, let me describe my environment:

Environment

  • Operating System: Windows 10 Pro
  • Python Version: 3.10.11
  • How did you install Zipline: mamba
  • Python packages: zipline-reloaded 2.4, numpy 1.23.5, pandas 1.5.3

Now that you know a little about me, let me tell you about the issue I am
having:

Description of Issue

I'm using zipline-reloaded to backtest a futures time return trend trading strategy similar to the one in the book Trading Evolved by Andreas Clenow. The main difference is that I'm only using the S&P 500 futures ('ES').
The details and source code can be found from https://www.followingthetrend.com/trading-evolved/.

In the code, commissions are set within initialize() using the code below:
comm_model = PerContract(cost=0.85, exchange_fee=1.5)
set_commission(us_futures=comm_model)

  • What did you expect to happen? I expected that the backtest would take into account the commissions for each contract traded and this would be shown in the "transactions" field in the "perf" output when contracts are traded.

  • What happened instead? The commission in transactions is always None.

Here is how you can reproduce this issue on your machine:

Reproduction Steps

  1. Ingest some futures data (I'm using Norgate)
  2. Modify the source code for time return trend strategy and change markets to ['ES'] only
  3. Run the backtest for the past 1 year
  4. Inspect the output "perf", specifically the commissions in the transactions column

What steps have you taken to resolve this already?

I tried looking into the documentation for commissions, but I couldn't resolve the issue.

Sincerely,
ktan636

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