Get Order Information

Initialization

All examples on this page assume the following initialization has been completed:

from tigeropen.tiger_open_config import TigerOpenClientConfig

For details, see Prerequisites.


Get Order List

TradeClient.get_orders(account=None, sec_type=None, market=Market.ALL, symbol=None, start_time=None, end_time=None, limit=100, is_brief=False, states=None, sort_by=None, seg_type=None, page_token=None)

Description

Retrieves account order records, including all order statuses and orders of various security types. Parameters can be passed for filtering.

Parameters

Parameter NameTypeRequiredDescription
accountstrNoAccount ID. If not provided, uses the default account from client_config
sec_typeSecurityTypeNoSecurity type. Can use constants from tigeropen.common.consts.SecurityType
marketMarketNoMarket. Can use constants from tigeropen.common.consts.Market
symbolstrNoSecurity symbol
start_timestr or intNoStart time (closed interval). Millisecond timestamp or date string, e.g. 1643346000000 or '2019-01-01' or '2019-01-01 12:00:00'. Filters on the timestamp selected by sort_by.
end_timestr or intNoEnd time (open interval). Millisecond timestamp or date string, e.g. 1653346000000 or '2019-11-01' or '2019-11-01 15:00:00'. Filters on the timestamp selected by sort_by.
limitintNoNumber of orders to retrieve per request. Default: 100, Maximum: 300
is_briefboolNo【supports only Global accounts】 Whether to return brief order data
stateslist[OrderStatus]NoOrder-state filter. Global converts values to status codes before querying; Prime/Paper filters returned orders by state. Omission applies no state filter.
sort_byOrderSortByNoOmnibus accounts only. Timestamp used for sorting and start_time/end_time filtering. LATEST_CREATED sorts descending and filters by order creation/submission time; LATEST_STATUS_UPDATED sorts descending and filters by the most recent order status update time. The service defaults to LATEST_CREATED when omitted.
seg_typeSegmentTypeNoAccount segment. Available: SegmentType.SEC for securities; SegmentType.FUT for commodities. Can import from tigeropen.common.consts.SegmentType
page_tokenstrNoPage token. Note: If this field is set (pass empty string initially, then pass the next_page_token value from response), the return structure changes - instead of returning order list, returns OrdersResponse object with result and page_token fields

Time Range Note: start_time and end_time are both optional. Omitting either bound applies no corresponding time filter. The get_orders interface defines no maximum time span, but each request is subject to a result limit. Use a reasonable time range and paginate with page_token or time boundaries.

Returns

list or OrdersResponse

If page_token is not None in the request, returns OrdersResponse object (OrdersResponse.result field contains order list, OrdersResponse.next_page_token contains next page token). Otherwise returns order list.

Each element in the list is an Order object (tigeropen.trade.domain.order.Order). For detailed field descriptions, see Order Object

Example

orders = trade_client.get_orders(sec_type=SecurityType.STK, market=Market.ALL)

# Limit the result count and filter by order time. String times default to Beijing time; client_config.timezone changes their time zone.
orders = trade_client.get_orders(limit=10,
                                 start_time='2022-09-02 01:00:00', end_time='2022-11-08 00:00:00',
                                 seg_type='SEC'
                                 )
orders = trade_client.get_orders(limit=10,
                                 start_time=1656224964000, end_time=1666224964000,
                                 seg_type='SEC'
                                 )
# View order properties
order1 = orders[0]
print(order1.status)  # Order status
print(order1.id)  # Order ID
print(order1.contract.symbol) # Contract symbol
print(order1.contract.sec_type) # Contract type

Retrieves orders using page_token pagination.


def test_get_orders_by_page():
    results = []
    params = {
        'sec_type': 'STK',
        'start_time': int(datetime.strptime('2023-01-01', '%Y-%m-%d').timestamp() * 1000),
        'end_time': int(datetime.strptime('2025-08-01', '%Y-%m-%d').timestamp() * 1000),
        'limit': 10,
        'page_token': ''
    }
    
    page = 1
    while True:
        response: OrdersResponse = trade_client.get_orders(**params)
        print(f'page {page}, size {len(response.result)}, next_page_token: {response.next_page_token}')
        page += 1
                    
        if response.result:
            results.extend(response.result)
            
        if not response.next_page_token:
            break
            
        params['page_token'] = response.next_page_token
        
    print(f'total: {len(results)}, results: {results}')

Retrieves orders paginated by time.

def test_get_orders_by_page():
    result = list()
    # Number returned each time (must be <= 300)
    limit = 300
    conditions = {
        'limit': limit,
        'start_time': '2025-01-01',
        'end_time': '2025-02-12',
        # Return data is in reverse chronological order, newest first. Sorted by order_time here
        'sort_by': OrderSortBy.LATEST_CREATED,
        # Can add other filter conditions
    }
    orders_page = trade_client.get_orders(**conditions)
    result.extend(orders_page)
    while len(orders_page) == limit:
        next_order_time = orders_page[-1].order_time
        conditions.pop('end_time', None)
        orders_page = trade_client.get_orders(**conditions, end_time=next_order_time)
        result.extend(orders_page)
    print(f'total order size: {len(result)}')
    return result

Example Response

[Order({'account': '1', 'id': 162998104807903232, 'order_id': 341, 'parent_id': 0, 'order_time': 1557972846184, 'reason': '136:Order is already being cancelled.', 'trade_time': 1557975394512, 'action': 'BUY', 'quantity': 2, 'filled': 0, 'avg_fill_price': 0, 'commission': 0, 'realized_pnl': 0, 'trail_stop_price': None, 'limit_price': 0.1, 'aux_price': None, 'trailing_percent': None, 'percent_offset': None, 'order_type': 'LMT', 'time_in_force': 'DAY', 'outside_rth': True, 'contract': SPY, 'status': 'CANCELLED', 'remaining': 2}),
Order({'account': '1', 'id': 162998998620389376, 'order_id': 344, 'parent_id': 0, 'order_time': 1557973698590, 'reason': '136:Order is already being cancelled.', 'trade_time': 1557973773622, 'action': 'BUY', 'quantity': 1, 'filled': 0, 'avg_fill_price': 0, 'commission': 0, 'realized_pnl': 0, 'trail_stop_price': None, 'limit_price': 0.1, 'aux_price': None, 'trailing_percent': None, 'percent_offset': None, 'order_type': 'LMT', 'time_in_force': 'DAY', 'outside_rth': True, 'contract': SPY, 'status': 'CANCELLED', 'remaining': 1}),
Order({'account': '1', 'id': 152239266327625728, 'order_id': 230, 'parent_id': 0, 'order_time': 1547712418243, 'reason': '201:Order rejected - Reason: YOUR ORDER IS NOT ACCEPTED. IN ORDER TO OBTAIN THE DESIRED POSITION YOUR EQUITY WITH LOAN VALUE [1247.90 USD] MUST EXCEED THE INITIAL MARGIN [4989.99 USD]', 'trade_time': 1547712418275, 'action': 'BUY', 'quantity': 100, 'filled': 0, 'avg_fill_price': 0, 'commission': 0, 'realized_pnl': 0, 'trail_stop_price': None, 'limit_price': 5, 'aux_price': None, 'trailing_percent': None, 'percent_offset': None, 'order_type': 'LMT', 'time_in_force': 'DAY', 'outside_rth': True, 'contract': AAPL, 'status': 'REJECTED', 'remaining': 100})]

Rate Limit

The base rate limit is 120 requests/minute. get_order() and get_orders() map to the same wire method and share this limit.


Get Specific Order

TradeClient.get_order(account=None, id=None, order_id=None, is_brief=False, show_charges=None)

Description

Retrieves a specific order by ID.

Parameters

Parameter NameTypeRequiredDescription
accountstrNoAccount ID. If not provided, uses the default account from client_config
idintYesGlobal order ID returned after order submission
order_idintNo【supports only Global accounts】 Local order ID
is_briefboolNo【supports only Global accounts】 Return brief order data
show_chargesboolNoWhether to display list of tigeropen.trade.domain.order.Charge

Returns

Order object

For detailed field descriptions, see Order Object

Example

print(trade_client.get_order(id=31059079170361344))

Example Response

