internal void ApplyInternal(OptionSold sold) { if (SoldToOpen == null) { ApplyFirstTransactionLogic(true, sold.When); } if (Deleted == true) { Deleted = false; } AddNoteIfNotEmpty(sold.Notes); if (NumberOfContracts == 0) { PremiumReceived = 0; PremiumPaid = 0; } NumberOfContracts -= sold.NumberOfContracts; Sells.Add(sold); var credit = (sold.NumberOfContracts * sold.Premium); PremiumReceived += credit; Transactions.Add( Transaction.CreditTx( Id, sold.Id, Ticker, $"Sold {sold.NumberOfContracts} x ${StrikePrice} {OptionType} {Expiration.ToString("MM/dd")} contract(s) for ${sold.Premium} premium/contract", credit, sold.When, true ) ); ApplyClosedLogicIfApplicable(sold.When, sold.Id); }
internal void Apply(OptionSold sold) { this.NumberOfContracts -= sold.NumberOfContracts; this.Sells.Add(sold); var credit = (sold.NumberOfContracts * sold.Premium); this.Credit += credit; this.Transactions.Add( Transaction.CreditTx( this.Ticker, $"Sold {sold.NumberOfContracts} x ${this.StrikePrice} {this.OptionType} {this.Expiration.ToString("MM/dd")} contract(s) for ${sold.Premium} premium/contract", credit, sold.When, true ) ); }
protected void ApplyInternal(OptionSold sold) { this.State.Apply(sold); }