[Mod] update gateway document for using ConId as contract symbol at IB Gateway

This commit is contained in:
vn.py 2019-06-10 14:15:08 +08:00
parent 8f5f187fcd
commit a833576ebb
3 changed files with 27 additions and 21 deletions

View File

@ -71,23 +71,23 @@ def main():
## 接口分类
| 接口 |类型 |
| ------ | :------: |
| CTP | 期货 |
| FEMAS | 期货 |
| OES | 国内股票 |
| XTP | 国内股票、指数、基金、债券、期权、融资融券 |
| IB | 外盘股票、期货、期权 |
| TAP | 外盘股票、期货、期权 |
| FUTU | 国内股票、港股、美股 |
| TIGER | 国内股票、港股、美股 |
| BITFINEX | 数字货币 |
| BITMEX | 数字货币 |
| OKEX | 数字货币 |
| OKEXF | 数字货币 |
| HUOBI | 数字货币 |
| HBDM | 数字货币 |
| ONETOKEN | 数字货币 |
| 接口 | 类型 |
| -------- | :----------------------------------------: |
| CTP | 期货 |
| FEMAS | 期货 |
| OES | 国内股票 |
| XTP | 国内股票、指数、基金、债券、期权、融资融券 |
| IB | 外盘股票、期货、期权 |
| TAP | 外盘股票、期货、期权 |
| FUTU | 国内股票、港股、美股 |
| TIGER | 国内股票、港股、美股 |
| BITFINEX | 数字货币 |
| BITMEX | 数字货币 |
| OKEX | 数字货币 |
| OKEXF | 数字货币 |
| HUOBI | 数字货币 |
| HBDM | 数字货币 |
| ONETOKEN | 数字货币 |
@ -270,8 +270,11 @@ main_engine.add_gateway(IbGateway)
 
#### 其他特点
可交易品种几乎覆盖全球的股票、期权、期权;手续费相对较低。
注意IB接口的合约代码较为特殊请前往官网的产品查询板块查询VN Trader中使用的是盈透证券对于每个合约在某一交易所的唯一标识符ConId来作为合约代码而非Symbol或者LocalName。
 

View File

@ -5,7 +5,7 @@ from vnpy.trader.ui import MainWindow, create_qapp
# from vnpy.gateway.bitmex import BitmexGateway
# from vnpy.gateway.futu import FutuGateway
# from vnpy.gateway.ib import IbGateway
from vnpy.gateway.ib import IbGateway
# from vnpy.gateway.ctp import CtpGateway
# # from vnpy.gateway.ctptest import CtptestGateway
# from vnpy.gateway.femas import FemasGateway
@ -18,7 +18,7 @@ from vnpy.trader.ui import MainWindow, create_qapp
# from vnpy.gateway.okexf import OkexfGateway
# from vnpy.gateway.xtp import XtpGateway
# from vnpy.gateway.hbdm import HbdmGateway
from vnpy.gateway.tap import TapGateway
# from vnpy.gateway.tap import TapGateway
# from vnpy.app.cta_strategy import CtaStrategyApp
# from vnpy.app.csv_loader import CsvLoaderApp
@ -39,7 +39,7 @@ def main():
# main_engine.add_gateway(CtpGateway)
# # main_engine.add_gateway(CtptestGateway)
# main_engine.add_gateway(FemasGateway)
# main_engine.add_gateway(IbGateway)
main_engine.add_gateway(IbGateway)
# main_engine.add_gateway(FutuGateway)
# main_engine.add_gateway(BitmexGateway)
# main_engine.add_gateway(TigerGateway)
@ -50,7 +50,7 @@ def main():
# main_engine.add_gateway(OnetokenGateway)
# main_engine.add_gateway(OkexfGateway)
# main_engine.add_gateway(HbdmGateway)
main_engine.add_gateway(TapGateway)
# main_engine.add_gateway(TapGateway)
# main_engine.add_app(CtaStrategyApp)
# main_engine.add_app(CtaBacktesterApp)

View File

@ -416,6 +416,9 @@ class IbApi(EWrapper):
accountName,
)
if not contract.exchange:
return
ib_size = contract.multiplier
if not ib_size:
ib_size = 1