• BTC/USDT : $ 8191.01
  • ETH/USDT : $ 685.03
  • LTC/USDT : $ 131.63
  • QTUM/USDT : $ 15.38
    Theme:
  • Dark
  • Light

API 2.0

1.API Demos


2. Trading Pairs API

Return all the trading pairs supported by gate.io

URL: https://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: https://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: https://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: https://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: https://data.gate.io/api2/1/ticker/[CURR_A]_[CURR_B]

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

Links:

https://data.gate.io/api2/1/ticker/usdt_cny
https://data.gate.io/api2/1/ticker/btc_usdt
https://data.gate.io/api2/1/ticker/bch_usdt
https://data.gate.io/api2/1/ticker/eth_usdt
https://data.gate.io/api2/1/ticker/etc_usdt
https://data.gate.io/api2/1/ticker/qtum_usdt
https://data.gate.io/api2/1/ticker/ltc_usdt
https://data.gate.io/api2/1/ticker/dash_usdt
https://data.gate.io/api2/1/ticker/zec_usdt
https://data.gate.io/api2/1/ticker/btm_usdt
https://data.gate.io/api2/1/ticker/eos_usdt
https://data.gate.io/api2/1/ticker/req_usdt
https://data.gate.io/api2/1/ticker/snt_usdt
https://data.gate.io/api2/1/ticker/omg_usdt
https://data.gate.io/api2/1/ticker/pay_usdt
https://data.gate.io/api2/1/ticker/cvc_usdt
https://data.gate.io/api2/1/ticker/zrx_usdt
https://data.gate.io/api2/1/ticker/tnt_usdt
https://data.gate.io/api2/1/ticker/xmr_usdt
https://data.gate.io/api2/1/ticker/xrp_usdt
https://data.gate.io/api2/1/ticker/doge_usdt
https://data.gate.io/api2/1/ticker/bat_usdt
https://data.gate.io/api2/1/ticker/pst_usdt
https://data.gate.io/api2/1/ticker/btg_usdt
https://data.gate.io/api2/1/ticker/dpy_usdt
https://data.gate.io/api2/1/ticker/lrc_usdt
https://data.gate.io/api2/1/ticker/storj_usdt
https://data.gate.io/api2/1/ticker/rdn_usdt
https://data.gate.io/api2/1/ticker/stx_usdt
https://data.gate.io/api2/1/ticker/knc_usdt
https://data.gate.io/api2/1/ticker/link_usdt
https://data.gate.io/api2/1/ticker/cdt_usdt
https://data.gate.io/api2/1/ticker/ae_usdt
https://data.gate.io/api2/1/ticker/ae_eth
https://data.gate.io/api2/1/ticker/ae_btc
https://data.gate.io/api2/1/ticker/cdt_eth
https://data.gate.io/api2/1/ticker/rdn_eth
https://data.gate.io/api2/1/ticker/stx_eth
https://data.gate.io/api2/1/ticker/knc_eth
https://data.gate.io/api2/1/ticker/link_eth
https://data.gate.io/api2/1/ticker/req_eth
https://data.gate.io/api2/1/ticker/rcn_eth
https://data.gate.io/api2/1/ticker/trx_eth
https://data.gate.io/api2/1/ticker/arn_eth
https://data.gate.io/api2/1/ticker/kick_eth
https://data.gate.io/api2/1/ticker/bnt_eth
https://data.gate.io/api2/1/ticker/ven_eth
https://data.gate.io/api2/1/ticker/mco_eth
https://data.gate.io/api2/1/ticker/fun_eth
https://data.gate.io/api2/1/ticker/data_eth
https://data.gate.io/api2/1/ticker/rlc_eth
https://data.gate.io/api2/1/ticker/rlc_usdt
https://data.gate.io/api2/1/ticker/zsc_eth
https://data.gate.io/api2/1/ticker/wings_eth
https://data.gate.io/api2/1/ticker/ctr_eth
https://data.gate.io/api2/1/ticker/mda_eth
https://data.gate.io/api2/1/ticker/rcn_usdt
https://data.gate.io/api2/1/ticker/trx_usdt
https://data.gate.io/api2/1/ticker/kick_usdt
https://data.gate.io/api2/1/ticker/ven_usdt
https://data.gate.io/api2/1/ticker/mco_usdt
https://data.gate.io/api2/1/ticker/fun_usdt
https://data.gate.io/api2/1/ticker/data_usdt
https://data.gate.io/api2/1/ticker/zsc_usdt
https://data.gate.io/api2/1/ticker/mda_usdt
https://data.gate.io/api2/1/ticker/xtz_usdt
https://data.gate.io/api2/1/ticker/gnt_usdt
https://data.gate.io/api2/1/ticker/gnt_eth
https://data.gate.io/api2/1/ticker/gem_usdt
https://data.gate.io/api2/1/ticker/gem_eth
https://data.gate.io/api2/1/ticker/rfr_usdt
https://data.gate.io/api2/1/ticker/rfr_eth
https://data.gate.io/api2/1/ticker/dadi_usdt
https://data.gate.io/api2/1/ticker/dadi_eth
https://data.gate.io/api2/1/ticker/abt_usdt
https://data.gate.io/api2/1/ticker/abt_eth
https://data.gate.io/api2/1/ticker/ledu_btc
https://data.gate.io/api2/1/ticker/ledu_eth
https://data.gate.io/api2/1/ticker/ost_usdt
https://data.gate.io/api2/1/ticker/ost_eth
https://data.gate.io/api2/1/ticker/xlm_usdt
https://data.gate.io/api2/1/ticker/xlm_eth
https://data.gate.io/api2/1/ticker/xlm_btc
https://data.gate.io/api2/1/ticker/mobi_usdt
https://data.gate.io/api2/1/ticker/mobi_eth
https://data.gate.io/api2/1/ticker/mobi_btc
https://data.gate.io/api2/1/ticker/ocn_usdt
https://data.gate.io/api2/1/ticker/ocn_eth
https://data.gate.io/api2/1/ticker/ocn_btc
https://data.gate.io/api2/1/ticker/zpt_usdt
https://data.gate.io/api2/1/ticker/zpt_eth
https://data.gate.io/api2/1/ticker/zpt_btc
https://data.gate.io/api2/1/ticker/cofi_usdt
https://data.gate.io/api2/1/ticker/cofi_eth
https://data.gate.io/api2/1/ticker/jnt_usdt
https://data.gate.io/api2/1/ticker/jnt_eth
https://data.gate.io/api2/1/ticker/jnt_btc
https://data.gate.io/api2/1/ticker/blz_usdt
https://data.gate.io/api2/1/ticker/blz_eth
https://data.gate.io/api2/1/ticker/gxs_usdt
https://data.gate.io/api2/1/ticker/gxs_btc
https://data.gate.io/api2/1/ticker/mtn_usdt
https://data.gate.io/api2/1/ticker/mtn_eth
https://data.gate.io/api2/1/ticker/ruff_usdt
https://data.gate.io/api2/1/ticker/ruff_eth
https://data.gate.io/api2/1/ticker/ruff_btc
https://data.gate.io/api2/1/ticker/tnc_usdt
https://data.gate.io/api2/1/ticker/tnc_eth
https://data.gate.io/api2/1/ticker/tnc_btc
https://data.gate.io/api2/1/ticker/zil_usdt
https://data.gate.io/api2/1/ticker/zil_eth
https://data.gate.io/api2/1/ticker/tio_usdt
https://data.gate.io/api2/1/ticker/tio_eth
https://data.gate.io/api2/1/ticker/bto_usdt
https://data.gate.io/api2/1/ticker/bto_eth
https://data.gate.io/api2/1/ticker/theta_usdt
https://data.gate.io/api2/1/ticker/theta_eth
https://data.gate.io/api2/1/ticker/ddd_usdt
https://data.gate.io/api2/1/ticker/ddd_eth
https://data.gate.io/api2/1/ticker/ddd_btc
https://data.gate.io/api2/1/ticker/mkr_usdt
https://data.gate.io/api2/1/ticker/mkr_eth
https://data.gate.io/api2/1/ticker/dai_usdt
https://data.gate.io/api2/1/ticker/smt_usdt
https://data.gate.io/api2/1/ticker/smt_eth
https://data.gate.io/api2/1/ticker/mdt_usdt
https://data.gate.io/api2/1/ticker/mdt_eth
https://data.gate.io/api2/1/ticker/mdt_btc
https://data.gate.io/api2/1/ticker/mana_usdt
https://data.gate.io/api2/1/ticker/mana_eth
https://data.gate.io/api2/1/ticker/lun_usdt
https://data.gate.io/api2/1/ticker/lun_eth
https://data.gate.io/api2/1/ticker/salt_usdt
https://data.gate.io/api2/1/ticker/salt_eth
https://data.gate.io/api2/1/ticker/fuel_usdt
https://data.gate.io/api2/1/ticker/fuel_eth
https://data.gate.io/api2/1/ticker/elf_usdt
https://data.gate.io/api2/1/ticker/elf_eth
https://data.gate.io/api2/1/ticker/drgn_usdt
https://data.gate.io/api2/1/ticker/drgn_eth
https://data.gate.io/api2/1/ticker/gtc_usdt
https://data.gate.io/api2/1/ticker/gtc_eth
https://data.gate.io/api2/1/ticker/gtc_btc
https://data.gate.io/api2/1/ticker/qlc_usdt
https://data.gate.io/api2/1/ticker/qlc_btc
https://data.gate.io/api2/1/ticker/qlc_eth
https://data.gate.io/api2/1/ticker/dbc_usdt
https://data.gate.io/api2/1/ticker/dbc_btc
https://data.gate.io/api2/1/ticker/dbc_eth
https://data.gate.io/api2/1/ticker/bnty_usdt
https://data.gate.io/api2/1/ticker/bnty_eth
https://data.gate.io/api2/1/ticker/lend_usdt
https://data.gate.io/api2/1/ticker/lend_eth
https://data.gate.io/api2/1/ticker/icx_usdt
https://data.gate.io/api2/1/ticker/icx_eth
https://data.gate.io/api2/1/ticker/btf_usdt
https://data.gate.io/api2/1/ticker/btf_btc
https://data.gate.io/api2/1/ticker/ada_usdt
https://data.gate.io/api2/1/ticker/ada_btc
https://data.gate.io/api2/1/ticker/lsk_usdt
https://data.gate.io/api2/1/ticker/lsk_btc
https://data.gate.io/api2/1/ticker/waves_usdt
https://data.gate.io/api2/1/ticker/waves_btc
https://data.gate.io/api2/1/ticker/bifi_usdt
https://data.gate.io/api2/1/ticker/bifi_btc
https://data.gate.io/api2/1/ticker/mds_eth
https://data.gate.io/api2/1/ticker/mds_usdt
https://data.gate.io/api2/1/ticker/dgd_usdt
https://data.gate.io/api2/1/ticker/dgd_eth
https://data.gate.io/api2/1/ticker/qash_usdt
https://data.gate.io/api2/1/ticker/qash_eth
https://data.gate.io/api2/1/ticker/qash_btc
https://data.gate.io/api2/1/ticker/powr_usdt
https://data.gate.io/api2/1/ticker/powr_eth
https://data.gate.io/api2/1/ticker/powr_btc
https://data.gate.io/api2/1/ticker/fil_usdt
https://data.gate.io/api2/1/ticker/bcd_usdt
https://data.gate.io/api2/1/ticker/bcd_btc
https://data.gate.io/api2/1/ticker/sbtc_usdt
https://data.gate.io/api2/1/ticker/sbtc_btc
https://data.gate.io/api2/1/ticker/god_usdt
https://data.gate.io/api2/1/ticker/god_btc
https://data.gate.io/api2/1/ticker/bcx_usdt
https://data.gate.io/api2/1/ticker/bcx_btc
https://data.gate.io/api2/1/ticker/hsr_usdt
https://data.gate.io/api2/1/ticker/hsr_btc
https://data.gate.io/api2/1/ticker/hsr_eth
https://data.gate.io/api2/1/ticker/qsp_usdt
https://data.gate.io/api2/1/ticker/qsp_eth
https://data.gate.io/api2/1/ticker/ink_btc
https://data.gate.io/api2/1/ticker/ink_usdt
https://data.gate.io/api2/1/ticker/ink_eth
https://data.gate.io/api2/1/ticker/ink_qtum
https://data.gate.io/api2/1/ticker/med_qtum
https://data.gate.io/api2/1/ticker/med_eth
https://data.gate.io/api2/1/ticker/med_usdt
https://data.gate.io/api2/1/ticker/bot_qtum
https://data.gate.io/api2/1/ticker/bot_usdt
https://data.gate.io/api2/1/ticker/bot_eth
https://data.gate.io/api2/1/ticker/qbt_qtum
https://data.gate.io/api2/1/ticker/qbt_eth
https://data.gate.io/api2/1/ticker/qbt_usdt
https://data.gate.io/api2/1/ticker/tsl_qtum
https://data.gate.io/api2/1/ticker/tsl_usdt
https://data.gate.io/api2/1/ticker/gnx_usdt
https://data.gate.io/api2/1/ticker/gnx_eth
https://data.gate.io/api2/1/ticker/neo_usdt
https://data.gate.io/api2/1/ticker/gas_usdt
https://data.gate.io/api2/1/ticker/neo_btc
https://data.gate.io/api2/1/ticker/gas_btc
https://data.gate.io/api2/1/ticker/iota_usdt
https://data.gate.io/api2/1/ticker/iota_btc
https://data.gate.io/api2/1/ticker/nas_usdt
https://data.gate.io/api2/1/ticker/nas_eth
https://data.gate.io/api2/1/ticker/nas_btc
https://data.gate.io/api2/1/ticker/eth_btc
https://data.gate.io/api2/1/ticker/etc_btc
https://data.gate.io/api2/1/ticker/etc_eth
https://data.gate.io/api2/1/ticker/zec_btc
https://data.gate.io/api2/1/ticker/dash_btc
https://data.gate.io/api2/1/ticker/ltc_btc
https://data.gate.io/api2/1/ticker/bch_btc
https://data.gate.io/api2/1/ticker/btg_btc
https://data.gate.io/api2/1/ticker/qtum_btc
https://data.gate.io/api2/1/ticker/qtum_eth
https://data.gate.io/api2/1/ticker/xrp_btc
https://data.gate.io/api2/1/ticker/doge_btc
https://data.gate.io/api2/1/ticker/xmr_btc
https://data.gate.io/api2/1/ticker/zrx_btc
https://data.gate.io/api2/1/ticker/zrx_eth
https://data.gate.io/api2/1/ticker/dnt_eth
https://data.gate.io/api2/1/ticker/dpy_eth
https://data.gate.io/api2/1/ticker/oax_eth
https://data.gate.io/api2/1/ticker/rep_eth
https://data.gate.io/api2/1/ticker/lrc_eth
https://data.gate.io/api2/1/ticker/lrc_btc
https://data.gate.io/api2/1/ticker/pst_eth
https://data.gate.io/api2/1/ticker/bcdn_eth
https://data.gate.io/api2/1/ticker/bcdn_usdt
https://data.gate.io/api2/1/ticker/tnt_eth
https://data.gate.io/api2/1/ticker/snt_eth
https://data.gate.io/api2/1/ticker/snt_btc
https://data.gate.io/api2/1/ticker/btm_eth
https://data.gate.io/api2/1/ticker/btm_btc
https://data.gate.io/api2/1/ticker/llt_eth
https://data.gate.io/api2/1/ticker/snet_eth
https://data.gate.io/api2/1/ticker/snet_usdt
https://data.gate.io/api2/1/ticker/llt_snet
https://data.gate.io/api2/1/ticker/omg_eth
https://data.gate.io/api2/1/ticker/omg_btc
https://data.gate.io/api2/1/ticker/pay_eth
https://data.gate.io/api2/1/ticker/pay_btc
https://data.gate.io/api2/1/ticker/bat_eth
https://data.gate.io/api2/1/ticker/bat_btc
https://data.gate.io/api2/1/ticker/cvc_eth
https://data.gate.io/api2/1/ticker/storj_eth
https://data.gate.io/api2/1/ticker/storj_btc
https://data.gate.io/api2/1/ticker/eos_eth
https://data.gate.io/api2/1/ticker/eos_btc
https://data.gate.io/api2/1/ticker/bts_usdt
https://data.gate.io/api2/1/ticker/bts_btc
https://data.gate.io/api2/1/ticker/tips_eth
https://data.gate.io/api2/1/ticker/xmc_usdt
https://data.gate.io/api2/1/ticker/xmc_btc
https://data.gate.io/api2/1/ticker/cs_eth
https://data.gate.io/api2/1/ticker/cs_usdt
https://data.gate.io/api2/1/ticker/man_eth
https://data.gate.io/api2/1/ticker/man_usdt
https://data.gate.io/api2/1/ticker/rem_eth
https://data.gate.io/api2/1/ticker/rem_usdt
https://data.gate.io/api2/1/ticker/lym_eth
https://data.gate.io/api2/1/ticker/lym_btc
https://data.gate.io/api2/1/ticker/lym_usdt
https://data.gate.io/api2/1/ticker/instar_eth
https://data.gate.io/api2/1/ticker/ont_eth
https://data.gate.io/api2/1/ticker/ont_usdt
https://data.gate.io/api2/1/ticker/bft_eth
https://data.gate.io/api2/1/ticker/bft_usdt
https://data.gate.io/api2/1/ticker/iht_eth
https://data.gate.io/api2/1/ticker/iht_usdt
https://data.gate.io/api2/1/ticker/senc_eth
https://data.gate.io/api2/1/ticker/senc_usdt
https://data.gate.io/api2/1/ticker/tomo_eth
https://data.gate.io/api2/1/ticker/tomo_usdt
https://data.gate.io/api2/1/ticker/elec_eth
https://data.gate.io/api2/1/ticker/elec_usdt
https://data.gate.io/api2/1/ticker/ship_eth
https://data.gate.io/api2/1/ticker/tfd_eth
https://data.gate.io/api2/1/ticker/hav_eth
https://data.gate.io/api2/1/ticker/hav_usdt
https://data.gate.io/api2/1/ticker/hur_eth
https://data.gate.io/api2/1/ticker/lst_eth
https://data.gate.io/api2/1/ticker/lino_eth
https://data.gate.io/api2/1/ticker/swth_eth
https://data.gate.io/api2/1/ticker/swth_usdt
https://data.gate.io/api2/1/ticker/lrn_eth
https://data.gate.io/api2/1/ticker/lrn_usdt
https://data.gate.io/api2/1/ticker/dock_usdt
https://data.gate.io/api2/1/ticker/dock_eth
https://data.gate.io/api2/1/ticker/red_usdt
https://data.gate.io/api2/1/ticker/red_eth
https://data.gate.io/api2/1/ticker/lba_usdt
https://data.gate.io/api2/1/ticker/lba_eth
https://data.gate.io/api2/1/ticker/kan_usdt
https://data.gate.io/api2/1/ticker/kan_eth
https://data.gate.io/api2/1/ticker/mith_usdt
https://data.gate.io/api2/1/ticker/mith_eth
https://data.gate.io/api2/1/ticker/skm_usdt
https://data.gate.io/api2/1/ticker/skm_eth
https://data.gate.io/api2/1/ticker/xvg_usdt
https://data.gate.io/api2/1/ticker/xvg_btc
https://data.gate.io/api2/1/ticker/nano_usdt
https://data.gate.io/api2/1/ticker/nano_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: https://data.gate.io/api2/1/orderBook/[CURR_A]_[CURR_B]

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

