Object Details

About 16 min

PortfolioAccount Assets (Prime/Demo Account)

tigeropen.trade.domain.prime_account.PortfolioAccount sourceopen in new window

Instruction
Account Equity object, for synthetic/demo accounts. Contains the account's total assets, profit and loss, market value of positions, cash, available funds, margin, leverage and other related information

Object Properties

property nametypedescription
accountstrcorresponding account id
update_timestampintUpdate time, 13-digit timestamp in milliseconds
segmentstigeropen.trade.domain.prime_account.SegmentAccount information by trade type. The content is a dict with two keys, 'S' for securities, 'C' for futures, and the value is Segment object.

Segment Assets by Variety (Prime/Demo Account)

tigeropen.trade.domain.prime_account.Segment sourceopen in new window

Instruction Divide assets according to stock/futures trading varieties, and each part is a segment.

Object Properties

property nametypedescription
currencystrCurrency, such as USD, HKD
capabilitystrAccount Type, Margin: RegTMargin, Cash: Cash
categorystrSecurities Category C: (Commodities Futures), S: (Securities Stocks),F: (Funds)
cash_balancefloatThe cash that can be traded, plus the cash that has been locked (such as stocks that have been purchased but not yet traded, and some other situations will also have locked cash)
cash_available_for_tradefloatAmount of cash that can be traded in the current account
cash_available_for_withdrawalfloatAmount of cash that can be withdrawn in the current account
gross_position_valuefloatTotal value of securities: long stock value + short stock value + long option value + short option value. The above items are calculated as absolute values
equity_with_loanfloatEquity with loan value (including loan value assets). Securities Segment: cash value + stock value, futures Segment: cash value - maintenance margin
net_liquidationfloatNet Liquidation Value
init_marginfloatinitial margin requirement
maintain_marginfloatMaintenance margin requirement
overnight_marginfloatOvernight margin requirement
unrealized_plfloatfloating profit and loss
realized_plfloatRealized P&L
excess_liquidationfloatExcess liquidity, used to represent intraday risk value. Calculation method for securities segment: equity_with_loan - maintenance_margin_requirement. Calculation method for futures segment: net_liquidation - maintenance_margin_requirement
overnight_liquidationfloatOvernight risk control value, when it is less than 0, account positions will be forced to liquidate, you need to pay attention to the risks
buying_powerfloatbuying power. Estimate how many more dollars you can buy in stock assets. The margin account has a maximum of four times the purchasing power of the funds (funds that are not used for margin) during the day. Up to twice the purchasing power overnight
leveragefloatThe leverage multiplier currently used. When it is less than 1, it indicates that no leverage is used. When it is greater than 1, it indicates that leverage is used.
currency_assetsdictAccount asset information differentiated by transaction currency, is a dict with currency as key, and value as CurrencyAsset object
consolidatedSegTypesstringconsolidated Segment. The following are the fields of consolidated Segment:cash_available_for_trade、init_margin、maintain_margin、overnight_margin、excess_liquidation、overnight_liquidation、buying_power、locked_funds、leverage
uncollectedfloatIn transit funds
locked_fundsfloatLocked funds

CurrencyAsset sub-currency assets (Prime/demo account)

tigeropen.trade.domain.prime_account.CurrencyAsset sourceopen in new window

Instruction
Assets by currency.

Object Properties

member nametypedescription
currencystrCurrent currency, commonly used currencies include: USD-US dollar, HKD-Hong Kong dollar, SGD-Singapore dollar, CNH-RMB
cash_balancefloatCash that can be traded, plus the cash that has been locked (such as stocks that have been purchased but not yet traded, and some other situations will also have locked cash)
cash_available_for_tradefloatThe amount of cash that can be traded in the current account
gross_position_valuefloatgross value
stock_market_valuefloatThe market value of the stock, when the category is C (futures type), there will be no stock market value
futures_market_valuefloatThe market value of futures, when the category is S (stock type), there will be no futures market value
option_market_valuefloatMarket value of the option
unrealized_plfloatUnrealizd profit and loss of the account
realized_plfloatThe realized profit and loss in the account

