Accounting
The accounting subpackage defines both different account types and account management machinery.
There is also an ExchangeRateCalculator for calculating the exchange rate between FX and/or Crypto pairs. The AccountManager is mainly used from the Portfolio to manage accounting operations.
The AccountFactory supports customized account types for specific integrations. These custom account types can be registered with the factory and will then be instantiated when an AccountState event is received for that integration.
class CashAccount
Bases: Account
CashAccount(AccountState event, bool calculate_account_state=False, bool allow_borrowing=False)
Provides a cash account.
- Parameters:
- event (AccountState) – The initial account state event.
- calculate_account_state (bool , optional) – If the account state should be calculated from order fills.
- allow_borrowing (bool , optional) – If borrowing is allowed (negative balances).
- Raises:
ValueError – If event.account_type is not equal to
CASH.
ACCOUNT_TYPE = 1
allow_borrowing
If borrowing is allowed (negative balances).
- Returns: bool