1. 所有交易对 API

返回所有系统支持的交易对

URL: https://api.ukex.com/api/index/pairs

示例

    
        	# Request
		GET: https://api.ukex.com/api/index/pairs
		# Response
    		["btc_gbp","eth_gbp","bch_gbp","ltc_gbp","btc_eur","eth_eur","ltc_eur","bch_eur",
			"btc_buc","eth_buc","ltc_buc","bch_buc","btc_usd","eth_usd","ltc_usd","bch_usd",
			"eth_btc","ltc_btc","bch_btc","ltc_eth","dero_btc","pivx_btc","sys_btc","ae_buc",
			"ae_btc","ae_eth","btm_btc"]
        

返回值说明

			eth_btc: 以太币对比特币交易
			etc_btc: 以太经典对比特币
			zec_btc: ZCash对比特币
			ltc_eth: 莱特币对以太币
	    

2. 交易市场订单参数 API

返回所有系统支持的交易市场的参数信息,包括交易费,最小下单量,价格精度等

URL: https://api.ukex.com/api/index/marketinfo

示例

    
        	# Request
		GET: https://api.ukex.com/api/index/marketinfo
		# Response
    		{
				"result": "true",
				"pairs": {
					"ltc_usd": {
						"decimal_places": "2",
						"amount_decimal_places": "2",
						"min_amount": "",
						"fee_buy": "0.1",
						"fee_sell": "0.1"
					},
					"btc_usd": {
						"decimal_places": "2",
						"amount_decimal_places": "2",
						"min_amount": "",
						"fee_buy": "0.1",
						"fee_sell": "0.1"
					},
					"eth_usd": {
						"decimal_places": "2",
						"amount_decimal_places": "2",
						"min_amount": "",
						"fee_buy": "0.1",
						"fee_sell": "0.1"
					}
				}
			}
        

返回值说明

			decimal_places: 价格小数点计算位数
			amount_decimal_places: 数量小数点计算位数
			min_amount: 最小交易额
			fee_buy: 买方手续费(eg 0.2 即千分之2)
			fee_sell: 卖方手续费
	    

3. 交易市场详情 API

返回所有系统支持的交易市场的详细行情和币种信息,包括币种名,市值,供应量,最新价格,涨跌趋势,价格曲线等

URL: https://api.ukex.com/api/index/marketlist

示例

    
        	# Request
		GET: https://api.ukex.com/api/index/marketlist
		# Response
			{
				"result": "true",
				"data": [{
					"no": 1,
					"symbol": "btc",
					"name": "BitCoin",
					"name_en": "BitCoin",
					"name_cn": "比特币",
					"pair": "btc_gbp",
					"rate": 5181.97,
					"vol_a": 439.93,
					"vol_b": 2215993.84,
					"curr_a": "btc",
					"curr_b": "gbp",
					"curr_suffix": "gbp",
					"rate_percent": 3.61,
					"trend": "up"
				}, {
					"no": 2,
					"symbol": "eth",
					"name": "ethereum",
					"name_en": "ethereum",
					"name_cn": "以太坊",
					"pair": "eth_gbp",
					"rate": 220.18,
					"vol_a": 475.6,
					"vol_b": 104718.06,
					"curr_a": "eth",
					"curr_b": "gbp",
					"curr_suffix": "gbp",
					"rate_percent": 0.18,
					"trend": "up"
				}]
			}
        

返回值说明

			symbol : 币种标识
			name: 币种名称
			name_en: 英文名称
			name_cn: 中文名称
			pair: 交易对
			rate: 当前价格
			vol_a: 被兑换货币交易量
			vol_b: 兑换货币交易量
			curr_a: 被兑换货币
			curr_b: 兑换货币
			curr_suffix: 货币类型后缀
			rate_percent: 涨跌百分百
			trend: 24小时趋势 up涨 down跌
	    

4. 所有交易行情 API

返回系统支持的所有交易对的 最新,最高,最低 交易行情和交易量

URL: https://api.ukex.com/api/index/tickers

