public OptionTrade(HugoDataSet.HugoOptionCorrectionsRow row)
        {
            tradeType   = row.TradeTypeName;
            tradeVolume = Convert.ToDouble(row.TradeVolume);
            tradePrice  = Convert.ToDouble(row.TradePrice);
            totalCost   = Convert.ToDouble(row.TotalCost);
            subAcctName = row.SubAcctName;

            underlyingSymbol = row.UnderlyingSymbol;
            optionSymbol     = row.OptionSymbol;
            expirationDate   = row.ExpirationDate;
            strikePrice      = row.StrikePrice;
            optionType       = row.OptionType;

            tradeMedium = ConvertTradeMedium(ConvertExt.ToStringOrNull(row.TradeMediumName));
            tradeDate   = row.TradeDateTime;

            if (row.RecordType == "Update")
            {
                tradeNote = "Changed to: " + row.DifferenceMsg;
            }
            else
            {
                tradeNote = "(" + row.RecordType + ")";
            }
        }
        public OptionTrade(HugoDataSet.ConfirmationCorrectionsRow row)
        {
            tradeType   = ConvertTradeTypeName(row.TradeTypeName, "");
            tradeVolume = Convert.ToDouble(row.TradeVolume);
            tradePrice  = Convert.ToDouble(row.TradePrice);
            totalCost   = Convert.ToDouble(row.TotalCost);
            subAcctName = row.SubAcctName;

            underlyingSymbol = row.UnderlyingSymbol;
            optionSymbol     = row.OptionSymbol;
            expirationDate   = row.ExpirationDate;
            strikePrice      = row.StrikePrice;
            optionType       = row.OptionType;

            exchangeName = row.ExchangeName.StartsWith("?") ? null : row.ExchangeName;
            tradeDate    = ConvertExt.ToValidDateTime(row.TradeDate);

            if (row.RecordType == "Correction")
            {
                tradeNote = "Changed to: " + row.GetDifferenceMsg(false /* use Hugo account and underlying symbols */);
            }
            else
            {
                tradeNote = "(" + row.RecordType + ")";
            }
        }
        public OptionTrade(HugoDataSet.HugoOptionTradesRow row)
        {
            tradeId     = row.TradeId;
            tradeType   = row.TradeTypeName;
            tradeVolume = Convert.ToDouble(row.TradeVolume);
            tradePrice  = Convert.ToDouble(row.TradePrice);
            commission  = Convert.ToDouble(row.Commission);
            secFee      = Convert.ToDouble(row.SECFee);
            orfFee      = Convert.ToDouble(row.ORFFee);
            totalCost   = Convert.ToDouble(row.TotalCost);
            subAcctName = row.SubAcctName;

            underlyingSymbol = row.UnderlyingSymbol;
            optionSymbol     = row.OptionSymbol;
            expirationDate   = row.ExpirationDate;
            strikePrice      = row.StrikePrice;
            optionType       = row.OptionType;

            brokerName   = ConvertExt.ToStringOrNull(row.BrokerName);
            exchangeName = ConvertExt.ToStringOrNull(row.ExchangeName);
            tradeMedium  = ConvertTradeMedium(ConvertExt.ToStringOrNull(row.TradeMediumName));
            tradeReason  = ConvertExt.ToStringOrNull(row.TradeReasonDescr);
            tradeDate    = row.TradeDateTime;
            tradeNote    = ConvertExt.ToStringOrNull(row.TradeNote);
            traderName   = ConvertExt.ToStringOrNull(row.TraderName);

            spreadFlag       = ConvertExt.ToBooleanOrNull(row["SpreadFlag"]);
            tradeArchiveFlag = ConvertExt.ToBooleanOrNull(row["TradeArchiveFlag"]);

            consolidationPackageId = row.ConsolidationPackageId;
            numberOfTrades         = row.NumberOfTrades;
        }
        public OptionTrade(HugoDataSet.MerrillOptionTradesRow row)
        {
            tradeId     = row.TradeId;
            tradeType   = ConvertTradeTypeName(row.TradeTypeName, row.CancelCode);
            tradeVolume = Convert.ToDouble(row.TradeVolume);
            tradePrice  = Convert.ToDouble(row.TradePrice);
            commission  = row.Commission;
            secFee      = row.SECFee;
            orfFee      = row.ORFFee;
            totalCost   = Convert.ToDouble(row.TotalCost);
            subAcctName = row.SubAcctName;

            underlyingSymbol = row.UnderlyingSymbol;
            optionSymbol     = row.OptionSymbol;
            expirationDate   = row.ExpirationDate;
            strikePrice      = row.StrikePrice;
            optionType       = row.OptionType;

            exchangeName      = row.ExchangeName.StartsWith("?") ? null : row.ExchangeName;
            tradeMedium       = ConvertTradeMedium(ConvertExt.ToStringOrNull(row.TradeMediumName));
            tradeNote         = "Added by reconciliation client";
            tradeDate         = ConvertExt.ToValidDateTime(row.TradeDate);
            traderName        = Utilities.TraderName;
            optionArchiveFlag = row.OptionArchiveFlag;
        }
        public static DateTime ToDateTime(string parameterValue, string parameterName)
        {
            try
            {
                if (parameterValue == null)
                {
                    return(DateTime.Today);
                }
                if (parameterValue.Length <= 0)
                {
                    return(DateTime.Today);
                }

                DateTime result;
                if (DateTime.TryParse(parameterValue, CultureInfo.CurrentCulture, DateTimeStyles.None, out result))
                {
                    return(result);
                }
                else
                {
                    // if unable to parse, it is possible this is an OADate
                    return(ConvertExt.FromOADate(Convert.ToInt32(parameterValue)));
                }
            }
            catch (ArgumentException)
            {
                throw new ReconciliationConversionException(String.Format(CultureInfo.CurrentCulture, "Unable to convert {0}, value = {1}, to DateTime",
                                                                          parameterName, parameterValue));
            }
            catch (NotSupportedException)
            {
                throw new ReconciliationConversionException(String.Format(CultureInfo.CurrentCulture, "Unable to convert {0}, value = {1}, to DateTime",
                                                                          parameterName, parameterValue));
            }
            catch (FormatException)
            {
                throw new ReconciliationConversionException(String.Format(CultureInfo.CurrentCulture, "Unable to convert {0}, value = {1}, to DateTime",
                                                                          parameterName, parameterValue));
            }
            catch (OverflowException)
            {
                throw new ReconciliationConversionException(String.Format(CultureInfo.CurrentCulture, "Unable to convert {0}, value = {1}, to DateTime",
                                                                          parameterName, parameterValue));
            }
            catch (Exception)
            {
                throw;
            }
        }
        public FuturesTrade(HugoDataSet.FuturesPositionsRow row)
        {
            tradeId     = -1;
            tradeType   = (row.Discrepancy > 0) ? "Sell" : "Buy";
            tradeVolume = Convert.ToDouble(Math.Abs(row.Discrepancy));
            subAcctName = row.SubAcctName;

            underlyingSymbol = row.FuturesSymbol;

            tradeMedium = "Correction";
            tradeReason = "Journal";
            tradeDate   = ConvertExt.ToValidDateTime(null);
            tradeNote   = "Added by reconciliation client to match clearing house position";
            traderName  = Utilities.TraderName;
        }
