internal void OnStopOrderCall(StopOrder stopOrder) { //if (OnStopOrder != null) OnStopOrder(stopOrder); OnStopOrder?.Invoke(stopOrder); // invoke event specific for the transaction string correlationId = stopOrder.TransId.ToString(); #region Totally untested code or handling manual transactions if (!QuikService.Storage.Contains(correlationId)) { correlationId = "manual:" + stopOrder.OrderNum + ":" + correlationId; var fakeTrans = new Transaction() { Comment = correlationId, IsManual = true // TODO map order properties back to transaction // ideally, make C# property names consistent (Lua names are set as JSON.NET properties via an attribute) }; QuikService.Storage.Set <Transaction>(correlationId, fakeTrans); } #endregion Totally untested code or handling manual transactions var tr = QuikService.Storage.Get <Transaction>(correlationId); if (tr != null) { lock (tr) { tr.OnStopOrderCall(stopOrder); } } Trace.Assert(tr != null, "Transaction must exist in persistent storage until it is completed and all order messages are recieved"); }
internal void OnStopOrderCall(StopOrder stopOrder) { OnStopOrder?.Invoke(stopOrder); if (StopOrders == null) { StopOrders = new List <StopOrder>(); } StopOrders.Add(stopOrder); }