示例

        	# Request
		GET: https://api.ukex.com/api/index/tickers
		# Response
			{
				"btc_gbp": {
					"result": "true",
					"last": 5187.78,
					"lowestAsk": "5231.18000000",
					"highestBid": "5146.37000000",
					"percentChange": 3.73,
					"baseVolume": 440.08,
					"quoteVolume": 2215993.84,
					"high24hr": 5348.25,
					"low24hr": 5021.97
				},
				"eth_gbp": {
					"result": "true",
					"last": 221.2,
					"lowestAsk": "223.05000000",
					"highestBid": "219.30000000",
					"percentChange": 0.65,
					"baseVolume": 473.91,
					"quoteVolume": 104718.06,
					"high24hr": 234.05,
					"low24hr": 213.63
				}
			}
        

返回值说明

			baseVolume: 交易量
			high24hr:24小时最高价
			highestBid:买方最高价
			last:最新成交价
			low24hr:24小时最低价
			lowestAsk:卖方最低价
			percentChange:涨跌百分比
			quoteVolume: 兑换货币交易量
	    

5. 单项交易行情 API

返回最新,最高,最低 交易行情和交易量

URL: https://api.ukex.com/api/index/ticker/[CURR_A]_[CURR_B]

请替换 [CURR_A] and [CURR_B] 为您需要查看的币种.

示例

        	# Request
		GET: https://api.ukex.com/api/index/ticker/btc_buc
		# Response
			{
				"result": "true",
				"last": 4580.0416,
				"lowestAsk": "4602.98160000",
				"highestBid": "4556.73100000",
				"percentChange": 4.55,
				"baseVolume": 125.8385,
				"quoteVolume": 566288.6824,
				"high24hr": 4684.9169,
				"low24hr": 4396.5712
			}
        

返回值说明

			baseVolume: 交易量
			high24hr:24小时最高价
			highestBid:买方最高价
			last:最新成交价
			low24hr:24小时最低价
			lowestAsk:卖方最低价
			percentChange:涨跌百分比
			quoteVolume: 兑换货币交易量
	    

6. 市场深度 API

返回当前市场深度(委托挂单),其中 asks 是委卖单, bids 是委买单

URL: https://api.ukex.com/api/index/orderBook/[CURR_A]_[CURR_B]

请替换 [CURR_A] and [CURR_B] 为您需要查看的币种.

示例

        	# Request
		GET: https://api.ukex.com/api/index/orderBook/btc_buc
		# Response
			{
				"result": "true",
				"asks": [
					[4619.0898, 0.5309],
					[4619.0293, 0.2133],
					[4618.9791, 0.2588],
					[4618.967, 0.6978],
					[4618.8481, 0.0667]
				],
				"bids": [
					[4544.5304, 0.5222],
					[4544.403, 0.2686],
					[4544.3563, 0.1184],
					[4544.2338, 0.0369],
					[4544.2162, 0.4002]
				]
			}
        

返回值说明

			asks :卖方深度
			bids :买方深度
	    

7. 历史成交记录 API

返回最新80条历史成交记录

URL: https://api.ukex.com/api/index/tradeHistory/[CURR_A]_[CURR_B]

请替换 [CURR_A] and [CURR_B] 为您需要查看的币种.

示例

        	# Request
		GET: https://api.ukex.com/api/index/tradeHistory/btc_buc
		# Response
			{
				"result": "true",
				"data": [{
					"tradeID": "14898485",
					"date": "2018-08-22 15:17:08",
					"type": "buy",
					"rate": "4582.0304",
					"amount": "0.4783",
					"total": "2191.58514032",
					"time_unix":"1534922228"
				}],
				"elapsed": "0.0126ms"
			}
        

返回值说明

			amount: 成交币种数量
			date: 订单时间
			rate: 币种单价
			total: 订单总额
			tradeID: tradeID
			type: 买卖类型, buy买 sell卖
	    

8. 所有货币

返回交易所所有币种充值提现信息

URL: https://api.ukex.com/api/index/currencies

示例

        	# Request
		GET: https://api.ukex.com/api/index/currencies
		# Response
			[{
				"name": "usd",
				"can_deposit": "1",
				"can_withdraw": "1",
				"min_withdrawal": "0.0001"
			}]
        

返回值说明

			name: 币种名称
			can_deposit: 是否允许充值 1:是 0:否
			can_withdraw: 是否允许提现 1:是 0:否
			min_withdrawal: 最小提现数量
	    

9. 自动交易 API

通过以下API,用户可以使用程序控制自动进行账号资金查询,下单交易,取消挂单。

请注意:请在您的程序中设置的HTTP请求头参数 Content-Type 为 application/x-www-form-urlencoded

用户首先要通过这个链接获取API接口身份认证用到的Key和Secret。 然后在程序中用Secret作为密码,通过SHA512加密方式签名需要POST给服务器的数据得到Sign,并在HTTPS

请求的Header部分传回Key和Sign。请参考以下接口说明和例子程序进行设置。


1.获取帐号资金余额API

API URL: https://api.ukex.com/api/private/balances

参数数据提交方式:POST

参数:无


示例

        	# Request
		POST: https://api.ukex.com/api/private/balances
		# Response
			{
				"result": "true",
				"available": {
					"BTC": "1000",
					"ETH": "968.8",
					"ETC": "0",
					},
				"locked": {
					"ETH": "1"
					}
			}
        

返回值说明

			available: 可用各币种资金余额
			locked: 冻结币种金额
	    

2.获取充值地址API

API URL: https://api.ukex.com/api/private/depositAddress

参数数据提交方式:POST

参数:

参数名 参数类型 必填 描述
currency String 币种 如(BTC, LTC)

示例

        	# Request
		POST: https://api.ukex.com/api/private/depositAddress
		# Response
			{
				"result": "true",
				"addr": "LPXtk1kWHioP62SzfqwKbYE3Z7Wt2ujYEc",
				"message": "Sucess",
				"code": 0
			}
        

返回值说明

			available: 可用各币种资金余额
			locked: 冻结币种金额
	    

3.获取充值提现历史API

API URL: https://api.ukex.com/api/private/depositsWithdrawals

参数数据提交方式:POST

参数:

参数名 参数类型 必填 描述
start String 起始UNIX时间(如 1469092370)
end String 终止UNIX时间(如 1469713981)

示例

        	# Request
		POST: https://api.ukex.com/api/private/depositsWithdrawals
		# Response
			{
				"result": "true",
				"deposits": [
						{
						"id": "c204730",
						"currency": "ETH",
						"address": "1111 1111 1111 1111 1111 1",
						"amount": "222.61",
						"txid": "210496",
						"timestamp": "1474962729",
						"status": "DONE"
						}
					],
				"withdraws": [
						{
						"currency": "ETC",
						"address": "addr2",
						"amount": "600000000",
						"txid": "2104963",
						"timestamp": "1469092378",
						"status": "DONE"
						}
					],
				"message": "Success"
			}
        

返回值说明

			deposits: 充值
			withdraws: 提现
			currency: 币种
			address: 充值/提现地址
			amount: 金额
			timestamp: 发起时间戳
			status: 记录状态 DONE:完成; CANCEL:取消; REQUEST:请求中
	    

4.下单交易买入API

API URL: https://api.ukex.com/api/private/buy

参数数据提交方式:POST

参数:

参数名 参数类型 必填 描述
currencyPair String 交易币种对(如ltc_btc,ltc_btc)
rate String 价格(如 1000)
amount String 交易量(如 10)

示例

        	# Request
		POST: https://api.ukex.com/api/private/buy
		# Response
			{
				"result":"true",
				"orderNumber":"123456",
				"code":"0",
				"message":"Success"
			}
        

返回值说明

			orderNumber: 订单单号
			code: 错误编号
			message:返回消息
			result:结果
	    

5.下单交易卖出API

API URL: https://api.ukex.com/api/private/sell

