Object Details
PortfolioAccount Assets (Prime/Demo Account)
tigeropen.trade.domain.prime_account.PortfolioAccount
source
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 name | type | description |
---|---|---|
account | str | corresponding account id |
update_timestamp | int | Update time, 13-digit timestamp in milliseconds |
segments | tigeropen.trade.domain.prime_account.Segment | Account 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
source
Instruction Divide assets according to stock/futures trading varieties, and each part is a segment.
Object Properties
property name | type | description |
---|---|---|
currency | str | Currency, such as USD, HKD |
capability | str | Account Type, Margin: RegTMargin, Cash: Cash |
category | str | Securities Category C: (Commodities Futures), S: (Securities Stocks),F: (Funds) |
cash_balance | float | The 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_trade | float | Amount of cash that can be traded in the current account |
cash_available_for_withdrawal | float | Amount of cash that can be withdrawn in the current account |
gross_position_value | float | Total 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_loan | float | Equity with loan value (including loan value assets). Securities Segment: cash value + stock value, futures Segment: cash value - maintenance margin |
net_liquidation | float | Net Liquidation Value |
init_margin | float | initial margin requirement |
maintain_margin | float | Maintenance margin requirement |
overnight_margin | float | Overnight margin requirement |
unrealized_pl | float | floating profit and loss |
realized_pl | float | Realized P&L |
excess_liquidation | float | Excess 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_liquidation | float | Overnight 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_power | float | buying 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 |
leverage | float | The 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_assets | dict | Account asset information differentiated by transaction currency, is a dict with currency as key, and value as CurrencyAsset object |
consolidatedSegTypes | string | consolidated 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 |
uncollected | float | In transit funds |
locked_funds | float | Locked funds |
CurrencyAsset sub-currency assets (Prime/demo account)
tigeropen.trade.domain.prime_account.CurrencyAsset
source
Instruction
Assets by currency.
Object Properties
member name | type | description |
---|---|---|
currency | str | Current currency, commonly used currencies include: USD-US dollar, HKD-Hong Kong dollar, SGD-Singapore dollar, CNH-RMB |
cash_balance | float | 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_trade | float | The amount of cash that can be traded in the current account |
gross_position_value | float | gross value |
stock_market_value | float | The market value of the stock, when the category is C (futures type), there will be no stock market value |
futures_market_value | float | The market value of futures, when the category is S (stock type), there will be no futures market value |
option_market_value | float | Market value of the option |
unrealized_pl | float | Unrealizd profit and loss of the account |
realized_pl | float | The realized profit and loss in the account |
PortfolioAccount Assets (Global Account)
tigeropen.trade.domain.account.PortfolioAccount
source
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 name | type | description |
---|---|---|
account | str | corresponding account id |
summary | tigeropen.trade.domain.account.Account | Account summary information, statistics on segments |
segments | dict | Account 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_values | dict | Account 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
source
instruction Asset summary information of each trading product in the account.
Object Properties
property name | type | description |
---|---|---|
accrued_cash | float | The accumulated interest payable in the current month, updated according to the daily frequency |
accrued_dividend | float | Accumulated dividends. Refers to the accumulated value of all dividends that have been executed but not paid |
available_funds | float | Available funds (available for trading). Calculated as equity_with_loan - initial_margin_requirement |
∆ buying_power | float | Purchasing 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 |
cash | float | Cash Amount |
currency | str | currency, meaning refer to enumeration parameter-currency |
cushion | float | The ratio of remaining liquidity to total assets, calculated as: excess_liquidity/net_liquidation |
∆ day_trades_remaining | int | The number of trades remaining in the day, -1 means unlimited |
equity_with_loan | float | Equity with loan value (asset with loan value) - Securities Segment: Cash Value + Stock Value - Futures Segment: Cash Value - Maintenance Margin |
excess_liquidity | float | Excess Liquidity - Securities Segment: Calculation Method: equity_with_loan - maintenance_margin_requirement- Futures Segment: Calculation Method: net_liquidation - maintenance_margin_requirement |
∆ gross_position_value | float | Total 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_requirement | float | Initial Margin |
maintenance_margin_requirement | float | Maintenance Margin |
realized_pnl | float | Today's Realized P&L |
unrealized_pnl | float | Unrealized profit and loss |
net_liquidation | float | Total Assets (Net Liquidation Value) - Securities Segment: Cash Value + Stock Value + Stock Option Value - Futures Segment: Cash Value + Mark-to-Market Profit and Loss |
∆ regt_equity | float | Only for the securities segment, that is, the equity with loan (including the loan equity value) calculated according to the Regulation T Act |
∆ regt_margin | float | For security segments only, i.e. initial margin requirements calculated under Regulation T |
∆ sma | float | For 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. |
timestamp | int | Update time |
SecuritySegment Equity Assets (Global Account)
tigeropen.trade.domain.account.SecuritySegment
source
Instruction
Stock asset information.
Object Properties
property name | type | description |
---|---|---|
accrued_cash | float | The accumulated interest payable in the current month, updated daily. |
accrued_dividend | float | Cumulative dividends. Refers to the cumulative value of all dividends that have been executed but not paid |
available_funds | float | Available funds (available for trading). Calculated as equity_with_loan - initial_margin_requirement |
cash | float | Cash |
equity_with_loan | float | Equity with loan value (asset with loan value). Calculation method: cash value + stock value |
excess_liquidity | float | Excess liquidity. Calculation method: equity_with_loan - maintenance_margin_requirement |
gross_position_value | float | Total 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_requirement | float | Initial Margin |
maintenance_margin_requirement | float | Maintenance margin |
leverage | float | For securities only Segment gross_position_value / net_liquidation |
net_liquidation | float | Total assets (net liquidation value). Calculation method: cash value + stock value + stock option value |
∆ regt_equity | float | Only for the securities segment, that is, the equity with loan (including the loan equity value) calculated according to the Regulation T Act |
∆ regt_margin | float | For security segments only, i.e. initial margin requirements calculated under Regulation T |
∆ sma | float | For 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. |
timestamp | int | Update time |
SecuritySegment Equity Assets (Global Account)
tigeropen.trade.domain.account.SecuritySegment
source
Instruction
Stock asset information.
Object Properties
property name | type | description |
---|---|---|
accrued_cash | float | The accumulated interest payable in the current month, updated daily. |
accrued_dividend | float | Cumulative dividends. Refers to the cumulative value of all dividends that have been executed but not paid |
available_funds | float | Available funds (available for trading). Calculated as equity_with_loan - initial_margin_requirement |
cash | float | Cash |
equity_with_loan | float | Equity with loan value (asset with loan value). Calculation method: cash value + stock value |
excess_liquidity | float | Excess liquidity. Calculation method: equity_with_loan - maintenance_margin_requirement |
gross_position_value | float | Total 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_requirement | float | Initial Margin |
maintenance_margin_requirement | float | Maintenance margin |
leverage | float | For securities only Segment gross_position_value / net_liquidation |
net_liquidation | float | Total assets (net liquidation value). Calculation method: cash value + stock value + stock option value |
∆ regt_equity | float | Only for the securities segment, that is, the equity with loan (including the loan equity value) calculated according to the Regulation T Act |
∆ regt_margin | float | For security segments only, i.e. initial margin requirements calculated under Regulation T |
∆ sma | float | For 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. |
timestamp | int | Update time |
CommoditySegment Futures Assets (Global Account)
tigeropen.trade.domain.account.CommoditySegment
source
Instruction
Futures asset information.
Object Properties
property name | type | description |
---|---|---|
accrued_cash | float | The accumulated interest payable in the current month, updated daily. |
accrued_dividend | float | Cumulative dividends. Refers to the cumulative value of all dividends that have been executed but not paid |
available_funds | float | Available funds (available for trading). Calculated as equity_with_loan - initial_margin_requirement |
cash | float | Cash |
equity_with_loan | float | Equity with loan value (asset with loan value) calculation method: cash value - maintenance margin |
excess_liquidity | float | Excess liquidity. Calculation method: net_liquidation - maintenance_margin_requirement |
initial_margin_requirement | float | Initial Margin |
maintenance_margin_requirement | float | Maintenance Margin |
net_liquidation | float | Total assets (net liquidation value). Calculation method: cash value + mark-to-market profit and loss |
timestamp | int | Update time |
MarketValue sub-currency assets (Global account)
tigeropen.trade.domain.account.MarketValue
source
Instruction
Asset information by currency.
Object Properties
property name | type | description |
---|---|---|
currency | str | currency unit |
net_liquidation | float | Total Assets (Net Liquidation Value) |
cash_balance | float | cash |
stock_market_value | float | stock market value |
option_market_value | float | Option Market Value |
warrant_value | float | Warrant Market Value |
futures_pnl | float | Mark to Market |
unrealized_pnl | float | Unrealized PNL |
realized_pnl | float | Realized P&L |
exchange_rate | float | Exchange rate to account's primary currency |
net_dividend | float | Net dividends payable and dividends receivable |
timestamp | int | Update time |
Position position
tigeropen.trade.domain.position.Position
source
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 name | type | description |
---|---|---|
account | str | The corresponding account ID |
contract | tigeropen.trade.domain.contract.Contract | Contract object |
position_qty | float | Position quantity |
quantity | int | Contract quantity (deprecated) |
position_scale | int | Contract 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_cost | float | Average cost with commission |
market_value | float | Market Cap |
salable_qty | float | Saleable quantity |
average_cost_of_carry | float | 累计持仓成本(A股模式计算方式) |
market_price | float | Latest market price |
is_level0_price | boolean | is lv0(delay) quote |
realized_pnl | float | Realized profit and loss in FIFO rule |
unrealized_pnl | float | Unrealized profit and loss |
unrealized_pnl_by_cost_of_carry | float | Unrealized profit and loss by cost of carry |
unrealized_pnl_percent_by_cost_of_carry | float | Unrealized profit and loss percentage by cost of carry |
today_pnl | float | Today's profit and loss |
today_pnl_percent | float | Today's profit and loss percentage |
yesterday_pnl | float | Yesterday's profit and loss, Fund only |
last_close_price | float | The closing price on the last trading day (pre-adjusted for stock rights) |
Order object
tigeropen.trade.domain.order.Order
source
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 name | type | description |
---|---|---|
account | str | The account to which the order belongs |
id | int | Global order id |
order_id | int | The account automatically increments the order number, which is obsolete |
parent_id | int | Parent order id, currently only used for additional orders on TigerTrade App |
order_time | int | Order time, 13-digit timestamp in milliseconds |
reason | str | When the order fails, the description of the reason for the failure will be returned |
trade_time | int | Latest order status change time. (if filled, represents the trade time; if canceled, represents the cancel time), 13-digit timestamp in milliseconds |
update_time | int | Order attribute update time |
expire_time | int | GTD Order expire time |
action | str | Trade direction, 'BUY' / 'SELL' |
quantity | int | Order quantity |
filled | int | Number of transactions |
avg_fill_price | float | Average fill price including commission |
commission | float | Including commissions, stamp duties, SFC fees and other series of fees |
gst | float | Goods and Service Tax |
realized_pnl | float | Realized Pnl |
trail_stop_price | float | Trailing stop price |
limit_price | float | Limit order price |
aux_price | float | In 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_percent | float | Trailing stop order-percent, the value range is 0-100 |
percent_offset | float | <This field is not used> |
order_type | str | Order type, 'MKT' market order/'LMT' limit order/'STP' stop order/'STP_LMT' stop limit order/'TRAIL' trailing stop order |
time_in_force | str | Valid period, valid within 'DAY'/valid until 'GTC' is revoked/ 'GTD' good till date |
outside_rth | bool | Whether it supports pre-market and post-market trading, exclusive to US stocks. |
contract | Contract | tigeropen.trade.domain.contract.Contract contract object |
status | OrderStatus | tigeropen.common.consts.OrderStatus Enumeration, indicating order status |
remaining | int | Unfilled Quantity |
sub_ids | List(int) | sub-order ID list(Only available orders have sub order ) |
user_mark | str | user can customize orders |
adjust_limit | float | Price 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_price | float | Latest price |
Build method:
Generate order objects locally via tigeropen.common.util.order_utils 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 name | type | description |
---|---|---|
account | str | Order account, you can use an integrated account, a global account or a demo account |
contract | tigeropen.trade.domain.contract.Contract | contract object to trade |
action | str | trading direction, 'BUY' / 'SELL' |
quantity | int | The 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 name | type | description |
---|---|---|
account | str | Order account, you can use an integrated account, a global account or a demo account |
contract | tigeropen.trade.domain.contract.Contract | contract object to trade |
action | str | trading direction, 'BUY' / 'SELL' |
quantity | int | The quantity of the order, which must be an integer greater than 0 |
limit_price | float | The 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 name | type | description |
---|---|---|
account | str | Order account, you can use an integrated account, a global account or a demo account |
contract | tigeropen.trade.domain.contract.Contract | contract object to trade |
action | str | trading direction, 'BUY' / 'SELL' |
quantity | int | The quantity of the order, which must be an integer greater than 0 |
aux_price | float | Price 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 name | type | description |
---|---|---|
account | str | Order account, you can use an integrated account, a global account or a demo account |
contract | tigeropen.trade.domain.contract.Contract | contract object to trade |
action | str | trading direction, 'BUY' / 'SELL' |
quantity | int | The quantity of the order, which must be an integer greater than 0 |
limit_price | float | The price of the limit price, must be greater than 0 |
aux_price | float | Price 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 name | type | description |
---|---|---|
account | str | Order account, you can use an integrated account, a global account or a demo account |
contract | tigeropen.trade.domain.contract.Contract | contract object to trade |
action | str | trading direction, 'BUY' / 'SELL' |
quantity | int | The quantity of the order, which must be an integer greater than 0 |
trailing_percent | float | Trailing stop order - percentage, the value range is 0-100, aux_price and trailing_percent are mutually exclusive |
aux_price | float | Spread, 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 name | type | description |
---|---|---|
leg_type | str | Additional order type. 'PROFIT' Take Profit order type, 'LOSS' Stop Loss order type |
price | float | Additional order price. |
time_in_force | str | Additional order validity period. 'DAY' (good for the day) and 'GTC' (good-Til-Canceled). |
outside_rth | bool | Whether 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 name | type | description |
---|---|---|
account | str | Place order account |
contract | tigeropen.trade.domain.contract.Contract | Contract object |
action | str | Trade Direction,’Buy‘/'Sell' |
quantity | int | Order quantities, must be an integer greater than 0 |
limit_price | float | Limit price, must greater than 0 |
time_in_force | str | Additional 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 name | type | description |
---|---|---|
account | str | account |
order_id | int | order id |
contract | Contract | contract object |
id | int | transaction record id |
action | str | Order direction |
filled_quantity | int | transacted quantity |
filled_price | float | transacted price |
filled_amount | float | transacted amount |
transacted_at | str | transacted time |
OrderLeg Additional order
tigeropen.trade.domain.order.OrderLeg
Explanation
Additional orders that are carried along with the main order
parameter
parameter name | type | description |
---|---|---|
leg_type | str | Additional order types. 'PROFIT' for take profit order type, 'LOSS' for stop loss order type |
price | float | Additional order price |
time_in_force | str | Additional Order Validity Dates. 'DAY' (Good-Til-Canceled) and 'GTC' (Good-Til-Canceled) |
outside_rth | bool | Whether 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 name | type | description |
---|---|---|
start_time | str or int | Effective start time (time string or timestamp, dedicated to TWAP and VWAP), such as '2020-11-19 23:00:00' or 1640159945678 |
end_time | str or int | Expiration time (time string or timestamp TWAP and VWAP specific) |
no_take_liq | bool | Whether to reduce the number of transactions as much as possible (only for VWAP orders) |
allow_past_end_time | bool | Whether to allow the transaction to continue after the expiration time (TWAP and VWAP only) |
participation_rate | float | Participation rate (for VWAP only, 0.01-0.5) |
Contract object
tigeropen.trade.domain.contract.Contract
source
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 name | type | description |
---|---|---|
identifier | str | Unique identifier, the stock identifier is the same as the symbol, the option is a 21-digit identifier, such as: 'AAPL 220729C00150000', the futures identifier |
symbol | str | Contract code |
contract_id | int | contract id |
sec_type | str | Securities Type |
name | str | Contract name |
currency | str | currency |
exchange | str | Exchange |
expiry | str | Expiration date (for options/futures) |
strike | float | Strike Price (for options) |
multiplier | float | Number per lot |
put_call | str | Option direction, bullish bearish |
local_symbol | str | |
short_margin | float | short margin ratio(deprecated, use short_initial_margin instead |
short_initial_margin | float | short initial margin ratio |
short_maintenance_margin | float | short maintenance margin ratio |
short_fee_rate | float | Short rate |
shortable | int | Short pool remaining |
long_initial_margin | float | Long initial margin |
long_maintenance_margin | float | Long Maintenance Margin |
contract_month | str | Contract month, such as 202201, means January 2022 |
primary_exchange | str | Stock Listing Exchange |
market | str | Market |
min_tick | float | Minimum tick unit |
tickSizes | str | Exclusive 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_class | str | The trading class name of the contract |
status | str | Status |
continuous | bool | Exclusive to futures, whether it is a continuous contract |
trade | bool | Futures are exclusive, whether they can be traded |
last_trading_date | str | Exclusive to futures, the last trading day, such as '20211220', means December 20, 2021 |
first_notice_date | str | Exclusively 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_time | int | Futures exclusive, bid closing timestamp |
is_etf | bool | is ETF |
etf_leverage | int | ETF leverage |
discounted_day_initial_margin | float | Futures only, Intraday initial margin discount |
discounted_day_maintenance_margin | float | Futures only, Intraday maintenance margin discount |
discounted_time_zone_code | float | Futures only, Intraday margin discount period time zone |
discounted_start_at | float | Futures only, Intraday margin discount start time |
discounted_end_at | float | Futures 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:
parameter | requirement | description |
---|---|---|
symbol | Yes | Contract Exp: 00700/AAPL |
sec_type | Yes | Contract type Exp: SecurityType.STK/SecurityType.OPT |
currency | No | Currency Exp: Currency.USD/Currency.HKD |
exchange | No | Exchange Exp: SMART/SEHK |
expiry | No | Expiration Date Must be passed when the trading type is an option yyyyMMdd |
strike | No | Strike price Must be passed when the transaction type is an option |
put_call | No | CALL/PUT Must be passed when the trading type is an option |
secret_key | No | Institutional 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
parameter | type | description |
---|---|---|
market | str | Market(US:US Stock,CN:Shanghai and Shenzhen,HK:Hongkong) |
trading_status | str | Market 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; |
status | str | Market status description(Market not open,Trading,Market closed etc.) |
open_time | datetime.datetime | Last opening time |
OptionFilter Option Filter
tigeropen.quote.domain.filter.OptionFilter
Explanation
Option filter parameter
parameter
parameter | type | requirement | description |
---|---|---|---|
implied_volatility | float | No | Implied 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_money | bool | No | In the price |
open_interest | int | No | Open 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 |
delta | float | No | delta, 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 |
gamma | float | No | gamma, Reflects the impact of stock price changes on delta. Every time the stock price changes by 1 dollar, delta changes gamma |
theta | float | No | theta, 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 |
vega | float | No | vega, Reflects the impact of volatility on option price changes. For every 1% change in volatility, the option price changes approximately vega |
rho | float | No | rho, 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 |