how to access the account from the strategy? #760
-
sometimes, the strategy will change the order size according the account's balance, how to access the account from the strategy? thanks. |
Beta Was this translation helpful? Give feedback.
Answered by
cjdsellers
Sep 5, 2022
Replies: 1 comment
-
The best way is via the self.portfolio.account(venue) Or these methods and properties are available: cdef class PortfolioFacade:
cdef readonly bint initialized
"""If the portfolio is initialized.\n\n:returns: `bool`"""
cdef readonly analyzer
"""The portfolios analyzer.\n\n:returns: `PortfolioAnalyzer`"""
cpdef Account account(self, Venue venue)
cpdef dict balances_locked(self, Venue venue)
cpdef dict margins_init(self, Venue venue)
cpdef dict margins_maint(self, Venue venue)
cpdef dict unrealized_pnls(self, Venue venue)
cpdef dict net_exposures(self, Venue venue)
cpdef Money unrealized_pnl(self, InstrumentId instrument_id)
cpdef Money net_exposure(self, InstrumentId instrument_id)
cpdef object net_position(self, InstrumentId instrument_id)
cpdef bint is_net_long(self, InstrumentId instrument_id) except *
cpdef bint is_net_short(self, InstrumentId instrument_id) except *
cpdef bint is_flat(self, InstrumentId instrument_id) except *
cpdef bint is_completely_flat(self) except * |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jandykwan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The best way is via the
Portfolio
which acts as a manager of sorts for all of the accounting:Or these methods and properties are available: