• BTC/USDT : $ 11450
  • ETH/USDT : $ 1032
  • LTC/USDT : $ 190.17
  • QTUM/USDT : $ 37.99
    Theme:
  • Dark
  • Light

API 2.0

1.API Demos


2. Trading Pairs API

Return all the trading pairs supported by gate.io

URL: http://data.gate.io/api2/1/pairs

Return data example:

	[
		"eth_btc","etc_btc","etc_eth","zec_btc","dash_btc","ltc_btc","bcc_btc",
		"qtum_btc","qtum_eth","xrp_btc","zrx_btc","zrx_eth","dnt_eth","dpy_eth",
		"oax_eth","lrc_eth","lrc_btc","pst_eth","tnt_eth","snt_eth","snt_btc",
		"omg_eth","omg_btc","pay_eth","pay_btc","bat_eth","cvc_eth","storj_eth",
		"storj_btc","eos_eth","eos_btc".
	]
				


3. Market Info API

Returns all markets' fee, minimum order total amount, price decimal places.

URL: http://data.gate.io/api2/1/marketinfo

Return data example:

    {
        "result": "true",
        "pairs": [
                      {
                            "eth_btc": {
                                "decimal_places": 6,
                                "min_amount": 0.0001,
                                "fee": 0.2
                            }
                      },
                      {
                            "etc_btc": {
                                "decimal_places": 6,
                                "min_amount": 0.0001,
                                "fee": 0.2
                            }
                      }
            ]
    }
				


4. Market Details API

Returns market details including pair, coin name, coin symbol, last price, trading volume, coin supply, coin market cap, price trend, etc.

URL: http://data.gate.io/api2/1/marketlist

Return data example:

    {
        "result": "true",
        "data": [
                {
                    "no": 1,
                    "symbol": "LTC",
                    "name": "Litecoin",
                    "name_en": "Litecoin",
                    "name_cn": "莱特币",
                    "pair": "ltc_btc",
                    "rate": "418.00",
                    "vol_a": 168120.2,
                    "vol_b": "65,616,561",
                    "curr_a": "LTC",
                    "curr_b": "BTC",
                    "curr_suffix": " BTC",
                    "rate_percent": "19.73",
                    "trend": "up",
                    "supply": 25760300,
                    "marketcap": "10,767,805,404",
                    "plot": null
                },
                {
                    "no": 2,
                    "symbol": "ETH",
                    "name": "ETH",
                    "name_en": "ETH",
                    "name_cn": "以太币",
                    "pair": "etc_eth",
                    "rate": "0.7450",
                    "vol_a": 65227328.3,
                    "vol_b": "51,041,999",
                    "curr_a": "etc",
                    "curr_b": "eth",
                    "curr_suffix": " eth",
                    "rate_percent": "-1.84",
                    "trend": "up",
                    "supply": 1050000000,
                    "marketcap": "782,250,000",
                    "plot": null
                }
            ]
    }
				


5. Tickers API

returns the tickers for all the supported trading pairs at once, cached in 10 seconds::

URL: http://data.gate.io/api2/1/tickers

Return data example:

    {
          "eth_btc": {
                "result": "true",
                "last": 0.1,
                "lowestAsk": 0.1,
                "highestBid": "0.00000000",
                "percentChange": 0,
                "baseVolume": 0.001,
                "quoteVolume": 0.01,
                "high24hr": 0.1,
                "low24hr": 0.1
            },
        "xrp_btc": {
                "result": "true",
                "last": "0.00004720",
                "lowestAsk": "0.00005620",
                "highestBid": "0.00004550",
                "percentChange": -7.4510907045863,
                "baseVolume": 0.5324,
                "quoteVolume": 11417.333,
                "high24hr": "0.00005580",
                "low24hr": "0.00004560"
            }
        }

				


6. Ticker API

returns the current ticker for the selected currency, cached in 10 seconds:

URL: http://data.gate.io/api2/1/ticker/[CURR_A]_[CURR_B]

Replace [CURR_A] and [CURR_B] with the selected currencies.

Links:

