About 3 min

  • Basics of Tiger Open API

    Note: Users who only need to use the SDK to call the API can skip this section

    The API interface is mainly divided into transaction interface and market interface according to function, and can be divided into REST API interface and long connection push interface according to the calling form. Among them, the REST API interface includes the transaction interface and part of the market interface. Data such as order status, real-time market quotations, and in-depth market quotations have high real-time requirements, which are implemented through the persistent connection push interface. The protocols used for persistent connection push are WebSocket and Stomp , both the REST API interface and the push interface require authentication and interface signature when calling

    Request address

    The domain name is embedded in the OpenAPI SDK, for separate access by protocol, you can visit https://openapi.tigerfintech.com A demo account will be automatically generated after successful registration of developer information. The demo account trading is also accessed through the link of the official environment, but the underlying trading environment is isolated from each other

    Public request parameters

    ParameterTypeRequiredMaximum LengthDescriptionExample Value
    tiger_idstringyes10ID assigned to developer20150129
    methodstringyes128interface nameplace_order
    charsetstringyes10The encoding format used by the request, currently supported: UTF-8UTF-8
    sign_typestringYes10The signature algorithm type used by the merchant to generate the signature string, currently supports RSARSA
    timestampstringyes19request time, format "yyyy-mm-dd HH:mm:ss"2018-05-09 11:30:00
    versionstringyes3Interface version, current versions include: 1.0, 2.0. Please refer to the interface documentation for the specific version1.0
    biz_contentstringYes-A collection of request parameters. All business parameters except public parameters are passed in this parameter. For details, refer to each interface access document
    signstringYes344The signature string of the request parameterSee the example for details
    account_typestringNo-Account type, must be passed during token authentication, the type includes: [GLOBAL, STANDARD]
    access_tokenstringNo-The token must be passed during authentication. It is used to verify the user's identity and can be obtained through the login interface
    trade_tokenstringNo-Token authentication is optional, and it must be passed through the relevant interface of order placement, which can be obtained through the transaction password interface

    Public response parameters

    ParameterTypeRequiredDescriptionExample Value
    codestringyesgateway return code, see: code field description40001
    messagestringyesgateway return code description, see: code field descriptionpost param is empty
    datastringNoBusiness return content, see the specific API interface documentation for details-
    timestampstringyestimestamp returned by gateway1525849042762

    Request example

    {
      "tiger_id":"1",
      "charset":"UTF-8",
      "sign_type":"RSA",
      "version":"1.0",
      "timestamp":"2018-09-01 10:00:00",
      "method":"order_no",
      "biz_content":"{\"account\":\"DU575569\"}",
      "Sign": "QwM4MCdffJ5WK59f + dbFvKMn5Qqw2A5GTA8g0XIAp / Fsvb5fbZUwYzxjznx0jO7VO9Npbzd + ywR6VrMz4liblTMPGDvDnPJP0rGUVF + xbj / 3MBr3vFZ25XheyjfHIpP6f + qhNkn9KdFsviohZAWeplkYjV + OyxwMQmpnkP / vll4 ="
    }
    

    Response example

    {
        "code": 0,
        "message": "",
        "timestamp": 1525849042762,
        "data": {
            "orderId": 10000164
        }
    }
    

    Events

    The events API currently supports two methods, one is through the subscription and push interfaces provided in the SDK, and the other is through the http callback address. The http callback address can be added and updated on the developer registration information page. Domain name configuration is supported, but IP and port address configuration is not supported (the developer information page supports filling in ip and port addresses, but does not actually push callback messages. ). The http callback interface can be used to obtain the latest changes in orders, assets and positions, but cannot obtain the latest price changes and deep order data. The subscription interface in the SDK can receive all types of callback messages. If there are no special requirements, it is recommended to use the push interface provided by the SDK first.

    If the HTTP callback result push times out or fails, it will try to push it three times repeatedly. If the three pushes time out or fail, the message will not continue to be pushed, but it will not affect the push of subsequent messages.

    If the format of the domain name is detected to be illegal, or the request cannot be received and processed normally, the domain name may be added to the blacklist, and no further messages will be sent to the domain name address in the future

    The format of the message sent by the event API is:

    {
        "subject":"Asset",
        "data":{
            "type":"asset",
            "usdCash":854879.28,
            "account":"DU575567",
            "timestamp":1528719139003
        }
    }
    
    • Subjects has the following values: OrderStatus (order status change message), Asset (asset change message), Position (position change message), Quote (market price change message), QuoteDepth (deep bid and ask price change news)
    • For the field content correspondes to each message type, you can refer to the subscription part of the document
Last update: