Merge pull request #1201 from Gwill/refine_ctp_gateway

优化 ctp 股票期权 tick 数据获取
This commit is contained in:
vn.py 2018-10-30 12:51:38 +08:00 committed by GitHub
commit 82efb56b63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 2 deletions

View File

@ -4,6 +4,15 @@ cache: pip
python:
- 2.7
- 3.6
before_install:
- sudo apt install build-essential
- wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
- tar -xzf ta-lib-0.4.0-src.tar.gz
- cd ta-lib/
- ./configure --prefix=/usr
- make
- sudo make install
- cd ..
install:
- pip install -r requirements.txt
- pip install flake8 # pytest # add another testing frameworks later

View File

@ -376,9 +376,33 @@ class CtpMdApi(MdApi):
tick.askVolume1 = data['AskVolume1']
# 大商所日期转换
if tick.exchange is EXCHANGE_DCE:
if tick.exchange == EXCHANGE_DCE:
tick.date = datetime.now().strftime('%Y%m%d')
# 上交所SEE股票期权相关
if tick.exchange == EXCHANGE_SSE:
tick.bidPrice2 = data['BidPrice2']
tick.bidVolume2 = data['BidVolume2']
tick.askPrice2 = data['AskPrice2']
tick.askVolume2 = data['AskVolume2']
tick.bidPrice3 = data['BidPrice3']
tick.bidVolume3 = data['BidVolume3']
tick.askPrice3 = data['AskPrice3']
tick.askVolume3 = data['AskVolume3']
tick.bidPrice4 = data['BidPrice4']
tick.bidVolume4 = data['BidVolume4']
tick.askPrice4 = data['AskPrice4']
tick.askVolume4 = data['AskVolume4']
tick.bidPrice5 = data['BidPrice5']
tick.bidVolume5 = data['BidVolume5']
tick.askPrice5 = data['AskPrice5']
tick.askVolume5 = data['AskVolume5']
tick.date = data['TradingDay']
self.gateway.onTick(tick)
#----------------------------------------------------------------------