Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OrderModified"/> class.
        /// </summary>
        /// <param name="accountId">The event account identifier.</param>
        /// <param name="orderId">The event order identifier.</param>
        /// <param name="orderIdBroker">The event broker order identifier.</param>
        /// <param name="modifiedQuantity">The event order modified quantity.</param>
        /// <param name="modifiedPrice">The event order modified price.</param>
        /// <param name="modifiedTime">The event order modification accepted time.</param>
        /// <param name="eventId">The event identifier.</param>
        /// <param name="eventTimestamp">The event timestamp.</param>
        public OrderModified(
            AccountId accountId,
            OrderId orderId,
            OrderIdBroker orderIdBroker,
            Quantity modifiedQuantity,
            Price modifiedPrice,
            ZonedDateTime modifiedTime,
            Guid eventId,
            ZonedDateTime eventTimestamp)
            : base(
                orderId,
                EventType,
                eventId,
                eventTimestamp)
        {
            Debug.NotDefault(modifiedTime, nameof(modifiedTime));
            Debug.NotDefault(eventId, nameof(eventId));
            Debug.NotDefault(eventTimestamp, nameof(eventTimestamp));

            this.AccountId        = accountId;
            this.OrderIdBroker    = orderIdBroker;
            this.ModifiedQuantity = modifiedQuantity;
            this.ModifiedPrice    = modifiedPrice;
            this.ModifiedTime     = modifiedTime;
        }
        private OrderWorking GenerateOrderWorkingEvent(ExecutionReport message)
        {
            var orderId       = this.GetOrderId(message);
            var orderIdBroker = new OrderIdBroker(message.GetField(Tags.OrderID));
            var symbol        = this.GetSymbol(message.GetField(Tags.Symbol));
            var orderSide     = FxcmMessageHelper.GetOrderSide(message.GetField(Tags.Side));
            var orderType     = FxcmMessageHelper.GetOrderType(message.GetField(Tags.OrdType));
            var quantity      = Quantity.Create(message.GetDecimal(Tags.OrderQty));
            var price         = FxcmMessageHelper.GetOrderPrice(orderType, message);
            var timeInForce   = FxcmMessageHelper.GetTimeInForce(message.GetField(Tags.TimeInForce));
            var expireTime    = FxcmMessageHelper.GetExpireTime(message);
            var workingTime   = FxcmMessageHelper.ParseTimestamp(message.GetField(Tags.TransactTime));

            return(new OrderWorking(
                       this.accountId,
                       orderId,
                       orderIdBroker,
                       symbol,
                       orderSide,
                       orderType,
                       quantity,
                       price,
                       timeInForce,
                       expireTime,
                       workingTime,
                       this.NewGuid(),
                       this.TimeNow()));
        }
        private OrderAccepted GenerateOrderAcceptedEvent(ExecutionReport message)
        {
            var orderId       = this.GetOrderId(message);
            var orderIdBroker = new OrderIdBroker(message.GetField(Tags.OrderID));
            var acceptedTime  = FxcmMessageHelper.ParseTimestamp(message.GetField(Tags.TransactTime));

            return(new OrderAccepted(
                       this.accountId,
                       orderId,
                       orderIdBroker,
                       acceptedTime,
                       this.NewGuid(),
                       this.TimeNow()));
        }
        private OrderModified GenerateOrderModifiedEvent(ExecutionReport message)
        {
            var orderId       = this.GetOrderId(message);
            var orderIdBroker = new OrderIdBroker(message.GetField(Tags.OrderID));
            var orderType     = FxcmMessageHelper.GetOrderType(message.GetField(Tags.OrdType));
            var quantity      = message.IsSetField(Tags.LeavesQty)
                ? Quantity.Create(message.GetDecimal(Tags.LeavesQty))
                : Quantity.Create(message.GetDecimal(Tags.OrderQty));
            var price        = FxcmMessageHelper.GetOrderPrice(orderType, message);
            var modifiedTime = FxcmMessageHelper.ParseTimestamp(message.GetField(Tags.TransactTime));

            return(new OrderModified(
                       this.accountId,
                       orderId,
                       orderIdBroker,
                       quantity,
                       price,
                       modifiedTime,
                       this.NewGuid(),
                       this.TimeNow()));
        }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OrderAccepted"/> class.
        /// </summary>
        /// <param name="accountId">The event account identifier.</param>
        /// <param name="orderId">The event order identifier.</param>
        /// <param name="orderIdBroker">The event order identifier from the broker.</param>
        /// <param name="acceptedTime">The event accepted time.</param>
        /// <param name="eventId">The event identifier.</param>
        /// <param name="eventTimestamp">The event timestamp.</param>
        public OrderAccepted(
            AccountId accountId,
            OrderId orderId,
            OrderIdBroker orderIdBroker,
            ZonedDateTime acceptedTime,
            Guid eventId,
            ZonedDateTime eventTimestamp)
            : base(
                orderId,
                EventType,
                eventId,
                eventTimestamp)
        {
            Debug.NotDefault(acceptedTime, nameof(acceptedTime));
            Debug.NotDefault(eventId, nameof(eventId));
            Debug.NotDefault(eventTimestamp, nameof(eventTimestamp));

            this.OrderIdBroker = orderIdBroker;
            this.AccountId     = accountId;
            this.AcceptedTime  = acceptedTime;
        }
Beispiel #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OrderWorking"/> class.
        /// </summary>
        /// <param name="accountId">The event account identifier.</param>
        /// <param name="orderId">The event order identifier.</param>
        /// <param name="orderIdBroker">The event order identifier from the broker.</param>
        /// <param name="symbol">The event symbol.</param>
        /// <param name="orderSide">The event order side.</param>
        /// <param name="orderType">The event order type.</param>
        /// <param name="quantity">The event order quantity.</param>
        /// <param name="price">The event order price.</param>
        /// <param name="timeInForce">The event order time in force.</param>
        /// <param name="expireTime">The event order expire time.</param>
        /// <param name="workingTime">The event order accepted time.</param>
        /// <param name="eventId">The event identifier.</param>
        /// <param name="eventTimestamp">The event timestamp.</param>
        public OrderWorking(
            AccountId accountId,
            OrderId orderId,
            OrderIdBroker orderIdBroker,
            Symbol symbol,
            OrderSide orderSide,
            OrderType orderType,
            Quantity quantity,
            Price price,
            TimeInForce timeInForce,
            ZonedDateTime?expireTime,
            ZonedDateTime workingTime,
            Guid eventId,
            ZonedDateTime eventTimestamp)
            : base(
                orderId,
                EventType,
                eventId,
                eventTimestamp)
        {
            Condition.NotDefault(orderSide, nameof(orderSide));
            Condition.NotDefault(orderType, nameof(orderType));
            Condition.NotDefault(timeInForce, nameof(timeInForce));
            Debug.NotDefault(workingTime, nameof(workingTime));
            Debug.NotDefault(eventId, nameof(eventId));
            Debug.NotDefault(eventTimestamp, nameof(eventTimestamp));

            this.AccountId     = accountId;
            this.OrderIdBroker = orderIdBroker;
            this.Symbol        = symbol;
            this.OrderSide     = orderSide;
            this.OrderType     = orderType;
            this.Quantity      = quantity;
            this.Price         = price;
            this.TimeInForce   = timeInForce;
            this.ExpireTime    = expireTime;
            this.WorkingTime   = workingTime;
        }