http://data.gate.io/api2/1/ticker/btc_usdt
http://data.gate.io/api2/1/ticker/bch_usdt
http://data.gate.io/api2/1/ticker/eth_usdt
http://data.gate.io/api2/1/ticker/etc_usdt
http://data.gate.io/api2/1/ticker/qtum_usdt
http://data.gate.io/api2/1/ticker/ltc_usdt
http://data.gate.io/api2/1/ticker/dash_usdt
http://data.gate.io/api2/1/ticker/zec_usdt
http://data.gate.io/api2/1/ticker/btm_usdt
http://data.gate.io/api2/1/ticker/eos_usdt
http://data.gate.io/api2/1/ticker/req_usdt
http://data.gate.io/api2/1/ticker/snt_usdt
http://data.gate.io/api2/1/ticker/omg_usdt
http://data.gate.io/api2/1/ticker/pay_usdt
http://data.gate.io/api2/1/ticker/cvc_usdt
http://data.gate.io/api2/1/ticker/zrx_usdt
http://data.gate.io/api2/1/ticker/tnt_usdt
http://data.gate.io/api2/1/ticker/xmr_usdt
http://data.gate.io/api2/1/ticker/xrp_usdt
http://data.gate.io/api2/1/ticker/doge_usdt
http://data.gate.io/api2/1/ticker/bat_usdt
http://data.gate.io/api2/1/ticker/llt_usdt
http://data.gate.io/api2/1/ticker/pst_usdt
http://data.gate.io/api2/1/ticker/btg_usdt
http://data.gate.io/api2/1/ticker/dpy_usdt
http://data.gate.io/api2/1/ticker/lrc_usdt
http://data.gate.io/api2/1/ticker/storj_usdt
http://data.gate.io/api2/1/ticker/rdn_usdt
http://data.gate.io/api2/1/ticker/stx_usdt
http://data.gate.io/api2/1/ticker/knc_usdt
http://data.gate.io/api2/1/ticker/link_usdt
http://data.gate.io/api2/1/ticker/cdt_usdt
http://data.gate.io/api2/1/ticker/ae_usdt
http://data.gate.io/api2/1/ticker/ae_eth
http://data.gate.io/api2/1/ticker/cdt_eth
http://data.gate.io/api2/1/ticker/rdn_eth
http://data.gate.io/api2/1/ticker/stx_eth
http://data.gate.io/api2/1/ticker/knc_eth
http://data.gate.io/api2/1/ticker/link_eth
http://data.gate.io/api2/1/ticker/req_eth
http://data.gate.io/api2/1/ticker/rcn_eth
http://data.gate.io/api2/1/ticker/trx_eth
http://data.gate.io/api2/1/ticker/arn_eth
http://data.gate.io/api2/1/ticker/kick_eth
http://data.gate.io/api2/1/ticker/bnt_eth
http://data.gate.io/api2/1/ticker/ven_eth
http://data.gate.io/api2/1/ticker/mco_eth
http://data.gate.io/api2/1/ticker/fun_eth
http://data.gate.io/api2/1/ticker/data_eth
http://data.gate.io/api2/1/ticker/rlc_eth
http://data.gate.io/api2/1/ticker/zsc_eth
http://data.gate.io/api2/1/ticker/wings_eth
http://data.gate.io/api2/1/ticker/ctr_eth
http://data.gate.io/api2/1/ticker/mda_eth
http://data.gate.io/api2/1/ticker/rcn_usdt
http://data.gate.io/api2/1/ticker/trx_usdt
http://data.gate.io/api2/1/ticker/kick_usdt
http://data.gate.io/api2/1/ticker/ven_usdt
http://data.gate.io/api2/1/ticker/mco_usdt
http://data.gate.io/api2/1/ticker/fun_usdt
http://data.gate.io/api2/1/ticker/data_usdt
http://data.gate.io/api2/1/ticker/zsc_usdt
http://data.gate.io/api2/1/ticker/ctr_usdt
http://data.gate.io/api2/1/ticker/mda_usdt
http://data.gate.io/api2/1/ticker/xtz_usdt
http://data.gate.io/api2/1/ticker/gnt_usdt
http://data.gate.io/api2/1/ticker/gnt_eth
http://data.gate.io/api2/1/ticker/ost_usdt
http://data.gate.io/api2/1/ticker/ost_eth
http://data.gate.io/api2/1/ticker/tio_usdt
http://data.gate.io/api2/1/ticker/tio_eth
http://data.gate.io/api2/1/ticker/bto_usdt
http://data.gate.io/api2/1/ticker/bto_eth
http://data.gate.io/api2/1/ticker/theta_usdt
http://data.gate.io/api2/1/ticker/theta_eth
http://data.gate.io/api2/1/ticker/ddd_eth
http://data.gate.io/api2/1/ticker/mkr_usdt
http://data.gate.io/api2/1/ticker/mkr_eth
http://data.gate.io/api2/1/ticker/dai_usdt
http://data.gate.io/api2/1/ticker/smt_usdt
http://data.gate.io/api2/1/ticker/smt_eth
http://data.gate.io/api2/1/ticker/mdt_usdt
http://data.gate.io/api2/1/ticker/mdt_eth
http://data.gate.io/api2/1/ticker/mdt_btc
http://data.gate.io/api2/1/ticker/mana_usdt
http://data.gate.io/api2/1/ticker/mana_eth
http://data.gate.io/api2/1/ticker/lun_usdt
http://data.gate.io/api2/1/ticker/lun_eth
http://data.gate.io/api2/1/ticker/salt_usdt
http://data.gate.io/api2/1/ticker/salt_eth
http://data.gate.io/api2/1/ticker/fuel_usdt
http://data.gate.io/api2/1/ticker/fuel_eth
http://data.gate.io/api2/1/ticker/elf_usdt
http://data.gate.io/api2/1/ticker/elf_eth
http://data.gate.io/api2/1/ticker/drgn_usdt
http://data.gate.io/api2/1/ticker/drgn_eth
http://data.gate.io/api2/1/ticker/gtc_usdt
http://data.gate.io/api2/1/ticker/gtc_eth
http://data.gate.io/api2/1/ticker/gtc_btc
http://data.gate.io/api2/1/ticker/qlc_usdt
http://data.gate.io/api2/1/ticker/qlc_btc
http://data.gate.io/api2/1/ticker/qlc_eth
http://data.gate.io/api2/1/ticker/dbc_usdt
http://data.gate.io/api2/1/ticker/dbc_btc
http://data.gate.io/api2/1/ticker/dbc_eth
http://data.gate.io/api2/1/ticker/bnty_usdt
http://data.gate.io/api2/1/ticker/bnty_eth
http://data.gate.io/api2/1/ticker/lend_usdt
http://data.gate.io/api2/1/ticker/lend_eth
http://data.gate.io/api2/1/ticker/icx_usdt
http://data.gate.io/api2/1/ticker/icx_eth
http://data.gate.io/api2/1/ticker/btf_usdt
http://data.gate.io/api2/1/ticker/btf_btc
http://data.gate.io/api2/1/ticker/ada_usdt
http://data.gate.io/api2/1/ticker/ada_btc
http://data.gate.io/api2/1/ticker/lsk_usdt
http://data.gate.io/api2/1/ticker/lsk_btc
http://data.gate.io/api2/1/ticker/waves_usdt
http://data.gate.io/api2/1/ticker/waves_btc
http://data.gate.io/api2/1/ticker/bifi_usdt
http://data.gate.io/api2/1/ticker/bifi_btc
http://data.gate.io/api2/1/ticker/mds_eth
http://data.gate.io/api2/1/ticker/mds_usdt
http://data.gate.io/api2/1/ticker/dgd_usdt
http://data.gate.io/api2/1/ticker/dgd_eth
http://data.gate.io/api2/1/ticker/qash_usdt
http://data.gate.io/api2/1/ticker/qash_eth
http://data.gate.io/api2/1/ticker/qash_btc
http://data.gate.io/api2/1/ticker/powr_usdt
http://data.gate.io/api2/1/ticker/powr_eth
http://data.gate.io/api2/1/ticker/powr_btc
http://data.gate.io/api2/1/ticker/fil_usdt
http://data.gate.io/api2/1/ticker/bcd_usdt
http://data.gate.io/api2/1/ticker/bcd_btc
http://data.gate.io/api2/1/ticker/sbtc_usdt
http://data.gate.io/api2/1/ticker/sbtc_btc
http://data.gate.io/api2/1/ticker/god_usdt
http://data.gate.io/api2/1/ticker/god_btc
http://data.gate.io/api2/1/ticker/bcx_usdt
http://data.gate.io/api2/1/ticker/bcx_btc
http://data.gate.io/api2/1/ticker/hsr_usdt
http://data.gate.io/api2/1/ticker/hsr_btc
http://data.gate.io/api2/1/ticker/hsr_eth
http://data.gate.io/api2/1/ticker/qsp_usdt
http://data.gate.io/api2/1/ticker/qsp_eth
http://data.gate.io/api2/1/ticker/ink_btc
http://data.gate.io/api2/1/ticker/ink_usdt
http://data.gate.io/api2/1/ticker/ink_eth
http://data.gate.io/api2/1/ticker/ink_qtum
http://data.gate.io/api2/1/ticker/med_qtum
http://data.gate.io/api2/1/ticker/med_eth
http://data.gate.io/api2/1/ticker/med_usdt
http://data.gate.io/api2/1/ticker/bot_qtum
http://data.gate.io/api2/1/ticker/bot_usdt
http://data.gate.io/api2/1/ticker/bot_eth
http://data.gate.io/api2/1/ticker/qbt_qtum
http://data.gate.io/api2/1/ticker/qbt_eth
http://data.gate.io/api2/1/ticker/qbt_usdt
http://data.gate.io/api2/1/ticker/tsl_qtum
http://data.gate.io/api2/1/ticker/tsl_usdt
http://data.gate.io/api2/1/ticker/gnx_usdt
http://data.gate.io/api2/1/ticker/gnx_eth
http://data.gate.io/api2/1/ticker/neo_usdt
http://data.gate.io/api2/1/ticker/gas_usdt
http://data.gate.io/api2/1/ticker/neo_btc
http://data.gate.io/api2/1/ticker/gas_btc
http://data.gate.io/api2/1/ticker/iota_usdt
http://data.gate.io/api2/1/ticker/iota_btc
http://data.gate.io/api2/1/ticker/nas_usdt
http://data.gate.io/api2/1/ticker/nas_eth
http://data.gate.io/api2/1/ticker/nas_btc
http://data.gate.io/api2/1/ticker/eth_btc
http://data.gate.io/api2/1/ticker/etc_btc
http://data.gate.io/api2/1/ticker/etc_eth
http://data.gate.io/api2/1/ticker/zec_btc
http://data.gate.io/api2/1/ticker/dash_btc
http://data.gate.io/api2/1/ticker/ltc_btc
http://data.gate.io/api2/1/ticker/bch_btc
http://data.gate.io/api2/1/ticker/btg_btc
http://data.gate.io/api2/1/ticker/qtum_btc
http://data.gate.io/api2/1/ticker/qtum_eth
http://data.gate.io/api2/1/ticker/xrp_btc
http://data.gate.io/api2/1/ticker/doge_btc
http://data.gate.io/api2/1/ticker/xmr_btc
http://data.gate.io/api2/1/ticker/zrx_btc
http://data.gate.io/api2/1/ticker/zrx_eth
http://data.gate.io/api2/1/ticker/dnt_eth
http://data.gate.io/api2/1/ticker/dpy_eth
http://data.gate.io/api2/1/ticker/oax_eth
http://data.gate.io/api2/1/ticker/rep_eth
http://data.gate.io/api2/1/ticker/lrc_eth
http://data.gate.io/api2/1/ticker/lrc_btc
http://data.gate.io/api2/1/ticker/pst_eth
http://data.gate.io/api2/1/ticker/bcdn_eth
http://data.gate.io/api2/1/ticker/bcdn_usdt
http://data.gate.io/api2/1/ticker/tnt_eth
http://data.gate.io/api2/1/ticker/snt_eth
http://data.gate.io/api2/1/ticker/snt_btc
http://data.gate.io/api2/1/ticker/btm_eth
http://data.gate.io/api2/1/ticker/btm_btc
http://data.gate.io/api2/1/ticker/llt_eth
http://data.gate.io/api2/1/ticker/omg_eth
http://data.gate.io/api2/1/ticker/omg_btc
http://data.gate.io/api2/1/ticker/pay_eth
http://data.gate.io/api2/1/ticker/pay_btc
http://data.gate.io/api2/1/ticker/bat_eth
http://data.gate.io/api2/1/ticker/bat_btc
http://data.gate.io/api2/1/ticker/cvc_eth
http://data.gate.io/api2/1/ticker/storj_eth
http://data.gate.io/api2/1/ticker/storj_btc
http://data.gate.io/api2/1/ticker/eos_eth
http://data.gate.io/api2/1/ticker/eos_btc
http://data.gate.io/api2/1/ticker/bts_usdt
http://data.gate.io/api2/1/ticker/bts_btc

