Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 25th, 2012  |  syntax: None  |  size: 3.60 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. usingSystem;usingSystem.Collections.Generic;usingSystem.Web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingT4;usingT4.API;usingSystem.Xml;publicpartialclass_Default:
  2. System.Web.UI.Page{
  3.  
  4. {protectedT4.API.HostmoAPI;protectedT4.API.ExchangeListmoExchanges;protectedbooldoneProcessing
  5. =
  6. false;protectedExchangemoExchange;protectedContractmoContract;protectedContractListmoContracts;protectedMarketmoMarket1;protectedMarketmoMarket2;protectedMarketListmoMarkets1Filter;protectedMarketListmoMarkets2Filter;protectedMarketListmoPickerMarkets;protectedMarketmoPickerMarket;protectedAccountListmoAccounts;protectedAccountmoAccount;protectedstringmstrMarketID1;protectedstringmstrMarketID2;protectedvoidPage_Load(objectsender,
  7. EventArgse)try{// Create the api host object. this.moAPI =
  8. newT4.API.Host("http://www.sim.t4login.com", APIServerType.Simulator,
  9. "T4Example", "112A04B0-5AAF-42F4-994E-FA7CB959C60B", "cts", "kcourtr",
  10. "kennet50");// Register the host events.  this.moAPI.Connected +=
  11. newT4.API.Host.ConnectedEventHandler(moAPI_Connected);this.moAPI.Disconnected +=
  12. newT4.API.Host.DisconnectedEventHandler(moAPI_Disconnected);this.moAPI.LoginSuccess
  13. +=
  14. newT4.API.Host.LoginSuccessEventHandler(moAPI_LoginSuccess);this.moAPI.LoginFailure
  15. += newT4.API.Host.LoginFailureEventHandler(moAPI_LoginFailure);//
  16. this.moAPI.Dispose();}
  17. {
  18. txtStatus.Text += ex.Message;
  19. }
  20. {
  21. {
  22. }
  23. ticks++;
  24. System.Threading.
  25. }
  26. txtStatus.Text +=
  27. }
  28. {
  29. txtStatus.Text +=
  30. }
  31. {
  32. txtStatus.Text +=
  33. }
  34. {
  35. txtStatus.Text +=
  36. Response.Write(
  37. txtStatus.Text = moAPI.MarketData.ToString();
  38.  
  39. moMarkets1Filter =
  40. moAPI.MarketData.CreateMarketFilter(catch(Exceptionex)this.doneProcessing =
  41. false;intticks = 0;while(!doneProcessing)if(ticks ==
  42. 50)break;Thread.Sleep(500);"\n\nFinished
  43. Processing.";privatevoidmoAPI_Connected()"Connected";privatevoidmoAPI_Disconnected(stringreason)"\nDisconnected:
  44. "+ reason;this.doneProcessing = true;privatevoidmoAPI_LoginSuccess()"\nLogged
  45. In";"Wtf mate.");"DL_30m", String.Empty);//D-30m:30Day FedFundmoMarkets2Filter =
  46. moAPI.MarketData.CreateMarketFilter(
  47. moMarkets1Filter.MarketListComplete +=
  48. moMarkets2Filter.MarketListComplete += "D_D",
  49. "N");newMarketList.MarketListCompleteEventHandler(moMarkets1Filter_MarketListComplete);newMarketList.MarketListCompleteEventHandler(moMarkets2Filter_MarketListComplete);//foreach
  50. (Exchange list in moAPI.MarketData.Exchanges)//{// txtStatus.Text += "\n
  51. exchangeID: " + list.ExchangeID;// list.Contracts.ContractListComplete += new
  52. ContractList.ContractListCompleteEventHandler(Contracts_ContractListComplete);//}
  53.  
  54. {
  55. moMarkets1Filter_MarketListComplete(moMarkets1Filter);
  56. txtStatus.Text +=
  57. }if(moMarkets1Filter.Complete)"\n filter 1 complete.";else{
  58. txtStatus.Text +=
  59. }
  60. {
  61. moMarkets2Filter_MarketListComplete(moMarkets2Filter);
  62. txtStatus.Text +=
  63. }
  64.  
  65. }
  66. {
  67. {
  68. txtStatus.Text +=
  69. }
  70. }
  71. {
  72. {"\n"+ moMarket1.ContractID;if(moMarkets2Filter.Complete)"\nfilter 2
  73. complete";voidContracts_ContractListComplete(ContractListpoContractList)foreach(Contractcontract
  74. inpoContractList)"\n ExchangeID: "+ contract.ExchangeID + " "+ "\n contractID:
  75. "+ contract.ContractID +
  76. contract.Description;voidmoMarkets1Filter_MarketListComplete(MarketListpoMarketList)foreach(MarketoMarket
  77. inpoMarketList)// txtStatus.Text += "\n 1" + oMarket.Description;}
  78. }
  79. {
  80. {voidmoMarkets2Filter_MarketListComplete(MarketListpoMarketList)foreach(MarketoMarket
  81. inpoMarketList)// txtStatus.Text += "\n 2 Description" + oMarket.LastDepth; }
  82. }
  83.  
  84.  
  85.  
  86.  
  87. {
  88. txtStatus.Text +=
  89. }
  90. }privatevoidmoAPI_LoginFailure(LoginResultpenReason)"\nFailed Login: "+
  91. penReason.ToString();this.doneProcessing = true;