public OrderAndPositionViewModel() { _eventaggregator = ServiceLocator.Current.GetInstance<EventAggregator>(); _logger = ServiceLocator.Current.GetInstance<ILoggerFacade>(); _configmanager = ServiceLocator.Current.GetInstance<IConfigManager>() as ConfigManager; _ordertracker = new OrderTracker(_configmanager.DailyOrderCapacity); _ordertracker.SendDebugEvent += OnDebug; _positiontracker = new PositionTracker(_configmanager.DailyOrderCapacity); _eventaggregator.GetEvent<InitialPositionEvent>().Subscribe(ClientGotInitialPosition); //_eventaggregator.GetEvent<SendOrderEvent>().Subscribe(ClientGotOrder); _eventaggregator.GetEvent<OrderConfirmationEvent>().Subscribe(ClientGotOrder); _eventaggregator.GetEvent<OrderCancelConfirmationEvent>().Subscribe(ClientGotOrderCancelConfirmation); _eventaggregator.GetEvent<OrderFillEvent>().Subscribe(ClientGotOrderFilled); _eventaggregator.GetEvent<GenerateReportEvent>().Subscribe(GeneratePerformanceReport); _resultstable.Columns.Add("Statistics"); _resultstable.Columns.Add("Result"); }
public override void Reset(bool popup = true) { _positiontracker = new PositionTracker(_symbols.Count); _barlisttracker = new BarListTracker(_symbols.ToArray(), new int[] { _higherbarinterval, _lowerbarinterval }); _barlisttracker.GotNewBar += _barlisttracker_GotNewBar; _ordertracker = new OrderTracker(10000); // in the none zone _isOBOSZone = Enumerable.Repeat<OBOSZone>(OBOSZone.None, _symbols.Count).ToArray(); // neither bull or bear _isHigherTimeFrameBullBear = Enumerable.Repeat<BullBearTrend>(BullBearTrend.None, _symbols.Count).ToArray(); // all are active _issymbolactive = Enumerable.Repeat<bool>(true, _symbols.Count).ToArray(); // none are filled _waittobefilled = Enumerable.Repeat<bool>(false, _symbols.Count).ToArray(); _currentorderids = Enumerable.Repeat<long>(0L, _symbols.Count).ToArray(); _entrylevel = Enumerable.Repeat<decimal>(0m, _symbols.Count).ToArray(); _exitlevel = Enumerable.Repeat<decimal>(0m, _symbols.Count).ToArray(); _transactions = 0; _currenttime = 0; }