/// <summary> /// Initializes necessary order execution components required for backtesting /// </summary> private void InitializeBacktestingOrderComponents() { // Initialze Utility Classes to manage backtesting order executions _orderExecutor = ContextRegistry.GetContext()["OrderExecutor"] as IOrderExecutor; _orderRequestListener = new OrderRequestListener(_orderExecutor, _asyncClassLogger); //Register OrderExecutor Events RegisterOrderExecutorEvents(); }
/// <summary> /// Argument Constructor /// </summary> /// <param name="strategyKey">Unique Key to Identify the Strategy Instance</param> /// <param name="strategyType">C# Class Type which implements TradeHubStrategy.cs</param> /// <param name="ctorArguments">Holds selected ctor arguments to execute strategy</param> public StrategyExecutor(string strategyKey, Type strategyType, object[] ctorArguments) { //_asyncClassLogger = ContextRegistry.GetContext()["StrategyRunnerLogger"] as AsyncClassLogger; _asyncClassLogger = new AsyncClassLogger("StrategyExecutor"); { _asyncClassLogger.SetLoggingLevel(); //set logging path string path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\TradeHub Logs\\Client"; _asyncClassLogger.LogDirectory(path); } _tradeHubStrategy = null; _strategyKey = strategyKey; _strategyType = strategyType; _ctorArguments = ctorArguments; _strategyStatus = Infrastructure.Constants.StrategyStatus.None; // Initialize statistics _statistics = new Statistics(_strategyKey); // Initialze Utility Classes //_orderExecutor = new OrderExecutor(_asyncClassLogger); _orderExecutor = new OrderExecutorGeneric(); _marketDataListener = new MarketDataListener(_asyncClassLogger); _orderRequestListener = new OrderRequestListener(_orderExecutor, _asyncClassLogger); // Use MarketDataListener.cs as Event Handler to get data from DataHandler.cs _dataHandler = new DataHandler( new IEventHandler <TradeHub.Common.HistoricalDataProvider.ValueObjects.MarketDataObject>[] { _marketDataListener }); _marketDataListener.BarSubscriptionList = _dataHandler.BarSubscriptionList; _marketDataListener.TickSubscriptionList = _dataHandler.TickSubscriptionList; // Initialize MarketRequestListener.cs to manage incoming market data requests from strategy _marketRequestListener = new MarketRequestListener(_dataHandler, _asyncClassLogger); //Register OrderExecutor Events RegisterOrderExecutorEvents(); //Register Market Data Listener Events RegisterMarketDataListenerEvents(); }
/// <summary> /// Argument Constructor /// </summary> /// <param name="orderExecutor">Provides server side order management</param> /// <param name="asyncClassLogger"> </param> public OrderRequestListener(IOrderExecutor orderExecutor, AsyncClassLogger asyncClassLogger) { // Save Instance _orderExecutor = orderExecutor; _asyncClassLogger = asyncClassLogger; }
public OrderManager(IOrderExecutor orderExecutor) { _orderExecutor = orderExecutor; timer = new Timer(1000 * 50); }