-
Notifications
You must be signed in to change notification settings - Fork 385
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
balance_locked & balance_free #249
Comments
So works correctly for live trading. The However for backtesting the However how to track and report this info, as well as how it might relate to the |
it's great that you do without a backtest and test on a real account, so you've already found your alpha) SimulatedExchange must do some calculations as a broker, how is an order with a stop loss for a backtest considered now? we need to calculate the current value of the position and its changes at the kernel level on every data tick in my opinion, in the simplest case, is need to calculate: |
So currently unrealized pnl isn't calculated on every tick as that would be quite inefficient. This also relates to your other issue about tracking a max and min unrealized pnl over a positions life. My thoughts right now is to provide this functionality with an optional component which can subscribe to position events and also ticks, possibly it could update in time snapshots or when certain thresholds are crossed. |
I'm going to close this and roll the discussion into #248 |
incorrectly calculated - always equal to the initial value of the account, regardless of positions and deals
class Testing(TradingStrategy):
....
self.free.append(self.execution.accounts()[0].balance_free(USDT))
self.locked.append(self.execution.accounts()[0].balance_locked(USDT))
self.balance.append(self.execution.accounts()[0].balance(USDT))
The text was updated successfully, but these errors were encountered: