You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running a strategy with two separate Bybit sub-accounts, which are configured as two distinct Venues in my trading node (I hack one of the Venue from BYBIT to BYBIT1 to let it work).
After the hack, I can submit order with different account by using client_id param. I can also fetch different account balance with different Venue (self.portfolio.account(venue))
My goal is to get the live net position (e.g., -100 for Account 1, +200 for Account 2) for each sub-account independently from within my strategy logic.
I have tried the following approaches without success:
self.cache.positions(): This seems to return a pre-aggregated list of positions, not a complete list that can be filtered by account_id. In my cases, it return 1 external position with +100 qty.
self.portfolio.account(venue).positions: The Account object (specifically MarginAccount) does not seem to have a .positions attribute or a .position() method to access its position state directly.
My startup logs clearly show that the Portfolio component correctly reconciles the positions for each account separately, but I cannot find an API endpoint within the Strategy class to access this separated state.
What is the canonical, framework-intended way to get the live net position for a specific account when multiple accounts are active in a single strategy?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am running a strategy with two separate Bybit sub-accounts, which are configured as two distinct Venues in my trading node (I hack one of the Venue from
BYBITtoBYBIT1to let it work).After the hack, I can submit order with different account by using
client_idparam. I can also fetch different account balance with different Venue (self.portfolio.account(venue))My goal is to get the live net position (e.g., -100 for Account 1, +200 for Account 2) for each sub-account independently from within my strategy logic.
I have tried the following approaches without success:
self.cache.positions(): This seems to return a pre-aggregated list of positions, not a complete list that can be filtered by account_id. In my cases, it return 1 external position with +100 qty.self.portfolio.account(venue).positions: The Account object (specifically MarginAccount) does not seem to have a .positions attribute or a .position() method to access its position state directly.My startup logs clearly show that the Portfolio component correctly reconciles the positions for each account separately, but I cannot find an API endpoint within the Strategy class to access this separated state.
What is the canonical, framework-intended way to get the live net position for a specific account when multiple accounts are active in a single strategy?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions