예제 #1
0
        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);
        }
예제 #2
0
        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
                    )
                );
        }
예제 #3
0
 protected void ApplyInternal(OptionSold sold)
 {
     this.State.Apply(sold);
 }