def Init(self): """ <summary> Initialize TT API </summary> """ # Use "Universal Login" Login Mode h = ttapi.ApiInitializeHandler(self.ttApiInitComplete) ttapi.TTAPI.CreateUniversalLoginTTAPI(ttapi.Dispatcher.Current, self.m_username, self.m_password,h)
def Init(self): """ <summary> Initialize TT API </summary> """ # Use "Universal Login" Login Mode h = ttapi.ApiInitializeHandler(self.ttApiInitComplete) ttapi.TTAPI.CreateXTraderModeTTAPI(ttapi.Dispatcher.Current, h)
clr.AddReference('C:\\tt\\ttapi\\bin\\TradingTechnologies.TTAPI') import TradingTechnologies.TTAPI as ttapi help(ttapi) ttapi.XTraderModeTTAPI print(ttapi.XTraderModeTTAPI) ttapi.XTraderModeTTAPI.Start() ttapi.XTraderModeTTAPI.StartFillFeed ttapi.XTraderModeTTAPI.StartFillFeed() help(ttapi.Dispatcher) disp = ttapi.Dispatcher.AttachWorkerDispatcher() disp.BeginInvoke(new Action(Init)) disp.BeginInvoke(Action(Init)) disp.BeginInvoke(Action) disp.BeginInvoke() disp = ttapi.Dispatcher.AttachUIDispatcher() h=ttapi.ApiInitializeHandler() h=ttapi.ApiInitializeHandler(ttapi.FillUpdateFlag) ttapi.XTraderModeTTAPIOptions.StartOrderFillFeed() ttapi.XTraderModeTTAPI.ConnectionStatusUpdate() ttapi.XTraderModeTTAPI.CreateXTraderModeTTAPI(disp,h) ttapi.XTraderModeTTAPI.ConnectionStatusUpdate() star = ttapi.XTraderModeTTAPI.CreateXTraderModeTTAPI(disp,h) star = ttapi.XTraderModeTTAPI.Start() ttapi.Session() ttapi.XTraderModeTTAPI.ConnectionStatusUpdate() ttapi.XTraderModeTTAPI.m_UserName() ttapi.XTraderModeTTAPI.Shutdown()
self.m_req.Update -= self.m_req_Update self.m_req.Dispose() self.m_req = None if (self.m_ps != None): self.m_ps.FieldsUpdated -= self.m_ps_FieldsUpdated self.m_ps.Dispose() self.m_ps = None #Begin shutdown the TT API ttapi.TTAPI.ShutdownCompleted += self.TTAPI_ShutdownCompleted ttapi.TTAPI.Shutdown() self.m_disposed = True # Unattached callbacks and dispose of all subscriptions # Begin shutdown the TT API def TTAPI_ShutdownCompleted(self, sender, e): """ <summary> Event notification for completion of TT API shutdown </summary> """ # Shutdown the Dispatcher if self.m_disp != None: self.m_disp.BeginInvokeShutdown() self.m_disp = None with ttapi.Dispatcher.AttachUIDispatcher() as disp: tr = TTAPIReadForm() m_handler = ttapi.ApiInitializeHandler(tr.ttApiInitHandler) ttapi.TTAPI.CreateXTraderModeTTAPI(disp, m_handler) Application.Run(tr)
def loginBtn_eventhandler(self, sender, event): ##tf = TTAPIFunctions("CHOODTS","12345678") name = sender.Name self.m_disp = ttapi.Dispatcher.AttachUIDispatcher() self.m_handler = ttapi.ApiInitializeHandler(tr.ttApiInitHandler) ttapi.TTAPI.CreateXTraderModeTTAPI(self.m_disp, self.m_handler)