2017-02-14 14:54:53 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
from time import time, sleep
|
|
|
|
|
|
|
|
from vnlhang import LhangApi
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2017-02-24 18:05:06 +00:00
|
|
|
apiKey = ''
|
|
|
|
secretKey = ''
|
2017-02-14 14:54:53 +00:00
|
|
|
|
|
|
|
# 创建API对象并初始化
|
|
|
|
api = LhangApi()
|
|
|
|
api.DEBUG = True
|
2017-02-24 18:05:06 +00:00
|
|
|
api.init(apiKey, secretKey, 2)
|
2017-02-14 14:54:53 +00:00
|
|
|
|
|
|
|
# 查询行情
|
|
|
|
api.getTicker('btc_cny')
|
|
|
|
|
|
|
|
# 查询深度
|
|
|
|
api.getDepth('btc_cny', '60', '1')
|
|
|
|
|
|
|
|
# 查询历史成交
|
|
|
|
#api.getTrades('btc_cny', '1', str(int(time())))
|
|
|
|
|
|
|
|
# 查询K线
|
|
|
|
#t = int(time())
|
|
|
|
#sleep(300)
|
|
|
|
#api.getKline('btc_cny', '20', 'minute1', str(t))
|
|
|
|
|
|
|
|
# 查询账户
|
|
|
|
#api.getUserInfo()
|
|
|
|
|
|
|
|
# 发送委托
|
|
|
|
#api.createOrder('btc_cny', 'sell', '8000', '0.001')
|
|
|
|
|
|
|
|
# 撤单
|
|
|
|
#api.cancelOrder('btc_cny', '725bd2da-73aa-419f-8090-f68488074e8f')
|
|
|
|
|
|
|
|
# 查询委托
|
|
|
|
#api.getOrdersInfo('btc_cny', '725bd2da-73aa-419f-8090-f68488074e8f')
|
|
|
|
|
|
|
|
# 查询委托历史
|
|
|
|
#api.getOrdersInfoHistory('btc_cny', '0', '1', '100')
|
|
|
|
|
|
|
|
# 阻塞
|
|
|
|
raw_input()
|