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())); }
/// <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) { }
/// <summary> /// Called when the start header is serialized using the specified XML writer. /// </summary> /// <param name="writer"> /// An <see cref="XmlDictionaryWriter"/> that is used to serialize the start header. /// </param> /// <param name="messageVersion">Unused.</param> /// <remarks> /// We override the default implementation in order to force a specific message /// layout, rather than relying on the default implementation which doesn't /// serialize in the expected manner. /// </remarks> protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion) { writer.WriteElementString("ActivityId", ActivityId.ToString()); writer.WriteElementString("AccessToken", AccessToken); writer.WriteElementString("ExecutionId", ExecutionId.ToString()); writer.WriteElementString("Action", Action); writer.WriteElementString("MomentStart", MomentStart.ToString("o", CultureInfo.InvariantCulture)); }
public void EndianSwap() { ContentType = ContentType.EndianSwap(); ContentMetadataVersion = ContentMetadataVersion.EndianSwap(); ContentSize = ContentSize.EndianSwap(); ExecutionId.EndianSwap(); Creator = Creator.EndianSwap(); StfsVolumeDescriptor.EndianSwap(); DataFiles = DataFiles.EndianSwap(); DataFilesSize = DataFilesSize.EndianSwap(); VolumeType = VolumeType.EndianSwap(); OnlineCreator = OnlineCreator.EndianSwap(); Category = Category.EndianSwap(); foreach (var str in DisplayName) { str.EndianSwap(); } foreach (var str in Description) { str.EndianSwap(); } Publisher.EndianSwap(); TitleName.EndianSwap(); ThumbnailSize = ThumbnailSize.EndianSwap(); foreach (var str in DisplayNameEx) { str.EndianSwap(); } TitleThumbnailSize = TitleThumbnailSize.EndianSwap(); foreach (var str in DescriptionEx) { str.EndianSwap(); } }
/// <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; }
public async Task <ExecutionResult?> GetResultAsync(ExecutionId executionId, CancellationToken cancellationToken = default) { var response = await httpClient.GetAsync($"{rootAddress}/api/getresult?executionId={executionId}", cancellationToken); return(await response.EnsureSuccessStatusCode().Content.ReadFromJsonAsync <ExecutionResult?>()); }
public override IEnumerator ReceivePayload(VisualPayload payload) { IEnumerator iterator; if (SpoofExecution.GetFirstValue(payload.Data)) { ExecutionTarget.SetValue(SpoofTrace(10000, 1), payload.Data); iterator = ParseExecution(payload.VisualData.Bound, payload.Data); while (iterator.MoveNext()) { yield return(null); } } else { UseCachedResults = false; bool isMemoryTrace = IncludeMemtrace.GetFirstValue(payload.Data); var execId = ExecutionId.GetFirstValue(payload.Data); if (execId < 0) { iterator = UpdateExecutionId(payload.Data); while (iterator.MoveNext()) { yield return(null); } } else { FoundExecutionId = (uint)execId; } if (!UseCachedResults) { iterator = GetTracesForCurrentSelections(payload.Data); while (iterator.MoveNext()) { yield return(null); } } var execution = new Execution() { ServiceId = ServiceId, CbId = BinaryId.Id, CbAuthor = BinaryId.Author, RequestId = FoundRequestId, RequestNature = RequestNature.GetFirstValue(payload.Data), ExecutionId = FoundExecutionId, Success = CsSuccess, Traces = Traces, PovType = PovType }; ExecutionTarget.SetValue(ExecutionToMutable(execution, isMemoryTrace, PovType), payload.Data); iterator = ParseExecution(payload.VisualData.Bound, payload.Data); while (iterator.MoveNext()) { yield return(null); } } }