public static void Init() { Currency.Converter = new DefaultCurrencyConverter(); foreach (SmartQuant.Instruments.Instrument sq_instrument in SmartQuant.Instruments.InstrumentManager.Instruments) { OpenQuant.AddInstrument(sq_instrument); } SmartQuant.Instruments.InstrumentManager.InstrumentAdded += new InstrumentEventHandler(OpenQuant.SQInstrumentManager_InstrumentAdded); SmartQuant.Instruments.InstrumentManager.InstrumentRemoved += new InstrumentEventHandler(OpenQuant.SQInstrumentManager_InstrumentRemoved); foreach (SmartQuant.Instruments.Portfolio sq_portfolio in PortfolioManager.Portfolios) { OpenQuant.AddPortfolio(sq_portfolio); } PortfolioManager.PortfolioAdded += new PortfolioEventHandler(OpenQuant.SQ_PortfolioManager_PortfolioAdded); OpenQuant.InitOrders(); OrderManager.NewOrder += new OrderEventHandler(OpenQuant.SQ_OrderManager_NewOrder); OrderManager.OrderRemoved += new OrderEventHandler(OpenQuant.SQ_OrderManager_OrderRemoved); OrderManager.OrderListUpdated += new EventHandler(OpenQuant.SQ_OrderManager_OrderListUpdated); }
public static void Init() { FreeQuant.Instruments.Currency.Converter = new DefaultCurrencyConverter(); foreach (FreeQuant.Instruments.Instrument fq_instrument in FreeQuant.Instruments.InstrumentManager.Instruments) { OpenQuant.AddInstrument(fq_instrument); } FreeQuant.Instruments.InstrumentManager.InstrumentAdded += (e) => { OpenQuant.AddInstrument(e.Instrument); }; FreeQuant.Instruments.InstrumentManager.InstrumentRemoved += (e) => { OpenQuant.RemoveInstrument(e.Instrument); }; foreach (FreeQuant.Instruments.Portfolio sq_portfolio in PortfolioManager.Portfolios) { OpenQuant.AddPortfolio(sq_portfolio); } PortfolioManager.PortfolioAdded += (e) => { OpenQuant.AddPortfolio(e.Portfolio); }; OpenQuant.InitOrders(); OrderManager.NewOrder += (e) => { Order order; if (Map.FQ_OQ_Order.ContainsKey(e.Order)) { order = Map.FQ_OQ_Order[e.Order] as Order; } else { order = new Order(e.Order); Map.OQ_FQ_Order[order] = e.Order; Map.FQ_OQ_Order[e.Order] = order; } OpenQuant.orders.Add(order); }; OrderManager.OrderRemoved += (e) => { Order order = Map.FQ_OQ_Order[e.Order] as Order; OpenQuant.orders.Remove(order); Map.FQ_OQ_Order.Remove(e.Order); Map.OQ_FQ_Order.Remove(order); }; OrderManager.OrderListUpdated += (sender, e) => { OpenQuant.orders.Clear(); Map.OQ_FQ_Order.Clear(); Map.FQ_OQ_Order.Clear(); foreach (SingleOrder order1 in OrderManager.Orders.All) { Order order2 = new Order(order1); OpenQuant.orders.Add(order2); Map.OQ_FQ_Order[order2] = order1; Map.FQ_OQ_Order[order1] = order2; } }; }
private static void SQ_PortfolioManager_PortfolioAdded(PortfolioEventArgs args) { OpenQuant.AddPortfolio(args.Portfolio); }