From 325bc059477c7349feefd56efc2d3f3349be2ef3 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Fri, 1 Dec 2017 22:20:05 +0800 Subject: [PATCH] =?UTF-8?q?[Mod]=E4=BF=AE=E6=94=B9=E5=8E=9F=E9=93=BE?= =?UTF-8?q?=E8=A1=8C=E6=8E=A5=E5=8F=A3=E4=B8=BA=E6=96=B0=E7=9A=84LBANK?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/api/{lhang => lbank}/README.md | 8 ++++---- vnpy/api/lbank/__init__.py | 3 +++ vnpy/api/{lhang => lbank}/test.py | 4 ++-- vnpy/api/{lhang/vnlhang.py => lbank/vnlbank.py} | 6 +++--- vnpy/api/lhang/__init__.py | 3 --- .../trader/app/optionMaster/uiOmAnalysisManager.py | 1 - .../LBANK_connect.json} | 0 .../{lhangGateway => lbankGateway}/__init__.py | 8 ++++---- .../lbankGateway.py} | 14 +++++++------- 9 files changed, 23 insertions(+), 24 deletions(-) rename vnpy/api/{lhang => lbank}/README.md (75%) create mode 100644 vnpy/api/lbank/__init__.py rename vnpy/api/{lhang => lbank}/test.py (94%) rename vnpy/api/{lhang/vnlhang.py => lbank/vnlbank.py} (98%) delete mode 100644 vnpy/api/lhang/__init__.py rename vnpy/trader/gateway/{lhangGateway/LHANG_connect.json => lbankGateway/LBANK_connect.json} (100%) rename vnpy/trader/gateway/{lhangGateway => lbankGateway}/__init__.py (50%) rename vnpy/trader/gateway/{lhangGateway/lhangGateway.py => lbankGateway/lbankGateway.py} (98%) diff --git a/vnpy/api/lhang/README.md b/vnpy/api/lbank/README.md similarity index 75% rename from vnpy/api/lhang/README.md rename to vnpy/api/lbank/README.md index aaf7d942..eb7e9784 100644 --- a/vnpy/api/lhang/README.md +++ b/vnpy/api/lbank/README.md @@ -1,16 +1,16 @@ -# vn.lhang +# vn.lbank ### 简介 -链行的比特币交易接口,基于Rest API开发。 +LBank的比特币交易接口,基于Rest API开发。 ### 特点 -vn.lhang的一些特点: +该接口的一些特点: 1. 面向对象的API设计,接近CTP API的结构,对于国内用户而言更容易上手 2. 参考CTP API的设计,主动函数调用的结果通过异步(回调函数)的方式推送到程序中,适用于开发稳定可靠的实盘交易程序 ### API版本 -日期:2017 - 02 +日期:2017 - 12 来源:链行官方API交流群 325248096 \ No newline at end of file diff --git a/vnpy/api/lbank/__init__.py b/vnpy/api/lbank/__init__.py new file mode 100644 index 00000000..e16e0806 --- /dev/null +++ b/vnpy/api/lbank/__init__.py @@ -0,0 +1,3 @@ +# encoding: UTF-8 + +from vnlbank import LbankApi \ No newline at end of file diff --git a/vnpy/api/lhang/test.py b/vnpy/api/lbank/test.py similarity index 94% rename from vnpy/api/lhang/test.py rename to vnpy/api/lbank/test.py index 717cb2b2..540e7476 100644 --- a/vnpy/api/lhang/test.py +++ b/vnpy/api/lbank/test.py @@ -2,7 +2,7 @@ from time import time, sleep -from vnlhang import LhangApi +from vnlbank import LbankApi if __name__ == '__main__': @@ -10,7 +10,7 @@ if __name__ == '__main__': secretKey = '' # 创建API对象并初始化 - api = LhangApi() + api = LbankApi() api.DEBUG = True api.init(apiKey, secretKey, 2) diff --git a/vnpy/api/lhang/vnlhang.py b/vnpy/api/lbank/vnlbank.py similarity index 98% rename from vnpy/api/lhang/vnlhang.py rename to vnpy/api/lbank/vnlbank.py index 644c9dd1..2c3fd5e4 100644 --- a/vnpy/api/lhang/vnlhang.py +++ b/vnpy/api/lbank/vnlbank.py @@ -10,7 +10,7 @@ from time import sleep -LHANG_API_ROOT ="https://api.lhang.com/v1/" +API_ROOT ="https://api.lbank.info/v1/" FUNCTION_TICKER = ('ticker.do', 'get') FUNCTION_DEPTH = ('depth.do', 'get') @@ -40,7 +40,7 @@ def signature(params, secretKey): ######################################################################## -class LhangApi(object): +class LbankApi(object): """""" DEBUG = True @@ -80,7 +80,7 @@ class LhangApi(object): # 读取方法和参数 api, method = req['function'] params = req['params'] - url = LHANG_API_ROOT + api + url = API_ROOT + api # 在参数中增加必须的字段 params['api_key'] = self.apiKey diff --git a/vnpy/api/lhang/__init__.py b/vnpy/api/lhang/__init__.py deleted file mode 100644 index 23159cfa..00000000 --- a/vnpy/api/lhang/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# encoding: UTF-8 - -from vnlhang import LhangApi \ No newline at end of file diff --git a/vnpy/trader/app/optionMaster/uiOmAnalysisManager.py b/vnpy/trader/app/optionMaster/uiOmAnalysisManager.py index 15199f35..e5bbacad 100644 --- a/vnpy/trader/app/optionMaster/uiOmAnalysisManager.py +++ b/vnpy/trader/app/optionMaster/uiOmAnalysisManager.py @@ -164,7 +164,6 @@ class AnalysisManager(QtWidgets.QWidget): for priceChange in priceChangeArray: for impvChange in impvChangeArray: - print priceChange, impvChange portfolioPnl = 0 portfolioDelta = 0 portfolioGamma = 0 diff --git a/vnpy/trader/gateway/lhangGateway/LHANG_connect.json b/vnpy/trader/gateway/lbankGateway/LBANK_connect.json similarity index 100% rename from vnpy/trader/gateway/lhangGateway/LHANG_connect.json rename to vnpy/trader/gateway/lbankGateway/LBANK_connect.json diff --git a/vnpy/trader/gateway/lhangGateway/__init__.py b/vnpy/trader/gateway/lbankGateway/__init__.py similarity index 50% rename from vnpy/trader/gateway/lhangGateway/__init__.py rename to vnpy/trader/gateway/lbankGateway/__init__.py index d07d4db8..d2d1cf2f 100644 --- a/vnpy/trader/gateway/lhangGateway/__init__.py +++ b/vnpy/trader/gateway/lbankGateway/__init__.py @@ -1,10 +1,10 @@ # encoding: UTF-8 from vnpy.trader import vtConstant -from lhangGateway import LhangGateway +from lbankGateway import LbankGateway -gatewayClass = LhangGateway -gatewayName = 'LHANG' -gatewayDisplayName = u'链行' +gatewayClass = lbankGateway +gatewayName = 'LBANK' +gatewayDisplayName = u'LBANK' gatewayType = vtConstant.GATEWAYTYPE_BTC gatewayQryEnabled = True diff --git a/vnpy/trader/gateway/lhangGateway/lhangGateway.py b/vnpy/trader/gateway/lbankGateway/lbankGateway.py similarity index 98% rename from vnpy/trader/gateway/lhangGateway/lhangGateway.py rename to vnpy/trader/gateway/lbankGateway/lbankGateway.py index 8e43d84d..8028e6b0 100644 --- a/vnpy/trader/gateway/lhangGateway/lhangGateway.py +++ b/vnpy/trader/gateway/lbankGateway/lbankGateway.py @@ -10,7 +10,7 @@ import json from datetime import datetime from time import sleep -from vnpy.api.lhang import LhangApi +from vnpy.api.lbank import LbankApi from vnpy.trader.vtGateway import * from vnpy.trader.vtFunction import getJsonPath @@ -37,15 +37,15 @@ STATUS_MAP[-1] = STATUS_CANCELLED ######################################################################## -class LhangGateway(VtGateway): +class LbankGateway(VtGateway): """链行接口""" #---------------------------------------------------------------------- - def __init__(self, eventEngine, gatewayName='LHANG'): + def __init__(self, eventEngine, gatewayName='LBANK'): """Constructor""" - super(LhangGateway, self).__init__(eventEngine, gatewayName) + super(LbankGateway, self).__init__(eventEngine, gatewayName) - self.api = LhangApi(self) + self.api = LbankApi(self) self.fileName = self.gatewayName + '_connect.json' self.filePath = getJsonPath(self.fileName, __file__) @@ -150,13 +150,13 @@ class LhangGateway(VtGateway): ######################################################################## -class LhangApi(LhangApi): +class LbankApi(LbankApi): """""" #---------------------------------------------------------------------- def __init__(self, gateway): """Constructor""" - super(LhangApi, self).__init__() + super(LbankApi, self).__init__() self.gateway = gateway self.gatewayName = gateway.gatewayName