Esempio n. 7
0
        public StockTrade(HugoDataSet.MerrillStockTradesRow row)
        {
            tradeId     = row.TradeId;
            tradeType   = ConvertTradeTypeName(row.TradeTypeName, row.CancelCode, ref shortFlag);
            tradeVolume = Convert.ToDouble(row.TradeVolume);
            tradePrice  = Convert.ToDouble(row.TradePrice);
            commission  = row.Commission;
            secFee      = row.SECFee;
            totalCost   = Convert.ToDouble(row.TotalCost);
            subAcctName = row.SubAcctName;

            underlyingSymbol = row.StockSymbol;

            exchangeName = row.ExchangeName.StartsWith("?") ? null : row.ExchangeName;
            tradeMedium  = ConvertExt.ToStringOrNull(row.TradeMediumName);
            tradeNote    = "Added by reconciliation client";
            tradeDate    = ConvertExt.ToValidDateTime(row.TradeDate);
            traderName   = Utilities.TraderName;
        }
        public FuturesTrade(HugoDataSet.HugoFuturesCorrectionsRow row)
        {
            tradeType   = ConvertTradeTypeName(row.TradeTypeName, "", ref shortFlag);
            tradeVolume = Convert.ToDouble(row.TradeVolume);
            tradePrice  = Convert.ToDouble(row.TradePrice);
            subAcctName = row.SubAcctName;

            underlyingSymbol = row.FuturesSymbol;

            tradeMedium = ConvertExt.ToStringOrNull(row.TradeMediumName);
            tradeDate   = row.TradeDateTime;
            totalCost   = Convert.ToDouble(row.TotalCost);

            if (row.RecordType == "Update")
            {
                tradeNote = "Changed to: " + row.DifferenceMsg;
            }
            else
            {
                tradeNote = "(" + row.RecordType + ")";
            }
        }
