Objects

PortfolioAccount Assets (Prime and Paper Trading Accounts)

Description

Account assets for prime and paper trading accounts, including total assets, P&L, position value, cash, available funds, margin, and leverage.

Object Properties

Property NameTypeDescription
accountstrCorresponding account ID
update_timestampintUpdate time, 13-digit timestamp in milliseconds
segmentstigeropen.trade.domain.prime_account.SegmentAccount information classified by trading instrument. The dict keys are S for securities, C for futures, and F for funds; each value is a Segment object

Segment Assets by Category (Prime and Paper Trading Accounts)

Description

Each Segment groups assets by instrument category, such as securities or futures.

Object Properties

Property NameTypeDescription
currencystrCurrency, such as USD, HKD
capabilitystrAccount capability: RegTMargin for a margin account or Cash for a cash account. Margin accounts support margin trading and unlimited intraday trades, with buying power of up to 4x intraday and 2x overnight.
categorystrInstrument category: C for commodity futures, S for securities, or F for funds
cash_balancefloatTotal cash balance across all currencies. Financing and borrowing interest is generally calculated daily based on the number of financing days, accrued throughout the month, and deducted around the fifth day of the following month. The displayed balance does not include accrued interest before that deduction. If the balance is zero before interest is deducted, it may become negative afterward.
cash_available_for_tradefloatFunds available for opening positions or subscribing to IPOs. Opening a position includes buying stock or selling stock short with borrowed shares. This value is not the same as available cash. It is calculated as: Available funds = Total assets - US stock option market value - Current total position initial margin - Frozen funds. Position initial margin is Σ(Individual stock position market value × Current opening margin ratio). A positive value means that the account may open positions. Maximum buying power is four times available funds. Example: With $10,000 in total assets, $1,000 in US stock options, $2,000 in Apple stock, a 45% Apple initial margin ratio, and no frozen funds, available funds are 10,000 - 1,000 - 2,000 × 45% = $8,100.
cash_available_for_withdrawalfloatCash amount that can be withdrawn from the current account
buying_powerfloatMaximum purchase amount. The displayed value is an estimate because each stock has its own margin ratio. Maximum buying power = 4 × Available funds. For example, $100,000 in available funds gives maximum buying power of $400,000. At a 30% Apple initial margin ratio, the account can buy at most $100,000 / 30% = $333,400 of Apple. At a 25% ratio, it can buy at most $100,000 / 25% = $400,000. Margin accounts provide up to 4x buying power intraday and 2x overnight on funds not already used as margin.
gross_position_valuefloatSum of all position market values in the account's base currency. Long values are positive and short values are negative. Example 1: $3,000 of Apple + (-$1,000 of Google) = $2,000. Example 2: $10,000 of Apple + $5,000 of long Apple options = $15,000.
equity_with_loanfloatEquity with loan value (ELV), used to assess opening and closing positions. Cash account = Cash balance. Margin account = Cash balance + Total securities market value - US stock option market value. Equivalently, ELV = Total assets - US stock options.
net_liquidationfloatTotal assets (net liquidation value) = Total securities market value + Cash balance + Accrued dividends - Accrued interest. Example: $1,000 cash plus a $1,000 long Apple position = $2,000. For a $1,000 Apple short, securities market value is -$1,000 and cash is $2,000, so total assets are $2,000 + (-$1,000) = $1,000.
init_marginfloatSum of the initial margin requirements for all positions. Positions may be opened only when equity with loan exceeds initial margin. During the 15 minutes before market close, initial and maintenance margin requirements are raised to at least 50% to meet regulatory requirements.
maintain_marginfloatSum of the maintenance margin requirements for all positions. Forced liquidation occurs when equity with loan falls below maintenance margin. During the 15 minutes before market close, initial and maintenance margin requirements are raised to at least 50% to meet regulatory requirements.
overnight_marginfloatRequired margin starting 15 minutes before market close. Initial and maintenance margin requirements are raised to at least 50% during this period, and Tiger International's overnight margin ratios are above 50%. If equity with loan is below overnight margin, forced liquidation may occur. Overnight margin = Σ(Individual stock overnight maintenance margin). Find individual rates under Stock Details Page > Quote Area > Margin Trading Symbol. Example: With $100,000 in assets, a 40% Apple opening margin ratio, a 20% intraday maintenance margin ratio, and $250,000 of Apple bought intraday, the ratio rises to 50% before close. Overnight margin is $250,000 × 50% = $125,000. Because equity with loan is $100,000, some positions will be liquidated.
unrealized_plfloatUnrealized P&L for held stocks and derivatives = Current price × Number of shares - Position cost
realized_plfloatRealized P&L for stocks and derivatives reduced during the current holding cycle = Σ[(Selling price - Buying price) × Number of shares sold - Commission]
excess_liquidationfloatCurrent excess liquidity measures liquidation risk: lower values indicate greater risk, and a value below 0 triggers liquidation of some positions. Current excess liquidity = Equity with loan - Account maintenance margin. Initial and maintenance margin requirements rise to at least 50% during the 15 minutes before market close. Example: (1) With $10,000 in assets and $12,000 of Apple at a 50% opening and maintenance margin ratio, excess liquidity = 10,000 - 6,000 = 4,000. (2) If the market value falls to 8,000, excess liquidity = (-2,000 + 8,000) - 4,000 = 2,000. (3) Buying another $1,000 of US stock options leaves 2,000 - 1,000 = 1,000. Forced liquidations use market prices, and the broker selects the positions. Monitor risk-control values and leverage indicators.
overnight_liquidationfloatOvernight excess liquidity = Equity with loan - Overnight margin. Initial and maintenance margin requirements rise to at least 50% during the 15 minutes before market close. A value below 0 creates a risk that some positions will be liquidated from that point. Forced liquidations use market prices, and the broker selects the positions. Monitor risk-control values and leverage indicators.
leveragefloatLeverage measures account financing and risk. Leverage = Sum of absolute securities market values / Total assets. Margin accounts support up to 4x intraday and 2x overnight leverage. Actual leverage depends on historical volatility, liquidity, and risk. Long margin ratios generally range from 25%-100%: 25% corresponds to 4x leverage, while 100% means buying entirely with cash (0x leverage). Short-selling margin may exceed 100%. Find individual rates under Stock Details Page > Quote Area > Margin Trading Symbol. Example: With $100,000 in assets, a 50% Apple ratio (1/50% = 2x) allows $200,000 of Apple; a 200% Google short ratio allows 10/200% = $50,000 of Google; and a 100% Microsoft ratio (1/100% = 1x) allows $100,000 of Microsoft.
currency_assetsdictAssets grouped by trading currency. Each key is a currency and each value is a CurrencyAsset object
uncollectedfloatFunds in transit
locked_fundsfloatLocked funds

CurrencyAsset Assets by Currency (Prime/Paper Trading Account)

Description

Assets classified by currency.

Object Properties

Property NameTypeDescriptionNotes
currencystrCurrent currency type, common currencies include: USD-US Dollar, HKD-Hong Kong Dollar, SGD-Singapore Dollar, CNH-Chinese Yuan
cash_balancefloatCash available for trading plus locked cash, such as cash reserved for submitted orders that have not filled
cash_available_for_tradefloatCash amount currently available for trading in the account
forex_ratefloatExchange rate from the current currency to base_currency. For example, when base_currency=USD and currency=HKD, forex_rate=0.128

PortfolioAccount Assets (Global Account)

Description

Account assets for global accounts, including total assets, P&L, position value, cash, available funds, margin, and leverage.

Object Properties

Property NameTypeDescription
accountstrCorresponding account ID
summarytigeropen.trade.domain.account.AccountAccount summary aggregated across segments
segmentsdictAssets grouped by instrument category; S identifies the securities segment

Account Summary Assets (Global Account)

Description

Account summary aggregated across instrument categories.

Object Properties

Property NameTypeDescription
accrued_cashfloatCurrent month's accumulated accrued interest payable, updated daily
accrued_dividendfloatAccrued dividends. Refers to the cumulative value of all executed but still unpaid dividends
available_fundsfloatFunds available for trading. Calculation: equity_with_loan - initial_margin_requirement
∆ buying_powerfloatBuying power: Estimated how much more USD stock assets you can purchase. Margin accounts have at most four times the buying power of funds (funds not used as margin) intraday. At most two times buying power overnight
cashfloatCash amount
currencystrCurrency. See Currency Type
cushionfloatRatio of excess liquidity to total assets, calculation method: excess_liquidity/net_liquidation
∆ day_trades_remainingintRemaining day trades for the day, -1 means unlimited
equity_with_loanfloatEquity with loan value (equity with loan value assets). Securities Segment: Cash value + Stock value. Futures Segment: Cash value - Maintenance margin
excess_liquidityfloatExcess liquidity. Securities segment: equity_with_loan - maintenance_margin_requirement. Futures segment: net_liquidation - maintenance_margin_requirement
∆ gross_position_valuefloatTotal securities value: Long stock value + Short stock value + Long option value + Short option value
initial_margin_requirementfloatInitial margin
maintenance_margin_requirementfloatMaintenance margin
realized_pnlfloatToday's realized P&L
unrealized_pnlfloatUnrealized P&L
net_liquidationfloatTotal assets (net liquidation value). Securities segment: Cash value + Stock value + Stock option value. Futures segment: Cash value + Mark-to-market P&L
∆ regt_equityfloatOnly for Securities Segment, i.e., equity with loan calculated according to Regulation T
∆ regt_marginfloatOnly for Securities Segment, i.e., initial margin requirements calculated according to Regulation T
∆ smafloatOnly for Securities Segment. Overnight risk control value, checks account overnight risk about 10 minutes before market close each trading day. Overnight risk control value needs to be greater than 0, otherwise some positions will be forcibly liquidated before market close. If overnight risk control value is below 0 during intraday trading but time hasn't reached 10 minutes before market close, the account will not trigger forced liquidation.
timestampintUpdate time

