|
我的憑證過期,所以顯示憑證無效,申請後重新連線,若正常會顯示正確的憑證代碼。
# -*- coding: UTF-8 -*-
#from win32com.client import CoClassBaseClass
import win32com.client.CLSIDToClass, pythoncom,pywintypes
import win32com.client.util
import win32event
import time
defaultNamedOptArg=pythoncom.Empty
defaultNamedNotOptArg=pythoncom.Empty
defaultUnnamedArg=pythoncom.Empty
class EventHandlers:
def __init__(self) :
self.event = win32event.CreateEvent(None, 0, 0, None)
#print ("Init")
return;
def OnLogonS(self, TLinkStatus=defaultNamedNotOptArg, AccList=defaultNamedNotOptArg, Casq=defaultNamedNotOptArg, Cast=defaultNamedNotOptArg):
win32event.SetEvent(self.event)
#print ("OnLogonS")
return;
def OnUserDefinsFuncResult(self, RowCount=defaultNamedNotOptArg, Results=defaultNamedNotOptArg, WorkID=defaultNamedNotOptArg):
win32event.SetEvent(self.event)
#print "OnUserDefinsFuncResult"
return;
yuanta=win32com.client.DispatchWithEvents("Yuanta.YuantaOrdCtrl.1",EventHandlers)
yuanta.SetFutOrdConnection("id","pw","api.yuantafutures.com.tw","80")
#yuanta.SendOrderF("01","0","F00","1234567","","","B","MXFB9","7900","1","","L","R","","")
pythoncom.PumpWaitingMessages()
------------------------------------------------------
20190209 12:31:52.086 YuantaOrd 1.6.1.3 for ActiveX control
20190209 12:31:52.086 Create
20190209 12:31:52.086 SetFutOrdConnection(A123456789,pw,api.yuantafutures.com.tw,80)
20190209 12:31:52.101 return: 3
20190209 12:31:52.554 OnLogonS(2,2-P0X-1234567--王小明,SN=9999AA9A,0)
|
|