Links:

https://data.gate.io/api2/1/orderBook/btc_usdt
https://data.gate.io/api2/1/orderBook/bch_usdt
https://data.gate.io/api2/1/orderBook/eth_usdt
https://data.gate.io/api2/1/orderBook/etc_usdt
https://data.gate.io/api2/1/orderBook/qtum_usdt
https://data.gate.io/api2/1/orderBook/ltc_usdt
https://data.gate.io/api2/1/orderBook/dash_usdt
https://data.gate.io/api2/1/orderBook/zec_usdt
https://data.gate.io/api2/1/orderBook/btm_usdt
https://data.gate.io/api2/1/orderBook/eos_usdt
https://data.gate.io/api2/1/orderBook/req_usdt
https://data.gate.io/api2/1/orderBook/snt_usdt
https://data.gate.io/api2/1/orderBook/omg_usdt
https://data.gate.io/api2/1/orderBook/pay_usdt
https://data.gate.io/api2/1/orderBook/cvc_usdt
https://data.gate.io/api2/1/orderBook/zrx_usdt
https://data.gate.io/api2/1/orderBook/tnt_usdt
https://data.gate.io/api2/1/orderBook/xmr_usdt
https://data.gate.io/api2/1/orderBook/xrp_usdt
https://data.gate.io/api2/1/orderBook/doge_usdt
https://data.gate.io/api2/1/orderBook/bat_usdt
https://data.gate.io/api2/1/orderBook/pst_usdt
https://data.gate.io/api2/1/orderBook/btg_usdt
https://data.gate.io/api2/1/orderBook/dpy_usdt
https://data.gate.io/api2/1/orderBook/lrc_usdt
https://data.gate.io/api2/1/orderBook/storj_usdt
https://data.gate.io/api2/1/orderBook/rdn_usdt
https://data.gate.io/api2/1/orderBook/stx_usdt
https://data.gate.io/api2/1/orderBook/knc_usdt
https://data.gate.io/api2/1/orderBook/link_usdt
https://data.gate.io/api2/1/orderBook/cdt_usdt
https://data.gate.io/api2/1/orderBook/ae_usdt
https://data.gate.io/api2/1/orderBook/ae_eth
https://data.gate.io/api2/1/orderBook/ae_btc
https://data.gate.io/api2/1/orderBook/cdt_eth
https://data.gate.io/api2/1/orderBook/rdn_eth
https://data.gate.io/api2/1/orderBook/stx_eth
https://data.gate.io/api2/1/orderBook/knc_eth
https://data.gate.io/api2/1/orderBook/link_eth
https://data.gate.io/api2/1/orderBook/req_eth
https://data.gate.io/api2/1/orderBook/rcn_eth
https://data.gate.io/api2/1/orderBook/trx_eth
https://data.gate.io/api2/1/orderBook/arn_eth
https://data.gate.io/api2/1/orderBook/kick_eth
https://data.gate.io/api2/1/orderBook/bnt_eth
https://data.gate.io/api2/1/orderBook/ven_eth
https://data.gate.io/api2/1/orderBook/mco_eth
https://data.gate.io/api2/1/orderBook/fun_eth
https://data.gate.io/api2/1/orderBook/data_eth
https://data.gate.io/api2/1/orderBook/rlc_eth
https://data.gate.io/api2/1/orderBook/rlc_usdt
https://data.gate.io/api2/1/orderBook/zsc_eth
https://data.gate.io/api2/1/orderBook/wings_eth
https://data.gate.io/api2/1/orderBook/ctr_eth
https://data.gate.io/api2/1/orderBook/mda_eth
https://data.gate.io/api2/1/orderBook/rcn_usdt
https://data.gate.io/api2/1/orderBook/trx_usdt
https://data.gate.io/api2/1/orderBook/kick_usdt
https://data.gate.io/api2/1/orderBook/ven_usdt
https://data.gate.io/api2/1/orderBook/mco_usdt
https://data.gate.io/api2/1/orderBook/fun_usdt
https://data.gate.io/api2/1/orderBook/data_usdt
https://data.gate.io/api2/1/orderBook/zsc_usdt
https://data.gate.io/api2/1/orderBook/mda_usdt
https://data.gate.io/api2/1/orderBook/xtz_usdt
https://data.gate.io/api2/1/orderBook/gnt_usdt
https://data.gate.io/api2/1/orderBook/gnt_eth
https://data.gate.io/api2/1/orderBook/gem_usdt
https://data.gate.io/api2/1/orderBook/gem_eth
https://data.gate.io/api2/1/orderBook/rfr_usdt
https://data.gate.io/api2/1/orderBook/rfr_eth
https://data.gate.io/api2/1/orderBook/dadi_usdt
https://data.gate.io/api2/1/orderBook/dadi_eth
https://data.gate.io/api2/1/orderBook/abt_usdt
https://data.gate.io/api2/1/orderBook/abt_eth
https://data.gate.io/api2/1/orderBook/ledu_btc
https://data.gate.io/api2/1/orderBook/ledu_eth
https://data.gate.io/api2/1/orderBook/ost_usdt
https://data.gate.io/api2/1/orderBook/ost_eth
https://data.gate.io/api2/1/orderBook/xlm_usdt
https://data.gate.io/api2/1/orderBook/xlm_eth
https://data.gate.io/api2/1/orderBook/xlm_btc
https://data.gate.io/api2/1/orderBook/mobi_usdt
https://data.gate.io/api2/1/orderBook/mobi_eth
https://data.gate.io/api2/1/orderBook/mobi_btc
https://data.gate.io/api2/1/orderBook/ocn_usdt
https://data.gate.io/api2/1/orderBook/ocn_eth
https://data.gate.io/api2/1/orderBook/ocn_btc
https://data.gate.io/api2/1/orderBook/zpt_usdt
https://data.gate.io/api2/1/orderBook/zpt_eth
https://data.gate.io/api2/1/orderBook/zpt_btc
https://data.gate.io/api2/1/orderBook/cofi_usdt
https://data.gate.io/api2/1/orderBook/cofi_eth
https://data.gate.io/api2/1/orderBook/jnt_usdt
https://data.gate.io/api2/1/orderBook/jnt_eth
https://data.gate.io/api2/1/orderBook/jnt_btc
https://data.gate.io/api2/1/orderBook/blz_usdt
https://data.gate.io/api2/1/orderBook/blz_eth
https://data.gate.io/api2/1/orderBook/gxs_usdt
https://data.gate.io/api2/1/orderBook/gxs_btc
https://data.gate.io/api2/1/orderBook/mtn_usdt
https://data.gate.io/api2/1/orderBook/mtn_eth
https://data.gate.io/api2/1/orderBook/ruff_usdt
https://data.gate.io/api2/1/orderBook/ruff_eth
https://data.gate.io/api2/1/orderBook/ruff_btc
https://data.gate.io/api2/1/orderBook/tnc_usdt
https://data.gate.io/api2/1/orderBook/tnc_eth
https://data.gate.io/api2/1/orderBook/tnc_btc
https://data.gate.io/api2/1/orderBook/zil_usdt
https://data.gate.io/api2/1/orderBook/zil_eth
https://data.gate.io/api2/1/orderBook/tio_usdt
https://data.gate.io/api2/1/orderBook/tio_eth
https://data.gate.io/api2/1/orderBook/bto_usdt
https://data.gate.io/api2/1/orderBook/bto_eth
https://data.gate.io/api2/1/orderBook/theta_usdt
https://data.gate.io/api2/1/orderBook/theta_eth
https://data.gate.io/api2/1/orderBook/ddd_usdt
https://data.gate.io/api2/1/orderBook/ddd_eth
https://data.gate.io/api2/1/orderBook/ddd_btc
https://data.gate.io/api2/1/orderBook/mkr_usdt
https://data.gate.io/api2/1/orderBook/mkr_eth
https://data.gate.io/api2/1/orderBook/dai_usdt
https://data.gate.io/api2/1/orderBook/smt_usdt
https://data.gate.io/api2/1/orderBook/smt_eth
https://data.gate.io/api2/1/orderBook/mdt_usdt
https://data.gate.io/api2/1/orderBook/mdt_eth
https://data.gate.io/api2/1/orderBook/mdt_btc
https://data.gate.io/api2/1/orderBook/mana_usdt
https://data.gate.io/api2/1/orderBook/mana_eth
https://data.gate.io/api2/1/orderBook/lun_usdt
https://data.gate.io/api2/1/orderBook/lun_eth
https://data.gate.io/api2/1/orderBook/salt_usdt
https://data.gate.io/api2/1/orderBook/salt_eth
https://data.gate.io/api2/1/orderBook/fuel_usdt
https://data.gate.io/api2/1/orderBook/fuel_eth
https://data.gate.io/api2/1/orderBook/elf_usdt
https://data.gate.io/api2/1/orderBook/elf_eth
https://data.gate.io/api2/1/orderBook/drgn_usdt
https://data.gate.io/api2/1/orderBook/drgn_eth
https://data.gate.io/api2/1/orderBook/gtc_usdt
https://data.gate.io/api2/1/orderBook/gtc_eth
https://data.gate.io/api2/1/orderBook/gtc_btc
https://data.gate.io/api2/1/orderBook/qlc_usdt
https://data.gate.io/api2/1/orderBook/qlc_btc
https://data.gate.io/api2/1/orderBook/qlc_eth
https://data.gate.io/api2/1/orderBook/dbc_usdt
https://data.gate.io/api2/1/orderBook/dbc_btc
https://data.gate.io/api2/1/orderBook/dbc_eth
https://data.gate.io/api2/1/orderBook/bnty_usdt
https://data.gate.io/api2/1/orderBook/bnty_eth
https://data.gate.io/api2/1/orderBook/lend_usdt
https://data.gate.io/api2/1/orderBook/lend_eth
https://data.gate.io/api2/1/orderBook/icx_usdt
https://data.gate.io/api2/1/orderBook/icx_eth
https://data.gate.io/api2/1/orderBook/btf_usdt
https://data.gate.io/api2/1/orderBook/btf_btc
https://data.gate.io/api2/1/orderBook/ada_usdt
https://data.gate.io/api2/1/orderBook/ada_btc
https://data.gate.io/api2/1/orderBook/lsk_usdt
https://data.gate.io/api2/1/orderBook/lsk_btc
https://data.gate.io/api2/1/orderBook/waves_usdt
https://data.gate.io/api2/1/orderBook/waves_btc
https://data.gate.io/api2/1/orderBook/bifi_usdt
https://data.gate.io/api2/1/orderBook/bifi_btc
https://data.gate.io/api2/1/orderBook/mds_eth
https://data.gate.io/api2/1/orderBook/mds_usdt
https://data.gate.io/api2/1/orderBook/dgd_usdt
https://data.gate.io/api2/1/orderBook/dgd_eth
https://data.gate.io/api2/1/orderBook/qash_usdt
https://data.gate.io/api2/1/orderBook/qash_eth
https://data.gate.io/api2/1/orderBook/qash_btc
https://data.gate.io/api2/1/orderBook/powr_usdt
https://data.gate.io/api2/1/orderBook/powr_eth
https://data.gate.io/api2/1/orderBook/powr_btc
https://data.gate.io/api2/1/orderBook/fil_usdt
https://data.gate.io/api2/1/orderBook/bcd_usdt
https://data.gate.io/api2/1/orderBook/bcd_btc
https://data.gate.io/api2/1/orderBook/sbtc_usdt
https://data.gate.io/api2/1/orderBook/sbtc_btc
https://data.gate.io/api2/1/orderBook/god_usdt
https://data.gate.io/api2/1/orderBook/god_btc
https://data.gate.io/api2/1/orderBook/bcx_usdt
https://data.gate.io/api2/1/orderBook/bcx_btc
https://data.gate.io/api2/1/orderBook/hsr_usdt
https://data.gate.io/api2/1/orderBook/hsr_btc
https://data.gate.io/api2/1/orderBook/hsr_eth
https://data.gate.io/api2/1/orderBook/qsp_usdt
https://data.gate.io/api2/1/orderBook/qsp_eth
https://data.gate.io/api2/1/orderBook/ink_btc
https://data.gate.io/api2/1/orderBook/ink_usdt
https://data.gate.io/api2/1/orderBook/ink_eth
https://data.gate.io/api2/1/orderBook/ink_qtum
https://data.gate.io/api2/1/orderBook/med_qtum
https://data.gate.io/api2/1/orderBook/med_eth
https://data.gate.io/api2/1/orderBook/med_usdt
https://data.gate.io/api2/1/orderBook/bot_qtum
https://data.gate.io/api2/1/orderBook/bot_usdt
https://data.gate.io/api2/1/orderBook/bot_eth
https://data.gate.io/api2/1/orderBook/qbt_qtum
https://data.gate.io/api2/1/orderBook/qbt_eth
https://data.gate.io/api2/1/orderBook/qbt_usdt
https://data.gate.io/api2/1/orderBook/tsl_qtum
https://data.gate.io/api2/1/orderBook/tsl_usdt
https://data.gate.io/api2/1/orderBook/gnx_usdt
https://data.gate.io/api2/1/orderBook/gnx_eth
https://data.gate.io/api2/1/orderBook/neo_usdt
https://data.gate.io/api2/1/orderBook/gas_usdt
https://data.gate.io/api2/1/orderBook/neo_btc
https://data.gate.io/api2/1/orderBook/gas_btc
https://data.gate.io/api2/1/orderBook/iota_usdt
https://data.gate.io/api2/1/orderBook/iota_btc
https://data.gate.io/api2/1/orderBook/nas_usdt
https://data.gate.io/api2/1/orderBook/nas_eth
https://data.gate.io/api2/1/orderBook/nas_btc
https://data.gate.io/api2/1/orderBook/eth_btc
https://data.gate.io/api2/1/orderBook/etc_btc
https://data.gate.io/api2/1/orderBook/etc_eth
https://data.gate.io/api2/1/orderBook/zec_btc
https://data.gate.io/api2/1/orderBook/dash_btc
https://data.gate.io/api2/1/orderBook/ltc_btc
https://data.gate.io/api2/1/orderBook/bch_btc
https://data.gate.io/api2/1/orderBook/btg_btc
https://data.gate.io/api2/1/orderBook/qtum_btc
https://data.gate.io/api2/1/orderBook/qtum_eth
https://data.gate.io/api2/1/orderBook/xrp_btc
https://data.gate.io/api2/1/orderBook/doge_btc
https://data.gate.io/api2/1/orderBook/xmr_btc
https://data.gate.io/api2/1/orderBook/zrx_btc
https://data.gate.io/api2/1/orderBook/zrx_eth
https://data.gate.io/api2/1/orderBook/dnt_eth
https://data.gate.io/api2/1/orderBook/dpy_eth
https://data.gate.io/api2/1/orderBook/oax_eth
https://data.gate.io/api2/1/orderBook/rep_eth
https://data.gate.io/api2/1/orderBook/lrc_eth
https://data.gate.io/api2/1/orderBook/lrc_btc
https://data.gate.io/api2/1/orderBook/pst_eth
https://data.gate.io/api2/1/orderBook/bcdn_eth
https://data.gate.io/api2/1/orderBook/bcdn_usdt
https://data.gate.io/api2/1/orderBook/tnt_eth
https://data.gate.io/api2/1/orderBook/snt_eth
https://data.gate.io/api2/1/orderBook/snt_btc
https://data.gate.io/api2/1/orderBook/btm_eth
https://data.gate.io/api2/1/orderBook/btm_btc
https://data.gate.io/api2/1/orderBook/llt_eth
https://data.gate.io/api2/1/orderBook/snet_eth
https://data.gate.io/api2/1/orderBook/snet_usdt
https://data.gate.io/api2/1/orderBook/llt_snet
https://data.gate.io/api2/1/orderBook/omg_eth
https://data.gate.io/api2/1/orderBook/omg_btc
https://data.gate.io/api2/1/orderBook/pay_eth
https://data.gate.io/api2/1/orderBook/pay_btc
https://data.gate.io/api2/1/orderBook/bat_eth
https://data.gate.io/api2/1/orderBook/bat_btc
https://data.gate.io/api2/1/orderBook/cvc_eth
https://data.gate.io/api2/1/orderBook/storj_eth
https://data.gate.io/api2/1/orderBook/storj_btc
https://data.gate.io/api2/1/orderBook/eos_eth
https://data.gate.io/api2/1/orderBook/eos_btc
https://data.gate.io/api2/1/orderBook/bts_usdt
https://data.gate.io/api2/1/orderBook/bts_btc
https://data.gate.io/api2/1/orderBook/tips_eth
https://data.gate.io/api2/1/orderBook/xmc_usdt
https://data.gate.io/api2/1/orderBook/xmc_btc
https://data.gate.io/api2/1/orderBook/cs_eth
https://data.gate.io/api2/1/orderBook/cs_usdt
https://data.gate.io/api2/1/orderBook/man_eth
https://data.gate.io/api2/1/orderBook/man_usdt
https://data.gate.io/api2/1/orderBook/rem_eth
https://data.gate.io/api2/1/orderBook/rem_usdt
https://data.gate.io/api2/1/orderBook/lym_eth
https://data.gate.io/api2/1/orderBook/lym_btc
https://data.gate.io/api2/1/orderBook/lym_usdt
https://data.gate.io/api2/1/orderBook/instar_eth
https://data.gate.io/api2/1/orderBook/ont_eth
https://data.gate.io/api2/1/orderBook/ont_usdt
https://data.gate.io/api2/1/orderBook/bft_eth
https://data.gate.io/api2/1/orderBook/bft_usdt
https://data.gate.io/api2/1/orderBook/iht_eth
https://data.gate.io/api2/1/orderBook/iht_usdt
https://data.gate.io/api2/1/orderBook/senc_eth
https://data.gate.io/api2/1/orderBook/senc_usdt
https://data.gate.io/api2/1/orderBook/tomo_eth
https://data.gate.io/api2/1/orderBook/tomo_usdt
https://data.gate.io/api2/1/orderBook/elec_eth
https://data.gate.io/api2/1/orderBook/elec_usdt
https://data.gate.io/api2/1/orderBook/ship_eth
https://data.gate.io/api2/1/orderBook/tfd_eth
https://data.gate.io/api2/1/orderBook/hav_eth
https://data.gate.io/api2/1/orderBook/hav_usdt
https://data.gate.io/api2/1/orderBook/hur_eth
https://data.gate.io/api2/1/orderBook/lst_eth
https://data.gate.io/api2/1/orderBook/lino_eth
https://data.gate.io/api2/1/orderBook/swth_eth
https://data.gate.io/api2/1/orderBook/swth_usdt
https://data.gate.io/api2/1/orderBook/lrn_eth
https://data.gate.io/api2/1/orderBook/lrn_usdt
https://data.gate.io/api2/1/orderBook/dock_usdt
https://data.gate.io/api2/1/orderBook/dock_eth
https://data.gate.io/api2/1/orderBook/red_usdt
https://data.gate.io/api2/1/orderBook/red_eth
https://data.gate.io/api2/1/orderBook/lba_usdt
https://data.gate.io/api2/1/orderBook/lba_eth
https://data.gate.io/api2/1/orderBook/kan_usdt
https://data.gate.io/api2/1/orderBook/kan_eth
https://data.gate.io/api2/1/orderBook/mith_usdt
https://data.gate.io/api2/1/orderBook/mith_eth
https://data.gate.io/api2/1/orderBook/skm_usdt
https://data.gate.io/api2/1/orderBook/skm_eth
https://data.gate.io/api2/1/orderBook/xvg_usdt
https://data.gate.io/api2/1/orderBook/xvg_btc
https://data.gate.io/api2/1/orderBook/nano_usdt
https://data.gate.io/api2/1/orderBook/nano_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: https://data.gate.io/api2/1/trade/[CURR_A]_[CURR_B]

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

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

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

