robcarver17 / pysystemtrade

Systematic Trading in python
GNU General Public License v3.0
2.63k stars 827 forks source link

Strategy report shows wrong notional capital & vol targets #831

Closed tgibson11 closed 1 year ago

tgibson11 commented 1 year ago

This reminds me of issue #495, but it isn't exactly the same.

In my strategy report target vol calc section, I am seeing the static notional capital from my system config rather than the current total capital. The annual & daily cash vol targets in the report are also being calculated from this incorrect capital figure.

Vol target calculation {'base_currency': 'USD', 'percentage_vol_target': 25.0, 'notional_trading_capital': ******, 'annual_cash_vol_target': ******, 'daily_cash_vol_target': ******}

When running the production system itself, I can see that it gets the current capital value (not sure if it's actually used, but at least it is getting it).

2022-11-11 01:30:03 {'type': 'run_systems', 'strategy_name': 'futures_system'}  Using capital of USD ******

I will investigate more when I have time, but I'm hoping you'll figure this out quicker than I can.

Edit: this might be something I messed up in my run_system code, so feel free to ignore and close this issue if you're not seeing the same behavior.

tgibson11 commented 1 year ago

Found the problem, my fault. I was setting the capital in the config object, but then instead of using that object I was reading it from the file again later.