コード例 #1
0
ファイル: OrderFilled.cs プロジェクト: w1r2p1/Nautilus
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderFilled"/> class.
 /// </summary>
 /// <param name="accountId">The event account identifier.</param>
 /// <param name="orderId">The event order identifier.</param>
 /// <param name="executionId">The event order execution identifier.</param>
 /// <param name="positionIdBroker">The event order execution ticket.</param>
 /// <param name="symbol">The event order symbol.</param>
 /// <param name="orderSide">The event order side.</param>
 /// <param name="filledQuantity">The event order filled quantity.</param>
 /// <param name="averagePrice">The event order average price.</param>
 /// <param name="quoteCurrency">The event order quote currency.</param>
 /// <param name="executionTime">The event order execution time.</param>
 /// <param name="eventId">The event identifier.</param>
 /// <param name="eventTimestamp">The event timestamp.</param>
 public OrderFilled(
     AccountId accountId,
     OrderId orderId,
     ExecutionId executionId,
     PositionIdBroker positionIdBroker,
     Symbol symbol,
     OrderSide orderSide,
     Quantity filledQuantity,
     Price averagePrice,
     Currency quoteCurrency,
     ZonedDateTime executionTime,
     Guid eventId,
     ZonedDateTime eventTimestamp)
     : base(
         accountId,
         orderId,
         executionId,
         positionIdBroker,
         symbol,
         orderSide,
         filledQuantity,
         averagePrice,
         quoteCurrency,
         executionTime,
         EventType,
         eventId,
         eventTimestamp)
 {
 }
コード例 #2
0
        private OrderPartiallyFilled GenerateOrderPartiallyFilledEvent(ExecutionReport message)
        {
            var orderId          = this.GetOrderId(message);
            var executionId      = new ExecutionId(message.GetField(Tags.ExecID));
            var positionIdBroker = new PositionIdBroker(message.GetField(FxcmTags.PosID));
            var symbol           = this.GetSymbol(message.GetField(Tags.Symbol));
            var orderSide        = FxcmMessageHelper.GetOrderSide(message.GetField(Tags.Side));
            var filledQuantity   = Quantity.Create(message.GetDecimal(Tags.CumQty));
            var averagePrice     = Price.Create(message.GetDecimal(Tags.AvgPx));
            var quoteCurrency    = this.GetQuoteCurrency(symbol, message.GetField(Tags.Currency));
            var leavesQuantity   = Quantity.Create(message.GetInt(Tags.LeavesQty));
            var executionTime    = FxcmMessageHelper.ParseTimestamp(message.GetField(Tags.TransactTime));

            return(new OrderPartiallyFilled(
                       this.accountId,
                       orderId,
                       executionId,
                       positionIdBroker,
                       symbol,
                       orderSide,
                       filledQuantity,
                       leavesQuantity,
                       averagePrice,
                       quoteCurrency,
                       executionTime,
                       this.NewGuid(),
                       this.TimeNow()));
        }
コード例 #3
0
        /// <inheritdoc />
        public override PositionId?GetPositionId(AccountId accountId, PositionIdBroker positionIdBroker)
        {
            if (this.indexBrokerPosition.TryGetValue(positionIdBroker, out var positionId))
            {
                return(positionId);
            }

            this.Logger.LogWarning($"Cannot find PositionId for {positionIdBroker} in the database.");
            return(null);
        }
コード例 #4
0
ファイル: OrderFillEvent.cs プロジェクト: w1r2p1/Nautilus
        /// <summary>
        /// Initializes a new instance of the <see cref="OrderFillEvent"/> class.
        /// </summary>
        /// <param name="accountId">The event account identifier.</param>
        /// <param name="orderId">The event order identifier.</param>
        /// <param name="executionId">The event order execution identifier.</param>
        /// <param name="positionIdBroker">The event broker position identifier.</param>
        /// <param name="symbol">The event order symbol.</param>
        /// <param name="orderSide">The event order side.</param>
        /// <param name="filledQuantity">The event order filled quantity.</param>
        /// <param name="averagePrice">The event order average price.</param>
        /// <param name="quoteCurrency">The event quote currency.</param>
        /// <param name="executionTime">The event order execution time.</param>
        /// <param name="eventType">The event type.</param>
        /// <param name="eventId">The event identifier.</param>
        /// <param name="eventTimestamp">The event timestamp.</param>
        protected OrderFillEvent(
            AccountId accountId,
            OrderId orderId,
            ExecutionId executionId,
            PositionIdBroker positionIdBroker,
            Symbol symbol,
            OrderSide orderSide,
            Quantity filledQuantity,
            Price averagePrice,
            Currency quoteCurrency,
            ZonedDateTime executionTime,
            Type eventType,
            Guid eventId,
            ZonedDateTime eventTimestamp)
            : base(
                orderId,
                eventType,
                eventId,
                eventTimestamp)
        {
            Condition.NotDefault(orderSide, nameof(orderSide));
            Condition.NotDefault(quoteCurrency, nameof(quoteCurrency));
            Debug.NotDefault(executionTime, nameof(executionTime));
            Debug.NotDefault(eventId, nameof(eventId));
            Debug.NotDefault(eventTimestamp, nameof(eventTimestamp));

            this.AccountId        = accountId;
            this.PositionIdBroker = positionIdBroker;
            this.ExecutionId      = executionId;
            this.Symbol           = symbol;
            this.OrderSide        = orderSide;
            this.FilledQuantity   = filledQuantity;
            this.AveragePrice     = averagePrice;
            this.Currency         = quoteCurrency;
            this.ExecutionTime    = executionTime;
        }
コード例 #5
0
ファイル: ExecutionDatabase.cs プロジェクト: w1r2p1/Nautilus
 /// <inheritdoc />
 public abstract PositionId?GetPositionId(AccountId accountId, PositionIdBroker positionIdBroker);