PortfolioAccount Assets (Global Account)

tigeropen.trade.domain.account.PortfolioAccount sourceopen in new window

Instruction
Account asset object, applicable to global accounts. Contains the account's total assets, profit and loss, market value of positions, cash, available funds, margin, leverage and other related information

Object Properties

property nametypedescription
accountstrcorresponding account id
summarytigeropen.trade.domain.account.AccountAccount summary information, statistics on segments
segmentsdictAccount information by trading type. There are two keys, 'S' means [securities](/en/python/appendix1/object.md#securitysegment-object-global account), 'C' means [futures](/en/python/appendix1/object. html#commoditysegment-object-global-account).
market_valuesdictAccount information by currency. The key: 'USD' means US dollar, 'HKD' means Hong Kong dollar; value is a [MarketValue object](/en/python/appendix1/object.md#marketvalue-object-global account)

Account Aggregate Assets (Global Account)

tigeropen.trade.domain.account.Account sourceopen in new window

instruction Asset summary information of each trading product in the account.

Object Properties

property nametypedescription
accrued_cashfloatThe accumulated interest payable in the current month, updated according to the daily frequency
accrued_dividendfloatAccumulated dividends. Refers to the accumulated value of all dividends that have been executed but not paid
available_fundsfloatAvailable funds (available for trading). Calculated as equity_with_loan - initial_margin_requirement
∆ buying_powerfloatPurchasing Power: Estimate how many more dollars you can buy in stock assets. The margin account has a maximum of four times the purchasing power of the funds (funds that are not used for margin) within a day. Up to twice the buying power overnight
cashfloatCash Amount
currencystrcurrency, meaning refer to enumeration parameter-currency
cushionfloatThe ratio of remaining liquidity to total assets, calculated as: excess_liquidity/net_liquidation
∆ day_trades_remainingintThe number of trades remaining in the day, -1 means unlimited
equity_with_loanfloatEquity with loan value (asset with loan value) - Securities Segment: Cash Value + Stock Value - Futures Segment: Cash Value - Maintenance Margin
excess_liquidityfloatExcess Liquidity - Securities Segment: Calculation Method: equity_with_loan - maintenance_margin_requirement- Futures Segment: Calculation Method: net_liquidation - maintenance_margin_requirement
∆ gross_position_valuefloatTotal value of securities: long stock value + short stock value + long option value + short option value. The above items are calculated as absolute values.
initial_margin_requirementfloatInitial Margin
maintenance_margin_requirementfloatMaintenance Margin
realized_pnlfloatToday's Realized P&L
unrealized_pnlfloatUnrealized profit and loss
net_liquidationfloatTotal Assets (Net Liquidation Value) - Securities Segment: Cash Value + Stock Value + Stock Option Value - Futures Segment: Cash Value + Mark-to-Market Profit and Loss
∆ regt_equityfloatOnly for the securities segment, that is, the equity with loan (including the loan equity value) calculated according to the Regulation T Act
∆ regt_marginfloatFor security segments only, i.e. initial margin requirements calculated under Regulation T
∆ smafloatFor security segments only. Overnight risk control value, the overnight risk of account positions is checked about 10 minutes before the close of each trading day. The overnight risk control value needs to be greater than 0, otherwise some positions in the account will be forced to close before the market closes. If the overnight risk control value is lower than 0 during the trading day, and the time is not 10 minutes before the closing time, the account will not be liquidated.
timestampintUpdate time

SecuritySegment Equity Assets (Global Account)

tigeropen.trade.domain.account.SecuritySegment sourceopen in new window

Instruction
Stock asset information.

Object Properties

property nametypedescription
accrued_cashfloatThe accumulated interest payable in the current month, updated daily.
accrued_dividendfloatCumulative dividends. Refers to the cumulative value of all dividends that have been executed but not paid
available_fundsfloatAvailable funds (available for trading). Calculated as equity_with_loan - initial_margin_requirement
cashfloatCash
equity_with_loanfloatEquity with loan value (asset with loan value). Calculation method: cash value + stock value
excess_liquidityfloatExcess liquidity. Calculation method: equity_with_loan - maintenance_margin_requirement
gross_position_valuefloatTotal value of securities: long stock value + short stock value + long option value + short option value. The above items are calculated as absolute values.
initial_margin_requirementfloatInitial Margin
maintenance_margin_requirementfloatMaintenance margin
leveragefloatFor securities only Segment gross_position_value / net_liquidation
net_liquidationfloatTotal assets (net liquidation value). Calculation method: cash value + stock value + stock option value
∆ regt_equityfloatOnly for the securities segment, that is, the equity with loan (including the loan equity value) calculated according to the Regulation T Act
∆ regt_marginfloatFor security segments only, i.e. initial margin requirements calculated under Regulation T
∆ smafloatFor security segments only. Overnight risk control value, the overnight risk of account positions is checked about 10 minutes before the close of each trading day. The overnight risk control value needs to be greater than 0, otherwise some positions in the account will be forced to close before the market closes. If the overnight risk control value is lower than 0 during the trading day, and the time is not 10 minutes before the closing time, the account will not be liquidated.
timestampintUpdate time

SecuritySegment Equity Assets (Global Account)

tigeropen.trade.domain.account.SecuritySegment sourceopen in new window

Instruction
Stock asset information.

Object Properties

property nametypedescription
accrued_cashfloatThe accumulated interest payable in the current month, updated daily.
accrued_dividendfloatCumulative dividends. Refers to the cumulative value of all dividends that have been executed but not paid
available_fundsfloatAvailable funds (available for trading). Calculated as equity_with_loan - initial_margin_requirement
cashfloatCash
equity_with_loanfloatEquity with loan value (asset with loan value). Calculation method: cash value + stock value
excess_liquidityfloatExcess liquidity. Calculation method: equity_with_loan - maintenance_margin_requirement
gross_position_valuefloatTotal value of securities: long stock value + short stock value + long option value + short option value. The above items are calculated as absolute values.
initial_margin_requirementfloatInitial Margin
maintenance_margin_requirementfloatMaintenance margin
leveragefloatFor securities only Segment gross_position_value / net_liquidation
net_liquidationfloatTotal assets (net liquidation value). Calculation method: cash value + stock value + stock option value
∆ regt_equityfloatOnly for the securities segment, that is, the equity with loan (including the loan equity value) calculated according to the Regulation T Act
∆ regt_marginfloatFor security segments only, i.e. initial margin requirements calculated under Regulation T
∆ smafloatFor security segments only. Overnight risk control value, the overnight risk of account positions is checked about 10 minutes before the close of each trading day. The overnight risk control value needs to be greater than 0, otherwise some positions in the account will be forced to close before the market closes. If the overnight risk control value is lower than 0 during the trading day, and the time is not 10 minutes before the closing time, the account will not be liquidated.
timestampintUpdate time

CommoditySegment Futures Assets (Global Account)

tigeropen.trade.domain.account.CommoditySegment sourceopen in new window

Instruction
Futures asset information.

Object Properties

property nametypedescription
accrued_cashfloatThe accumulated interest payable in the current month, updated daily.
accrued_dividendfloatCumulative dividends. Refers to the cumulative value of all dividends that have been executed but not paid
available_fundsfloatAvailable funds (available for trading). Calculated as equity_with_loan - initial_margin_requirement
cashfloatCash
equity_with_loanfloatEquity with loan value (asset with loan value) calculation method: cash value - maintenance margin
excess_liquidityfloatExcess liquidity. Calculation method: net_liquidation - maintenance_margin_requirement
initial_margin_requirementfloatInitial Margin
maintenance_margin_requirementfloatMaintenance Margin
net_liquidationfloatTotal assets (net liquidation value). Calculation method: cash value + mark-to-market profit and loss
timestampintUpdate time

MarketValue sub-currency assets (Global account)

tigeropen.trade.domain.account.MarketValue sourceopen in new window

Instruction
Asset information by currency.

Object Properties

property nametypedescription
currencystrcurrency unit
net_liquidationfloatTotal Assets (Net Liquidation Value)
cash_balancefloatcash
stock_market_valuefloatstock market value
option_market_valuefloatOption Market Value
warrant_valuefloatWarrant Market Value
futures_pnlfloatMark to Market
unrealized_pnlfloatUnrealized PNL
realized_pnlfloatRealized P&L
exchange_ratefloatExchange rate to account's primary currency
net_dividendfloatNet dividends payable and dividends receivable
timestampintUpdate time

Position position

tigeropen.trade.domain.position.Position sourceopen in new window

instruction
Account holding information. Including the contract subject of the position, the number of positions, cost, profit and loss and other information.

Object Properties

property nametypedescription
accountstrThe corresponding account ID
contracttigeropen.trade.domain.contract.ContractContract object
position_qtyfloatPosition quantity
quantityintContract quantity (deprecated)
position_scaleintContract quantity scale (deprecated) For example, the position value is 11123, the positionScale is 2, and the actual number of positions is 11123*10^(-2)=111.23
average_costfloatAverage cost with commission
market_valuefloatMarket Cap
salable_qtyfloatSaleable quantity
average_cost_of_carryfloat累计持仓成本(A股模式计算方式)
market_pricefloatLatest market price
is_level0_pricebooleanis lv0(delay) quote
realized_pnlfloatRealized profit and loss in FIFO rule
unrealized_pnlfloatUnrealized profit and loss
unrealized_pnl_by_cost_of_carryfloatUnrealized profit and loss by cost of carry
unrealized_pnl_percent_by_cost_of_carryfloatUnrealized profit and loss percentage by cost of carry
today_pnlfloatToday's profit and loss
today_pnl_percentfloatToday's profit and loss percentage
yesterday_pnlfloatYesterday's profit and loss, Fund only
last_close_pricefloatThe closing price on the last trading day (pre-adjusted for stock rights)

Order object

tigeropen.trade.domain.order.Order sourceopen in new window

Instruction
Order object. Querying an order will return this object, and the parameters of placing an order to change an order also need to use this object.

Object Properties

property nametypedescription
accountstrThe account to which the order belongs
idintGlobal order id
order_idintThe account automatically increments the order number, which is obsolete
parent_idintParent order id, currently only used for additional orders on TigerTrade App
order_timeintOrder time, 13-digit timestamp in milliseconds
reasonstrWhen the order fails, the description of the reason for the failure will be returned
trade_timeintLatest order status change time. (if filled, represents the trade time; if canceled, represents the cancel time), 13-digit timestamp in milliseconds
update_timeintOrder attribute update time
expire_timeintGTD Order expire time
actionstrTrade direction, 'BUY' / 'SELL'
quantityintOrder quantity
filledintNumber of transactions
avg_fill_pricefloatAverage fill price including commission
commissionfloatIncluding commissions, stamp duties, SFC fees and other series of fees
gstfloatGoods and Service Tax
realized_pnlfloatRealized Pnl
trail_stop_pricefloatTrailing stop price
limit_pricefloatLimit order price
aux_pricefloatIn a stop order, it indicates the price at which the stop loss started, and in a trailing stop order, it indicates the trailing spread
trailing_percentfloatTrailing stop order-percent, the value range is 0-100
percent_offsetfloat<This field is not used>
order_typestrOrder type, 'MKT' market order/'LMT' limit order/'STP' stop order/'STP_LMT' stop limit order/'TRAIL' trailing stop order
time_in_forcestrValid period, valid within 'DAY'/valid until 'GTC' is revoked/ 'GTD' good till date
outside_rthboolWhether it supports pre-market and post-market trading, exclusive to US stocks.
contractContracttigeropen.trade.domain.contract.Contract contract object
statusOrderStatustigeropen.common.consts.OrderStatusopen in new window Enumeration, indicating order status
remainingintUnfilled Quantity
sub_idsList(int)sub-order ID list(Only available orders have sub order )
user_markstruser can customize orders
adjust_limitfloatPrice fine-tuning range (the default is 0 means no adjustment, positive number means upward adjustment, negative number adjusts downward), and the incoming price is automatically adjusted to the legal position. For example: 0.001 represents upward adjustment and the range does not exceed 0.1%; -0.001 represents downward adjustment and the range does not exceed 0.1%. Default 0 means no adjustment
latest_pricefloatLatest price

Build method:

Generate order objects locally via tigeropen.common.util.order_utilsopen in new window in the SDK: order_utils only provides commonly used parameters. If additional parameters are required, after generating the order object, modify its properties.

from tigeropen.common.util.contract_utils import stock_contract
from tigeropen.common.util.order_utils import (market_order,  # market order
                                               limit_order,  # limit order
                                               stop_order,  # stop order
                                               stop_limit_order,  # stop limit order
                                               trail_order,  # trailing stop order
                                               order_leg)  # additional order

contract = stock_contract('AAPL', currency='USD')
order = limit_order('your account', contract, 'BUY', 100, 150.5)
order.time_in_force = 'GTC'  # Set order properties

# Next steps...

market_order Market order

market_order(account, contract, action, quantity)

parameter

parameter nametypedescription
accountstrOrder account, you can use an integrated account, a global account or a demo account
contracttigeropen.trade.domain.contract.Contractcontract object to trade
actionstrtrading direction, 'BUY' / 'SELL'
quantityintThe quantity of the order, which must be an integer greater than 0

return

Order object

limit_order Limit order

limit_order(account, contract, action, quantity, limit_price)

parameter

parameter nametypedescription
accountstrOrder account, you can use an integrated account, a global account or a demo account
contracttigeropen.trade.domain.contract.Contractcontract object to trade
actionstrtrading direction, 'BUY' / 'SELL'
quantityintThe quantity of the order, which must be an integer greater than 0
limit_pricefloatThe price of the limit price, must be greater than 0

return

Order object

stop_order Stop order

stop_order(account, contract, action, quantity, aux_price)

parameter

parameter nametypedescription
accountstrOrder account, you can use an integrated account, a global account or a demo account
contracttigeropen.trade.domain.contract.Contractcontract object to trade
actionstrtrading direction, 'BUY' / 'SELL'
quantityintThe quantity of the order, which must be an integer greater than 0
aux_pricefloatPrice that triggers the stop loss order, must be greater than 0

return

Order object

stop_limit_order Stop limit order

stop_limit_order(account, contract, action, quantity, limit_price, aux_price)

parameter

parameter nametypedescription
accountstrOrder account, you can use an integrated account, a global account or a demo account
contracttigeropen.trade.domain.contract.Contractcontract object to trade
actionstrtrading direction, 'BUY' / 'SELL'
quantityintThe quantity of the order, which must be an integer greater than 0
limit_pricefloatThe price of the limit price, must be greater than 0
aux_pricefloatPrice that triggers the stop loss order, must be greater than 0

return

Order object

trail_order Trailing stop order

trail_order(account, contract, action, quantity, trailing_percent=None, aux_price=None)

parameter

parameter nametypedescription
accountstrOrder account, you can use an integrated account, a global account or a demo account
contracttigeropen.trade.domain.contract.Contractcontract object to trade
actionstrtrading direction, 'BUY' / 'SELL'
quantityintThe quantity of the order, which must be an integer greater than 0
trailing_percentfloatTrailing stop order - percentage, the value range is 0-100, aux_price and trailing_percent are mutually exclusive
aux_pricefloatSpread, mutually exclusive with trailing_percent

return

Order object

order_leg Additional order

order_leg(leg_type, price, time_in_force='DAY', outside_rth=None):

parameter

parameter nametypedescription
leg_typestrAdditional order type. 'PROFIT' Take Profit order type, 'LOSS' Stop Loss order type
pricefloatAdditional order price.
time_in_forcestrAdditional order validity period. 'DAY' (good for the day) and 'GTC' (good-Til-Canceled).
outside_rthboolWhether additional orders allow pre-market and after-hours trading (exclusive to US stocks). True allows, False does not allow.

return

OrderLeg object tigeropen.trade.domain.order.OrderLeg

auction_limit_order Auction limit order

auction_limit_order(account, contract, action, quantity, limit_price, time_in_force)parameter

parameter nametypedescription
accountstrPlace order account
contracttigeropen.trade.domain.contract.ContractContract objectopen in new window
actionstrTrade Direction,’Buy‘/'Sell'
quantityintOrder quantities, must be an integer greater than 0
limit_pricefloatLimit price, must greater than 0
time_in_forcestrAdditional order validity period. 'DAY' (good for the day) and 'GTC' (good-Til-Canceled).

return

Order

Transaction transaction record

tigeropen.trade.domain.order.Transaction

Explanation Note Transaction records of orders

parameter

parameter nametypedescription
accountstraccount
order_idintorder id
contractContractcontract object
idinttransaction record id
actionstrOrder direction
filled_quantityinttransacted quantity
filled_pricefloattransacted price
filled_amountfloattransacted amount
transacted_atstrtransacted time

OrderLeg Additional order

tigeropen.trade.domain.order.OrderLeg

Explanation

Additional orders that are carried along with the main order

parameter

parameter nametypedescription
leg_typestrAdditional order types. 'PROFIT' for take profit order type, 'LOSS' for stop loss order type
pricefloatAdditional order price
time_in_forcestrAdditional Order Validity Dates. 'DAY' (Good-Til-Canceled) and 'GTC' (Good-Til-Canceled)
outside_rthboolWhether to allow pre-market and after-market trading for additional orders (exclusive to US stocks). True allows, False does not allow

AlgoParams Algo oder parameters

tigeropen.trade.domain.order.AlgoParams

Explanation

Algo order(VWAP/TWAP)parameters

parameter

parameter nametypedescription
start_timestr or intEffective start time (time string or timestamp, dedicated to TWAP and VWAP), such as '2020-11-19 23:00:00' or 1640159945678
end_timestr or intExpiration time (time string or timestamp TWAP and VWAP specific)
no_take_liqboolWhether to reduce the number of transactions as much as possible (only for VWAP orders)
allow_past_end_timeboolWhether to allow the transaction to continue after the expiration time (TWAP and VWAP only)
participation_ratefloatParticipation rate (for VWAP only, 0.01-0.5)

Contract object

tigeropen.trade.domain.contract.Contract sourceopen in new window

instruction
A contract refers to the transaction object or subject matter (such as a stock or an option), and the contract is uniformly formulated by the exchange. For example, buying stocks of Tiger Securities can be uniquely identified by the letter code TIGR and market information (ie market='US', the US market). Similarly, when purchasing options or futures products, other identification fields may be required. Through the contract information, we can uniquely determine a target when placing an order or obtaining market quotations. In the Open API Python SDK, contract information is stored through the tigeropen.trade.domain.contract.Contract object. The Contract object can be passed into the tool function that constructs the Order order object to create the Order object for placing an order

Common contracts include stock contracts, options contracts, futures contracts, etc. Most contracts include the following elements:

  • The subject code (symbol), generally the contract codes such as US stocks and British stocks are English letters, and the contract codes such as Hong Kong stocks and A shares are numbers. For example, the symbol of Tiger Securities is TIGR.
  • Contract type (security type), common contract types include: STK (stock), OPT (option), FUT (futures), CASH (foreign exchange). For example, the contract type of Tiger Securities stock is STK.
  • Currency type (currency), common currencies include USD (US dollar), HKD (Hong Kong dollar).
  • Exchange, STK type contracts generally do not use the exchange field, orders will be automatically routed, and futures contracts use the exchange field.

The vast majority of stocks, CFDs, indices or forex pairs can be uniquely identified by these four properties. Due to their nature, more complex contracts such as options and futures require some additional information. Here are a few common types of contracts and what they consist of:

stock

from tigeropen.common.util.contract_utils import stock_contract

contract = stock_contract(symbol='TIGR', currency='USD')
contract1 = stock_contract(symbol='00700', currency='HKD')

options

from tigeropen.common.util.contract_utils import option_contract

contract = option_contract(identifier='AAPL 190118P00160000')

futures

from tigeropen.common.util.contract_utils import future_contract

contract = future_contract(symbol='CL', currency='USD', expiry='20190328', multiplier=1.0, exchange='SGX')

Hongkong Warrant

from tigeropen.common.util.contract_utils import war_contract_by_symbol

contract = war_contract_by_symbol('01810', '20221116', 14.52, 'CALL', local_symbol='14759', multiplier=2000,
                                  currency='HKD')

Hongkong Callable Bull/Bear Contracts

from tigeropen.common.util.contract_utils import iopt_contract_by_symbol

contract = iopt_contract_by_symbol('02318', '20200420', 87.4, 'CALL', local_symbol='63379', currency='HKD')

See below for specific fields and construction methods

Data Member

member nametypedescription
identifierstrUnique identifier, the stock identifier is the same as the symbol, the option is a 21-digit identifier, such as: 'AAPL 220729C00150000', the futures identifier
symbolstrContract code
contract_idintcontract id
sec_typestrSecurities Type
namestrContract name
currencystrcurrency
exchangestrExchange
expirystrExpiration date (for options/futures)
strikefloatStrike Price (for options)
multiplierfloatNumber per lot
put_callstrOption direction, bullish bearish
local_symbolstr
short_marginfloatshort margin ratio(deprecated, use short_initial_margin instead
short_initial_marginfloatshort initial margin ratio
short_maintenance_marginfloatshort maintenance margin ratio
short_fee_ratefloatShort rate
shortableintShort pool remaining
long_initial_marginfloatLong initial margin
long_maintenance_marginfloatLong Maintenance Margin
contract_monthstrContract month, such as 202201, means January 2022
primary_exchangestrStock Listing Exchange
marketstrMarket
min_tickfloatMinimum tick unit
tickSizesstrExclusive to stocks, the minimum quotation unit price interval, that is, when the pending order price is between the begin and end intervals, it must meet the tickSize requirement, begin: the left interval of the price, end: the right interval of the price, type: the interval type OPEN/OPEN_CLOSED/CLOSED/CLOSED_OPEN( open range/left open right close/closed range/left close right open), tickSize: minimum price unit, example:[{"begin":"0","end":"1","tickSize":1.0E-4,"type":"CLOSED"},{"begin":"1","end":"Infinity","tickSize":0.01,"type":"OPEN"}]
trading_classstrThe trading class name of the contract
statusstrStatus
continuousboolExclusive to futures, whether it is a continuous contract
tradeboolFutures are exclusive, whether they can be traded
last_trading_datestrExclusive to futures, the last trading day, such as '20211220', means December 20, 2021
first_notice_datestrExclusively for futures, on the first notice day, long positions cannot be opened after the first notice day. Existing long positions will be forced to close before the first notice day (usually the first three trading days). , such as '20211222', which means December 22, 2021
last_bidding_close_timeintFutures exclusive, bid closing timestamp
is_etfboolis ETF
etf_leverageintETF leverage
discounted_day_initial_marginfloatFutures only, Intraday initial margin discount
discounted_day_maintenance_marginfloatFutures only, Intraday maintenance margin discount
discounted_time_zone_codefloatFutures only, Intraday margin discount period time zone
discounted_start_atfloatFutures only, Intraday margin discount start time
discounted_end_atfloatFutures only, Intraday margin discount end time

CAUTION

Only some properties will be displayed when printing. use Contract.to_str() to display all properties.

Use interface Contract parameter use this function to get:

get contract information get_contract/get_contracts

parameter:

parameterrequirementdescription
symbolYesContract Exp: 00700/AAPL
sec_typeYesContract type Exp: SecurityType.STK/SecurityType.OPT
currencyNoCurrency Exp: Currency.USD/Currency.HKD
exchangeNoExchange Exp: SMART/SEHK
expiryNoExpiration Date Must be passed when the trading type is an option yyyyMMdd
strikeNoStrike price Must be passed when the transaction type is an option
put_callNoCALL/PUT Must be passed when the trading type is an option
secret_keyNoInstitutional trader key, exclusive to institutional users, needs to be configured in client_config

return

get_contract return Contract parameter; get_contracts return Contract List of objects. Object properties see description above

Example

from tigeropen.trade.trade_client import TradeClient
from tigeropen.tiger_open_config import get_client_config

client_config = get_client_config(private_key_path='private key path', tiger_id='your tiger id', account='your account',
                                  secret_key='institutional trader private key')
trade_client = TradeClient(client_config)

# Get stock contract
contract = trade_client.get_contract('FB', sec_type=SecurityType.STK)
contracts = trade_client.get_contracts(['AAPL', 'TSLA'], sec_type=SecurityType.STK)

# Get future contract
fut_contract = trade_client.get_contract('CL', sec_type=SecurityType.FUT)

# Get option contract
opt_contract = trade_client.get_contract('SPY', sec_type=SecurityType.OPT, expiry='20231215', strike=435.0,
                                         put_call='CALL')

MarketStatus Market status

tigeropen.quote.domain.market_status.MarketStatus

Explanation

Market trading status

parameter

parametertypedescription
marketstrMarket(US:US Stock,CN:Shanghai and Shenzhen,HK:Hongkong)
trading_statusstrMarket trading status/ Market not open NOT_YET_OPEN; Pre-market hour PRE_HOUR_TRADING; Trading TRADING; Middle breaking time MIDDLE_CLOSE; Post trading hour POST_HOUR_TRADING; Market closed CLOSING; Early close EARLY_CLOSED; Market closed MARKET_CLOSED;
statusstrMarket status description(Market not open,Trading,Market closed etc.)
open_timedatetime.datetimeLast opening time

OptionFilter Option Filter

tigeropen.quote.domain.filter.OptionFilter

Explanation

Option filter parameter

parameter

parametertyperequirementdescription
implied_volatilityfloatNoImplied volatility reflects the market's expected future stock price fluctuations. The higher the implied volatility, the more severe the expected stock price fluctuations
in_the_moneyboolNoIn the price
open_interestintNoOpen interest, the number of outstanding contracts in the market participants at the end of each trading day. Reflects the depth and liquidity of the market
deltafloatNodelta, Reflects the impact of stock price changes on option price changes. For every 1 dollar change in stock price, the option price changes approximately, . between -1.0 ~ 1.0
gammafloatNogamma, Reflects the impact of stock price changes on delta. Every time the stock price changes by 1 dollar, delta changes gamma
thetafloatNotheta, Reflects the impact of time changes on option price changes. Every time the time is reduced by one day, the option price changes by theta
vegafloatNovega, Reflects the impact of volatility on option price changes. For every 1% change in volatility, the option price changes approximately vega
rhofloatNorho, Reflects the impact of the risk-free interest rate on the option price change. For every 1% change in the risk-free interest rate, the option price changes approximately rho
Last update: