edtechre / pybroker

Algorithmic Trading in Python with Machine Learning

Home Page:https://www.pybroker.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fees and account amount

pennymax opened this issue · comments

Hello @edtechre ,

I recently noticed that in the portfolio and metrics calculations, the transaction fees aren't being factored into either the pnl or market_value. This has led to a discrepancy, as the available cash for future investments is not reduced by these fees. This difference becomes particularly significant over thousands of trades, leading to a noticeable divergence from my live trading records.

Could you suggest a way to accurately simulate the scenario where each fee is deducted from the account balance? This would help in creating a more realistic representation of the financial impact these fees have over time. Thank you for your assistance!

Thank you for this inquiry, @pennymax. Yes, fees are not deducted from your cash balance, right now it is only there to show what fees your account has accrued. However, I can add a config option for this.

Thank you for your response, @edtechre! Having the option to accurately account for transaction fees in my portfolio calculations would be immensely beneficial, particularly for conducting long-term backtests.

Hi @edtechre , any updates on this, this is actually quite important for simulating the real trading result.

Hi @tsunamilx, I will work on supporting this hopefully this week.

A subtract_fees config option has been added as part of the v1.1.32 release.