Account Models¶
- class lime_trader.models.accounts.AccountDetails(account_number: str, trade_platform: str, margin_type: MarginType, restriction: RestrictionLevel, daytrades_count: int, account_value_total: Decimal, cash: Decimal, day_trading_buying_power: Decimal, margin_buying_power: Decimal, non_margin_buying_power: Decimal, position_market_value: Decimal, unsettled_cash: Decimal, cash_to_withdraw: Decimal, restriction_reason: str | None = None)[source]¶
Represents account details and balances
- account_number¶
Account number
- Type:
str
- trade_platform¶
Trading platform this account is traded on
- Type:
str
- margin_type¶
Margin type
- restriction¶
Restriction level effective on the account
- daytrades_count¶
Day trades counter
- Type:
int
- account_value_total¶
Total account liquidation value
- Type:
decimal.Decimal
- cash¶
Account debit balance when negative, credit balance when positive
- Type:
decimal.Decimal
- day_trading_buying_power¶
Day trading buying power for marginable securities
- Type:
decimal.Decimal
- margin_buying_power¶
Buying power for marginable securities
- Type:
decimal.Decimal
- non_margin_buying_power¶
Buying power for non-marginable securities
- Type:
decimal.Decimal
- position_market_value¶
Sum of all positions current market values. The value is negative for short positions
- Type:
decimal.Decimal
- unsettled_cash¶
Unsettled cash for cash accounts
- Type:
decimal.Decimal
- cash_to_withdraw¶
Cash available to withdraw from the account
- Type:
decimal.Decimal
- restriction_reason¶
Optional description explaining why the account is restricted
- Type:
str | None
- class lime_trader.models.accounts.AccountFeedAction(action: AccountFeedActionType, account: str)[source]¶
Action that is sent to account feed websocket
- action¶
Type of action
- account¶
Account number
- Type:
str
- class lime_trader.models.accounts.AccountFeedActionType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
- class lime_trader.models.accounts.AccountFeedError(t: AccountFeedType, code: str, description: str)[source]¶
Error during streaming account data
- t¶
Type of account feed, always “e”
- code¶
Error code
- Type:
str
- description¶
Error description
- Type:
str
- class lime_trader.models.accounts.AccountFeedType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
- class lime_trader.models.accounts.AccountPosition(symbol: str, quantity: int, average_open_price: Decimal, current_price: Decimal, security_type: SecurityType, legs: list[Leg] | None = None)[source]¶
Represents single account position
- symbol¶
Security symbol
- Type:
str
- quantity¶
Signed number of shares or option contracts. Negative for short positions
- Type:
int
- average_open_price¶
Average historical cost basis
- Type:
decimal.Decimal
- current_price¶
Current price
- Type:
decimal.Decimal
- security_type¶
Asset type
- legs¶
Legs of the multi-leg strategy
- Type:
list[lime_trader.models.accounts.Leg] | None
- class lime_trader.models.accounts.AccountPositions(account: str, positions: list[AccountPosition])[source]¶
List of account positions
- account¶
Account number
- Type:
str
- positions¶
Account positions
- Type:
- class lime_trader.models.accounts.AccountTrade(symbol: str, timestamp: datetime, quantity: int, price: Decimal, amount: Decimal, side: TradeSide, trade_id: str)[source]¶
Represents single account trade
- symbol¶
Security symbol
- Type:
str
- timestamp¶
Timestamp of the trade
- Type:
datetime.datetime
- quantity¶
Number of shares or option contracts, negative for sells, positive for buys
- Type:
int
- price¶
Trade price
- Type:
decimal.Decimal
- amount¶
Trade amount, which is the quantity multiplied by the lot size and price
- Type:
decimal.Decimal
- side¶
Trade side
- trade_id¶
The trade id
- Type:
str
- class lime_trader.models.accounts.AccountTradesPage(trades: list[AccountTrade], count: int)[source]¶
Page of account trades
- trades¶
List of trades in page
- Type:
- count¶
Total count of trades
- Type:
int
- class lime_trader.models.accounts.AccountTransaction(id: str, type: str, description: str, date: date, cash: TransactionCash, fees: list[TransactionFee], asset: TransactionAsset | None = None)[source]¶
Single account transaction
- id¶
Internal transaction id, globally unique, and it is not necessarily sequentially incremented
- Type:
str
- type¶
Transaction type
- Type:
str
- description¶
Human-readable transaction description
- Type:
str
- date¶
Date of transaction
- Type:
datetime.date
- cash¶
Describes the cash side of the transaction
- fees¶
List of fees charged by the transaction
- Type:
- asset¶
Structure describing the asset side of the transaction
- Type:
- class lime_trader.models.accounts.AccountTransactionsPage(transactions: list[AccountTransaction], count: int)[source]¶
Page of account transactions
- transactions¶
List of transactions in page
- Type:
- count¶
Total count of transactions
- Type:
int
- class lime_trader.models.accounts.Credentials(username: str, password: str, client_id: str, client_secret: str, grant_type: str)[source]¶
Credentials used for API authentication
- username¶
Username
- Type:
str
- password¶
Password
- Type:
str
- client_id¶
Client id issued to the service
- Type:
str
- client_secret¶
Client secret issued to the service
- Type:
str
- grant_type¶
OAuth authorization flow to use
- Type:
str
- class lime_trader.models.accounts.Leg(symbol: str, average_open_price: Decimal, current_price: Decimal, quantity: int, security_type: SecurityType)[source]¶
Represents leg in the multi-leg strategy
- symbol¶
The leg security symbol
- Type:
str
- quantity¶
Signed number of shares or option contracts for the leg
- Type:
int
- average_open_price¶
The leg cost basis
- Type:
decimal.Decimal
- current_price¶
The leg current price
- Type:
decimal.Decimal
- security_type¶
The leg asset type
- class lime_trader.models.accounts.MarginType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
- class lime_trader.models.accounts.RestrictionLevel(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
- class lime_trader.models.accounts.Route(exchange: str, time_in_force: list[TimeInForce], order_type: list[OrderType])[source]¶
Route available for account
- exchange¶
Route name to use when placing order
- Type:
str
- time_in_force¶
List of order duration instructions supported by a route
- Type:
- order_type¶
List of order types supported by a route
- Type:
- class lime_trader.models.accounts.SecurityType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
- class lime_trader.models.accounts.Token(scope: str, token_type: str, access_token: str, expires_in: int, date_created: ~datetime.datetime = <factory>)[source]¶
Represents access token
- scope¶
The scopes this token grants access to
- Type:
str
- token_type¶
Bearer means that access token should be put to the Authorization header of every web request
- Type:
str
- access_token¶
Access token
- Type:
str
- expires_in¶
Expiration lifetime in seconds
- Type:
int
- date_created¶
Date when token was created. Used to determine expiry date
- Type:
datetime.datetime
- class lime_trader.models.accounts.TradeSide(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
- class lime_trader.models.accounts.TransactionAsset(symbol: str, symbol_description: str, quantity: int, price: Decimal)[source]¶
Describes the asset side of the transaction
- symbol¶
Asset symbol
- Type:
str
- symbol_description¶
Company name for stocks or human-readable name for options
- Type:
str
- quantity¶
Transaction quantity, can be positive or negative
- Type:
int
- price¶
Price for each unit
- Type:
decimal.Decimal
- class lime_trader.models.accounts.TransactionCash(gross_amount: Decimal, net_amount: Decimal)[source]¶
Describes the cash side of the transaction
- gross_amount¶
Dollar amount not including fees, can be positive or negative
- Type:
decimal.Decimal
- net_amount¶
Net dollar amount including fees charged for the transaction, can be positive or negative
- Type:
decimal.Decimal