2017-12-10 12:52:43 +00:00
|
|
|
|
# encoding: UTF-8
|
|
|
|
|
|
2018-05-07 17:25:06 +00:00
|
|
|
|
from __future__ import absolute_import
|
|
|
|
|
from .vnokex import *
|
2017-12-10 12:52:43 +00:00
|
|
|
|
|
|
|
|
|
# 在OkCoin网站申请这两个Key,分别对应用户名和密码
|
|
|
|
|
apiKey = '你的accessKey'
|
|
|
|
|
secretKey = '你的secretKey'
|
|
|
|
|
|
|
|
|
|
# 创建API对象
|
2017-12-16 07:14:25 +00:00
|
|
|
|
api = OkexSpotApi()
|
2017-12-10 12:52:43 +00:00
|
|
|
|
|
2017-12-16 07:14:25 +00:00
|
|
|
|
api.connect(apiKey, secretKey, True)
|
2017-12-10 12:52:43 +00:00
|
|
|
|
|
|
|
|
|
sleep(3)
|
|
|
|
|
|
|
|
|
|
#api.login()
|
2017-12-18 01:37:31 +00:00
|
|
|
|
api.subscribeSpotTicker("bch_btc")
|
|
|
|
|
api.subscribeSpotDepth("bch_btc")
|
|
|
|
|
api.subscribeSpotDepth("bch_btc", 5)
|
|
|
|
|
api.subscribeSpotDeals("bch_btc")
|
|
|
|
|
api.subscribeSpotKlines("bch_btc","30min")
|
2017-12-10 12:52:43 +00:00
|
|
|
|
|
2017-12-18 01:37:31 +00:00
|
|
|
|
#api.spotTrade("etc_usdt","sell", "50" , "0.01")
|
2017-12-10 12:52:43 +00:00
|
|
|
|
#api.spotCancelOrder("etc_btc","44274138")
|
|
|
|
|
#api.spotUserInfo()
|
|
|
|
|
#api.spotOrderInfo("etc_btc", 44284731)
|
|
|
|
|
|
2017-12-16 07:14:25 +00:00
|
|
|
|
# api = OkexFuturesApi()
|
|
|
|
|
# api.connect(apiKey, secretKey, True)
|
2017-12-10 12:52:43 +00:00
|
|
|
|
|
|
|
|
|
# sleep(3)
|
|
|
|
|
#api.subsribeFutureTicker("btc","this_week")
|
2017-12-18 01:37:31 +00:00
|
|
|
|
#api.subscribeFutureKline("btc","this_week", "30min")
|
2017-12-10 12:52:43 +00:00
|
|
|
|
#api.subscribeFutureDepth("btc","this_week")
|
2017-12-18 01:37:31 +00:00
|
|
|
|
#api.subscribeFutureDepth("btc","this_week", 5)
|
2017-12-10 12:52:43 +00:00
|
|
|
|
#api.subscribeFutureTrades("btc","this_week")
|
|
|
|
|
#api.subscribeFutureIndex("btc")
|
|
|
|
|
#api.subscribeFutureForecast_price("btc")
|
|
|
|
|
|
|
|
|
|
#api.login()
|
|
|
|
|
#api.futureTrade( "etc_usd", "this_week" ,"1" , 20 , 1 , _match_price = '0' , _lever_rate = '10') # 14245727693
|
|
|
|
|
#api.futureCancelOrder("etc_usd","14245727693" , "this_week")
|
|
|
|
|
#api.futureUserInfo()
|
|
|
|
|
#api.futureOrderInfo("etc_usd" , "14245727693" , "this_week" , '1', '1' , '10')
|
|
|
|
|
# api.subscribeFutureTrades()
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
合约账户信息、 持仓信息等,在登录后都会自动推送。。。官方文档这样写的,还没实际验证过
|
2017-12-18 01:37:31 +00:00
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
input()
|