예제 #1
0
 /// <summary>
 /// Persist the received Trade Object
 /// </summary>
 /// <param name="trade">Trade to be stored</param>
 private void PersistTrade(Trade trade)
 {
     try
     {
         // Persist Trade
         PersistencePublisher.PublishDataForPersistence(trade);
     }
     catch (Exception exception)
     {
         Logger.Error(exception, _type.FullName, "PersistTrade");
     }
 }
예제 #2
0
        /// <summary>
        /// Called when Custom Strategy receives requested order accepted message
        /// </summary>
        /// <param name="order">Accepted Order details</param>
        private void OnOrderAccepted(Order order)
        {
            //OrderDetails orderDetails = new OrderDetails();
            //orderDetails.ID = order.OrderID;
            ////orderDetails.Price = order.;
            //orderDetails.Quantity = order.OrderSize;
            //orderDetails.Side = order.OrderSide;
            ////orderDetails.Type = order.;
            //orderDetails.Status = order.OrderStatus;

            //// Update UI
            //AddOrderDetails(orderDetails);

            PersistencePublisher.PublishDataForPersistence(order);
        }
예제 #3
0
        /// <summary>
        /// Called when Custom Strategy receives notification from Order Cancellation
        /// </summary>
        /// <param name="order">Contains cancelled order information</param>
        private void OnCancellationReceived(Order order)
        {
            OrderDetails orderDetails = new OrderDetails(order.OrderExecutionProvider);

            orderDetails.ID       = order.OrderID;
            orderDetails.Security = order.Security;
            orderDetails.Quantity = order.OrderSize;
            orderDetails.Side     = order.OrderSide;
            orderDetails.Time     = order.OrderDateTime;
            orderDetails.Status   = order.OrderStatus;

            // Update UI
            AddOrderDetails(orderDetails);

            // Handle Persistence
            PersistencePublisher.PublishDataForPersistence(order);
        }
예제 #4
0
        /// <summary>
        /// Called when Custom Strategy receives new execution message
        /// </summary>
        /// <param name="execution">Contains Execution Info</param>
        private void OnNewExecutionReceived(Execution execution)
        {
            // Update Stats
            OrderDetails orderDetails = new OrderDetails(execution.OrderExecutionProvider);

            orderDetails.ID       = execution.Fill.OrderId;
            orderDetails.Security = execution.Fill.Security;
            orderDetails.Price    = execution.Fill.ExecutionPrice;
            orderDetails.Quantity = execution.Fill.ExecutionSize;
            orderDetails.Side     = execution.Fill.ExecutionSide;
            orderDetails.Status   = execution.Order.OrderStatus;
            orderDetails.Time     = execution.Fill.ExecutionDateTime;

            // Update UI
            AddOrderDetails(orderDetails);

            PersistencePublisher.PublishDataForPersistence(execution.Fill);
            PersistencePublisher.PublishDataForPersistence(execution.Order);
        }
예제 #5
0
 /// <summary>
 /// Called when New order status received from <see cref="OrderExecutor"/>
 /// </summary>
 /// <param name="order"></param>
 private void OnOrderExecutorNewArrived(Order order)
 {
     _tradeHubStrategy.NewArrived(order);
     PersistencePublisher.PublishDataForPersistence(order);
 }
예제 #6
0
 /// <summary>
 /// Called when Executions received from <see cref="OrderExecutor"/>
 /// </summary>
 /// <param name="execution"></param>
 private void OnOrderExecutorExecutionArrived(Execution execution)
 {
     _tradeHubStrategy.ExecutionArrived(execution);
     PersistencePublisher.PublishDataForPersistence(execution.Fill);
     PersistencePublisher.PublishDataForPersistence(execution.Order);
 }