This repository was archived by the owner on Feb 21, 2026. It is now read-only.
Merged
Conversation
b6ae4b3 to
3a6530b
Compare
| @@ -1,5 +1,5 @@ | |||
| { | |||
| "version": "1.0.0", | |||
| "version": "1.2.0", | |||
Comment on lines
+361
to
+413
| async def _wait_for_positions_init(self, timeout) -> bool: | ||
| """ | ||
| Wait for positions to be initialized for futures/options trading. | ||
| This ensures that existing positions are loaded from the exchange before | ||
| calculating holdings ratios. | ||
| """ | ||
| if not (self.exchange_manager.is_future or self.exchange_manager.is_option): | ||
| return True | ||
| try: | ||
| full_symbols = self._get_full_traded_pairs() | ||
| if full_symbols: | ||
| self.logger.debug( | ||
| f"Waiting for positions initialization for symbols: {full_symbols}" | ||
| ) | ||
| await trading_util.wait_for_topic_init( | ||
| self.exchange_manager, timeout, | ||
| commons_enums.InitializationEventExchangeTopics.POSITIONS.value, | ||
| symbols=full_symbols | ||
| ) | ||
| self.logger.debug("Positions initialization completed") | ||
| return True | ||
| except (asyncio.TimeoutError,): | ||
| self.logger.warning( | ||
| f"Positions initialization took more than {timeout} seconds. " | ||
| f"Existing positions might not be reflected in holdings calculations." | ||
| ) | ||
| return False | ||
|
|
||
| async def _wait_for_orders_init(self, timeout) -> bool: | ||
| """ | ||
| Wait for orders to be initialized. | ||
| This ensures that existing open orders are loaded from the exchange before | ||
| calculating holdings ratios. | ||
| """ | ||
| try: | ||
| full_symbols = self._get_full_traded_pairs() | ||
| if full_symbols: | ||
| self.logger.debug( | ||
| f"Waiting for orders initialization for symbols: {full_symbols}" | ||
| ) | ||
| await trading_util.wait_for_topic_init( | ||
| self.exchange_manager, timeout, | ||
| commons_enums.InitializationEventExchangeTopics.ORDERS.value, | ||
| symbols=full_symbols | ||
| ) | ||
| self.logger.debug("Orders initialization completed") | ||
| return True | ||
| except (asyncio.TimeoutError,): | ||
| self.logger.warning( | ||
| f"Orders initialization took more than {timeout} seconds. " | ||
| f"Existing open orders might not be reflected in holdings calculations." | ||
| ) | ||
| return False |
Member
There was a problem hiding this comment.
I think we should factorize those calls
| commons_enums.InitializationEventExchangeTopics.ORDERS.value, | ||
| symbols=full_symbols | ||
| ) | ||
| self.logger.debug("Orders initialization completed") |
Member
There was a problem hiding this comment.
should we log everytime we execute this ? I understand it will be called everytime the index producer triggers
3a6530b to
9f65d85
Compare
Member
Author
|
Right, it's up |
Comment on lines
+369
to
+371
| self.logger.debug( | ||
| f"Waiting for {topic_name} initialization for symbols: {full_symbols}" | ||
| ) |
Member
There was a problem hiding this comment.
I think we should also remove this log, to avoid spamming
9f65d85 to
661f30e
Compare
GuillaumeDSM
approved these changes
Jan 30, 2026
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.
No description provided.