2015-01-24 2 views
0

대화 형 중개인과 함께 사용하는 작은 Python 프로그램이 있습니다. RTVolume을 사용하여 시간, 가격 및 수량을 요청하고 싶습니다. 여기 내 코드의 작은 발췌 문장입니다. 누구든지 RTVolume에 대한 요청을 포함시키는 방법을 알려줄 수 있습니까?IB를 사용하여 RTVolume을 요청하는 방법 py

클래스 BerryWrapper (EWrapper) :

def __init__(self): 

    pass 

def tickPrice(self, tickerId, field, price, canAutoExecute): 

    with open('log_me.txt','a') as file: 

     if (field == 4): 

      print 'Last[%s,%s,%s]' % (tickerId, price, canAutoExecute) 

      file.write('Last[%s,%s,%s]' % (tickerId, price, canAutoExecute)) 

     elif (field == 1): 

      print 'Bid[%s,%s,%s]' % (tickerId, price, canAutoExecute) 

      file.write('Bid[%s,%s,%s]' % (tickerId, price, canAutoExecute)) 

     elif (field == 2): 

      print 'Ask[%s,%s,%s]' % (tickerId, price, canAutoExecute) 

      file.write('Ask[%s,%s,%s]' % (tickerId, price, canAutoExecute)) 


def tickString(self, tickerId, tickType, value): 
    if (tickType == 45): 
     tod = strftime("%H:%M:%S", localtime(float(value))) 
     print('TickTime[%s, %s]' % (tickerId, tod)) 
     with open('log_me.txt','a') as file: 
      file.write('TickTime[%s, %s]'+'\r\n' % (tickerId, tod)) 

은 단순히 추가하는 방법은 무엇입니까?

def RTVolume(self, price, size, time, volume, VWAP, flag) 

답변

0

RTVolume를 요청하려면 다음과 같은 형식으로 요청을 발급해야합니다 (스냅 샷, "233"REQID, 계약)

eClientSocket.reqMktData을

관련 문제