SecuritySegment Stock Assets (Global Account)

Description

Stock asset information.

Object Properties

Property NameTypeDescription
accrued_cashfloatCurrent month's accumulated accrued interest payable, updated daily
accrued_dividendfloatAccrued dividends. Refers to the cumulative value of all executed but still unpaid dividends
available_fundsfloatFunds available for trading. Calculation: equity_with_loan - initial_margin_requirement
cashfloatCash
equity_with_loanfloatEquity with loan value. Calculation: Cash value + Stock value
excess_liquidityfloatExcess liquidity. Calculation: equity_with_loan - maintenance_margin_requirement
gross_position_valuefloatTotal securities value: Long stock value + Short stock value + Long option value + Short option value
initial_margin_requirementfloatInitial margin
maintenance_margin_requirementfloatMaintenance margin
leveragefloatOnly for Securities Segment gross_position_value / net_liquidation
net_liquidationfloatTotal assets (net liquidation value). Calculation: Cash value + Stock value + Stock option value
∆ regt_equityfloatOnly for Securities Segment, i.e., equity with loan calculated according to Regulation T
∆ regt_marginfloatOnly for Securities Segment, i.e., initial margin requirements calculated according to Regulation T
∆ smafloatOnly for Securities Segment. Overnight risk control value, checks account overnight risk about 10 minutes before market close each trading day. Overnight risk control value needs to be greater than 0, otherwise some positions will be forcibly liquidated before market close. If overnight risk control value is below 0 during intraday trading but time hasn't reached 10 minutes before market close, the account will not trigger forced liquidation.
timestampintUpdate time

CommoditySegment Futures Assets (Global Account)

Description

Futures asset information.

Object Properties

Property NameTypeDescription
accrued_cashfloatCurrent month's accumulated accrued interest payable, updated daily
accrued_dividendfloatAccrued dividends. Refers to the cumulative value of all executed but still unpaid dividends
available_fundsfloatFunds available for trading. Calculation: equity_with_loan - initial_margin_requirement
cashfloatCash
equity_with_loanfloatEquity with loan value. Calculation: Cash value - Maintenance margin
excess_liquidityfloatExcess liquidity. Calculation: net_liquidation - maintenance_margin_requirement
initial_margin_requirementfloatInitial margin
maintenance_margin_requirementfloatMaintenance margin
net_liquidationfloatTotal assets (net liquidation value). Calculation: Cash value + Mark-to-market P&L
timestampintUpdate time

MarketValue Assets by Currency (Global Account)

Description

Asset information classified 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 P&L
unrealized_pnlfloatUnrealized P&L
realized_pnlfloatRealized P&L
exchange_ratefloatExchange rate to account base currency
net_dividendfloatNet value of dividends payable and receivable
timestampintUpdate time

Position