Return data example:

	  {
		"result": "true",
		"last": 0.1,
		"lowestAsk": 0.1,
		"highestBid": "0.00000000",
		"percentChange": 0,
		"baseVolume": 0.001,
		"quoteVolume": 0.01,
		"high24hr": 0.1,
		"low24hr": 0.1
	  }

				


7. Depth API

Return the market depth including ask and bid orders.

URL: http://data.gate.io/api2/1/orderBook/[CURR_A]_[CURR_B]

Replace [CURR_A] and [CURR_B] with the selected currencies.

Links:

http://data.gate.io/api2/1/orderBook/btc_usdt
http://data.gate.io/api2/1/orderBook/bch_usdt
http://data.gate.io/api2/1/orderBook/eth_usdt
http://data.gate.io/api2/1/orderBook/etc_usdt
http://data.gate.io/api2/1/orderBook/qtum_usdt
http://data.gate.io/api2/1/orderBook/ltc_usdt
http://data.gate.io/api2/1/orderBook/dash_usdt
http://data.gate.io/api2/1/orderBook/zec_usdt
http://data.gate.io/api2/1/orderBook/btm_usdt
http://data.gate.io/api2/1/orderBook/eos_usdt
http://data.gate.io/api2/1/orderBook/req_usdt
http://data.gate.io/api2/1/orderBook/snt_usdt
http://data.gate.io/api2/1/orderBook/omg_usdt
http://data.gate.io/api2/1/orderBook/pay_usdt
http://data.gate.io/api2/1/orderBook/cvc_usdt
http://data.gate.io/api2/1/orderBook/zrx_usdt
http://data.gate.io/api2/1/orderBook/tnt_usdt
http://data.gate.io/api2/1/orderBook/xmr_usdt
http://data.gate.io/api2/1/orderBook/xrp_usdt
http://data.gate.io/api2/1/orderBook/doge_usdt
http://data.gate.io/api2/1/orderBook/bat_usdt
http://data.gate.io/api2/1/orderBook/llt_usdt
http://data.gate.io/api2/1/orderBook/pst_usdt
http://data.gate.io/api2/1/orderBook/btg_usdt
http://data.gate.io/api2/1/orderBook/dpy_usdt
http://data.gate.io/api2/1/orderBook/lrc_usdt
http://data.gate.io/api2/1/orderBook/storj_usdt
http://data.gate.io/api2/1/orderBook/rdn_usdt
http://data.gate.io/api2/1/orderBook/stx_usdt
http://data.gate.io/api2/1/orderBook/knc_usdt
http://data.gate.io/api2/1/orderBook/link_usdt
http://data.gate.io/api2/1/orderBook/cdt_usdt
http://data.gate.io/api2/1/orderBook/ae_usdt
http://data.gate.io/api2/1/orderBook/ae_eth
http://data.gate.io/api2/1/orderBook/cdt_eth
http://data.gate.io/api2/1/orderBook/rdn_eth
http://data.gate.io/api2/1/orderBook/stx_eth
http://data.gate.io/api2/1/orderBook/knc_eth
http://data.gate.io/api2/1/orderBook/link_eth
http://data.gate.io/api2/1/orderBook/req_eth
http://data.gate.io/api2/1/orderBook/rcn_eth
http://data.gate.io/api2/1/orderBook/trx_eth
http://data.gate.io/api2/1/orderBook/arn_eth
http://data.gate.io/api2/1/orderBook/kick_eth
http://data.gate.io/api2/1/orderBook/bnt_eth
http://data.gate.io/api2/1/orderBook/ven_eth
http://data.gate.io/api2/1/orderBook/mco_eth
http://data.gate.io/api2/1/orderBook/fun_eth
http://data.gate.io/api2/1/orderBook/data_eth
http://data.gate.io/api2/1/orderBook/rlc_eth
http://data.gate.io/api2/1/orderBook/zsc_eth
http://data.gate.io/api2/1/orderBook/wings_eth
http://data.gate.io/api2/1/orderBook/ctr_eth
http://data.gate.io/api2/1/orderBook/mda_eth
http://data.gate.io/api2/1/orderBook/rcn_usdt
http://data.gate.io/api2/1/orderBook/trx_usdt
http://data.gate.io/api2/1/orderBook/kick_usdt
http://data.gate.io/api2/1/orderBook/ven_usdt
http://data.gate.io/api2/1/orderBook/mco_usdt
http://data.gate.io/api2/1/orderBook/fun_usdt
http://data.gate.io/api2/1/orderBook/data_usdt
http://data.gate.io/api2/1/orderBook/zsc_usdt
http://data.gate.io/api2/1/orderBook/ctr_usdt
http://data.gate.io/api2/1/orderBook/mda_usdt
http://data.gate.io/api2/1/orderBook/xtz_usdt
http://data.gate.io/api2/1/orderBook/gnt_usdt
http://data.gate.io/api2/1/orderBook/gnt_eth
http://data.gate.io/api2/1/orderBook/ost_usdt
http://data.gate.io/api2/1/orderBook/ost_eth
http://data.gate.io/api2/1/orderBook/tio_usdt
http://data.gate.io/api2/1/orderBook/tio_eth
http://data.gate.io/api2/1/orderBook/bto_usdt
http://data.gate.io/api2/1/orderBook/bto_eth
http://data.gate.io/api2/1/orderBook/theta_usdt
http://data.gate.io/api2/1/orderBook/theta_eth
http://data.gate.io/api2/1/orderBook/ddd_eth
http://data.gate.io/api2/1/orderBook/mkr_usdt
http://data.gate.io/api2/1/orderBook/mkr_eth
http://data.gate.io/api2/1/orderBook/dai_usdt
http://data.gate.io/api2/1/orderBook/smt_usdt
http://data.gate.io/api2/1/orderBook/smt_eth
http://data.gate.io/api2/1/orderBook/mdt_usdt
http://data.gate.io/api2/1/orderBook/mdt_eth
http://data.gate.io/api2/1/orderBook/mdt_btc
http://data.gate.io/api2/1/orderBook/mana_usdt
http://data.gate.io/api2/1/orderBook/mana_eth
http://data.gate.io/api2/1/orderBook/lun_usdt
http://data.gate.io/api2/1/orderBook/lun_eth
http://data.gate.io/api2/1/orderBook/salt_usdt
http://data.gate.io/api2/1/orderBook/salt_eth
http://data.gate.io/api2/1/orderBook/fuel_usdt
http://data.gate.io/api2/1/orderBook/fuel_eth
http://data.gate.io/api2/1/orderBook/elf_usdt
http://data.gate.io/api2/1/orderBook/elf_eth
http://data.gate.io/api2/1/orderBook/drgn_usdt
http://data.gate.io/api2/1/orderBook/drgn_eth
http://data.gate.io/api2/1/orderBook/gtc_usdt
http://data.gate.io/api2/1/orderBook/gtc_eth
http://data.gate.io/api2/1/orderBook/gtc_btc
http://data.gate.io/api2/1/orderBook/qlc_usdt
http://data.gate.io/api2/1/orderBook/qlc_btc
http://data.gate.io/api2/1/orderBook/qlc_eth
http://data.gate.io/api2/1/orderBook/dbc_usdt
http://data.gate.io/api2/1/orderBook/dbc_btc
http://data.gate.io/api2/1/orderBook/dbc_eth
http://data.gate.io/api2/1/orderBook/bnty_usdt
http://data.gate.io/api2/1/orderBook/bnty_eth
http://data.gate.io/api2/1/orderBook/lend_usdt
http://data.gate.io/api2/1/orderBook/lend_eth
http://data.gate.io/api2/1/orderBook/icx_usdt
http://data.gate.io/api2/1/orderBook/icx_eth
http://data.gate.io/api2/1/orderBook/btf_usdt
http://data.gate.io/api2/1/orderBook/btf_btc
http://data.gate.io/api2/1/orderBook/ada_usdt
http://data.gate.io/api2/1/orderBook/ada_btc
http://data.gate.io/api2/1/orderBook/lsk_usdt
http://data.gate.io/api2/1/orderBook/lsk_btc
http://data.gate.io/api2/1/orderBook/waves_usdt
http://data.gate.io/api2/1/orderBook/waves_btc
http://data.gate.io/api2/1/orderBook/bifi_usdt
http://data.gate.io/api2/1/orderBook/bifi_btc
http://data.gate.io/api2/1/orderBook/mds_eth
http://data.gate.io/api2/1/orderBook/mds_usdt
http://data.gate.io/api2/1/orderBook/dgd_usdt
http://data.gate.io/api2/1/orderBook/dgd_eth
http://data.gate.io/api2/1/orderBook/qash_usdt
http://data.gate.io/api2/1/orderBook/qash_eth
http://data.gate.io/api2/1/orderBook/qash_btc
http://data.gate.io/api2/1/orderBook/powr_usdt
http://data.gate.io/api2/1/orderBook/powr_eth
http://data.gate.io/api2/1/orderBook/powr_btc
http://data.gate.io/api2/1/orderBook/fil_usdt
http://data.gate.io/api2/1/orderBook/bcd_usdt
http://data.gate.io/api2/1/orderBook/bcd_btc
http://data.gate.io/api2/1/orderBook/sbtc_usdt
http://data.gate.io/api2/1/orderBook/sbtc_btc
http://data.gate.io/api2/1/orderBook/god_usdt
http://data.gate.io/api2/1/orderBook/god_btc
http://data.gate.io/api2/1/orderBook/bcx_usdt
http://data.gate.io/api2/1/orderBook/bcx_btc
http://data.gate.io/api2/1/orderBook/hsr_usdt
http://data.gate.io/api2/1/orderBook/hsr_btc
http://data.gate.io/api2/1/orderBook/hsr_eth
http://data.gate.io/api2/1/orderBook/qsp_usdt
http://data.gate.io/api2/1/orderBook/qsp_eth
http://data.gate.io/api2/1/orderBook/ink_btc
http://data.gate.io/api2/1/orderBook/ink_usdt
http://data.gate.io/api2/1/orderBook/ink_eth
http://data.gate.io/api2/1/orderBook/ink_qtum
http://data.gate.io/api2/1/orderBook/med_qtum
http://data.gate.io/api2/1/orderBook/med_eth
http://data.gate.io/api2/1/orderBook/med_usdt
http://data.gate.io/api2/1/orderBook/bot_qtum
http://data.gate.io/api2/1/orderBook/bot_usdt
http://data.gate.io/api2/1/orderBook/bot_eth
http://data.gate.io/api2/1/orderBook/qbt_qtum
http://data.gate.io/api2/1/orderBook/qbt_eth
http://data.gate.io/api2/1/orderBook/qbt_usdt
http://data.gate.io/api2/1/orderBook/tsl_qtum
http://data.gate.io/api2/1/orderBook/tsl_usdt
http://data.gate.io/api2/1/orderBook/gnx_usdt
http://data.gate.io/api2/1/orderBook/gnx_eth
http://data.gate.io/api2/1/orderBook/neo_usdt
http://data.gate.io/api2/1/orderBook/gas_usdt
http://data.gate.io/api2/1/orderBook/neo_btc
http://data.gate.io/api2/1/orderBook/gas_btc
http://data.gate.io/api2/1/orderBook/iota_usdt
http://data.gate.io/api2/1/orderBook/iota_btc
http://data.gate.io/api2/1/orderBook/nas_usdt
http://data.gate.io/api2/1/orderBook/nas_eth
http://data.gate.io/api2/1/orderBook/nas_btc
http://data.gate.io/api2/1/orderBook/eth_btc
http://data.gate.io/api2/1/orderBook/etc_btc
http://data.gate.io/api2/1/orderBook/etc_eth
http://data.gate.io/api2/1/orderBook/zec_btc
http://data.gate.io/api2/1/orderBook/dash_btc
http://data.gate.io/api2/1/orderBook/ltc_btc
http://data.gate.io/api2/1/orderBook/bch_btc
http://data.gate.io/api2/1/orderBook/btg_btc
http://data.gate.io/api2/1/orderBook/qtum_btc
http://data.gate.io/api2/1/orderBook/qtum_eth
http://data.gate.io/api2/1/orderBook/xrp_btc
http://data.gate.io/api2/1/orderBook/doge_btc
http://data.gate.io/api2/1/orderBook/xmr_btc
http://data.gate.io/api2/1/orderBook/zrx_btc
http://data.gate.io/api2/1/orderBook/zrx_eth
http://data.gate.io/api2/1/orderBook/dnt_eth
http://data.gate.io/api2/1/orderBook/dpy_eth
http://data.gate.io/api2/1/orderBook/oax_eth
http://data.gate.io/api2/1/orderBook/rep_eth
http://data.gate.io/api2/1/orderBook/lrc_eth
http://data.gate.io/api2/1/orderBook/lrc_btc
http://data.gate.io/api2/1/orderBook/pst_eth
http://data.gate.io/api2/1/orderBook/bcdn_eth
http://data.gate.io/api2/1/orderBook/bcdn_usdt
http://data.gate.io/api2/1/orderBook/tnt_eth
http://data.gate.io/api2/1/orderBook/snt_eth
http://data.gate.io/api2/1/orderBook/snt_btc
http://data.gate.io/api2/1/orderBook/btm_eth
http://data.gate.io/api2/1/orderBook/btm_btc
http://data.gate.io/api2/1/orderBook/llt_eth
http://data.gate.io/api2/1/orderBook/omg_eth
http://data.gate.io/api2/1/orderBook/omg_btc
http://data.gate.io/api2/1/orderBook/pay_eth
http://data.gate.io/api2/1/orderBook/pay_btc
http://data.gate.io/api2/1/orderBook/bat_eth
http://data.gate.io/api2/1/orderBook/bat_btc
http://data.gate.io/api2/1/orderBook/cvc_eth
http://data.gate.io/api2/1/orderBook/storj_eth
http://data.gate.io/api2/1/orderBook/storj_btc
http://data.gate.io/api2/1/orderBook/eos_eth
http://data.gate.io/api2/1/orderBook/eos_btc
http://data.gate.io/api2/1/orderBook/bts_usdt
http://data.gate.io/api2/1/orderBook/bts_btc

