public double CopyTradeInfoFromPackage(IOptionTrade package, int tradeNumber, double remainderTotalCost)
        {
            tradeType   = package.TradeType;
            subAcctName = package.SubAcctName;

            optionSymbol   = package.OptionSymbol;
            expirationDate = package.ExpirationDate;
            strikePrice    = package.StrikePrice;
            optionType     = package.OptionType;

            exchangeName = package.ExchangeName;
            tradeMedium  = package.TradeMedium;

            // for last trade, use remainder of TotalCost
            if (tradeNumber == package.NumberOfTrades)
            {
                totalCost          = remainderTotalCost;
                remainderTotalCost = 0;
            }

            // for earlier trades, calculate it
            else
            {
                totalCost = Math.Round(package.TotalCost * (((package.UnitCost * package.TradeVolume) == 0) ? 1 :
                                                            UnitCost * TradeVolume / (package.UnitCost * package.TradeVolume)), 2);
                remainderTotalCost -= totalCost;
            }

            return(remainderTotalCost);
        }
 public static IOptionTrade PremiumCurrency(this IOptionTrade option, string premiumCurrency)
 {
     if (option.OptionDetails is VanillaOptionDetails)
     {
         ((VanillaOptionDetails)option.OptionDetails).PremiumCurrency(premiumCurrency);
     }
     return(option);
 }
 public static IOptionTrade PremiumAmount(this IOptionTrade option, decimal?premiumAmount)
 {
     if (option.OptionDetails is VanillaOptionDetails)
     {
         ((VanillaOptionDetails)option.OptionDetails).PremiumAmount(premiumAmount);
     }
     return(option);
 }
 public static IOptionTrade ExpiryDate(this IOptionTrade option, DateTime expiryDate)
 {
     if (option.OptionDetails is VanillaOptionDetails)
     {
         ((VanillaOptionDetails)option.OptionDetails).ExpiryDate(expiryDate);
     }
     return(option);
 }
 public static IOptionTrade PremiumDate(this IOptionTrade option, DateTime premiumDate)
 {
     if (option.OptionDetails is VanillaOptionDetails)
     {
         ((VanillaOptionDetails)option.OptionDetails).PremiumDate(premiumDate);
     }
     return(option);
 }
 public static IOptionTrade Model(this IOptionTrade option, string model)
 {
     if (option.OptionDetails is VanillaOptionDetails)
     {
         ((VanillaOptionDetails)option.OptionDetails).Model(model);
     }
     return(option);
 }
 public static IOptionTrade StrikePrice(this IOptionTrade option, decimal?strikePrice)
 {
     if (option.OptionDetails is VanillaOptionDetails)
     {
         ((VanillaOptionDetails)option.OptionDetails).StrikePrice(strikePrice);
     }
     return(option);
 }
 public static IOptionTrade CP(this IOptionTrade option, string cp)
 {
     if (option.OptionDetails is VanillaOptionDetails)
     {
         ((VanillaOptionDetails)option.OptionDetails).CP(cp);
     }
     return(option);
 }
        public static IOptionTrade CurrencyAmount(this IOptionTrade option, decimal?currencyAmount)
        {
            if (option.OptionDetails is VanillaOptionDetails)
            {
                ((VanillaOptionDetails)option.OptionDetails).CurrencyAmount(currencyAmount);
            }

            return(option);
        }
Beispiel #10
0
        public EditedOptionTrade(EditedOptionTrade editedTrade,
                                 IOptionTrade package,
                                 IOptionTrade partialTrade,
                                 ref double remainderTotalCost,
                                 ref double remainderCommission,
                                 ref double remainderSECFee,
                                 ref double remainderORFFee,
                                 ref int tradeNumber)
        {
            tradeid = partialTrade.TradeId.Value;

            optionsymbol          = editedTrade.OptionSymbol;
            nominalExpirationDate = editedTrade.NominalExpirationDate;
            strike     = editedTrade.Strike;
            optiontype = editedTrade.OptionType;

            tradetype   = editedTrade.TradeType;
            subacctname = editedTrade.SubAcctName;
            tradedate   = editedTrade.TradeDate;
            tradenote   = editedTrade.TradeNote;

            trader   = editedTrade.Trader;
            broker   = editedTrade.Broker;
            exchange = editedTrade.Exchange;
            medium   = editedTrade.Medium;
            reason   = editedTrade.Reason;

            // for last trade, use remainders
            if (++tradeNumber == package.NumberOfTrades)
            {
                commission = remainderCommission;
                secFee     = remainderSECFee;
                orfFee     = remainderORFFee;
                totalcost  = remainderTotalCost;
            }

            // for earlier trades, calculate
            else
            {
                double proRataFactor = (((package.UnitCost * package.TradeVolume) == 0) ? 1 :
                                        partialTrade.UnitCost * partialTrade.TradeVolume / (package.UnitCost * package.TradeVolume));

                commission           = Math.Round(package.Commission * proRataFactor, 2);
                remainderCommission -= commission.Value;

                secFee           = Math.Round(package.SECFee * proRataFactor, 2);
                remainderSECFee -= secFee.Value;

                orfFee           = Math.Round(package.ORFFee * proRataFactor, 2);
                remainderORFFee -= orfFee.Value;

                totalcost           = Math.Round(package.TotalCost * proRataFactor, 2);
                remainderTotalCost -= totalcost.Value;
            }
        }
        private static bool VerifyOptionTrade(IOptionTrade optionTrade)
        {
            if (optionTrade == null)
            {
                return(false);
            }

            if ((optionTrade.TradeVolume <= 0) || // don't add trades with no volum
                (optionTrade.TradeMedium == ReconciliationLib.Utilities.ReorgName) || // don't add reorg trades
                (optionTrade.OptionArchiveFlag ?? false))    // don't add trades for archived options
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }