- usingSystem;usingSystem.Collections.Generic;usingSystem.Web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingT4;usingT4.API;usingSystem.Xml;publicpartialclass_Default:
- System.Web.UI.Page{
- {protectedT4.API.HostmoAPI;protectedT4.API.ExchangeListmoExchanges;protectedbooldoneProcessing
- =
- false;protectedExchangemoExchange;protectedContractmoContract;protectedContractListmoContracts;protectedMarketmoMarket1;protectedMarketmoMarket2;protectedMarketListmoMarkets1Filter;protectedMarketListmoMarkets2Filter;protectedMarketListmoPickerMarkets;protectedMarketmoPickerMarket;protectedAccountListmoAccounts;protectedAccountmoAccount;protectedstringmstrMarketID1;protectedstringmstrMarketID2;protectedvoidPage_Load(objectsender,
- EventArgse)try{// Create the api host object. this.moAPI =
- newT4.API.Host("http://www.sim.t4login.com", APIServerType.Simulator,
- "T4Example", "112A04B0-5AAF-42F4-994E-FA7CB959C60B", "cts", "kcourtr",
- "kennet50");// Register the host events. this.moAPI.Connected +=
- newT4.API.Host.ConnectedEventHandler(moAPI_Connected);this.moAPI.Disconnected +=
- newT4.API.Host.DisconnectedEventHandler(moAPI_Disconnected);this.moAPI.LoginSuccess
- +=
- newT4.API.Host.LoginSuccessEventHandler(moAPI_LoginSuccess);this.moAPI.LoginFailure
- += newT4.API.Host.LoginFailureEventHandler(moAPI_LoginFailure);//
- this.moAPI.Dispose();}
- {
- txtStatus.Text += ex.Message;
- }
- {
- {
- }
- ticks++;
- System.Threading.
- }
- txtStatus.Text +=
- }
- {
- txtStatus.Text +=
- }
- {
- txtStatus.Text +=
- }
- {
- txtStatus.Text +=
- Response.Write(
- txtStatus.Text = moAPI.MarketData.ToString();
- moMarkets1Filter =
- moAPI.MarketData.CreateMarketFilter(catch(Exceptionex)this.doneProcessing =
- false;intticks = 0;while(!doneProcessing)if(ticks ==
- 50)break;Thread.Sleep(500);"\n\nFinished
- Processing.";privatevoidmoAPI_Connected()"Connected";privatevoidmoAPI_Disconnected(stringreason)"\nDisconnected:
- "+ reason;this.doneProcessing = true;privatevoidmoAPI_LoginSuccess()"\nLogged
- In";"Wtf mate.");"DL_30m", String.Empty);//D-30m:30Day FedFundmoMarkets2Filter =
- moAPI.MarketData.CreateMarketFilter(
- moMarkets1Filter.MarketListComplete +=
- moMarkets2Filter.MarketListComplete += "D_D",
- "N");newMarketList.MarketListCompleteEventHandler(moMarkets1Filter_MarketListComplete);newMarketList.MarketListCompleteEventHandler(moMarkets2Filter_MarketListComplete);//foreach
- (Exchange list in moAPI.MarketData.Exchanges)//{// txtStatus.Text += "\n
- exchangeID: " + list.ExchangeID;// list.Contracts.ContractListComplete += new
- ContractList.ContractListCompleteEventHandler(Contracts_ContractListComplete);//}
- {
- moMarkets1Filter_MarketListComplete(moMarkets1Filter);
- txtStatus.Text +=
- }if(moMarkets1Filter.Complete)"\n filter 1 complete.";else{
- txtStatus.Text +=
- }
- {
- moMarkets2Filter_MarketListComplete(moMarkets2Filter);
- txtStatus.Text +=
- }
- }
- {
- {
- txtStatus.Text +=
- }
- }
- {
- {"\n"+ moMarket1.ContractID;if(moMarkets2Filter.Complete)"\nfilter 2
- complete";voidContracts_ContractListComplete(ContractListpoContractList)foreach(Contractcontract
- inpoContractList)"\n ExchangeID: "+ contract.ExchangeID + " "+ "\n contractID:
- "+ contract.ContractID +
- contract.Description;voidmoMarkets1Filter_MarketListComplete(MarketListpoMarketList)foreach(MarketoMarket
- inpoMarketList)// txtStatus.Text += "\n 1" + oMarket.Description;}
- }
- {
- {voidmoMarkets2Filter_MarketListComplete(MarketListpoMarketList)foreach(MarketoMarket
- inpoMarketList)// txtStatus.Text += "\n 2 Description" + oMarket.LastDepth; }
- }
- {
- txtStatus.Text +=
- }
- }privatevoidmoAPI_LoginFailure(LoginResultpenReason)"\nFailed Login: "+
- penReason.ToString();this.doneProcessing = true;