Return data example:

  {
	"result": "true",
        "asks": [
                [29500,    4.07172355],
                [29499,    0.00203397],
                [29495,    1],
                [29488,    0.0672],
                [29475,    0.001]
            ],
        "bids": [
                [28001, 0.0477],
                [28000, 0.35714018],
                [28000, 2.56222976],
                [27800, 0.0015],
                [27777, 0.1]
            ]
  }

				


8. Trade History API

Return the most recent 80 trade history records:

URL: http://data.gate.io/api2/1/trade/[CURR_A]_[CURR_B]

Return at most 1,000 trade history records after [TID]:

URL: http://data.gate.io/api2/1/tradeHistory/[CURR_A]_[CURR_B]/[TID]

Replace [CURR_A] and [CURR_B] with the selected currencies.

Links:

http://data.gate.io/api2/1/tradeHistory/btc_usdt
http://data.gate.io/api2/1/tradeHistory/bch_usdt
http://data.gate.io/api2/1/tradeHistory/eth_usdt
http://data.gate.io/api2/1/tradeHistory/etc_usdt
http://data.gate.io/api2/1/tradeHistory/qtum_usdt
http://data.gate.io/api2/1/tradeHistory/ltc_usdt
http://data.gate.io/api2/1/tradeHistory/dash_usdt
http://data.gate.io/api2/1/tradeHistory/zec_usdt
http://data.gate.io/api2/1/tradeHistory/btm_usdt
http://data.gate.io/api2/1/tradeHistory/eos_usdt
http://data.gate.io/api2/1/tradeHistory/req_usdt
http://data.gate.io/api2/1/tradeHistory/snt_usdt
http://data.gate.io/api2/1/tradeHistory/omg_usdt
http://data.gate.io/api2/1/tradeHistory/pay_usdt
http://data.gate.io/api2/1/tradeHistory/cvc_usdt
http://data.gate.io/api2/1/tradeHistory/zrx_usdt
http://data.gate.io/api2/1/tradeHistory/tnt_usdt
http://data.gate.io/api2/1/tradeHistory/xmr_usdt
http://data.gate.io/api2/1/tradeHistory/xrp_usdt
http://data.gate.io/api2/1/tradeHistory/doge_usdt
http://data.gate.io/api2/1/tradeHistory/bat_usdt
http://data.gate.io/api2/1/tradeHistory/llt_usdt
http://data.gate.io/api2/1/tradeHistory/pst_usdt
http://data.gate.io/api2/1/tradeHistory/btg_usdt
http://data.gate.io/api2/1/tradeHistory/dpy_usdt
http://data.gate.io/api2/1/tradeHistory/lrc_usdt
http://data.gate.io/api2/1/tradeHistory/storj_usdt
http://data.gate.io/api2/1/tradeHistory/rdn_usdt
http://data.gate.io/api2/1/tradeHistory/stx_usdt
http://data.gate.io/api2/1/tradeHistory/knc_usdt
http://data.gate.io/api2/1/tradeHistory/link_usdt
http://data.gate.io/api2/1/tradeHistory/cdt_usdt
http://data.gate.io/api2/1/tradeHistory/ae_usdt
http://data.gate.io/api2/1/tradeHistory/ae_eth
http://data.gate.io/api2/1/tradeHistory/cdt_eth
http://data.gate.io/api2/1/tradeHistory/rdn_eth
http://data.gate.io/api2/1/tradeHistory/stx_eth
http://data.gate.io/api2/1/tradeHistory/knc_eth
http://data.gate.io/api2/1/tradeHistory/link_eth
http://data.gate.io/api2/1/tradeHistory/req_eth
http://data.gate.io/api2/1/tradeHistory/rcn_eth
http://data.gate.io/api2/1/tradeHistory/trx_eth
http://data.gate.io/api2/1/tradeHistory/arn_eth
http://data.gate.io/api2/1/tradeHistory/kick_eth
http://data.gate.io/api2/1/tradeHistory/bnt_eth
http://data.gate.io/api2/1/tradeHistory/ven_eth
http://data.gate.io/api2/1/tradeHistory/mco_eth
http://data.gate.io/api2/1/tradeHistory/fun_eth
http://data.gate.io/api2/1/tradeHistory/data_eth
http://data.gate.io/api2/1/tradeHistory/rlc_eth
http://data.gate.io/api2/1/tradeHistory/zsc_eth
http://data.gate.io/api2/1/tradeHistory/wings_eth
http://data.gate.io/api2/1/tradeHistory/ctr_eth
http://data.gate.io/api2/1/tradeHistory/mda_eth
http://data.gate.io/api2/1/tradeHistory/rcn_usdt
http://data.gate.io/api2/1/tradeHistory/trx_usdt
http://data.gate.io/api2/1/tradeHistory/kick_usdt
http://data.gate.io/api2/1/tradeHistory/ven_usdt
http://data.gate.io/api2/1/tradeHistory/mco_usdt
http://data.gate.io/api2/1/tradeHistory/fun_usdt
http://data.gate.io/api2/1/tradeHistory/data_usdt
http://data.gate.io/api2/1/tradeHistory/zsc_usdt
http://data.gate.io/api2/1/tradeHistory/ctr_usdt
http://data.gate.io/api2/1/tradeHistory/mda_usdt
http://data.gate.io/api2/1/tradeHistory/xtz_usdt
http://data.gate.io/api2/1/tradeHistory/gnt_usdt
http://data.gate.io/api2/1/tradeHistory/gnt_eth
http://data.gate.io/api2/1/tradeHistory/ost_usdt
http://data.gate.io/api2/1/tradeHistory/ost_eth
http://data.gate.io/api2/1/tradeHistory/tio_usdt
http://data.gate.io/api2/1/tradeHistory/tio_eth
http://data.gate.io/api2/1/tradeHistory/bto_usdt
http://data.gate.io/api2/1/tradeHistory/bto_eth
http://data.gate.io/api2/1/tradeHistory/theta_usdt
http://data.gate.io/api2/1/tradeHistory/theta_eth
http://data.gate.io/api2/1/tradeHistory/ddd_eth
http://data.gate.io/api2/1/tradeHistory/mkr_usdt
http://data.gate.io/api2/1/tradeHistory/mkr_eth
http://data.gate.io/api2/1/tradeHistory/dai_usdt
http://data.gate.io/api2/1/tradeHistory/smt_usdt
http://data.gate.io/api2/1/tradeHistory/smt_eth
http://data.gate.io/api2/1/tradeHistory/mdt_usdt
http://data.gate.io/api2/1/tradeHistory/mdt_eth
http://data.gate.io/api2/1/tradeHistory/mdt_btc
http://data.gate.io/api2/1/tradeHistory/mana_usdt
http://data.gate.io/api2/1/tradeHistory/mana_eth
http://data.gate.io/api2/1/tradeHistory/lun_usdt
http://data.gate.io/api2/1/tradeHistory/lun_eth
http://data.gate.io/api2/1/tradeHistory/salt_usdt
http://data.gate.io/api2/1/tradeHistory/salt_eth
http://data.gate.io/api2/1/tradeHistory/fuel_usdt
http://data.gate.io/api2/1/tradeHistory/fuel_eth
http://data.gate.io/api2/1/tradeHistory/elf_usdt
http://data.gate.io/api2/1/tradeHistory/elf_eth
http://data.gate.io/api2/1/tradeHistory/drgn_usdt
http://data.gate.io/api2/1/tradeHistory/drgn_eth
http://data.gate.io/api2/1/tradeHistory/gtc_usdt
http://data.gate.io/api2/1/tradeHistory/gtc_eth
http://data.gate.io/api2/1/tradeHistory/gtc_btc
http://data.gate.io/api2/1/tradeHistory/qlc_usdt
http://data.gate.io/api2/1/tradeHistory/qlc_btc
http://data.gate.io/api2/1/tradeHistory/qlc_eth
http://data.gate.io/api2/1/tradeHistory/dbc_usdt
http://data.gate.io/api2/1/tradeHistory/dbc_btc
http://data.gate.io/api2/1/tradeHistory/dbc_eth
http://data.gate.io/api2/1/tradeHistory/bnty_usdt
http://data.gate.io/api2/1/tradeHistory/bnty_eth
http://data.gate.io/api2/1/tradeHistory/lend_usdt
http://data.gate.io/api2/1/tradeHistory/lend_eth
http://data.gate.io/api2/1/tradeHistory/icx_usdt
http://data.gate.io/api2/1/tradeHistory/icx_eth
http://data.gate.io/api2/1/tradeHistory/btf_usdt
http://data.gate.io/api2/1/tradeHistory/btf_btc
http://data.gate.io/api2/1/tradeHistory/ada_usdt
http://data.gate.io/api2/1/tradeHistory/ada_btc
http://data.gate.io/api2/1/tradeHistory/lsk_usdt
http://data.gate.io/api2/1/tradeHistory/lsk_btc
http://data.gate.io/api2/1/tradeHistory/waves_usdt
http://data.gate.io/api2/1/tradeHistory/waves_btc
http://data.gate.io/api2/1/tradeHistory/bifi_usdt
http://data.gate.io/api2/1/tradeHistory/bifi_btc
http://data.gate.io/api2/1/tradeHistory/mds_eth
http://data.gate.io/api2/1/tradeHistory/mds_usdt
http://data.gate.io/api2/1/tradeHistory/dgd_usdt
http://data.gate.io/api2/1/tradeHistory/dgd_eth
http://data.gate.io/api2/1/tradeHistory/qash_usdt
http://data.gate.io/api2/1/tradeHistory/qash_eth
http://data.gate.io/api2/1/tradeHistory/qash_btc
http://data.gate.io/api2/1/tradeHistory/powr_usdt
http://data.gate.io/api2/1/tradeHistory/powr_eth
http://data.gate.io/api2/1/tradeHistory/powr_btc
http://data.gate.io/api2/1/tradeHistory/fil_usdt
http://data.gate.io/api2/1/tradeHistory/bcd_usdt
http://data.gate.io/api2/1/tradeHistory/bcd_btc
http://data.gate.io/api2/1/tradeHistory/sbtc_usdt
http://data.gate.io/api2/1/tradeHistory/sbtc_btc
http://data.gate.io/api2/1/tradeHistory/god_usdt
http://data.gate.io/api2/1/tradeHistory/god_btc
http://data.gate.io/api2/1/tradeHistory/bcx_usdt
http://data.gate.io/api2/1/tradeHistory/bcx_btc
http://data.gate.io/api2/1/tradeHistory/hsr_usdt
http://data.gate.io/api2/1/tradeHistory/hsr_btc
http://data.gate.io/api2/1/tradeHistory/hsr_eth
http://data.gate.io/api2/1/tradeHistory/qsp_usdt
http://data.gate.io/api2/1/tradeHistory/qsp_eth
http://data.gate.io/api2/1/tradeHistory/ink_btc
http://data.gate.io/api2/1/tradeHistory/ink_usdt
http://data.gate.io/api2/1/tradeHistory/ink_eth
http://data.gate.io/api2/1/tradeHistory/ink_qtum
http://data.gate.io/api2/1/tradeHistory/med_qtum
http://data.gate.io/api2/1/tradeHistory/med_eth
http://data.gate.io/api2/1/tradeHistory/med_usdt
http://data.gate.io/api2/1/tradeHistory/bot_qtum
http://data.gate.io/api2/1/tradeHistory/bot_usdt
http://data.gate.io/api2/1/tradeHistory/bot_eth
http://data.gate.io/api2/1/tradeHistory/qbt_qtum
http://data.gate.io/api2/1/tradeHistory/qbt_eth
http://data.gate.io/api2/1/tradeHistory/qbt_usdt
http://data.gate.io/api2/1/tradeHistory/tsl_qtum
http://data.gate.io/api2/1/tradeHistory/tsl_usdt
http://data.gate.io/api2/1/tradeHistory/gnx_usdt
http://data.gate.io/api2/1/tradeHistory/gnx_eth
http://data.gate.io/api2/1/tradeHistory/neo_usdt
http://data.gate.io/api2/1/tradeHistory/gas_usdt
http://data.gate.io/api2/1/tradeHistory/neo_btc
http://data.gate.io/api2/1/tradeHistory/gas_btc
http://data.gate.io/api2/1/tradeHistory/iota_usdt
http://data.gate.io/api2/1/tradeHistory/iota_btc
http://data.gate.io/api2/1/tradeHistory/nas_usdt
http://data.gate.io/api2/1/tradeHistory/nas_eth
http://data.gate.io/api2/1/tradeHistory/nas_btc
http://data.gate.io/api2/1/tradeHistory/eth_btc
http://data.gate.io/api2/1/tradeHistory/etc_btc
http://data.gate.io/api2/1/tradeHistory/etc_eth
http://data.gate.io/api2/1/tradeHistory/zec_btc
http://data.gate.io/api2/1/tradeHistory/dash_btc
http://data.gate.io/api2/1/tradeHistory/ltc_btc
http://data.gate.io/api2/1/tradeHistory/bch_btc
http://data.gate.io/api2/1/tradeHistory/btg_btc
http://data.gate.io/api2/1/tradeHistory/qtum_btc
http://data.gate.io/api2/1/tradeHistory/qtum_eth
http://data.gate.io/api2/1/tradeHistory/xrp_btc
http://data.gate.io/api2/1/tradeHistory/doge_btc
http://data.gate.io/api2/1/tradeHistory/xmr_btc
http://data.gate.io/api2/1/tradeHistory/zrx_btc
http://data.gate.io/api2/1/tradeHistory/zrx_eth
http://data.gate.io/api2/1/tradeHistory/dnt_eth
http://data.gate.io/api2/1/tradeHistory/dpy_eth
http://data.gate.io/api2/1/tradeHistory/oax_eth
http://data.gate.io/api2/1/tradeHistory/rep_eth
http://data.gate.io/api2/1/tradeHistory/lrc_eth
http://data.gate.io/api2/1/tradeHistory/lrc_btc
http://data.gate.io/api2/1/tradeHistory/pst_eth
http://data.gate.io/api2/1/tradeHistory/bcdn_eth
http://data.gate.io/api2/1/tradeHistory/bcdn_usdt
http://data.gate.io/api2/1/tradeHistory/tnt_eth
http://data.gate.io/api2/1/tradeHistory/snt_eth
http://data.gate.io/api2/1/tradeHistory/snt_btc
http://data.gate.io/api2/1/tradeHistory/btm_eth
http://data.gate.io/api2/1/tradeHistory/btm_btc
http://data.gate.io/api2/1/tradeHistory/llt_eth
http://data.gate.io/api2/1/tradeHistory/omg_eth
http://data.gate.io/api2/1/tradeHistory/omg_btc
http://data.gate.io/api2/1/tradeHistory/pay_eth
http://data.gate.io/api2/1/tradeHistory/pay_btc
http://data.gate.io/api2/1/tradeHistory/bat_eth
http://data.gate.io/api2/1/tradeHistory/bat_btc
http://data.gate.io/api2/1/tradeHistory/cvc_eth
http://data.gate.io/api2/1/tradeHistory/storj_eth
http://data.gate.io/api2/1/tradeHistory/storj_btc
http://data.gate.io/api2/1/tradeHistory/eos_eth
http://data.gate.io/api2/1/tradeHistory/eos_btc
http://data.gate.io/api2/1/tradeHistory/bts_usdt
http://data.gate.io/api2/1/tradeHistory/bts_btc

Return data example:

  {
	"result": "true",
        "data": [
            {
                "tradeID": "27734287",
                "date": "2017-09-29 11:52:05",
                "timestamp": "1506657125",
                "type": "buy",
                "rate": 0.1,
                "amount": 0.01,
                "total": 0.001
            }
        ],
        "elapsed": "6.901ms"
  }

				



9. Trade API

The following APIs can be used for auto-trading in a program.
Notice: please set Content-Type to application/x-www-form-urlencoded in your HTTP request header if it's not the default value.

Click here to obtain a Key and Secret. Use the the Secret as a passphrase to sign the POST data in SHA512 encryption. Send the Key and Sign back in HTTPS Header for Authentication. Please refer to the following instructions and PHP example codes.

Get account fund balances API

API URL: https://api.gate.io/api2/1/private/balances

Parameter submission method: POST

Parameter: None

Return data format: JSON

Return data example:

	{
		"result":"true",
		"available":{
			"BTC":"0.83337671",
			"LTC":"94.364",
			"ETH":"0.07161",
			"ETC":"82.35029899"
		},
		"locked":{
			"BTC":"0.0002",
			"YAC":"10.01"
		}
	}
				


get deposit address API

API URL: https://gate.io/api2/1/private/depositAddress

Parameter submission method: POST