Description

Position details, including the contract, quantity, cost, and P&L.

Object Properties

Property NameTypeDescription
accountstrCorresponding account ID
contracttigeropen.trade.domain.contract.ContractContract object
position_qtyfloatPosition quantity
quantityintPosition quantity (deprecated). When actual position has decimals, need to combine with position_scale
position_scaleintPosition quantity decimal offset (deprecated). If position=11123, positionScale=2, then actual position=11123*10^(-2)=111.23
average_costfloatAverage cost including commission
market_valuefloatMarket value
salable_qtyfloatSellable quantity
average_cost_of_carryfloatCumulative position cost (A-share calculation method)
market_pricefloatMarket price
is_level0_pricebooleanIndicates whether the price is a Level 0 delayed quote
realized_pnlfloatRealized P&L under FIFO mode
unrealized_pnlfloatUnrealized P&L
unrealized_pnl_by_cost_of_carryfloatUnrealized P&L (A-share calculation method)
unrealized_pnl_percent_by_cost_of_carryfloatUnrealized P&L percentage (A-share calculation method)
today_pnlfloatToday's P&L amount
today_pnl_percentfloatToday's P&L percentage
yesterday_pnlfloatFund's P&L for the previous day
last_close_pricefloatLast intraday close price (forward adjusted), for US stocks intraday it's previous trading day's close price

Order

Description

Order queries return this object. Order placement and modification methods also accept it.

Object Properties

Property NameTypeDescription
accountstrAccount to which the order belongs
idlongGlobal order ID
order_idintAccount auto-increment order number, deprecated
parent_idlongParent order ID, currently used only for attached orders in the Tiger Trade app
order_timeintOrder time, 13-digit timestamp in milliseconds
trade_timeintTime of the most recent order state transition, as a 13-digit millisecond timestamp. For filled orders this is the last fill time; for canceled orders it is the cancellation confirmation time; for new orders it is the submission confirmation time
update_timeintTime any order field was last modified, as a 13-digit millisecond timestamp. Unlike trade_time, this changes for modifications, fills, state transitions, and any other field update
expire_timeintGTD order expiration time, 13-digit timestamp in milliseconds
reasonstrServer-provided reason for a failed order operation, including placement rejection, modification failure, or cancellation failure. None or empty on success
actionstrTrade direction, 'BUY' / 'SELL'
quantityintOrder quantity
quantity_scaleintOrder quantity offset, default is 0. For fractional shares, quantity and quantity_scale combined represent actual order quantity, e.g., quantity=111 quantity_scale=2, then actual quantity=111*10^(-2)=1.11
total_cash_amountfloatTotal order amount, None when ordering by shares
filled_cash_amountfloatFilled amount, None when ordering by shares
refund_cash_amountfloatRefund amount, equals total order amount minus filled amount. None when ordering by shares or order is not terminated
filledintFilled quantity
avg_fill_pricefloatAverage fill price including commission
commissionfloatIncludes commission, stamp duty, regulatory fees and other charges
gstfloatGoods and Services Tax for orders in the AU and SG markets; 0 for other markets
realized_pnlfloatRealized P&L calculated using FIFO. Relevant after a closing order fills; generally 0 for opening or unfilled orders
trail_stop_pricefloatTrailing stop price
limit_pricefloatLimit order price
aux_pricefloatIn stop orders, represents the trigger price for stop order. In trailing stop orders, represents the trailing spread
trailing_percentfloatTrailing stop order - percentage, range 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_forcestrTime in force: DAY for a day order, GTC for good-till-canceled, or GTD for good-till-date (requires expire_time)
outside_rthboolAllows pre-market and after-hours trading for US stocks
trading_session_typestrTrading session type: RTH, PRE_RTH_POST, OVERNIGHT, FULL, HK_AUC, HK_CTS, or HK_AUC_CTS
statusstrOrder status. See Order Status
filled_scaleintDecimal offset for filled; for example, filled=111 and filled_scale=2 represents 1.11
is_openboolIndicates whether this is an opening order
can_modifyboolIndicates whether the order can currently be modified
liquidationboolIndicates whether forced liquidation triggered the order
latest_pricefloatLatest contract price populated at query time for reference
algo_strategystrAlgorithmic strategy, such as TWAP or VWAP; None for regular orders
algo_paramsAlgoParamsAlgorithmic order parameters. See AlgoParams
chargeslistItemized fee details as Charge objects
sourcestrOrder source, such as OpenApi
attr_descstrAdditional description of the order
contractContractContract object. See Contract

