internal void ApplyInternal(OptionPurchased purchased) { if (FirstFill == null) { ApplyFirstTransactionLogic(false, purchased.When); } if (Deleted == true) { Deleted = false; } if (NumberOfContracts == 0) { PremiumReceived = 0; PremiumPaid = 0; } AddNoteIfNotEmpty(purchased.Notes); NumberOfContracts += purchased.NumberOfContracts; var debit = purchased.NumberOfContracts * purchased.Premium; PremiumPaid += debit; Buys.Add(purchased); var description = $"Bought {purchased.NumberOfContracts} x ${StrikePrice} {OptionType} {Expiration.ToString("MM/dd")} contracts for ${purchased.Premium}/contract"; Transactions.Add( Transaction.DebitTx( Id, purchased.Id, Ticker, description, debit, purchased.When, true ) ); ApplyClosedLogicIfApplicable(purchased.When, purchased.Id); }
private void OpenOrder(BookOpen openOrder) { var offer = new ProductOffer { OrderId = openOrder.OrderId, Price = openOrder.Price, Size = openOrder.RemainingSize }; if (openOrder.Side == SideType.Buy) { Buys.Add(offer); } else { Sells.Add(offer); } if (!RemoveReceiveOrder(openOrder.OrderId)) { Api.Log.Warning($"No receive message for order id {openOrder.OrderId}"); } }
internal void AddBuy(TradeActionEvent trade) { Buys.Add(trade); }