参数数据提交方式:POST

参数:

参数名 参数类型 必填 描述
currencyPair String 交易币种对(如ltc_btc,ltc_btc)
rate String 价格(如 1000)
amount String 交易量(如 10)

示例

        	# Request
		POST: https://api.ukex.com/api/private/sell
		# Response
			{
				"result":"true",
				"orderNumber":"123456",
				"code":"0",
				"message":"Success"
			}
        

返回值说明

			orderNumber: 订单单号
			code: 错误编号
			message:返回消息
			result:结果
	    

6.取消下单API

API URL: https://api.ukex.com/api/private/cancelOrder

参数数据提交方式:POST

参数:

参数名 参数类型 必填 描述
orderNumber String 下单单号
currencyPair String 交易币种对(如 ltc_btc)

示例

        	# Request
		POST: https://api.ukex.com/api/private/cancelOrder
		# Response
			{"result":"true","message":"Success"}
        

返回值说明

			result: 是否成功 true成功 false失败
			message: 提示消息
	    

7.取消多个下单API

API URL: https://api.ukex.com/api/private/cancelOrders

参数数据提交方式:POST

参数: 注意:orders_json,的json字符串用urlencode封装一次,避免json字符串无法正常解析

参数名 参数类型 必填 描述
orders_json String 下单单号和pair的json数据; 示例:[ { “orderNumber”:”7942422” “currencyPair”:”ltc_btc” }, { “orderNumber”:”7942423” “currencyPair”:”ltc_btc” } ]

示例

        	# Request
		POST: https://api.ukex.com/api/private/cancelOrders
		# Response
			{"result":"true","message":"Success"}
        

返回值说明

			result: 是否成功 true成功 false失败
			message: 提示消息
	    

8.取消所有下单API

API URL: https://api.ukex.com/api/private/cancelAllOrders

参数数据提交方式:POST

参数:

参数名 参数类型 必填 描述
type int 下单类型(0:卖出,1:买入,-1:不限制)
currencyPair String 交易币种对 (示例:ltc_btc)

示例

        	# Request
		POST: https://api.ukex.com/api/private/cancelAllOrders
		# Response
			{"result":"true","message":"Success"}
        

返回值说明

			result: 是否成功 true成功 false失败
			message: 提示消息
	    

9.获取下单状态API

API URL: https://api.ukex.com/api/private/getOrder

参数数据提交方式:POST

参数:

参数名 参数类型 必填 描述
orderNumber int 下单单号
currencyPair String 交易币种对 (示例:ltc_btc)

示例

        	# Request
		POST: https://api.ukex.com/api/private/getOrder
		# Response
			{
				"result":"true",
				"order":{
					"orderNumber":"15088",
					"status":"cancelled",
					"currencyPair":"eth_btc",
					"type":"sell",
					"amount":"0.39901357",
					"initialRate":811,
					"initialAmount":"1"
					},
				"message":"Success"
			}
        

返回值说明

			status: 订单状态 cancelled已取消 done已完成
			currencyPair: 交易对
			type: 买卖类型 sell卖出, buy买入
			rate: 价格
			amount: 未成交数量
			initialRate: 下单价格
			initialAmount: 下单量
			orderNumber: 下单单号
	    

10.获取我的当前挂单列表API

API URL: https://api.ukex.com/api/private/openOrders

参数数据提交方式:POST

参数:

参数名 参数类型 必填 描述
currencyPair String 交易币种对(如:eth_btc)

示例

        	# Request
		POST: https://api.ukex.com/api/private/openOrders
		# Response
			{
				"result": "true", "message": "Success", "code": 0,"elapsed": "6.262ms",
				"orders": [
						{
						"orderNumber": "30032151",
						"type": "buy",
						"amount": "0.0936",
						"total": "2000",
						"initialRate": 21367.521367521,
						"initialAmount": "0.0936",
						"filledAmount": 0,
						"currencyPair": "eth_btc",
						"timestamp": "1407828913",
						"status": "open"
						}
					]
				}
        

