Sign Up Assets {{loginUser.loginName}}
{{showLang}}
  • Exchange
  • Futures
  • Fiat deal
  • Contract competition
  • Bonus Center
  • Rebate
  • Token Ranking
  • Listing Application
  • Strategy Plaza
  • {{showLang}}
  • {{loginUser.loginName}}
  • Sign In
  • Sign Up
Dear ZBG users, you have not opened contract trading account, please open first.
Not now Open
用户API-HTTP接口

HTTPAPI

ZBG provides users with a simple and powerful API, designed to help users quickly and efficiently integrate ZBG trading capabilities into their own applications.If you have any questions, please contact us for technical discussion at QQ group:829230107 , We will provide you the most authoritative answer

CCXT Example: https://github.com/zbgapi/ccxt/

Java Example: https://github.com/zbg-user-api-demo/user_api_demo_java.git

Python Example: https://github.com/zbg-user-api-demo/user_api_demo_py.git

API Domain Name

Domain Name: {{url}}

Instructions

Before using these APIs to obtain two parameters, after the website login, launch the API function to get the Api Id and Api Secret.Using these two parameters to have the transaction orders, withdrawals and other advanced privileges, please keep it confidential. All http interfaces need to be signed, and the signing rules are described later.

1Interface of Market Quotations

Please note that the domain name of the interface of market quotations is different from the front part of the HTTP interface, no signature id required, header signature does not need the parameters of the signature. One IP can only access 1000 times this part of the interface within a minute, please pay attention to the frequency control.

1.1 24H Quotation of All Markets

This data server will be updated every 10 seconds. Please do not acquire the data too frequently.
path:{{url}}/api/data/v1/tickers
Request method:get
Request message

isUseMarketName=true          //Required, choose ‘ true“ to replace marketID with names like BTC_USDT; choose “false”to use marketId

Two formats of return message
When isUseMarketName=fasle

{
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    },
    "datas": [
        [
            99,
            "0.0",
            "0",
            "0",
            "0",
            "0.0",
            "[]",
            "9.396",
            "9.08",
            "21469873.428"
        ],
        [
            90,
            "8249994.968",
            "8257720.9458",
            "8207608.58",
            "1080294.9779",
            "0.51",
            "[[1, 8219706.597], [2, 8249994.998]]",
            "7418805.42381067",
            "7418805.425",
            "21469873.428"
        ]
    ]
}

When isUseMarketName=true

{
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    },
    "datas": {
        "ETC_USDT": [
            99,
            "0.0",
            "0",
            "0",
            "0",
            "0.0",
            "[]",
            "9.296",
            "9.708",
            "21469873.428"
        ],
        "BTC_KRW": [
            90,
            "8245004.195",
            "8257720.93",
            "8207608.57",
            "1187226.0187",
            "0.45",
            "[[1, 8219706.597], [2, 8245004.125]]",
            "7418805.413",
            "7418805.47",
            "21469873.408"
        ]
    }
}

Data explanation

[Market ID, latest transaction price, highest price, lowest price, 24h volume, 24h change, list of closing prices in last 6H, top buying price, top selling price, 24h volume (in unit of the buyer's currency)]

List of closing prices in last 6h in chronological order, data explanation:

[[serial number, closing price], [serial number, closing price], [serial number, closing price]]

1.2 24H Quotation of Single Market

This data server will be updated every 10 seconds. Please do not acquire the data too frequently.
path:{{url}}/api/data/v1/ticker
Request method:get
Request message


marketName=ZT_USDT          //Market name

Return message

{
    "datas": [
        99,
        "826.4023",
        "826.4023",
        "820.5862",
        "172.1401",
        "0.73",
        "[[1, 821.597], [2, 826.7998], [3, 826.4023]]",
        "741.4126",
        "741.4237",
        "2143.408"
    ],
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    }
}

Data explanation

[Market ID, latest transaction price, highest price, lowest price, 24h volume, 24h change, list of closing prices in last 6H, top buying price, top selling price, 24h volume (in unit of the buyer's currency)]

List of closing prices in last 6h in chronological order, data explanation:

[[serial number, closing price], [serial number, closing price], [serial number, closing price]]

1.3 Public - historical transaction records

Return the latest 80 transaction records
path:{{url}}/exchange/api/v1/common/trade-history
Request method:get
Request message


            symbol=ZT_USDT          //Market name
            trade-id=T6609287826112524288          //Trade ID

Return message

{
    "datas": [
            {
                "trade-id": "T6609287828167733248",//Trade ID
                "date": "2019-12-08 11:50:12",//created-time yyyy-MM-dd HH:mm:ss
                "side": "buy",//Type of sale, buy/sell
                "amount": "3500.2956",//Quantity
                "total": "133.36126236",//Total Amount
                "price": "0.0381",//Commission Order Price
                "created-at": "1575777012865",//Initiate timestamp, milliseconds
            },
            {
                "trade-id": "T6609287826112524288",//Trade ID
                "date": "2019-12-08 11:50:12",//created-time yyyy-MM-dd HH:mm:ss
                "side": "buy",//Type of sale, buy/sell
                "amount": "3500.2956",//Quantity
                "total": "133.36126236",//Total Amount
                "price": "0.0381",//Commission Order Price
                "created-at": "1575777012375",//Initiate timestamp, milliseconds
            }
    ],
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    }
}

1.4 K-Line

path:{{url}}/api/data/v1/klines
Request method:get
Request message


marketName=ZT_USDT             //Market name
type=1M                         //K line type, support 1M,5M,15M,30M,1H,1D,1W, which stand for 1-30m,1h,1day,1week
dataSize=5                      //data size, maximum 1000

Return message

{
    "datas": [
        [
            "K",
            "90",
            "etc_usdt",
            "1532181600",
            "826.7",
            "827.68",
            "826.68",
            "826.07",
            "492261",
            "0.04",
            "6.8",
            "1H",
            "false"
            "407073731.01"
        ],
        ..........
    ],
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    }
}

Data explanation

[data type, market id, market name, time stamp, opening data, highest price, lowest price, closing price, volume, change, US dollar exchange rate, k-line cycle, whether is converted, volume (in unit of the buyer's currency)]

1.5 Trading History

path:{{url}}/api/data/v1/trades
Request method:get
Request message


marketName=ZT_USDT             //Market name
dataSize=10                     //data size, maximum 1000

Return message

{
    "datas": [
        [
            "T",
            "90",
            "1532183063",
            "ETC_USDT",
            "bid",
            "827.90",
            "515.50"
        ],
        ..........
    ],
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    }
}

Data explanation

[Data type, market ID, time stamp, market name,type (asks or bids), price, amount]

1.6 Market Data (Market Depth)

A maximum of 50 data of selling and buying can be returned
path:{{url}}/api/data/v1/entrusts
Request method:get
Request message


marketName=ZT_USDT             //Market name
dataSize=5                      //Number of gear, Means 5 levels of buying and selling, the maximum is 50

Return message

{
    "datas": {
        "asks": [
            [
                "824.898",
                "5.95"
            ],
            [
                "741.435",
                "4.88"
            ],
            [
                "741.47",
                "0.01"
            ]
        ],
        "bids": [
            [
                "294",
                "24.32"
            ],
            [
                "247",
                "2.064"
            ],
            [
                "216",
                "17.043"
            ]
        ],
        "timestamp": "1532183394"
    },
    "resMsg": {
        "code": "1",
        "method": null,
        "message": "success !"
    }
}

Data explanation

asks: [[price, amount]]
bids: [[price, amount]]