tigeropen.trade.domain.order.Charge Object Properties

PropertyTypeDescription
categorystrFee category (TIGER/THIRD_PARTY)
category_descstrFee category description: Tiger Charge; Third Parties
totalfloatTotal fees for current category
detailstigeropen.trade.domain.order.ChargeDetailFee details

tigeropen.trade.domain.order.ChargeDetail Object Properties

PropertyTypeDescription
typestrFee type: SETTLEMENT_FEE/STAMP_DUTY/TRANSACTION_LEVY/EXCHANGE_FEE/FRC_TRANSACTION_LEVY
type_descstrFee type description: Settlement Fee; Stamp Duty; Transaction Levy; Exchange Fee; AFRC Transaction Levy
original_amountfloatFee amount
after_discount_amountfloatFee amount after discount

Constructing an Order

Use tigeropen.common.util.order_utils to construct order objects locally. These utilities accept the most common parameters. To set other parameters, construct the order first and then update 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)           # Attached 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

# Subsequent operations...

Market Order

market_order(account, contract, action, quantity)

Parameters

ParameterTypeDescription
accountstrPrime, global, or paper trading account
contracttigeropen.trade.domain.contract.ContractContract to trade

Returns

Order object


Limit Order

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

Parameters

ParameterTypeDescription
accountstrPrime, global, or paper trading account
contracttigeropen.trade.domain.contract.ContractContract to trade

Returns

Order object


Stop Order

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

Parameters

ParameterTypeDescription
accountstrPrime, global, or paper trading account
contracttigeropen.trade.domain.contract.ContractContract to trade

Returns

Order object


Stop-Limit Order

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

Parameters

ParameterTypeDescription
accountstrPrime, global, or paper trading account
contracttigeropen.trade.domain.contract.ContractContract to trade

Returns

Order object


Trailing Stop Order

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

Parameters

ParameterTypeDescription
accountstrPrime, global, or paper trading account
contracttigeropen.trade.domain.contract.ContractContract to trade

Returns

Order object


Attached Order

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

Parameters

Parameter NameTypeDescription
leg_typestrAttached order type: PROFIT for a take-profit order or LOSS for a stop-loss order
pricefloatAttached order price
time_in_forcestrAttached order time in force: DAY or GTC (good-till-canceled)
outside_rthboolAllows the attached order to trade during pre-market and after-hours sessions for US stocks

Returns

OrderLeg object tigeropen.trade.domain.order.OrderLeg


Auction Limit Order

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

Parameters

Parameter NameTypeDescription
accountstrPrime or paper trading account
contracttigeropen.trade.domain.contract.ContractContract to trade

Returns

Order object


Auction Market Order

auction_market_order(account, contract, action, quantity, time_in_force)

Parameters

Parameter NameTypeDescription
accountstrPrime or paper trading account
contracttigeropen.trade.domain.contract.ContractContract to trade

Returns

Order object


Transaction

tigeropen.trade.domain.order.Transaction

Description

Execution record for an order.

Object Properties

Property NameTypeDescription
accountstrAccount ID
order_idintOrder ID
contractContractContract object
idintTransaction record ID
actionstrOrder direction
filled_quantityintFilled quantity
filled_quantity_scaleintDecimal offset for the filled quantity; defaults to 0. filled_quantity and filled_quantityScale together represent the actual quantity. For example, qty=111 and scale=2 represent 111*10^(-2)=1.11
filled_pricefloatFill price
filled_amountfloatFilled amount
transacted_atstrExecution time

OrderLeg Attached Order

tigeropen.trade.domain.order.OrderLeg

Description

An attached order submitted with the primary order.

Object Properties

PropertyTypeDescription
leg_typestrAttached order type: PROFIT for a take-profit order or LOSS for a stop-loss order
pricefloatAttached order price
time_in_forcestrAttached order time in force: DAY or GTC (good-till-canceled)
outside_rthboolAllows the attached order to trade during pre-market and after-hours sessions for US stocks

AlgoParams Algorithmic Order Parameters

tigeropen.trade.domain.order.AlgoParams