Links:

https://data.gate.io/api2/1/tradeHistory/btc_usdt
https://data.gate.io/api2/1/tradeHistory/bch_usdt
https://data.gate.io/api2/1/tradeHistory/eth_usdt
https://data.gate.io/api2/1/tradeHistory/etc_usdt
https://data.gate.io/api2/1/tradeHistory/qtum_usdt
https://data.gate.io/api2/1/tradeHistory/ltc_usdt
https://data.gate.io/api2/1/tradeHistory/dash_usdt
https://data.gate.io/api2/1/tradeHistory/zec_usdt
https://data.gate.io/api2/1/tradeHistory/btm_usdt
https://data.gate.io/api2/1/tradeHistory/eos_usdt
https://data.gate.io/api2/1/tradeHistory/req_usdt
https://data.gate.io/api2/1/tradeHistory/snt_usdt
https://data.gate.io/api2/1/tradeHistory/omg_usdt
https://data.gate.io/api2/1/tradeHistory/pay_usdt
https://data.gate.io/api2/1/tradeHistory/cvc_usdt
https://data.gate.io/api2/1/tradeHistory/zrx_usdt
https://data.gate.io/api2/1/tradeHistory/tnt_usdt
https://data.gate.io/api2/1/tradeHistory/xmr_usdt
https://data.gate.io/api2/1/tradeHistory/xrp_usdt
https://data.gate.io/api2/1/tradeHistory/doge_usdt
https://data.gate.io/api2/1/tradeHistory/bat_usdt
https://data.gate.io/api2/1/tradeHistory/pst_usdt
https://data.gate.io/api2/1/tradeHistory/btg_usdt
https://data.gate.io/api2/1/tradeHistory/dpy_usdt
https://data.gate.io/api2/1/tradeHistory/lrc_usdt
https://data.gate.io/api2/1/tradeHistory/storj_usdt
https://data.gate.io/api2/1/tradeHistory/rdn_usdt
https://data.gate.io/api2/1/tradeHistory/stx_usdt
https://data.gate.io/api2/1/tradeHistory/knc_usdt
https://data.gate.io/api2/1/tradeHistory/link_usdt
https://data.gate.io/api2/1/tradeHistory/cdt_usdt
https://data.gate.io/api2/1/tradeHistory/ae_usdt
https://data.gate.io/api2/1/tradeHistory/ae_eth
https://data.gate.io/api2/1/tradeHistory/ae_btc
https://data.gate.io/api2/1/tradeHistory/cdt_eth
https://data.gate.io/api2/1/tradeHistory/rdn_eth
https://data.gate.io/api2/1/tradeHistory/stx_eth
https://data.gate.io/api2/1/tradeHistory/knc_eth
https://data.gate.io/api2/1/tradeHistory/link_eth
https://data.gate.io/api2/1/tradeHistory/req_eth
https://data.gate.io/api2/1/tradeHistory/rcn_eth
https://data.gate.io/api2/1/tradeHistory/trx_eth
https://data.gate.io/api2/1/tradeHistory/arn_eth
https://data.gate.io/api2/1/tradeHistory/kick_eth
https://data.gate.io/api2/1/tradeHistory/bnt_eth
https://data.gate.io/api2/1/tradeHistory/ven_eth
https://data.gate.io/api2/1/tradeHistory/mco_eth
https://data.gate.io/api2/1/tradeHistory/fun_eth
https://data.gate.io/api2/1/tradeHistory/data_eth
https://data.gate.io/api2/1/tradeHistory/rlc_eth
https://data.gate.io/api2/1/tradeHistory/rlc_usdt
https://data.gate.io/api2/1/tradeHistory/zsc_eth
https://data.gate.io/api2/1/tradeHistory/wings_eth
https://data.gate.io/api2/1/tradeHistory/ctr_eth
https://data.gate.io/api2/1/tradeHistory/mda_eth
https://data.gate.io/api2/1/tradeHistory/rcn_usdt
https://data.gate.io/api2/1/tradeHistory/trx_usdt
https://data.gate.io/api2/1/tradeHistory/kick_usdt
https://data.gate.io/api2/1/tradeHistory/ven_usdt
https://data.gate.io/api2/1/tradeHistory/mco_usdt
https://data.gate.io/api2/1/tradeHistory/fun_usdt
https://data.gate.io/api2/1/tradeHistory/data_usdt
https://data.gate.io/api2/1/tradeHistory/zsc_usdt
https://data.gate.io/api2/1/tradeHistory/mda_usdt
https://data.gate.io/api2/1/tradeHistory/xtz_usdt
https://data.gate.io/api2/1/tradeHistory/gnt_usdt
https://data.gate.io/api2/1/tradeHistory/gnt_eth
https://data.gate.io/api2/1/tradeHistory/gem_usdt
https://data.gate.io/api2/1/tradeHistory/gem_eth
https://data.gate.io/api2/1/tradeHistory/rfr_usdt
https://data.gate.io/api2/1/tradeHistory/rfr_eth
https://data.gate.io/api2/1/tradeHistory/dadi_usdt
https://data.gate.io/api2/1/tradeHistory/dadi_eth
https://data.gate.io/api2/1/tradeHistory/abt_usdt
https://data.gate.io/api2/1/tradeHistory/abt_eth
https://data.gate.io/api2/1/tradeHistory/ledu_btc
https://data.gate.io/api2/1/tradeHistory/ledu_eth
https://data.gate.io/api2/1/tradeHistory/ost_usdt
https://data.gate.io/api2/1/tradeHistory/ost_eth
https://data.gate.io/api2/1/tradeHistory/xlm_usdt
https://data.gate.io/api2/1/tradeHistory/xlm_eth
https://data.gate.io/api2/1/tradeHistory/xlm_btc
https://data.gate.io/api2/1/tradeHistory/mobi_usdt
https://data.gate.io/api2/1/tradeHistory/mobi_eth
https://data.gate.io/api2/1/tradeHistory/mobi_btc
https://data.gate.io/api2/1/tradeHistory/ocn_usdt
https://data.gate.io/api2/1/tradeHistory/ocn_eth
https://data.gate.io/api2/1/tradeHistory/ocn_btc
https://data.gate.io/api2/1/tradeHistory/zpt_usdt
https://data.gate.io/api2/1/tradeHistory/zpt_eth
https://data.gate.io/api2/1/tradeHistory/zpt_btc
https://data.gate.io/api2/1/tradeHistory/cofi_usdt
https://data.gate.io/api2/1/tradeHistory/cofi_eth
https://data.gate.io/api2/1/tradeHistory/jnt_usdt
https://data.gate.io/api2/1/tradeHistory/jnt_eth
https://data.gate.io/api2/1/tradeHistory/jnt_btc
https://data.gate.io/api2/1/tradeHistory/blz_usdt
https://data.gate.io/api2/1/tradeHistory/blz_eth
https://data.gate.io/api2/1/tradeHistory/gxs_usdt
https://data.gate.io/api2/1/tradeHistory/gxs_btc
https://data.gate.io/api2/1/tradeHistory/mtn_usdt
https://data.gate.io/api2/1/tradeHistory/mtn_eth
https://data.gate.io/api2/1/tradeHistory/ruff_usdt
https://data.gate.io/api2/1/tradeHistory/ruff_eth
https://data.gate.io/api2/1/tradeHistory/ruff_btc
https://data.gate.io/api2/1/tradeHistory/tnc_usdt
https://data.gate.io/api2/1/tradeHistory/tnc_eth
https://data.gate.io/api2/1/tradeHistory/tnc_btc
https://data.gate.io/api2/1/tradeHistory/zil_usdt
https://data.gate.io/api2/1/tradeHistory/zil_eth
https://data.gate.io/api2/1/tradeHistory/tio_usdt
https://data.gate.io/api2/1/tradeHistory/tio_eth
https://data.gate.io/api2/1/tradeHistory/bto_usdt
https://data.gate.io/api2/1/tradeHistory/bto_eth
https://data.gate.io/api2/1/tradeHistory/theta_usdt
https://data.gate.io/api2/1/tradeHistory/theta_eth
https://data.gate.io/api2/1/tradeHistory/ddd_usdt
https://data.gate.io/api2/1/tradeHistory/ddd_eth
https://data.gate.io/api2/1/tradeHistory/ddd_btc
https://data.gate.io/api2/1/tradeHistory/mkr_usdt
https://data.gate.io/api2/1/tradeHistory/mkr_eth
https://data.gate.io/api2/1/tradeHistory/dai_usdt
https://data.gate.io/api2/1/tradeHistory/smt_usdt
https://data.gate.io/api2/1/tradeHistory/smt_eth
https://data.gate.io/api2/1/tradeHistory/mdt_usdt
https://data.gate.io/api2/1/tradeHistory/mdt_eth
https://data.gate.io/api2/1/tradeHistory/mdt_btc
https://data.gate.io/api2/1/tradeHistory/mana_usdt
https://data.gate.io/api2/1/tradeHistory/mana_eth
https://data.gate.io/api2/1/tradeHistory/lun_usdt
https://data.gate.io/api2/1/tradeHistory/lun_eth
https://data.gate.io/api2/1/tradeHistory/salt_usdt
https://data.gate.io/api2/1/tradeHistory/salt_eth
https://data.gate.io/api2/1/tradeHistory/fuel_usdt
https://data.gate.io/api2/1/tradeHistory/fuel_eth
https://data.gate.io/api2/1/tradeHistory/elf_usdt
https://data.gate.io/api2/1/tradeHistory/elf_eth
https://data.gate.io/api2/1/tradeHistory/drgn_usdt
https://data.gate.io/api2/1/tradeHistory/drgn_eth
https://data.gate.io/api2/1/tradeHistory/gtc_usdt
https://data.gate.io/api2/1/tradeHistory/gtc_eth
https://data.gate.io/api2/1/tradeHistory/gtc_btc
https://data.gate.io/api2/1/tradeHistory/qlc_usdt
https://data.gate.io/api2/1/tradeHistory/qlc_btc
https://data.gate.io/api2/1/tradeHistory/qlc_eth
https://data.gate.io/api2/1/tradeHistory/dbc_usdt
https://data.gate.io/api2/1/tradeHistory/dbc_btc
https://data.gate.io/api2/1/tradeHistory/dbc_eth
https://data.gate.io/api2/1/tradeHistory/bnty_usdt
https://data.gate.io/api2/1/tradeHistory/bnty_eth
https://data.gate.io/api2/1/tradeHistory/lend_usdt
https://data.gate.io/api2/1/tradeHistory/lend_eth
https://data.gate.io/api2/1/tradeHistory/icx_usdt
https://data.gate.io/api2/1/tradeHistory/icx_eth
https://data.gate.io/api2/1/tradeHistory/btf_usdt
https://data.gate.io/api2/1/tradeHistory/btf_btc
https://data.gate.io/api2/1/tradeHistory/ada_usdt
https://data.gate.io/api2/1/tradeHistory/ada_btc
https://data.gate.io/api2/1/tradeHistory/lsk_usdt
https://data.gate.io/api2/1/tradeHistory/lsk_btc
https://data.gate.io/api2/1/tradeHistory/waves_usdt
https://data.gate.io/api2/1/tradeHistory/waves_btc
https://data.gate.io/api2/1/tradeHistory/bifi_usdt
https://data.gate.io/api2/1/tradeHistory/bifi_btc
https://data.gate.io/api2/1/tradeHistory/mds_eth
https://data.gate.io/api2/1/tradeHistory/mds_usdt
https://data.gate.io/api2/1/tradeHistory/dgd_usdt
https://data.gate.io/api2/1/tradeHistory/dgd_eth
https://data.gate.io/api2/1/tradeHistory/qash_usdt
https://data.gate.io/api2/1/tradeHistory/qash_eth
https://data.gate.io/api2/1/tradeHistory/qash_btc
https://data.gate.io/api2/1/tradeHistory/powr_usdt
https://data.gate.io/api2/1/tradeHistory/powr_eth
https://data.gate.io/api2/1/tradeHistory/powr_btc
https://data.gate.io/api2/1/tradeHistory/fil_usdt
https://data.gate.io/api2/1/tradeHistory/bcd_usdt
https://data.gate.io/api2/1/tradeHistory/bcd_btc
https://data.gate.io/api2/1/tradeHistory/sbtc_usdt
https://data.gate.io/api2/1/tradeHistory/sbtc_btc
https://data.gate.io/api2/1/tradeHistory/god_usdt
https://data.gate.io/api2/1/tradeHistory/god_btc
https://data.gate.io/api2/1/tradeHistory/bcx_usdt
https://data.gate.io/api2/1/tradeHistory/bcx_btc
https://data.gate.io/api2/1/tradeHistory/hsr_usdt
https://data.gate.io/api2/1/tradeHistory/hsr_btc
https://data.gate.io/api2/1/tradeHistory/hsr_eth
https://data.gate.io/api2/1/tradeHistory/qsp_usdt
https://data.gate.io/api2/1/tradeHistory/qsp_eth
https://data.gate.io/api2/1/tradeHistory/ink_btc
https://data.gate.io/api2/1/tradeHistory/ink_usdt
https://data.gate.io/api2/1/tradeHistory/ink_eth
https://data.gate.io/api2/1/tradeHistory/ink_qtum
https://data.gate.io/api2/1/tradeHistory/med_qtum
https://data.gate.io/api2/1/tradeHistory/med_eth
https://data.gate.io/api2/1/tradeHistory/med_usdt
https://data.gate.io/api2/1/tradeHistory/bot_qtum
https://data.gate.io/api2/1/tradeHistory/bot_usdt
https://data.gate.io/api2/1/tradeHistory/bot_eth
https://data.gate.io/api2/1/tradeHistory/qbt_qtum
https://data.gate.io/api2/1/tradeHistory/qbt_eth
https://data.gate.io/api2/1/tradeHistory/qbt_usdt
https://data.gate.io/api2/1/tradeHistory/tsl_qtum
https://data.gate.io/api2/1/tradeHistory/tsl_usdt
https://data.gate.io/api2/1/tradeHistory/gnx_usdt
https://data.gate.io/api2/1/tradeHistory/gnx_eth
https://data.gate.io/api2/1/tradeHistory/neo_usdt
https://data.gate.io/api2/1/tradeHistory/gas_usdt
https://data.gate.io/api2/1/tradeHistory/neo_btc
https://data.gate.io/api2/1/tradeHistory/gas_btc
https://data.gate.io/api2/1/tradeHistory/iota_usdt
https://data.gate.io/api2/1/tradeHistory/iota_btc
https://data.gate.io/api2/1/tradeHistory/nas_usdt
https://data.gate.io/api2/1/tradeHistory/nas_eth
https://data.gate.io/api2/1/tradeHistory/nas_btc
https://data.gate.io/api2/1/tradeHistory/eth_btc
https://data.gate.io/api2/1/tradeHistory/etc_btc
https://data.gate.io/api2/1/tradeHistory/etc_eth
https://data.gate.io/api2/1/tradeHistory/zec_btc
https://data.gate.io/api2/1/tradeHistory/dash_btc
https://data.gate.io/api2/1/tradeHistory/ltc_btc
https://data.gate.io/api2/1/tradeHistory/bch_btc
https://data.gate.io/api2/1/tradeHistory/btg_btc
https://data.gate.io/api2/1/tradeHistory/qtum_btc
https://data.gate.io/api2/1/tradeHistory/qtum_eth
https://data.gate.io/api2/1/tradeHistory/xrp_btc
https://data.gate.io/api2/1/tradeHistory/doge_btc
https://data.gate.io/api2/1/tradeHistory/xmr_btc
https://data.gate.io/api2/1/tradeHistory/zrx_btc
https://data.gate.io/api2/1/tradeHistory/zrx_eth
https://data.gate.io/api2/1/tradeHistory/dnt_eth
https://data.gate.io/api2/1/tradeHistory/dpy_eth
https://data.gate.io/api2/1/tradeHistory/oax_eth
https://data.gate.io/api2/1/tradeHistory/rep_eth
https://data.gate.io/api2/1/tradeHistory/lrc_eth
https://data.gate.io/api2/1/tradeHistory/lrc_btc
https://data.gate.io/api2/1/tradeHistory/pst_eth
https://data.gate.io/api2/1/tradeHistory/bcdn_eth
https://data.gate.io/api2/1/tradeHistory/bcdn_usdt
https://data.gate.io/api2/1/tradeHistory/tnt_eth
https://data.gate.io/api2/1/tradeHistory/snt_eth
https://data.gate.io/api2/1/tradeHistory/snt_btc
https://data.gate.io/api2/1/tradeHistory/btm_eth
https://data.gate.io/api2/1/tradeHistory/btm_btc
https://data.gate.io/api2/1/tradeHistory/llt_eth
https://data.gate.io/api2/1/tradeHistory/snet_eth
https://data.gate.io/api2/1/tradeHistory/snet_usdt
https://data.gate.io/api2/1/tradeHistory/llt_snet
https://data.gate.io/api2/1/tradeHistory/omg_eth
https://data.gate.io/api2/1/tradeHistory/omg_btc
https://data.gate.io/api2/1/tradeHistory/pay_eth
https://data.gate.io/api2/1/tradeHistory/pay_btc
https://data.gate.io/api2/1/tradeHistory/bat_eth
https://data.gate.io/api2/1/tradeHistory/bat_btc
https://data.gate.io/api2/1/tradeHistory/cvc_eth
https://data.gate.io/api2/1/tradeHistory/storj_eth
https://data.gate.io/api2/1/tradeHistory/storj_btc
https://data.gate.io/api2/1/tradeHistory/eos_eth
https://data.gate.io/api2/1/tradeHistory/eos_btc
https://data.gate.io/api2/1/tradeHistory/bts_usdt
https://data.gate.io/api2/1/tradeHistory/bts_btc
https://data.gate.io/api2/1/tradeHistory/tips_eth
https://data.gate.io/api2/1/tradeHistory/xmc_usdt
https://data.gate.io/api2/1/tradeHistory/xmc_btc
https://data.gate.io/api2/1/tradeHistory/cs_eth
https://data.gate.io/api2/1/tradeHistory/cs_usdt
https://data.gate.io/api2/1/tradeHistory/man_eth
https://data.gate.io/api2/1/tradeHistory/man_usdt
https://data.gate.io/api2/1/tradeHistory/rem_eth
https://data.gate.io/api2/1/tradeHistory/rem_usdt
https://data.gate.io/api2/1/tradeHistory/lym_eth
https://data.gate.io/api2/1/tradeHistory/lym_btc
https://data.gate.io/api2/1/tradeHistory/lym_usdt
https://data.gate.io/api2/1/tradeHistory/instar_eth
https://data.gate.io/api2/1/tradeHistory/ont_eth
https://data.gate.io/api2/1/tradeHistory/ont_usdt
https://data.gate.io/api2/1/tradeHistory/bft_eth
https://data.gate.io/api2/1/tradeHistory/bft_usdt
https://data.gate.io/api2/1/tradeHistory/iht_eth
https://data.gate.io/api2/1/tradeHistory/iht_usdt
https://data.gate.io/api2/1/tradeHistory/senc_eth
https://data.gate.io/api2/1/tradeHistory/senc_usdt
https://data.gate.io/api2/1/tradeHistory/tomo_eth
https://data.gate.io/api2/1/tradeHistory/tomo_usdt
https://data.gate.io/api2/1/tradeHistory/elec_eth
https://data.gate.io/api2/1/tradeHistory/elec_usdt
https://data.gate.io/api2/1/tradeHistory/ship_eth
https://data.gate.io/api2/1/tradeHistory/tfd_eth
https://data.gate.io/api2/1/tradeHistory/hav_eth
https://data.gate.io/api2/1/tradeHistory/hav_usdt
https://data.gate.io/api2/1/tradeHistory/hur_eth
https://data.gate.io/api2/1/tradeHistory/lst_eth
https://data.gate.io/api2/1/tradeHistory/lino_eth
https://data.gate.io/api2/1/tradeHistory/swth_eth
https://data.gate.io/api2/1/tradeHistory/swth_usdt
https://data.gate.io/api2/1/tradeHistory/lrn_eth
https://data.gate.io/api2/1/tradeHistory/lrn_usdt
https://data.gate.io/api2/1/tradeHistory/dock_usdt
https://data.gate.io/api2/1/tradeHistory/dock_eth
https://data.gate.io/api2/1/tradeHistory/red_usdt
https://data.gate.io/api2/1/tradeHistory/red_eth
https://data.gate.io/api2/1/tradeHistory/lba_usdt
https://data.gate.io/api2/1/tradeHistory/lba_eth
https://data.gate.io/api2/1/tradeHistory/kan_usdt
https://data.gate.io/api2/1/tradeHistory/kan_eth
https://data.gate.io/api2/1/tradeHistory/mith_usdt
https://data.gate.io/api2/1/tradeHistory/mith_eth
https://data.gate.io/api2/1/tradeHistory/skm_usdt
https://data.gate.io/api2/1/tradeHistory/skm_eth
https://data.gate.io/api2/1/tradeHistory/xvg_usdt
https://data.gate.io/api2/1/tradeHistory/xvg_btc
https://data.gate.io/api2/1/tradeHistory/nano_usdt
https://data.gate.io/api2/1/tradeHistory/nano_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",
		"rate":"1000",
		"leftAmount":"0",
		"filledAmount":"0.1",
		"filledRate":"800.00",
		"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",
		"rate":"1000",
		"leftAmount":"0",
		"filledAmount":"0.1",
		"filledRate":"800.00",
		"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
currencyPair currency pair ltc_btc

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', urldecode($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/orderBook/'.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 withdraw($currency, $amount, $address) {

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

function get_order($order_number, $currency_pair) {

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

function cancel_order($order_number, $currency_pair) {

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

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, $pair));

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

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

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

}
?>