Пример #1
0
        public void OrderFillExecutionPriceQueryTest()
        {
            IOrderRepository orderRespository = ContextRegistry.GetContext()["OrderRespository"] as IOrderRepository;
            var orderReportManager            = new OrderReportManager(orderRespository);

            var dataEventReceived = false;
            var manualDataEvent   = new ManualResetEvent(false);

            IList <object[]> report = null;
            var arguments           = new Dictionary <OrderParameters, string>();

            // Add Filter Parameters
            arguments.Add(OrderParameters.ExecutionPrice, "65");

            // Hook Data Event
            orderReportManager.DataReceived += delegate(IList <object[]> obj)
            {
                report            = obj;
                dataEventReceived = true;
                manualDataEvent.Set();
            };

            // Request Report Data
            orderReportManager.RequestReport(arguments);

            manualDataEvent.WaitOne(2000);

            Assert.IsNotNull(report);
            Assert.IsTrue(dataEventReceived, "Report Event");
            Assert.Greater(report.Count, 0, "Return Count");
        }
Пример #2
0
        public void OrderQueryTest()
        {
            IOrderRepository orderRespository = ContextRegistry.GetContext()["OrderRespository"] as IOrderRepository;
            var orderReportManager            = new OrderReportManager(orderRespository);

            var dataEventReceived = false;
            var manualDataEvent   = new ManualResetEvent(false);

            IList <object[]> report = null;
            var arguments           = new Dictionary <OrderParameters, string>();

            // Add Filter Parameters
            arguments.Add(OrderParameters.OrderSide, "BUY");
            //arguments.Add(OrderParameters.OrderStatus, "CANCELLED,OPEN,EXECUTED");
            //arguments.Add(OrderParameters.StartOrderDateTime, "2013-06-20 09:30:00");
            //arguments.Add(OrderParameters.EndOrderDateTime, "2013-06-20 09:31:00");
            //arguments.Add(OrderParameters.OrderSize, "13");

            // Hook Data Event
            orderReportManager.DataReceived += delegate(IList <object[]> obj)
            {
                report            = obj;
                dataEventReceived = true;
                manualDataEvent.Set();
            };

            // Request Report Data
            orderReportManager.RequestReport(arguments);

            manualDataEvent.WaitOne(200000);

            Assert.IsNotNull(report);
            Assert.IsTrue(dataEventReceived, "Report Event");
            Assert.Greater(report.Count, 0, "Return Count");
        }
        /// <summary>
        /// Argument Constructor
        /// </summary>
        /// <param name="orderReportManager">Provides Order Reporting Data</param>
        /// <param name="profitLossReportManager">Provides Profit Loss Reprot Data</param>
        /// <param name="communicator">Handles incoming requests and outgoing data</param>
        public ApplicationController(OrderReportManager orderReportManager, ProfitLossReportManager profitLossReportManager, ICommunicator communicator)
        {
            // Save References
            _communicator            = communicator;
            _orderReportManager      = orderReportManager;
            _profitLossReportManager = profitLossReportManager;

            // Register Communicator Events
            RegisterCommunicatorEvents();

            // Register Report Manager Events
            RegisterReportManagerEvents();
        }