Description

Parameters for VWAP and TWAP orders.

Object Properties

PropertyTypeDescription
start_timestr/intEffective start time (time string or timestamp, TWAP and VWAP only), e.g. '2020-11-19 23:00:00' or 1640159945678
end_timestr/intExpiry time (time string or timestamp, TWAP and VWAP only)
no_take_liqboolMinimizes trading frequency for VWAP orders
allow_past_end_timeboolAllows fills after the end time for TWAP and VWAP orders
participation_ratefloatParticipation rate (VWAP only, 0.01-0.5)

Contract

tigeropen.trade.domain.contract.Contract source

Description

A contract identifies a tradable instrument, such as a stock, option, or futures contract. For example, the symbol TIGR and market='US' identify Tiger Brokers stock. Options and futures require additional identifying fields. The Python SDK stores this information in tigeropen.trade.domain.contract.Contract, which can be passed to utilities that construct Order objects.

Most contracts use the following fields:

  • Symbol: US and UK symbols are generally alphabetic, while Hong Kong and A-share symbols are numeric. For example, Tiger Brokers' symbol is TIGR.
  • Security type: Common values include STK (stock), OPT (option), FUT (futures), and CASH (forex). Tiger Brokers stock uses STK.
  • Currency: Common values include USD and HKD.
  • Exchange: Stock orders are generally routed automatically and do not require this field. Futures contracts require it.

These four fields identify most stocks, CFDs, indices, and forex pairs. Options and futures require additional fields. The following examples construct common contract types.

Stocks

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, option_contract_by_symbol
contract = option_contract(identifier='AAPL  190118P00160000')
contract = option_contract_by_symbol('JD', expiry='20211015', strike=45.0, put_call='PUT', currency='USD')

Futures

from tigeropen.common.util.contract_utils import future_contract
contract = future_contract(symbol='CL', currency='USD', expiry='20190328', multiplier=1.0, exchange='SGX')

Hong Kong Warrants

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')

Hong Kong CBBC

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')

The following table lists the available fields.

Object Properties

Property NameTypeDescription
identifierstrUnique identifier. For stocks, this is the symbol. For options, it is a 21-character identifier such as AAPL 220729C00150000. Futures also use a contract identifier
symbolstrStock symbol; for an option, the symbol of the underlying asset
sec_typestrSecurity type, such as STK for stock, OPT for option, FUT for futures, WAR for warrant, or IOPT for CBBC; defaults to STK
namestrContract name
currencystrCurrency, USD/HKD/CNH
exchangestrExchange
expirystrOptions and futures only, option or futures expiry date
strikefloatOptions only, option strike price
multiplierfloatQuantity per lot
put_callstrOptions only, option direction, CALL or PUT
local_symbolstrGlobal account only, Hong Kong stocks used to identify warrants and CBBC
short_marginfloatShort margin ratio (deprecated, please use short_initial_margin instead)
short_initial_marginfloatShort initial margin ratio in the range (0, 1]; for example, 0.6 means 60%
short_maintenance_marginfloatShort maintenance margin ratio in the range (0, 1], typically below short_initial_margin. Available for prime/paper accounts but not global-account contracts
short_fee_ratefloatAnnualized short-borrow fee rate; for example, 0.03 means 3%
shortableboolIndicates that the borrow pool currently has inventory (shortable_count > 0). This does not indicate that the account has short-selling permission
long_initial_marginfloatLong initial margin ratio in the range (0, 1]; for example, 0.3 means a 30% requirement
long_maintenance_marginfloatLong maintenance margin ratio in the range (0, 1], typically below long_initial_margin
contract_monthstrContract month, e.g., 202201, represents January 2022
primary_exchangestrStock listing exchange
marketstrMarket, such as US, HK, or CN
min_tickfloatMinimum tick size. Fixed for futures; for stocks it varies by price range and may be None, so prefer tick_sizes
tick_sizeslistTick-size rules by price range. Each item includes begin, end, tickSize, and interval type (OPEN, OPEN_CLOSED, CLOSED, or CLOSED_OPEN)
trading_classstrContract trading class name
continuousboolFutures only. Indicates whether this is a continuous contract
statusintTradability status: 0 for not tradable, 1 for tradable
tradeboolFutures only. Indicates whether the contract is tradable
last_trading_datestrFutures only, last trading date, e.g., '20211220', represents December 20, 2021
first_notice_datestrFutures only, first notice date, contracts cannot open long positions after first notice date. Existing long positions will be forcibly closed before the first notice date (usually three trading days prior), e.g., '20211222', represents December 22, 2021
last_bidding_close_timeintFutures only, bidding close timestamp
is_etfboolIndicates whether the contract is an ETF
etf_leverageintETF leverage multiple; present only for ETFs
discounted_day_initial_marginfloatFutures only. Discounted intraday initial margin
discounted_day_maintenance_marginfloatFutures only. Discounted intraday maintenance margin
discounted_time_zone_codestrFutures only, time zone for the intraday margin discount period, such as America/New_York
discounted_start_atintFutures only, intraday margin discount start time as a millisecond timestamp
discounted_end_atintFutures only, intraday margin discount end time as a millisecond timestamp
lot_sizefloatUnits per lot, such as 100 shares for a Hong Kong stock, 1 share for a US stock, or 100 shares for an A-share. Order quantities usually must be multiples of this value except for fractional-share trading
support_overnight_tradingboolIndicates whether the contract supports overnight trading
⚠️

Warning

print(contract) displays only some attributes. Use print(contract.to_str()) to display all attributes.

Retrieve Contracts Through the API

Use get_contract or get_contracts to retrieve contract information.

Parameters:

ParameterRequiredDescription
symbolYesContract symbol, such as 00700 or AAPL
sec_typeYesContract type, such as SecurityType.STK or SecurityType.OPT
currencyNoCurrency, such as Currency.USD or Currency.HKD
exchangeNoExchange, such as SMART or SEHK
expiryNoExpiration date in yyyyMMdd format; required for options
strikeNoStrike price, required when trading options
put_callNoCALL/PUT, required when trading options
secret_keyNoInstitutional trader key; available only to institutional users and configured in client_config

Returns

get_contract returns a Contract; get_contracts returns a list of Contract objects. Their properties are listed above.

Example

from tigeropen.trade.trade_client import TradeClient
from tigeropen.common.consts import SecurityType
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 exclusive 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 futures 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

tigeropen.quote.domain.market_status.MarketStatus

Description

Trading status for a market.

Object Properties

PropertyTypeDescription
marketstrMarket. (US: US stocks, CN: A-shares, HK: Hong Kong stocks)
trading_statusstrMarket trading status code: NOT_YET_OPEN, PRE_HOUR_TRADING, TRADING, MIDDLE_CLOSE, POST_HOUR_TRADING, CLOSING, OVERNIGHT_TRADING, EARLY_CLOSED, or MARKET_CLOSED
statusstrMarket status description (not yet open, trading, closed, etc.)
open_timedatetime.datetimeMost recent open time

OptionFilter

tigeropen.quote.domain.filter.OptionFilter

Description

Filters for an option chain request.

⚠️

Option-chain Greeks are deprecated

Greek-related option-chain filters delta, gamma, theta, vega, and rho are Deprecated. Their values are updated daily and are not timely enough for intraday use. Do not use them for real-time trading decisions. Use Option Calculation Tools with current market inputs instead.

Object Properties

ParameterTypeRequiredDescription
implied_volatilityfloatNoImplied volatility, which reflects the market's expectation of future price volatility
in_the_moneyboolNoIndicates whether the option is in the money
open_interestintNoNumber of open contracts held by market participants at the end of each trading day; an indicator of market depth and liquidity
deltafloatNoDeprecated. Daily-updated Delta filter; not suitable for intraday use
gammafloatNoDeprecated. Daily-updated Gamma filter; not suitable for intraday use
thetafloatNoDeprecated. Daily-updated Theta filter; not suitable for intraday use
vegafloatNoDeprecated. Daily-updated Vega filter; not suitable for intraday use
rhofloatNoDeprecated. Daily-updated Rho filter; not suitable for intraday use

Order Changes

FieldDescription
idOrder ID
accountAccount
symbolPosition symbol, e.g., 'AAPL', '00700', 'ES', 'CN'
expiryOptions, warrants, CBBC only
strikeOptions, warrants, CBBC only
rightOptions, warrants, CBBC only
identifierAsset identifier. Stock identifier is same as symbol. Futures include contract month, e.g., 'CN2201'
multiplierQuantity per lot, futures, options, warrants, CBBC only
actionBuy/sell direction. BUY for buy, SELL for sell
marketMarket. US, HK
currencyCurrency. USD US Dollar, HKD Hong Kong Dollar
segTypeClassification by trading type. S for stocks, C for futures
secTypeSTK Stocks, OPT Options, WAR Warrants, IOPT CBBC, CASH FOREX, FUT Futures, FOP Future Options
orderTypeOrder type. 'MKT' market order/'LMT' limit order/'STP' stop order/'STP_LMT' stop limit order/'TRAIL' trailing stop order
isLongIndicates whether this is a long position
totalQuantityOrder quantity
totalQuantityScaleOrder quantity offset, e.g., totalQuantity=111, totalQuantityScale=2, then actual totalQuantity=111*10^(-2)=1.11
filledQuantityTotal filled quantity (for orders filled in multiple trades, filledQuantity is cumulative total filled)
filledQuantityScaleTotal filled quantity offset
avgFillPriceAverage fill price
limitPriceLimit order price
stopPriceStop price
realizedPnlRealized P&L (only prime accounts have this field)
statusOrder Status
replaceStatusOrder Replace Status
cancelStatusOrder Cancel Status
outsideRthAllows pre-market and after-hours trading for US stocks
canModifyIndicates whether the order can be modified
canCancelIndicates whether the order can be canceled
liquidationIndicates whether this is a closing order
nameAsset name
sourceOrder source (from 'OpenApi', or other)
errorMsgError message
attrDescOrder description
commissionAndFeeTotal commission and fees
openTimeOrder time
timestampOrder status last update time

Position Changes

FieldDescription
accountUser account
symbolStock symbol
expiryExpiry date, options, warrants, CBBC only
strikeStrike price, options, warrants, CBBC only
rightOption direction PUT/CALL, options, warrants, CBBC only
identifierAsset identifier
multiplierLot size, options, warrants, CBBC only
marketTrading market
currencyCurrency type
segTypeClassification by trading type. S for stocks, C for futures
secTypeContract type
positionPosition
positionScalePosition quantity offset
averageCostAverage cost
latestPriceLatest price
marketValueMarket value
unrealizedPnlUnrealized P&L
nameAsset name
timestampServer time

Asset Changes

FieldDescription
accountUser account
currencyCurrency type
segTypeClassification by trading type. S for stocks, C for futures
availableFundsAvailable funds (loan value equity - initial margin)
excessLiquidityExcess liquidity (loan value equity - maintenance margin)
netLiquidationNet liquidation value
equityWithLoanEquity with loan value (loan value assets)
buyingPowerBuying power
cashBalanceAccount cash balance
grossPositionValuePosition market value
initMarginReqCurrent initial margin
maintMarginReqCurrent maintenance margin
timestampServer time

Quote Changes

  • Basic quotes
FieldSub-fieldDescription
symbolStock symbol
typeType
timestampQuote data time
serverTimestampServer time
avgPriceAverage price
latestPriceLatest price
latestPriceTimestampLatest price timestamp (no value in pre/post market)
latestTimeLatest price time
preClosePrevious close
volumeDaily cumulative volume
amountDaily cumulative turnover (options/futures not supported)
openOpen price
highHigh price
lowLow price
hourTradingTagPre/post market tag (no value during US market hours), values: Pre-market/After-hours
marketStatusMarket status: Trading, WaitingOpen, OpeningAuction, InAuction, ClosingAuction, Closed, MiddayBreak, AfterHoursTrading, AfterHoursMatching, ExtendedTrading, PreMarket, or Overnight
identifierAsset identifier (options only)
openIntOpen interest (options only)
tradeTimeTrade time (futures only)
preSettlementPrevious settlement price (futures only)
minTickMinimum tick size (futures only)
mipMinute price
miaMinute average price
mitMinute time
mivMinute volume
mioMinute open price (futures only)
mihMinute high price (futures only)
milMinute low price (futures only)
  • Best bid/ask quotes
FieldDescription
askPriceAsk price
askSizeAsk size
askTimestampAsk timestamp (Pre/Post-Mkt data not supported)
bidPriceBid price
bidSizeBid size
bidTimestampBid timestamp (Pre/Post-Mkt data not supported)


Did this page help you?