public void RequestBarIB(int routeId, int conId, DateTime endDate) { Contract histContract = new Contract { Symbol = DataRequests.GetSymbol(conId), ConId = conId, Exchange = "SMART", PrimaryExch = "ISLAND", SecType = "STK", Currency = "USD" }; Security tempSecurity = new Security { Symbol = DataRequests.GetSymbol(conId), ConId = conId, SecType = Security.SecurityType.STK, }; if (!BlackList.Contains(tempSecurity)) { int reqId = myRequests.NextReqId; myRequests.Add(reqId, routeId, conId, histContract.Symbol); string date = endDate.Date.AddDays(1).ToString("yyyyMMdd HH:mm:ss"); Program.myIB.ibClient.ClientSocket.reqHistoricalData(reqId, histContract, date, "1 D", "1 day", "TRADES", 1, 1, false, null); } }
/// <summary> /// Attempts to add a SecurityList to the database /// </summary> /// <param name="newSecurityList"></param> /// <returns></returns> public static int AddSecurityList(SecurityList newSecurityList) { int numberAdded = 0; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Log.Info(0, string.Format("Start AddList")); foreach (Security addSecurity in newSecurityList.Contracts) { if (DataRequests.GetSymbol(addSecurity.ConId) == null) { if (AddSecurity(addSecurity)) { numberAdded++; } } } stopwatch.Stop(); Log.Info(0, string.Format("End AddList - Added {0} Time={1}", numberAdded, stopwatch.Elapsed.TotalMilliseconds)); return(numberAdded); }