Order({'account': '111111', 'id': 31059079170361344, 'order_id': 948, 'parent_id': None, 'order_time': 1685861168000, 
'reason': 'Order expired', 'trade_time': 1686010200000, 'action': 'BUY', 'quantity': 1, 'filled': 0, 'avg_fill_price': 0.0, 
'commission': 0.0, 'realized_pnl': 0.0, 'trail_stop_price': None, 'limit_price': 100.0, 'aux_price': None, 
'trailing_percent': None, 'percent_offset': None, 'order_type': 'LMT', 'time_in_force': 'DAY', 'outside_rth': True, 
'order_legs': None, 'algo_params': None, 'algo_strategy': 'LMT', 'secret_key': '', 'liquidation': False, 'discount': 0, 
'attr_desc': None, 'source': 'OpenApi', 'adjust_limit': None, 'sub_ids': None, 'user_mark': '', 
'update_time': 1686010200000, 'expire_time': None, 'can_modify': False, 'external_id': '948', 'combo_type': None, 
'combo_type_desc': None, 'is_open': True, 'contract_legs': None, 'filled_scale': 0, 'total_cash_amount': None, 
'filled_cash_amount': 0.0, 'refund_cash_amount': None, 'attr_list': ['ALGORITHM', 'NON_TRADING_HOURS', 'TEST_ORDER'], 
'latest_price': 215.82, 'orders': None, 'gst': 0.0, 'quantity_scale': 0, 'trading_session_type': None, 'charges': None, 
'contract': AAPL/STK/USD, 'status': 'CANCELLED', 'remaining': 1})

Rate Limit

The base rate limit is 120 requests/minute. get_order() and get_orders() map to the same wire method and share this limit.


Get Pending Orders List

TradeClient.get_open_orders(account=None, sec_type=None, market=Market.ALL, symbol=None, start_time=None, end_time=None, parent_id=None, sort_by=None, seg_type=None, **kwargs)

Description

Retrieves list of pending orders, may include partially filled orders where the unfilled portion remains pending.

Parameters

Parameter NameTypeRequiredDescription
accountstrNoAccount ID. If not provided, uses the default account from client_config
sec_typeSecurityTypeNoSecurity type. Can use constants from tigeropen.common.consts.SecurityType
marketMarketNoMarket. Can use constants from tigeropen.common.consts.Market, e.g. Market.US
symbolstrNoSecurity symbol
start_timestr or intNoStart time. Millisecond timestamp or datetime string, e.g. 1639386000000 or '2019-06-07 23:00:00' or '2019-06-07'
end_timestr or intNoEnd time. Millisecond timestamp or datetime string, e.g. 1639386000000 or '2019-06-07 23:00:00' or '2019-06-07'
parent_idintNoParent order ID
sort_byOrderSortByNoOmnibus accounts only. Timestamp used for sorting and start_time/end_time filtering. LATEST_CREATED sorts descending and filters by order creation/submission time; LATEST_STATUS_UPDATED sorts descending and filters by the most recent order status update time. The service defaults to LATEST_CREATED when omitted.
seg_typeSegmentTypeNoAccount segment. Available: SegmentType.SEC for securities; SegmentType.FUT for commodities. Can import from tigeropen.common.consts.SegmentType

Returns

list

Each element in the list is an Order object (tigeropen.trade.domain.order.Order). For detailed field descriptions, see Order Object

Example

open_orders = trade_client.get_open_orders(sec_type=SecurityType.STK, market=Market.ALL)

Example Response

Same as get_orders

Rate Limit

The base rate limit is 120 requests/minute.


Get Canceled Orders

TradeClient.get_cancelled_orders(account=None, sec_type=None, market=Market.ALL, symbol=None, start_time=None, end_time=None, sort_by=None, seg_type=None, **kwargs)

Description

Returns canceled and expired orders, including partially filled orders whose remaining quantity was canceled.

Parameters

Parameter NameTypeRequiredDescription
accountstrNoAccount ID. If not provided, uses the default account from client_config
sec_typeSecurityTypeNoSecurity type. Can use constants from tigeropen.common.consts.SecurityType
marketMarketNoMarket. Can use constants from tigeropen.common.consts.Market, e.g. Market.US
symbolstrNoSecurity symbol
start_timestr or intNoStart time. Millisecond timestamp or datetime string, e.g. 1639386000000 or '2019-06-07 23:00:00' or '2019-06-07'
end_timestr or intNoEnd time. Millisecond timestamp or datetime string, e.g. 1639386000000 or '2019-06-07 23:00:00' or '2019-06-07'
sort_byOrderSortByNoOmnibus accounts only. Timestamp used for sorting and start_time/end_time filtering. LATEST_CREATED sorts descending and filters by order creation/submission time; LATEST_STATUS_UPDATED sorts descending and filters by the most recent order status update time. The service defaults to LATEST_CREATED when omitted.
seg_typeSegmentTypeNoAccount segment. Available: SegmentType.SEC for securities; SegmentType.FUT for commodities. Can import from tigeropen.common.consts.SegmentType

Returns

list

Each element in the list is an Order object. For detailed field descriptions, see Order Object

Example

cancelled_orders = trade_client.get_cancelled_orders(sec_type=SecurityType.STK, market=Market.ALL)

Example Response

Same as get_orders

Rate Limit

The base rate limit is 120 requests/minute.


Get Filled Orders List

TradeClient.get_filled_orders(account=None, sec_type=None, market=Market.ALL, symbol=None, start_time=None, end_time=None, sort_by=None, seg_type=None, **kwargs)

Description

Retrieves list of filled orders.

Orders may have partial fill status, in which case the order status might be HELD, CANCELLED, EXPIRED, or REJECTED.

Parameters

Parameter NameTypeRequiredDescription
accountstrNoAccount ID. If not provided, uses the default account from client_config
sec_typeSecurityTypeNoSecurity type. Can use constants from tigeropen.common.consts.SecurityType
marketMarketNoMarket. Can use constants from tigeropen.common.consts.Market, e.g. Market.US
symbolstrNoSecurity symbol
start_timestr or intYesStart time. Millisecond timestamp or datetime string, e.g. 1639386000000 or '2019-06-07 23:00:00' or '2019-06-07'
end_timestr or intYesEnd time. Millisecond timestamp or datetime string, e.g. 1639386000000 or '2019-06-07 23:00:00' or '2019-06-07'
sort_byOrderSortByNoOmnibus accounts only. Timestamp used for sorting and start_time/end_time filtering. LATEST_CREATED sorts descending and filters by order creation/submission time; LATEST_STATUS_UPDATED sorts descending and filters by the most recent order status update time. The service defaults to LATEST_CREATED when omitted.
seg_typeSegmentTypeNoAccount segment. Available: SegmentType.SEC for securities; SegmentType.FUT for commodities. Can import from tigeropen.common.consts.SegmentType

Note: The interval between start_time and end_time cannot exceed 90 days

Returns
list

Each element in the list is an Order object. For detailed field descriptions, see Order Object

Example

print(trade_client.get_filled_orders(start_time='2025-01-05',end_time='2025-03-29'))

Example Response

Same as get_orders

Rate Limit

The base rate limit is 120 requests/minute.


Get Order Transaction Records

TradeClient.get_transactions(account=None, order_id=None, symbol=None, sec_type=None, start_time=None, end_time=None, limit=100, expiry=None, strike=None, put_call=None)

Description
Retrieves detailed transaction records of filled orders (only applicable to prime/paper trading accounts).

Parameters

Note: When making requests, parameters must be provided as either:

  • order_id
  • or symbol and sec_type
Parameter NameTypeRequiredDescriptionRemarks
accountstrNoAccount ID. If not provided, uses the default account from client_config
order_idintYes/No(required when symbol+sec_type not provided)Global order ID returned after order placement, not local order ID
symbolstrYes/No(required when order_id not provided)Underlying symbol. When querying by symbol, sec_type is required
sec_typeSecurityTypeYes/No(required when order_id not provided)Underlying type. When querying by symbol, sec_type is requiredSecurity type. Can use constants from tigeropen.common.consts.SecurityType
start_timestr or intNoStart time for order last update time. Millisecond timestamp or date string, e.g. 1643346000000 or '2019-01-01' or '2019-01-01 12:00:00'
end_timestr or intNoEnd time for order last update time. Millisecond timestamp or date string, e.g. 1653346000000 or '2019-11-01' or '2019-11-01 15:00:00'
since_datestrNoSince date for transaction date. format: "20250101"sdk >= 3.5.0
to_datestrNoTo Date for transaction date. format: "20250201"sdk >= 3.5.0
limitintNoNumber of records to retrieve per request, maximum 100, default 20
expirystrNoExpiry date (for options). Format 'yyyyMMdd', e.g. '220121'
strikefloatNoStrike price (for options). e.g. 100.5
put_callstrNoCall or Put (for options). 'PUT' or 'CALL'
page_tokenstrNoPage token. Note: If this field is set (pass empty string initially, then pass next_page_token value), return structure changes - returns TransactionsResponse object with result list and page_token fields instead of transaction list

Returns
list or TransactionsResponse
If page_token is not None in the request, returns TransactionsResponse object (TransactionsResponse.result field contains transaction list, TransactionsResponse.next_page_token contains next page token). Otherwise returns transaction list.

Each element in the list is a Transaction object. For detailed field descriptions, see Transaction

Example

filled_orders = trade_client.get_transactions(symbol='AAPL', sec_type=SecurityType.STK)

Retrieves transactions using page_token pagination.

def test_get_transaction_by_page():
    """Get all transaction records
    Get all transaction records within specified time range using pagination
    """
    results = []
    params = {
        'symbol': 'AAPL',
        'start_time': int(datetime.strptime('2023-01-01', '%Y-%m-%d').timestamp() * 1000),
        'end_time': int(datetime.strptime('2025-08-01', '%Y-%m-%d').timestamp() * 1000),
        'limit': 15,  
        'page_token': ''
    }
    
    page = 1
    while True:
        response: TransactionsResponse = trade_client.get_transactions(**params)
        print(f'page {page}, size {len(response.result)}, next_page_token: {response.next_page_token}')
        page += 1
                    
        if response.result:
            results.extend(response.result)
            
        if not response.next_page_token:
            break
            
        params['page_token'] = response.next_page_token
        
    print(f'total: {len(results)}, results: {results}')

Example Response

Transaction({'account': 111111, 'order_id': 20947299719447552, 'contract': AAPL/STK/USD, 'id': 20947300069016576, 'action': 'BUY', 'filled_quantity': 1, 'filled_price': 132.25, 'filled_amount': 132.25, 'transacted_at': '2020-12-23 17:06:54'}), 

Transaction({'account': 111111, 'order_id': 19837920138101760, 'contract': AAPL/STK/USD, 'id': 19837920740508672, 'action': 'BUY', 'filled_quantity': 1, 'filled_price': 116.21, 'filled_amount': 116.21, 'transacted_at': '2020-09-16 18:02:00'})]
        

Rate Limit

The base rate limit is 60 requests/minute.


Preview Order

TradeClient.preview_order(order)

Description

Previews an order and returns whether it can be submitted, together with relevant asset information.

Preview results always contain is_pass. message is present only when the server returns a non-null message. Account, margin, commission, GST, and liquidity keys are included only when asset-preview, before-preview, and order-preview data are all available; an absent key differs from numeric zero. The queried-order fields avg_fill_price and realized_pnl are not part of the preview result.

Parameters
An Order object, as used by the order placement API.
Currently does not support OCA orders and attached orders.

Always returned

FieldTypeDescription
is_passboolWhether the order can be submitted

Optional field: message (preview message returned by the server).

Conditional asset-preview fields

FieldTypeDescription
accountstrAccount ID
init_marginfloatInitial margin after order placement
maint_marginfloatMaintenance margin after order placement
equity_with_loanfloatBorrowable equity after order placement
init_margin_beforefloatInitial margin before order placement
maint_margin_beforefloatMaintenance margin before order placement
equity_with_loan_beforefloatBorrowable equity before order placement
margin_currencystrMargin currency
commissionfloatEstimated commission
gstfloatEstimated GST
commission_currencystrEstimated commission currency
available_eefloatHypothetical post-fill available equity in margin_currency
excess_liquidityfloatHypothetical post-fill excess liquidity in margin_currency
overnight_liquidationfloatHypothetical post-fill overnight excess liquidity in margin_currency

Example

from tigeropen.common.util.contract_utils import stock_contract
contract = stock_contract(symbol='AAPL', currency='USD')
order = limit_order(account=client_config.account, contract=contract, action='BUY', limit_price=170, quantity=5)

result = trade_client.preview_order(order)
print(result)

Example Response

{"account": "111111", "init_margin": 3937.6255463, "maint_margin": 3437.6255463, "equity_with_loan": 1250864.63784,
  "init_margin_before": 937.6255463, "maint_margin_before": 937.6255463, "equity_with_loan_before": 1250890.48784,
  "margin_currency": "USD", "commission": 23.72, "commission_currency": "USD",
  "available_ee": 1246927.0122936, "excess_liquidity": 1247427.0122936, "overnight_liquidation": 1247427.0122936,
  "gst": 2.13, "is_pass": True
}

{'account': '111111', 'init_margin': 10000004816.402893, 'maint_margin': 10000004816.402893,
 'equity_with_loan': -24603909.5121613, 'init_margin_before': 937.6255463,
 'maint_margin_before': 937.6255463, 'equity_with_loan_before': 1250890.48784, 
 'margin_currency': 'USD', 'commission': 23720000.0, 'commission_currency': 'USD',
 'available_ee': -10024608725.915054, 'excess_liquidity': -10024608725.915054, 
 'overnight_liquidation': -10024608725.915054, 'gst': 2134800.0,
 'is_pass': False, 'message': 'Insufficient available funds or buying power'}

Did this page help you?