1、首先着手点 在 盈透的 stream tick 数据流
首先 查看 盈透api
tws api , IBpy , simpleClient , ib_insync , IbGateway
首先不管好坏 只要能实现 功能即可
2、通过查看 资料 总结以下代码
### 代码 借鉴云金杞 文章
### https://blog.youkuaiyun.com/qq_26948675/article/details/121733934?ops_request_misc=&request_id=&biz_id=102&utm_term=11tws%E5%92%8Cib&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-121733934.142^v59^js_top,201^v3^add_ask&spm=1018.2226.3001.4187
### SimpleClient 类来源于 云金杞
from datetime import datetime
from threading import Thread
import time
import sys
from ibapi.client import EClient, Contract
from ibapi.order import Order
from ibapi.wrapper import EWrapper
from ibapi.utils import iswrapper
class SimpleClient(EWrapper, EClient):
''' Serves as the client and the wrapper '''
def __init__(self, addr, port, client_id):
EWrapper.__init__(self)
EClient.__init__(self, self)
# 订单号
self.order_id = 0
# Connect to TWS
self.connect(addr, port, client_id)
# Launch the client thread
thread = Thread(target=self.run)
thread.start()
@iswrapper
def currentTime(self, cur_time):
t = datetime.fromtimestamp(cur_time)
print('Current time: {}'.format(t))
@iswrapper
def contractDetails(self, reqId, details):
print('Long name: {}'.format(details.longName))
print('Category: {}'.format(details.category))
print('Subcategory: {}'.format(details.subcategory))
print('Contract ID: {}\n&#