//Constructor public IBBrokerManager(RiskFilter r) { riskFilter = r; tickerIdsToProduct = new Dictionary<int, FlexTrade.Product>(); openOrders = new Dictionary<int, Krs.Ats.IBNet.Order>(); orderInputQueue = new List<Krs.Ats.IBNet.Order>(); openOrderContracts = new Dictionary<int, Krs.Ats.IBNet.Contract>(); ordersOrgFormat = new Dictionary<int, FlexTrade.Order>(); //The interface with Interactive Brokers is a singleton. We do this to control the message //flow. Having multiple client connections may be better for performance and should be //explored in the future. if (ibClient == null) { //Create the IB Client which is the main interface for interactining the broker system log.Info("Creating new IB Client object"); ibClient = new IBClient(); //We need to be listening for all of the events coming back from IB. This class will //catch all of the messages and exceptions for this broker so that other classes //don't need to be concerned with broker specific issues. ibClient.ThrowExceptions = true; ibClient.TickPrice += new EventHandler<TickPriceEventArgs>(priceChangeTick); ibClient.TickSize += new EventHandler<TickSizeEventArgs>(sizeChangeTick); ibClient.Error += new EventHandler<ErrorEventArgs>(errorReceived); ibClient.NextValidId += new EventHandler<NextValidIdEventArgs>(nextValidId); ibClient.ExecDetails += new EventHandler<ExecDetailsEventArgs>(fillReceived); ibClient.OpenOrder += new EventHandler<OpenOrderEventArgs>(openOrder); } }
private void GetMarginUtilisation(RiskEntityItem riskEntity) { // Create a new MarginUtilisationQuery muq = new MarginUtilisationQuery(null); // Create a new filter for the query // Please note that all the risk queries use the same filter RiskFilter filter = new RiskFilter(); // MarginUtilisation query filter requires an entity that should have beed // retrieved via the MarginUtilisation RiskEntityQuery. filter.AddFilterCriteria(RiskFilter.FilterBy.RiskEntity, riskEntity); // Provide a query handler and start the query. muq.QueryResponse += muq_QueryResponse; muq.Start(filter); }
public UnacceptableRiskException(RiskFilter s, List<String> m) { sender = s; riskFilterMessages = m; }