Exemplo n.º 1
0
 private static int getContractID(EClientSocket client, EWrapperImpl Allture, TradeBooks Book, int m, int leg, string sectype, string exchange)
 {
     Allture.checkContractEnd = false;
     client.reqContractDetails(20010, ContractSamples.Contract_Options(Book.symbol[m], sectype, Book.expiration[m], Book.CallPut[m], leg, Book.multipler[m].ToString(), exchange));
     //Thread.Sleep(sleep1);
     while (!Allture.checkContractEnd)
     {
         Thread.Sleep(200);
     }
     Console.WriteLine("contract_ID: " + Allture.contract_ID + "\n");
     return(Allture.contract_ID);
 }
Exemplo n.º 2
0
        private static double getSpreadPremium(EClientSocket client, EWrapperImpl Allture, TradeBooks Book, int m, double LegS, double LegB, string sectype, string exchange)
        {
            double LegB_price, LegS_price;

            client.reqMktData(3011, ContractSamples.Contract_Options(Book.symbol[m], sectype, Book.expiration[m], Book.CallPut[m], LegB, Book.multipler[m].ToString(), exchange), string.Empty, false, false, null);
            Thread.Sleep(1000);
            client.cancelMktData(3011);
            LegB_price = Allture.ask_price;
            Console.WriteLine("legB ask: " + LegB_price + "\n");

            client.reqMktData(3012, ContractSamples.Contract_Options(Book.symbol[m], sectype, Book.expiration[m], Book.CallPut[m], LegS, Book.multipler[m].ToString(), exchange), string.Empty, false, false, null);
            Thread.Sleep(1000);
            client.cancelMktData(3012);
            LegS_price = Allture.ask_price;
            Console.WriteLine("legS ask: " + LegS_price + "\n");

            return(LegS_price - LegB_price);
        }