コード例 #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
ファイル: OwnedOption.cs プロジェクト: DT021/stock-analysis
 protected void ApplyInternal(OptionSold sold)
 {
     this.State.Apply(sold);
 }