Esempio n. 9
0
        public StockTrade(HugoDataSet.HugoStockTradesRow row)
        {
            tradeId     = row.TradeId;
            tradeType   = ConvertTradeTypeName(row.TradeTypeName, "", ref shortFlag);
            tradeVolume = Convert.ToDouble(row.TradeVolume);
            tradePrice  = Convert.ToDouble(row.TradePrice);
            subAcctName = row.SubAcctName;

            underlyingSymbol = row.StockSymbol;

            brokerName   = ConvertExt.ToStringOrNull(row.BrokerName);
            exchangeName = ConvertExt.ToStringOrNull(row.ExchangeName);
            tradeMedium  = ConvertExt.ToStringOrNull(row.TradeMediumName);
            tradeReason  = ConvertExt.ToStringOrNull(row.TradeReasonDescr);
            tradeDate    = row.TradeDateTime;
            tradeNote    = ConvertExt.ToStringOrNull(row.TradeNote);
            traderName   = ConvertExt.ToStringOrNull(row.TraderName);
            totalCost    = Convert.ToDouble(row.TotalCost);
            taxLotId     = ConvertExt.ToStringOrNull(row.TaxLotId);
            commission   = Convert.ToDouble(row.Commission);
            secFee       = Convert.ToDouble(row.SEC_Fee);
        }
        public FuturesTrade(HugoDataSet.HugoFuturesTradesRow row)
        {
            tradeId     = row.TradeId;
            tradeType   = ConvertTradeTypeName(row.TradeTypeName, "", ref shortFlag);
            tradeVolume = Convert.ToDouble(row.TradeVolume);
            tradePrice  = Convert.ToDouble(row.TradePrice);
            subAcctName = row.SubAcctName;

            underlyingSymbol = row.FuturesSymbol;

            brokerName   = ConvertExt.ToStringOrNull(row.BrokerName);
            exchangeName = ConvertExt.ToStringOrNull(row.ExchangeName);
            tradeMedium  = ConvertExt.ToStringOrNull(row.TradeMediumName);
            tradeReason  = ConvertExt.ToStringOrNull(row.TradeReasonDescr);
            tradeDate    = row.TradeDateTime;
            tradeNote    = ConvertExt.ToStringOrNull(row.TradeNote);
            traderName   = ConvertExt.ToStringOrNull(row.TraderName);
            totalCost    = Convert.ToDouble(row.TotalCost);

            commission  = Convert.ToDouble(row.Commission);
            nfaFee      = Convert.ToDouble(row.NFAFee);
            exchangeFee = Convert.ToDouble(row.ExchangeFee);
            clearingFee = Convert.ToDouble(row.ClearingFee);
        }