Skip to content
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
Herklos merged 1 commit into
masterfrom
fix/value-holder-open-orders
Jan 30, 2026
Merged

Herklos merged 1 commit into
masterfrom
fix/value-holder-open-orders

Conversation

@Herklos

@Herklos Herklos commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

…ymbol valuation

@Herklos
Herklos requested a review from GuillaumeDSM January 29, 2026 22:16
@Herklos Herklos self-assigned this Jan 29, 2026
@Herklos
Herklos enabled auto-merge (rebase) January 29, 2026 22:16
@Herklos
Herklos force-pushed the fix/value-holder-open-orders branch 2 times, most recently from 44991d7 to 20ad58e Compare January 30, 2026 08:03
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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, it would be better to use a real Order object to avoid mock side effects

@Herklos
Herklos force-pushed the fix/value-holder-open-orders branch from 20ad58e to edd469e Compare January 30, 2026 08:27
@Herklos

Herklos commented Jan 30, 2026

Copy link
Copy Markdown
Contributor Author

Good point, it's up

@GuillaumeDSM GuillaumeDSM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Herklos
Herklos merged commit 024bc18 into master Jan 30, 2026
3 checks passed
@Herklos
Herklos deleted the fix/value-holder-open-orders branch January 30, 2026 08:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants