This repository was archived by the owner on Feb 3, 2026. It is now read-only.
[FuturesPortfolioValueHolder] Fix open orders value calculation for s… - #1340
Merged
Merged
Conversation
Herklos
enabled auto-merge (rebase)
January 29, 2026 22:16
Herklos
force-pushed
the
fix/value-holder-open-orders
branch
2 times, most recently
from
January 30, 2026 08:03
44991d7 to
20ad58e
Compare
| position_value += pending_order_value | ||
| else: | ||
| # For simple currencies (e.g., "ETH"), use currency-based matching | ||
| pending_order_holdings = self._get_total_holdings_in_open_orders(currency) |
Comment on lines
+660
to
+666
| mock_order = mock.Mock() | ||
| mock_order.symbol = test_symbol | ||
| mock_order.side = order_side | ||
| mock_order.origin_quantity = order_quantity | ||
| mock_order.filled_quantity = filled_quantity | ||
| mock_order.origin_price = order_price | ||
| mock_order.status = enums.OrderStatus.OPEN |
Member
There was a problem hiding this comment.
as we have a real backtesting_trader, I think it would be better to use a real order object here to make sure _get_open_orders_value_for_symbol only uses real Order attributes (and not local mock atttributes)
Comment on lines
+689
to
+704
| buy_order = mock.Mock() | ||
| buy_order.symbol = test_symbol | ||
| buy_order.side = enums.TradeOrderSide.BUY | ||
| buy_order.origin_quantity = decimal.Decimal("10") | ||
| buy_order.filled_quantity = decimal.Decimal("0") | ||
| buy_order.origin_price = decimal.Decimal("50") | ||
| buy_order.status = enums.OrderStatus.OPEN | ||
|
|
||
| # Sell order: -5 * 40 = -200 | ||
| sell_order = mock.Mock() | ||
| sell_order.symbol = test_symbol | ||
| sell_order.side = enums.TradeOrderSide.SELL | ||
| sell_order.origin_quantity = decimal.Decimal("5") | ||
| sell_order.filled_quantity = decimal.Decimal("0") | ||
| sell_order.origin_price = decimal.Decimal("40") | ||
| sell_order.status = enums.OrderStatus.OPEN |
Member
There was a problem hiding this comment.
same here, it would be better to use a real Order object to avoid mock side effects
Herklos
force-pushed
the
fix/value-holder-open-orders
branch
from
January 30, 2026 08:27
20ad58e to
edd469e
Compare
Contributor
Author
|
Good point, it's up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ymbol valuation