Parameter:

Parameter Description Example
currency 币种 LTC

Return data format: JSON

Return data example:

	{
		"result":"true",
		"addr":{
			"LQ6sF9nsQssZST7YtLnMBwE3dVWqoDdrPc "
		}
	}
				


get new address API

API URL: https://gate.io/api2/1/private/newAddress

Parameter submission method: POST

Parameter:

Parameter Description Example
currency currency of new address LTC

Return data format: JSON

Return data example:

				{
					"result":"true",
					"addr":{
						"LQ6sF9nsQssZST7YtLnMBwE3dVWqoDdrPc "
					}
				}
				


get deposit withdrawal history API

API URL: https://gate.io/api2/1/private/depositsWithdrawals

Parameter submission method: POST

Parameter:

Parameter Description Example
start start UNIX time 1469092370
end end UNIX time 1469713981

Return data format: JSON

Return data example:

	{
		"result": "true",
		"deposits": [
			{
				"currency": "BTS",
				"address": "addr1",
				"amount": "800000000",
				"txid": "ab1efaba6a911f62d4eb88a7ac515cfe82f18f41",
				"timestamp": "1469092378",
				"status": "DONE"
			}
		
		],
		"withdraws": [
			{
				"currency": "BTS",
				"address": "addr2",
				"amount": "600000000",
				"txid": "afsad33eda911f62d4eb88fasd7fd89af7d9fs32",
				"timestamp": "1469092378",
				"status": "DONE"
			}
		],
		"message": "Success"
	}
				


Place order buy API

API URL: https://api.gate.io/api2/1/private/buy

Parameter submission method: POST

Parameter:

Parameter Description Example
currencyPair currency pair ltc_btc
rate The rate to buy 0.023
amount The amount to buy 100

Return data format: JSON

Return data example:

	{
		"result":"true",
		"orderNumber":"123456",
		"msg":"Success"
	}
				

Notice: The returned orderNumber can be used for cancelling or getting order.


Place order sell API

API URL: https://api.gate.io/api2/1/private/sell

Parameter submission method: POST

Parameter:

Parameter Description Example
currencyPair currency pair ltc_btc
rate The rate to buy 0.023
amount The amount to buy 100

Return data format: JSON

Return data example:

	{
		"result":"true",
		"orderNumber":"123456",
		"msg":"Success"
	}
				

Notice: The returned orderNumber can be used for cancelling or getting order.


Cancel order API

API URL: https://api.gate.io/api2/1/private/cancelOrder

Parameter submission method: POST

Parameter:

Parameter Description Example
orderNumber Order ID 123456

Return data format: JSON

Return data example:

	{
		"result":"true",
		"msg":"Success"
	}
				


Cancel all orders API

API URL: https://gate.io/api2/1/private/cancelAllOrders

Parameter submission method: POST

Parameter:

Parameter Description Example
type order type(0:sell,1:buy,-1:all) 0
currencyPair currency pair ltc_btc

Return data format: JSON

Return data example:

	{
		"result":"true",
		"message":"Success"
	}
				


Get order status API

API URL: https://api.gate.io/api2/1/private/getOrder

Parameter submission method: POST

Parameter:

Parameter Description Example
orderNumber Order ID 123456
currencyPair Pair ltc_btc

Return data format: JSON

Return data example:

	{
		"result":true,
		"order":{
			"id":"15088",
			"status":"cancelled",
			"pair":"eth_btc",
			"type":"sell",
			"rate":0.06930520,
			"amount":"0.39901357",
			"initial_rate":0.06930520,
			"initial_amount":"1"
		},
		"msg":"Success"
	}

				


Get my open order list API

API URL: https://api.gate.io/api2/1/private/openOrders

Parameter submission method: POST

Parameter: None

Return data format: JSON

Return data example:

	{
		"result":"true",
		"orders": [
			{
				"id": "3",
				"orderNumber": "0",
				"type": "sell",
				"rate": 0.0693,
				"amount": "100000",
				"total": "980",
				"currencyPair": "eth_btc",
				"timestamp": "1470648164",
				"status": "open"
			},
			{
				"id": "5",
				"orderNumber": "0",
				"type": "sell",
				"rate": 0.00000204,
				"amount": "1000204",
				"total": "2.04041616",
				"currencyPair": "doge_btc",
				"timestamp": "1470648850",
				"status": "open"
			}
		],
		"message":"Success"
	}

				


Get my last 24h trades API

API URL: https://api.gate.io/api2/1/private/tradeHistory

Parameter submission method: POST

Parameter:

Parameter Description Example
currencyPair currency pair ltc_btc
orderNumber Order ID (optional) 626150

Return data format: JSON

Return data example:

	{
		"result":"true",
		"trades":[
		    {
		      "id":"7942422"
		      "orderid":"38100777"
		      "pair":"ltc_btc"
		      "type":"sell"
		      "rate":"0.01719"
		      "amount":"0.0588"
		      "time":"06-12 02:49:11"
		      "time_unix":"1402512551"
		    }
		    {
		      "id":"7942422"
		      "orderid":"38100491"
		      "pair":"ltc_btc"
		      "type":"buy"
		      "rate":"0.01719"
		      "amount":"0.0588"
		      "time":"06-12 02:49:11"
		      "time_unix":"1402512551"
		    }
	  	]
	  	"message":"Success"
	}


				


withdrawal API

API URL: https://api.gate.io/api2/1/private/withdraw

Parameter submission method: POST

Parameter:

Parameter Description Example
currency withdraw currency btc
amount withdraw amount 0.01
address withdraw address 1HkxtBAMrA3tP5ENnYY2CZortjZvFDH5Cs

Return data format: JSON

Return data example:

	{
		"result":"true",
		"message":"Success"
	}
				


10. Error code


Error codes details from system

Error codes Details
1 Invalid request
2 Invalid version
3 Invalid request
4 Too many attempts
5,6 Invalid sign
7 Currency is not supported
8,9 Currency is not supported
10 Verified failed
11 Obtaining address failed
12 Empty params
13 Internal error, please report to administrator
14 Invalid user
15 Cancel order too fast, please wait 1 min and try again
16 Invalid order id or order is already closed
17 Invalid orderid
18 Invalid amount
19 Not permitted or trade is disabled
20 Your order size is too small
21 You don't have enough fund

11. Demos


Example codes in PHP ( More: JAVA, NODEJS, PYTHON, GO, PHP )

			

<?php

function gateio_query($path, array $req = array()) {
	// API settings, add your Key and Secret at here
	$key = '';
	$secret = '';

	// generate a nonce to avoid problems with 32bits systems
	$mt = explode(' ', microtime());
	$req['nonce'] = $mt[1].substr($mt[0], 2, 6);

	// generate the POST data string
	$post_data = http_build_query($req, '', '&');
	$sign = hash_hmac('sha512', $post_data, $secret);

	// generate the extra headers
	$headers = array(
		'KEY: '.$key,
		'SIGN: '.$sign
	);

	//!!! please set Content-Type to application/x-www-form-urlencoded if it's not the default value

	// curl handle (initialize if required)
	static $ch = null;
	if (is_null($ch)) {
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; gate.io PHP bot; '.php_uname('a').'; PHP/'.phpversion().')');
	}

	curl_setopt($ch, CURLOPT_URL, 'https://gate.io/api2/'.$path);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);


	// run the query
	$res = curl_exec($ch);

	if ($res === false) throw new Exception('Could not get reply: '.curl_error($ch));
	//var_dump($res);
	//print_r($res);
	$dec = json_decode($res, true);
	if (!$dec) throw new Exception('Invalid data received, please make sure connection is working and requested API exists: '.$res);

	return $dec;
}


function curl_file_get_contents($url) {

	// our curl handle (initialize if required)
	static $ch = null;
	if (is_null($ch)) {
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_USERAGENT,
			'Mozilla/4.0 (compatible; gate.io PHP bot; '.php_uname('a').'; PHP/'.phpversion().')'
			);
	}
	curl_setopt($ch, CURLOPT_URL, 'https://gate.io/api2/'.$url);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

	// run the query
	$res = curl_exec($ch);
	if ($res === false) throw new Exception('Could not get reply: '.curl_error($ch));
	//echo $res;
	$dec = json_decode($res, true);
	if (!$dec) throw new Exception('Invalid data: '.$res);

	return $dec;
}

function get_top_rate($currency_pair, $type='BUY') {

	$url = '1/orderBook/'.strtoupper($currency_pair);
	$json = curl_file_get_contents($url);

	$rate = 0;

	if (strtoupper($type) == 'BUY') {
		$r =  $json['bids'][0];
		$rate = $r[0];
	} else  {
		$r = end($json['asks']);
		$rate = $r[0];
	}

	return $rate;
}

function get_pairs() {

	$url = '1/pairs';
	$json = curl_file_get_contents($url);

	return $json;
}

function get_marketinfo(){

	$url = '1/marketinfo';
	$json = curl_file_get_contents($url);

	return $json;
}

function get_tickers(){

	$url = '1/tickers';
	$json = curl_file_get_contents($url);

	return $json;
}

function get_ticker($current_pairs){

	$url = '1/ticker/'.strtoupper($current_pairs);
	$json = curl_file_get_contents($url);

	return $json;
}

function get_orderbooks(){

	$url = '1/orderBooks';
	$json = curl_file_get_contents($url);

	return $json;
}

function get_orderbook($current_pairs){

	$url = '1/orderBooks/'.strtoupper($current_pairs);
	$json = curl_file_get_contents($url);

	return $json;
}

function get_trade_history($current_pairs, $tid){

	$url = '1/tradeHistory/'.strtoupper($current_pairs).'/'.$tid;
	$json = curl_file_get_contents($url);

	return $json;
}

function get_balances() {

	return gateio_query('1/private/balances');
}

function get_order_trades($order_number) {

	return gateio_query('1/private/orderTrades',
		array(
			'orderNumber' => $order_number
		)
	);
}

function withdraw($currency, $amount, $address) {

	return gateio_query('1/private/withdraw',
		array(
			'currency' => strtoupper($currency),
			'amount' => $amount,
			'address' => $address
		)
	);
}

function get_order($order_number) {

	return gateio_query('1/private/getOrder',
		array(
			'orderNumber' => $order_number
		)
	);
}

function cancel_order($order_number) {

	return gateio_query('1/private/cancelOrder',
		array(
			'orderNumber' => $order_number
		)
	);
}

function cancel_all_orders($type, $currency_pair) {

	return gateio_query('1/private/cancelAllOrders',
		array(
			'type' => $type,
			'currencyPair' => strtoupper($currency_pair)
		)
	);
}

function sell($currency_pair, $rate, $amount) {

	return gateio_query('1/private/sell',
		array(
			'currencyPair' => strtoupper($currency_pair),
			'rate' => $rate,
			'amount' => $amount,
		)
	);
}

function buy($currency_pair, $rate, $amount) {

	return gateio_query('1/private/buy',
		array(
			'currencyPair' => strtoupper($currency_pair),
			'rate' => $rate,
			'amount' => $amount,
		)
	);
}

function get_my_trade_history($currency_pair, $order_number) {

	return gateio_query('1/private/tradeHistory',
		array(
			'currencyPair' => strtoupper($currency_pair),
			'orderNumber' => $order_number
		)
	);
}

function open_orders() {

	return gateio_query('1/private/openOrders');
}

function deposit_address($currency) {

	return gateio_query('1/private/depositAddress',
		array(
			'currency' => strtoupper($currency)
		)
	);
}


try {
	// example 1: get balances
	var_dump(get_balances());

	// example 2: place a buy order
	$pair = 'ltc_btc';
	$rate = get_top_rate($pair, $type) * 1.01;
	var_dump(buy($pair, $rate, '0.01'));

	// example 3: cancel an order
	var_dump(cancel_order(125811));

	// example 4: get order status
	var_dump(get_order(15088));

	// example 5: list all open orders
	var_dump(open_orders());

} catch (Exception $e) {
	echo "Error:".$e->getMessage();

}
?>