返回值说明

			amount: 订单总数量 剩余未成交数量
			currencyPair: 订单交易对
			filledAmount: 已成交量
			initialAmount: 下单量
			initialRate: 下单价格
			orderNumber: 订单号
			status: 订单状态
			timestamp: 时间戳
			total: 总计
			type: 买卖类型 buy:买入;sell:卖出
	    

11.获取我的24小时内成交记录API

API URL: https://api.ukex.com/api/private/tradeHistory

参数数据提交方式:POST

参数:

参数名 参数类型 必填 描述
currencyPair String 交易币种对(如:eth_btc)
orderNumber int 订单号
page int 当前页数,默认:1
limit int 每页数量 默认:1000

示例

        	# Request
		POST: https://api.ukex.com/api/private/tradeHistory
		# Response
			{
				"result": "true",
				"message": "Success",
				"trades": [
						{
						"id": "7942422",
						"orderid": "38100491",
						"pair": "ltc_btc",
						"type": "buy",
						"rate": "0.01719",
						"amount": "0.0588",
						"time": "06-12 02:49:11",
						"time_unix": "1402512551"
						}
					]
			}
        

返回值说明

			id: 成交id
			orderid: 委托订单id
			pair: 交易对
			type: 买卖类型
			rate: 买卖价格
			amount: 订单买卖币种数量
			time: 订单时间
			time_unix: 订单unix时间戳
	    

12.提现API

API URL: https://api.ukex.com/api/private/withdraw

参数数据提交方式:POST

参数:

参数名 参数类型 必填 描述
currency string 提现币种(如:btc)
amount string 提现数量
address string 提现地址(如:1HkxtBAMrA3tP5ENnYY2CZortjZvFDH5Cssa)

示例

        	# Request
		POST: https://api.ukex.com/api/private/withdraw
		# Response
			 {"result": "true",  "message": "Success"}
        

返回值说明

			result: 是否成功 true申请成功 false申请失败
			message: 提示消息
	    

13.获取充值地址API

API URL: https://api.ukex.com/api/private/depositAddress

参数数据提交方式:POST

参数:

参数名 参数类型 必填 描述
currency string 提现币种(如:btc)

示例

        	# Request
		POST: https://api.ukex.com/api/private/depositAddress
		# Response
			{
				"result": "true",
				"addr": "LPXtk1kWHioP62SzfqwKbYE3Z7Wt2ujYEc",
				"message": "Sucess",
				"code": 0
			}
        

返回值说明

			addr: 钱包地址
	    

10. API请求说明

使用地址 https://api.ukex.com

获取地址:https://www.ukex.com/user/apiKey

Secret作为密码,通过SHA512加密方式签名需要POST给服务器的数据得到Sign,并在HTTPS请求的Header部分传回Key和Sign

PHP请求示例

			$post_data = http_build_query($req, ‘’, ‘&’);
			$sign = hash_hmac(‘sha512’, $post_data, $secret);
			$headers = array(
			‘KEY: ‘.$key,
			‘SIGN: ‘.$sign
			);
			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; bvmall PHP bot; ‘.php_uname(‘a’).’; PHP/‘.phpversion().’)’);
			}
        
			curl_setopt($ch, CURLOPT_URL, https://api.ukex.com/api/'.$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);
			$res = curl_exec($ch);

			返回值说明:返回数据类型默认json result 为状态, true 为成功, false为失败
		
			签名样例参考:
			apiKey:kcdfCheY-9WWQ-dkQE-OSn5-cd2OAQEmiUj0MSDE
			secret:bd123bffa3e4ebfc1a7e8e5d0a9be029a40002cc
			请求url:http://api.ukex.com/api/private/getOrder
			请求参数:orderNumber=210041&currencyPair=eth_buc
			签名sign结果:ddace0792aca13c86271d1c643e63eaf2ecfc6fa0c25e4005293ac561bdcf20037ed2ce90011c292c636e4011ce1aa2d8142dc73962f11fd1e77b153bcb2566e