//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Initialize the API </summary> //////////////////////////////////////////////////////////////////////////////////////////////////// public void Init(tt_net_sdk.TTAPIOptions apiConfig) { ApiInitializeHandler apiInitializeHandler = new ApiInitializeHandler(ttNetApiInitHandler); TTAPI.ShutdownCompleted += TTAPI_ShutdownCompleted; TTAPI.CreateTTAPI(tt_net_sdk.Dispatcher.Current, apiConfig, apiInitializeHandler); }
static void Main() { using (Dispatcher disp = Dispatcher.AttachUIDispatcher()) { Application.EnableVisualStyles(); // Create an instance of the API MarketExplorer marketExplorer = new MarketExplorer(); // Add your app secret Key here. It looks like: 00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000 string appSecretKey = "Add your app secret Key here"; // Add the host machine instance id assigned to you by TT only needed for Server mode. If set in // Client mode, it will simply be ignored string instanceId = "Add your host machine instance id here"; // Set the environment the app needs to run in here tt_net_sdk.ServiceEnvironment environment = tt_net_sdk.ServiceEnvironment.UatCert; // Select the mode in which you wish to run -- Client (outside the TT datacenter) // or Server (on a dedicated machine inside TT datacenter) tt_net_sdk.TTAPIOptions.SDKMode sdkMode = tt_net_sdk.TTAPIOptions.SDKMode.Client; tt_net_sdk.TTAPIOptions apiConfig = new tt_net_sdk.TTAPIOptions( sdkMode, environment, appSecretKey, 5000); // set the instance id and any other options needed apiConfig.ServerInstanceId = instanceId; ApiInitializeHandler handler = new ApiInitializeHandler(marketExplorer.ttNetApiInitHandler); TTAPI.CreateTTAPI(disp, apiConfig, handler); Application.Run(marketExplorer); } }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Attach the worker Dispatcher</summary> //////////////////////////////////////////////////////////////////////////////////////////////////// public void Start(tt_net_sdk.TTAPIOptions apiConfig) { m_disp = tt_net_sdk.Dispatcher.AttachWorkerDispatcher(); m_disp.DispatchAction(() => { Init(apiConfig); }); m_disp.Run(); }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Initialize the API </summary> //////////////////////////////////////////////////////////////////////////////////////////////////// public void Init(tt_net_sdk.TTAPIOptions apiConfig) { ApiInitializeHandler apiInitializeHandler = new ApiInitializeHandler(ttNetApiInitHandler); TTAPI.ShutdownCompleted += TTAPI_ShutdownCompleted; //For Algo Orders apiConfig.AlgoUserDisconnectAction = UserDisconnectAction.Cancel; TTAPI.CreateTTAPI(tt_net_sdk.Dispatcher.Current, apiConfig, apiInitializeHandler); }
static void Main() { using (Dispatcher disp = Dispatcher.AttachUIDispatcher()) { Application.EnableVisualStyles(); // Create an instance of the API MarketExplorer marketExplorer = new MarketExplorer(); // Add your app secret Key here. It looks like: 00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000 string appSecretKey = "Add your app secret Key here"; tt_net_sdk.ServiceEnvironment environment = tt_net_sdk.ServiceEnvironment.UatCert; tt_net_sdk.TTAPIOptions apiConfig = new tt_net_sdk.TTAPIOptions(environment, appSecretKey, 5000); ApiInitializeHandler handler = new ApiInitializeHandler(marketExplorer.ttNetApiInitHandler); TTAPI.CreateTTAPI(disp, apiConfig, handler); Application.Run(marketExplorer); } }
static void Main() { using (Dispatcher disp = Dispatcher.AttachUIDispatcher()) { Application.EnableVisualStyles(); // Create an instance of the API MarketExplorer marketExplorer = new MarketExplorer(); // Add your app secret Key here. It looks like: 00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000 string appSecretKey = "240bc7e6-ba70-b3eb-b99c-28b34865525b:91ecb109-b5fc-5eaf-96ab-af8539b8fd5a"; tt_net_sdk.ServiceEnvironment environment = tt_net_sdk.ServiceEnvironment.DevCert; tt_net_sdk.TTAPIOptions apiConfig = new tt_net_sdk.TTAPIOptions(environment, appSecretKey, 5000); ApiInitializeHandler handler = new ApiInitializeHandler(marketExplorer.ttNetApiInitHandler); TTAPI.CreateTTAPI(disp, apiConfig, handler); Application.Run(marketExplorer); } }