tbapi.api.interfaces.iaccount
1from __future__ import annotations 2from typing import TYPE_CHECKING 3from tbapi.common.decorators import tb_interface 4from tbapi.common.converters import to_python_datetime, to_net_datetime 5from datetime import datetime 6from Tickblaze.Scripts.Api.Interfaces import IAccount as _IAccount 7from typing import Any, overload 8from abc import ABC, abstractmethod 9 10@tb_interface(_IAccount) 11class IAccount(): 12 """Represents trading account with balance, margin, positions, and equity details.""" 13 14 @property 15 def name(self) -> str: 16 """The account name.""" 17 val = self._value.Name 18 return val 19 @property 20 def base_currency_code(self) -> str: 21 """The currency code for the account's base currency.""" 22 val = self._value.BaseCurrencyCode 23 return val 24 @property 25 def buying_power(self) -> float: 26 """The available buying power for the account.""" 27 val = self._value.BuyingPower 28 return val 29 @property 30 def cash_value(self) -> float: 31 """The current cash value in the account.""" 32 val = self._value.CashValue 33 return val 34 @property 35 def excess_initial_margin(self) -> float: 36 """The excess initial margin available in the account.""" 37 val = self._value.ExcessInitialMargin 38 return val 39 @property 40 def excess_intraday_margin(self) -> float: 41 """The excess intraday margin available in the account.""" 42 val = self._value.ExcessIntradayMargin 43 return val 44 @property 45 def gross_realized_pn_l(self) -> float: 46 """The gross realized profit and loss for the account.""" 47 val = self._value.GrossRealizedPnL 48 return val 49 @property 50 def initial_cash(self) -> float: 51 """The initial cash amount deposited into the account.""" 52 val = self._value.InitialCash 53 return val 54 @property 55 def initial_margin(self) -> float: 56 """The initial margin required for opening positions in the account.""" 57 val = self._value.InitialMargin 58 return val 59 @property 60 def intraday_margin(self) -> float: 61 """The intraday margin requirement for the account.""" 62 val = self._value.IntradayMargin 63 return val 64 @property 65 def net_liquidation(self) -> float: 66 """The net liquidation value, which is the current total value of the account.""" 67 val = self._value.NetLiquidation 68 return val 69 @property 70 def realized_pn_l(self) -> float: 71 """The realized profit and loss, representing closed positions.""" 72 val = self._value.RealizedPnL 73 return val 74 @property 75 def total_pn_l(self) -> float: 76 """The total profit and loss, combining both realized and unrealized profits/losses.""" 77 val = self._value.TotalPnL 78 return val 79 @property 80 def unrealized_pn_l(self) -> float: 81 """The unrealized profit and loss from open positions in the account.""" 82 val = self._value.UnrealizedPnL 83 return val 84 @property 85 def cash(self) -> float: 86 """The cash balance in the account.""" 87 val = self._value.Cash 88 return val 89 @property 90 def equity(self) -> float: 91 """The equity in the account, which is the value of the account's assets.""" 92 val = self._value.Equity 93 return val 94 @property 95 def excess_equity(self) -> float: 96 """The excess equity available in the account.""" 97 val = self._value.ExcessEquity 98 return val 99 @property 100 def market_value(self) -> float: 101 """The market value of all positions held in the account.""" 102 val = self._value.MarketValue 103 return val 104 @property 105 def initial_margin_overnight(self) -> float: 106 """The initial margin required for holding overnight positions.""" 107 val = self._value.InitialMarginOvernight 108 return val 109 @property 110 def maintenance_margin(self) -> float: 111 """The maintenance margin requirement for the account.""" 112 val = self._value.MaintenanceMargin 113 return val 114 @property 115 def maintenance_margin_overnight(self) -> float: 116 """The maintenance margin required for holding overnight positions.""" 117 val = self._value.MaintenanceMarginOvernight 118 return val 119 @property 120 def net_liquidation_value(self) -> float: 121 """The net liquidation value including all assets and liabilities in the account.""" 122 val = self._value.NetLiquidationValue 123 return val 124 @property 125 def total_net_value(self) -> float: 126 """The total net value of the account, which combines equity and any liabilities.""" 127 val = self._value.TotalNetValue 128 return val 129 @property 130 def positions(self) -> IReadOnlyList: 131 """A list of positions currently held in the account.""" 132 val = self._value.Positions 133 return val
16@tb_interface(_IAccount) 17class IAccount(): 18 """Represents trading account with balance, margin, positions, and equity details.""" 19 20 @property 21 def name(self) -> str: 22 """The account name.""" 23 val = self._value.Name 24 return val 25 @property 26 def base_currency_code(self) -> str: 27 """The currency code for the account's base currency.""" 28 val = self._value.BaseCurrencyCode 29 return val 30 @property 31 def buying_power(self) -> float: 32 """The available buying power for the account.""" 33 val = self._value.BuyingPower 34 return val 35 @property 36 def cash_value(self) -> float: 37 """The current cash value in the account.""" 38 val = self._value.CashValue 39 return val 40 @property 41 def excess_initial_margin(self) -> float: 42 """The excess initial margin available in the account.""" 43 val = self._value.ExcessInitialMargin 44 return val 45 @property 46 def excess_intraday_margin(self) -> float: 47 """The excess intraday margin available in the account.""" 48 val = self._value.ExcessIntradayMargin 49 return val 50 @property 51 def gross_realized_pn_l(self) -> float: 52 """The gross realized profit and loss for the account.""" 53 val = self._value.GrossRealizedPnL 54 return val 55 @property 56 def initial_cash(self) -> float: 57 """The initial cash amount deposited into the account.""" 58 val = self._value.InitialCash 59 return val 60 @property 61 def initial_margin(self) -> float: 62 """The initial margin required for opening positions in the account.""" 63 val = self._value.InitialMargin 64 return val 65 @property 66 def intraday_margin(self) -> float: 67 """The intraday margin requirement for the account.""" 68 val = self._value.IntradayMargin 69 return val 70 @property 71 def net_liquidation(self) -> float: 72 """The net liquidation value, which is the current total value of the account.""" 73 val = self._value.NetLiquidation 74 return val 75 @property 76 def realized_pn_l(self) -> float: 77 """The realized profit and loss, representing closed positions.""" 78 val = self._value.RealizedPnL 79 return val 80 @property 81 def total_pn_l(self) -> float: 82 """The total profit and loss, combining both realized and unrealized profits/losses.""" 83 val = self._value.TotalPnL 84 return val 85 @property 86 def unrealized_pn_l(self) -> float: 87 """The unrealized profit and loss from open positions in the account.""" 88 val = self._value.UnrealizedPnL 89 return val 90 @property 91 def cash(self) -> float: 92 """The cash balance in the account.""" 93 val = self._value.Cash 94 return val 95 @property 96 def equity(self) -> float: 97 """The equity in the account, which is the value of the account's assets.""" 98 val = self._value.Equity 99 return val 100 @property 101 def excess_equity(self) -> float: 102 """The excess equity available in the account.""" 103 val = self._value.ExcessEquity 104 return val 105 @property 106 def market_value(self) -> float: 107 """The market value of all positions held in the account.""" 108 val = self._value.MarketValue 109 return val 110 @property 111 def initial_margin_overnight(self) -> float: 112 """The initial margin required for holding overnight positions.""" 113 val = self._value.InitialMarginOvernight 114 return val 115 @property 116 def maintenance_margin(self) -> float: 117 """The maintenance margin requirement for the account.""" 118 val = self._value.MaintenanceMargin 119 return val 120 @property 121 def maintenance_margin_overnight(self) -> float: 122 """The maintenance margin required for holding overnight positions.""" 123 val = self._value.MaintenanceMarginOvernight 124 return val 125 @property 126 def net_liquidation_value(self) -> float: 127 """The net liquidation value including all assets and liabilities in the account.""" 128 val = self._value.NetLiquidationValue 129 return val 130 @property 131 def total_net_value(self) -> float: 132 """The total net value of the account, which combines equity and any liabilities.""" 133 val = self._value.TotalNetValue 134 return val 135 @property 136 def positions(self) -> IReadOnlyList: 137 """A list of positions currently held in the account.""" 138 val = self._value.Positions 139 return val
Represents trading account with balance, margin, positions, and equity details.
20 @property 21 def name(self) -> str: 22 """The account name.""" 23 val = self._value.Name 24 return val
The account name.
25 @property 26 def base_currency_code(self) -> str: 27 """The currency code for the account's base currency.""" 28 val = self._value.BaseCurrencyCode 29 return val
The currency code for the account's base currency.
30 @property 31 def buying_power(self) -> float: 32 """The available buying power for the account.""" 33 val = self._value.BuyingPower 34 return val
The available buying power for the account.
35 @property 36 def cash_value(self) -> float: 37 """The current cash value in the account.""" 38 val = self._value.CashValue 39 return val
The current cash value in the account.
40 @property 41 def excess_initial_margin(self) -> float: 42 """The excess initial margin available in the account.""" 43 val = self._value.ExcessInitialMargin 44 return val
The excess initial margin available in the account.
45 @property 46 def excess_intraday_margin(self) -> float: 47 """The excess intraday margin available in the account.""" 48 val = self._value.ExcessIntradayMargin 49 return val
The excess intraday margin available in the account.
50 @property 51 def gross_realized_pn_l(self) -> float: 52 """The gross realized profit and loss for the account.""" 53 val = self._value.GrossRealizedPnL 54 return val
The gross realized profit and loss for the account.
55 @property 56 def initial_cash(self) -> float: 57 """The initial cash amount deposited into the account.""" 58 val = self._value.InitialCash 59 return val
The initial cash amount deposited into the account.
60 @property 61 def initial_margin(self) -> float: 62 """The initial margin required for opening positions in the account.""" 63 val = self._value.InitialMargin 64 return val
The initial margin required for opening positions in the account.
65 @property 66 def intraday_margin(self) -> float: 67 """The intraday margin requirement for the account.""" 68 val = self._value.IntradayMargin 69 return val
The intraday margin requirement for the account.
70 @property 71 def net_liquidation(self) -> float: 72 """The net liquidation value, which is the current total value of the account.""" 73 val = self._value.NetLiquidation 74 return val
The net liquidation value, which is the current total value of the account.
75 @property 76 def realized_pn_l(self) -> float: 77 """The realized profit and loss, representing closed positions.""" 78 val = self._value.RealizedPnL 79 return val
The realized profit and loss, representing closed positions.
80 @property 81 def total_pn_l(self) -> float: 82 """The total profit and loss, combining both realized and unrealized profits/losses.""" 83 val = self._value.TotalPnL 84 return val
The total profit and loss, combining both realized and unrealized profits/losses.
85 @property 86 def unrealized_pn_l(self) -> float: 87 """The unrealized profit and loss from open positions in the account.""" 88 val = self._value.UnrealizedPnL 89 return val
The unrealized profit and loss from open positions in the account.
90 @property 91 def cash(self) -> float: 92 """The cash balance in the account.""" 93 val = self._value.Cash 94 return val
The cash balance in the account.
95 @property 96 def equity(self) -> float: 97 """The equity in the account, which is the value of the account's assets.""" 98 val = self._value.Equity 99 return val
The equity in the account, which is the value of the account's assets.
100 @property 101 def excess_equity(self) -> float: 102 """The excess equity available in the account.""" 103 val = self._value.ExcessEquity 104 return val
The excess equity available in the account.
105 @property 106 def market_value(self) -> float: 107 """The market value of all positions held in the account.""" 108 val = self._value.MarketValue 109 return val
The market value of all positions held in the account.
110 @property 111 def initial_margin_overnight(self) -> float: 112 """The initial margin required for holding overnight positions.""" 113 val = self._value.InitialMarginOvernight 114 return val
The initial margin required for holding overnight positions.
115 @property 116 def maintenance_margin(self) -> float: 117 """The maintenance margin requirement for the account.""" 118 val = self._value.MaintenanceMargin 119 return val
The maintenance margin requirement for the account.
120 @property 121 def maintenance_margin_overnight(self) -> float: 122 """The maintenance margin required for holding overnight positions.""" 123 val = self._value.MaintenanceMarginOvernight 124 return val
The maintenance margin required for holding overnight positions.
125 @property 126 def net_liquidation_value(self) -> float: 127 """The net liquidation value including all assets and liabilities in the account.""" 128 val = self._value.NetLiquidationValue 129 return val
The net liquidation value including all assets and liabilities in the account.