private static PhysicalConstructParams ParsePhysicalSettings(IDBRow dataRowOrder)
        {
            PhysicalConstructParams result = new PhysicalConstructParams();

            result.PhysicalTradeSide = (PhysicalTradeSide)((int)dataRowOrder["PhysicalTradeSide"]);

            if (dataRowOrder["PhysicalRequestId"] != DBNull.Value)
            {
                result.PhysicalRequestId = ((Guid)dataRowOrder["PhysicalRequestId"]);
            }

            if (dataRowOrder["PhysicalValueMatureDay"] != DBNull.Value)
            {
                result.PhysicalValueMatureDay = (int)dataRowOrder["PhysicalValueMatureDay"];
            }
            else
            {
                result.PhysicalValueMatureDay = 0;
            }
            result.PhysicalType               = (Protocal.Physical.PhysicalType)dataRowOrder.GetColumn <byte>("PhysicalType");
            result.PhysicalOriginValue        = (decimal)dataRowOrder["PhysicalOriginValue"];
            result.PhysicalOriginValueBalance = (decimal)dataRowOrder["PhysicalOriginValueBalance"];
            result.PaidPledgeBalance          = (decimal)dataRowOrder["PaidPledgeBalance"];
            result.PaidPledge = dataRowOrder.GetColumn <decimal>("PaidPledge");

            return(result);
        }
Exemplo n.º 2
0
 public OrderDeletedReason(IDBRow dr)
 {
     this.ID          = dr.GetColumn <Guid>("ID");
     this.Code        = dr.GetColumn <string>("Code");
     this.Description = dr.GetColumn <string>("Description");
     this.ReasonDesc  = dr.GetColumn <string>("ReasonDesc");
 }
Exemplo n.º 3
0
 internal InstrumentDayOpenCloseHistory(IDBRow dr)
 {
     this.TradeDay      = (DateTime)dr["TradeDay"];
     this.InstrumentID  = (Guid)dr["InstrumentID"];
     this.DayOpenTime   = dr.GetColumn <DateTime?>("DayOpenTime");
     this.DayCloseTime  = dr.GetColumn <DateTime?>("DayCloseTime");
     this.ValueDate     = dr.GetColumn <DateTime?>("ValueDate");
     this.RealValueDate = dr.GetColumn <DateTime?>("RealValueDate");
 }
Exemplo n.º 4
0
 internal Currency(IDBRow currencyRow)
 {
     this.id                    = (Guid)currencyRow["ID"];
     this.Code                  = (string)currencyRow["Code"];
     this.decimals              = (short)currencyRow["Decimals"];
     this.InterestPolicyId      = currencyRow.GetColumn <Guid?>("InterestPolicyID");
     this.UInterestIn           = currencyRow.GetColumn <decimal>("UInterestIn");
     this.UInterestOut          = currencyRow.GetColumn <decimal>("UInterestOut");
     this.UsableInterestDayYear = currencyRow.GetColumn <int>("UsableInterestDayYear");
 }
Exemplo n.º 5
0
        //Only Update the fields that should take effect in the past
        internal override void Update(IDBRow instrumentRow)
        {
            base.Update(instrumentRow);

            this._category      = (InstrumentCategory)instrumentRow.GetColumn <int>("Category");
            this._numeratorUnit = instrumentRow.GetColumn <int>("NumeratorUnit");
            this._denominator   = instrumentRow.GetColumn <int>("Denominator");
            this._isNormal      = instrumentRow.GetColumn <bool>("IsNormal");

            this.DayOpenTime  = (instrumentRow["DayOpenTime"] == DBNull.Value) ? default(DateTime) : (DateTime)instrumentRow["DayOpenTime"];
            this.DayCloseTime = (instrumentRow["DayCloseTime"] == DBNull.Value) ? default(DateTime) : (DateTime)instrumentRow["DayCloseTime"];
            if (instrumentRow.Contains("EndTime"))
            {
                _endTime = (instrumentRow["EndTime"] == DBNull.Value) ? default(DateTime) : (DateTime)instrumentRow["EndTime"];
            }
            this.ValueDate       = (instrumentRow["ValueDate"] == DBNull.Value) ? default(DateTime) : (DateTime)instrumentRow["ValueDate"];
            this.NextDayOpenTime = (instrumentRow["NextDayOpenTime"] == DBNull.Value) ? default(DateTime) : (DateTime)instrumentRow["NextDayOpenTime"];

            this._commissionFormula = (FeeFormula)instrumentRow.GetColumn <byte>("CommissionFormula");
            this._levyFormula       = (FeeFormula)instrumentRow.GetColumn <byte>("LevyFormula");
            _otherFeeFormula        = (FeeFormula)instrumentRow.GetColumn <byte>("OtherFeeFormula");
            this._marginFormula     = (MarginFormula)instrumentRow.GetColumn <byte>("MarginFormula");
            this._tradePLFormula    = (TradePLFormula)instrumentRow.GetColumn <byte>("TradePLFormula");

            this._isExpired = this.DayOpenTime == default(DateTime) && this.DayCloseTime == default(DateTime) && this.ValueDate == default(DateTime) && this.NextDayOpenTime == default(DateTime);
        }
Exemplo n.º 6
0
        internal Bill(IDBRow dr)
            : base("Bill", ItemCapacityFactor)
        {
            Guid          id         = (Guid)dr["ID"];
            Guid          accountId  = (Guid)dr["AccountID"];
            decimal       value      = (decimal)dr["Value"];
            BillType      type       = (BillType)dr.GetColumn <int>("Type");
            BillOwnerType ownerType  = (BillOwnerType)dr.GetColumn <int>("OwnerType");
            DateTime      updateTime = dr.GetColumn <DateTime>("UpdateTime");
            Guid          currencyId = dr.GetColumn <Guid>("CurrencyID");

            this.Initialize(id, accountId, currencyId, value, type, ownerType, updateTime);
        }
Exemplo n.º 7
0
 internal InterestPolicy(IDBRow dr)
 {
     this.Id         = dr.GetColumn <Guid>("ID");
     this.Code       = dr.GetColumn <string>("Code");
     this.Mon        = dr.GetColumn <Int16>("Mon");
     this.Tue        = dr.GetColumn <Int16>("Tue");
     this.Wed        = dr.GetColumn <Int16>("Wed");
     this.Thu        = dr.GetColumn <Int16>("Thu");
     this.Fri        = dr.GetColumn <Int16>("Fri");
     this.Sat        = dr.GetColumn <Int16>("Sat");
     this.Sun        = dr.GetColumn <Int16>("Sun");
     this.UpdateTime = dr.GetColumn <DateTime>("UpdateTime");
 }
Exemplo n.º 8
0
 internal void Update(IDBRow customerRow)
 {
     this.id                   = (Guid)customerRow["ID"];
     this.name                 = (string)customerRow["Name"];
     this.dealingPolicyId      = customerRow.GetColumn <Guid?>("DealingPolicyID");
     this.privateQuotePolicyId = customerRow.GetColumn <Guid?>("PrivateQuotePolicyID");
     if (customerRow.Contains("Type"))
     {
         this.customerType = (CustomerType)customerRow["Type"];
     }
     if (customerRow.Contains("EmployeeType"))
     {
         this.employeeType = (EmployeeType)customerRow["EmployeeType"];
     }
 }
Exemplo n.º 9
0
        internal BOPolicyDetail(IDBRow row)
        {
            Guid binaryOptionPolicyID  = (Guid)row["BOPolicyID"];
            Guid binaryOptionBetTypeID = (Guid)row["BOBetTypeID"];
            int  frequency             = (int)row["Frequency"];

            this.Key               = new BOPolicyDetailKey(binaryOptionPolicyID, binaryOptionBetTypeID, frequency);
            this.MinBet            = (decimal)row["MinBet"];
            this.MaxBet            = (decimal)row["MaxBet"];
            this.AutoAcceptMaxBet  = (decimal)row["AutoAcceptMaxBet"];
            this.StepBet           = (decimal)row["StepBet"];
            this.Odds              = (decimal)row["Odds"];
            this.CommissionOpen    = (decimal)row["CommissionOpen"];
            this.MinCommissionOpen = (decimal)row["MinCommissionOpen"];
            this.MaxOrderCount     = row.GetColumn <int?>("MaxOrderCount");
            this.TotalBetLimit     = row.GetColumn <decimal?>("TotalBetLimit");
        }
Exemplo n.º 10
0
        internal static void Create(IDBRow dr)
        {
            Guid    currencyId = (Guid)dr["CurrencyID"];
            decimal balance    = (decimal)dr["Balance"];
            decimal frozenFund = dr.GetColumn <decimal>("FrozenFund");
            Guid    accountId  = (Guid)dr["AccountID"];
            Account account    = TradingSetting.Default.GetAccount(accountId);

            new SubFund(account, currencyId, balance, frozenFund, OperationType.None);
        }
 internal static void ParseForBO(BOOrderConstructParams constructParams, IDBRow dataRowOrder, Guid instrumentId, Guid accountId, DateTime?tradeDay)
 {
     constructParams.ParseForGeneral(dataRowOrder, instrumentId, accountId, tradeDay);
     constructParams.PaidPledge        = dataRowOrder.GetColumn <decimal>("PaidPledge");
     constructParams.PaidPledgeBalance = dataRowOrder.GetColumn <decimal>("PaidPledgeBalance");
     constructParams.BetTypeId         = dataRowOrder.GetColumn <Guid>("BOBetTypeID");
     constructParams.Frequency         = dataRowOrder.GetColumn <int>("BOFrequency");
     constructParams.Odds       = dataRowOrder.GetColumn <decimal>("BOOdds");
     constructParams.BetOption  = dataRowOrder.GetColumn <long>("BOBetOption");
     constructParams.SettleTime = dataRowOrder.GetColumn <DateTime?>("BOSettleTime");
 }
Exemplo n.º 12
0
        public static Alert Create(IDBRow row, IQuotationSetterProvider quotationSetterProvider)
        {
            Alert alert = new Alert();

            alert.Id            = (Guid)row["ID"];
            alert.UserId        = (Guid)row["UserID"];
            alert.QuotePolicyId = row.GetColumn <Guid?>("QuotePolicyID");
            alert.InstrumentId  = (Guid)row["InstrumentID"];
            alert.Condition     = (AlertCondition)((int)row["Condition"]);
            alert.ExpireTime    = (DateTime)row["ExpirationTime"];
            IQuotationSetter setter = quotationSetterProvider.Get(alert.InstrumentId);

            alert.Price = new Price((string)row["Price"], setter.NumeratorUnit, setter.Denominator);
            alert.State = (AlertState)((int)row["State"]);

            return(alert);
        }
Exemplo n.º 13
0
        internal Instrument(IDBRow instrumentRow)
        {
            this._id         = (Guid)instrumentRow["ID"];
            this._currencyId = (Guid)instrumentRow["CurrencyID"];
            this._code       = (string)instrumentRow["Code"];
            _originCode      = instrumentRow.GetColumn <string>("OriginCode");

            this._isActive           = instrumentRow.GetColumn <bool>("IsActive");
            this._lastAcceptTimeSpan = instrumentRow.GetColumn <int>("LastAcceptTimeSpan");
            this._orderTypeMask      = instrumentRow.GetColumn <int>("OrderTypeMask");
            this._mit = instrumentRow.GetColumn <bool>("MIT");

            this.AutoAcceptMaxLot = instrumentRow.GetColumn <decimal>("AutoAcceptMaxLot");
            this.AutoCancelMaxLot = instrumentRow.GetColumn <decimal>("AutoCancelMaxLot");
            this._isAutoFill      = instrumentRow.GetColumn <bool>("IsAutoFill");

            this._maxMinAdjust = instrumentRow.GetColumn <int>("MaxMinAdjust");

            this._interestFormula  = (InterestFormula)instrumentRow.GetColumn <byte>("InterestFormula");
            this._interestYearDays = instrumentRow.GetColumn <int>("InterestYearDays");
            this._useSettlementPriceForInterest = instrumentRow.GetColumn <bool>("UseSettlementPriceForInterest");
            this.InactiveTime = instrumentRow.GetColumn <int>("OriginInactiveTime");

            this._isBetterPrice    = instrumentRow.GetColumn <bool>("IsBetterPrice");
            this._hitTimes         = instrumentRow.GetColumn <short>("HitTimes");
            this._penetrationPoint = instrumentRow.GetColumn <int>("PenetrationPoint");

            this._isPriceEnabled = instrumentRow.GetColumn <bool>("IsPriceEnabled");

            this.SpotPaymentTime = instrumentRow.GetColumn <DateTime?>("SpotPaymentTime");

            this._canPlacePendingOrderAtAnyTime = instrumentRow.GetColumn <bool>("CanPlacePendingOrderAtAnyTime");
            this._allowedSpotTradeOrderSides    = (AllowedOrderSides)instrumentRow.GetColumn <byte>("AllowedSpotTradeOrderSides");

            this.HitPriceVariationForSTP = instrumentRow.GetColumn <int>("HitPriceVariationForSTP");

            if (instrumentRow.ExistsColumn("ExternalExchangeCode"))
            {
                if (instrumentRow["ExternalExchangeCode"] != DBNull.Value)
                {
                    this._exchangeSystem = (ExchangeSystem)Enum.Parse(typeof(ExchangeSystem), (string)(instrumentRow["ExternalExchangeCode"]), true);
                }
            }

            this.AutoDQDelay      = TimeSpan.FromSeconds(instrumentRow.GetColumn <Int16>("AutoDQDelay"));
            this._summaryQuantity = instrumentRow.GetColumn <decimal>("SummaryQuantity");
            this.PLValueDay       = instrumentRow.GetColumn <Int16>("PLValueDay");

            if (instrumentRow.ExistsColumn("UseAlertLevel4WhenClosed"))
            {
                this.UseAlertLevel4WhenClosed = instrumentRow["UseAlertLevel4WhenClosed"] == DBNull.Value ? false : (bool)instrumentRow["UseAlertLevel4WhenClosed"];
            }
            if (instrumentRow.ExistsColumn("HolidayAlertDayPolicyID"))
            {
                Guid policyId = Guid.Empty;
                if (Guid.TryParse(instrumentRow["HolidayAlertDayPolicyID"].ToString(), out policyId))
                {
                    this.HolidayAlertDayPolicyId = policyId;
                }
            }
            if (instrumentRow.ExistsColumn("AcceptIfDoneVariation"))
            {
                this._acceptIfDoneVariation = instrumentRow.GetColumn <int>("AcceptIfDoneVariation");
            }
            if (instrumentRow.Contains("PlaceSptMktTimeSpan"))
            {
                _placeSptMktTimeSpan = TimeSpan.FromSeconds((int)instrumentRow["PlaceSptMktTimeSpan"]);
            }

            if (instrumentRow.Contains("FirstOrderTime"))
            {
                _firstOrderTime = (int)instrumentRow["FirstOrderTime"];
            }

            this.Update(instrumentRow);
        }
Exemplo n.º 14
0
        internal OrderDayHistory(IDBRow dr)
        {
            this.TradeDay               = (DateTime)dr["TradeDay"];
            this.OrderID                = (Guid)dr["OrderID"];
            this.InstrumentID           = (Guid)dr["InstrumentID"];
            this.AccountID              = (Guid)dr["AccountID"];
            this.CurrencyID             = (Guid)dr["CurrencyID"];
            this.DayInterestPLNotValued = dr.GetColumn <decimal>("DayInterestPLNotValued");
            this.DayStoragePLNotValued  = dr.GetColumn <decimal>("DayStoragePLNotValued");

            this.InterestPLValued = dr.GetColumn <decimal>("InterestPLValued");
            this.StoragePLValued  = dr.GetColumn <decimal>("StoragePLValued");
            this.TradePLValued    = dr.GetColumn <decimal>("TradePLValued");

            this.InterestPLFloat = dr.GetColumn <decimal>("InterestPLFloat");
            this.StoragePLFloat  = dr.GetColumn <decimal>("StoragePLFloat");
            this.TradePLFloat    = dr.GetColumn <decimal>("TradePLFloat");

            this.LotBalance     = dr.GetColumn <decimal>("LotBalance");
            this.StoragePerLot  = dr.GetColumn <decimal>("StoragePerLot");
            this.InterestPerLot = dr.GetColumn <decimal>("InterestPerLot");
        }
Exemplo n.º 15
0
        internal InstalmentPolicyDetail(IDBRow dataRow)
        {
            this.InstalmentPolicyId = dataRow.GetColumn <Guid>("InstalmentPolicyId");
            this.IsActive           = (bool)dataRow["IsActive"];
            this.InstalmentFeeType  = (InstalmentFeeType)dataRow.GetColumn <int>("AdministrationFeeBase");
            this.InstalmentFeeRate  = dataRow.GetColumn <decimal>("AdministrationFee");
            this.PrepaymentFeeType  = (PrepaymentFeeType)dataRow.GetColumn <int>("ContractTerminateType");
            this.PrepaymentFeeRate  = dataRow.GetColumn <decimal>("ContractTerminateFee");
            this.DownPaymentBasis   = (DownPaymentBasis)dataRow.GetColumn <int>("DownPaymentBasis");

            this.LatePaymentAutoCutDay = dataRow.GetColumn <int>("LatePaymentAutoCutDay");
            this.AutoCutPenaltyValue   = dataRow.GetColumn <decimal>("AutoCutPenaltyValue");
            this.AutoCutPenaltyBase    = (AutoCutPenaltyBase)dataRow.GetColumn <int>("AutoCutPenaltyBase");
            this.InterestRate          = dataRow.GetColumn <decimal>("InterestRate");

            this.ClosePenaltyValue  = dataRow.GetColumn <decimal>("ClosePenaltyValue");
            this.ClosePenaltyBase   = (ClosePenaltyBase)dataRow.GetColumn <int>("ClosePenaltyBase");
            this.DebitInterestRatio = dataRow.GetColumn <decimal>("DebitInterestRatio");
            this.DebitFreeDays      = dataRow.GetColumn <int>("DebitFreeDays");
            this.DebitInterestType  = dataRow.GetColumn <int>("DebitInterestType");

            int period = dataRow.GetColumn <int>("Period");
            InstalmentFrequence frequence = (InstalmentFrequence)dataRow.GetColumn <int>("Frequence");

            this.Period = new InstalmentPeriod(period, frequence);
        }
Exemplo n.º 16
0
        //Replace has no key change, used for get settings in the past
        internal void Update(IDBRow tradePolicyDetailRow)
        {
            this.instrumentId = tradePolicyDetailRow.GetColumn <Guid>("InstrumentID");

            this.multipleCloseAllowed = tradePolicyDetailRow.GetColumn <bool>("MultipleCloseAllowed");
            //this.changePlacedOrderAllowed = (bool)tradePolicyDetailRow["ChangePlacedOrderAllowed"];
            this.isTradeActive = tradePolicyDetailRow.GetColumn <bool>("IsTradeActive");
            this.contractSize  = tradePolicyDetailRow.GetColumn <decimal>("ContractSize");

            this.minCommissionOpen  = tradePolicyDetailRow.GetColumn <decimal>("MinCommissionOpen");
            this.minCommissionClose = tradePolicyDetailRow.GetColumn <decimal>("MinCommissionClose");

            this.commissionOpen     = tradePolicyDetailRow.GetColumn <decimal>("CommissionOpen");
            this.commissionCloseD   = tradePolicyDetailRow.GetColumn <decimal>("CommissionCloseD");
            this.commissionCloseO   = tradePolicyDetailRow.GetColumn <decimal>("CommissionCloseO");
            this.pairRelationFactor = tradePolicyDetailRow.GetColumn <decimal>("PairRelationFactor");

            this.levyOpen  = tradePolicyDetailRow.GetColumn <decimal>("LevyOpen");
            this.levyClose = tradePolicyDetailRow.GetColumn <decimal>("LevyClose");

            this.marginD          = tradePolicyDetailRow.GetColumn <decimal>("MarginD");
            this.marginO          = tradePolicyDetailRow.GetColumn <decimal>("MarginO");
            this.marginLockedD    = tradePolicyDetailRow.GetColumn <decimal>("MarginLockedD");
            this.marginLockedO    = tradePolicyDetailRow.GetColumn <decimal>("MarginLockedO");
            this.marginSpot       = tradePolicyDetailRow.GetColumn <decimal>("MarginSpot");
            this.marginSpotSpread = tradePolicyDetailRow.GetColumn <decimal>("MarginSpotSpread");
            this.riskCredit       = tradePolicyDetailRow.GetColumn <decimal>("RiskCredit");

            this.necessaryRound  = tradePolicyDetailRow.GetColumn <int>("NecessaryRound");
            this.alertLevel1     = tradePolicyDetailRow.GetColumn <decimal>("AlertLevel1");
            this.alertLevel2     = tradePolicyDetailRow.GetColumn <decimal>("AlertLevel2");
            this.alertLevel3     = tradePolicyDetailRow.GetColumn <decimal>("AlertLevel3");
            this.alertLevel4     = tradePolicyDetailRow.GetColumn <decimal>("AlertLevel4");
            this.alertLevel1Lock = tradePolicyDetailRow.GetColumn <decimal>("AlertLevel1Lock");
            this.alertLevel2Lock = tradePolicyDetailRow.GetColumn <decimal>("AlertLevel2Lock");
            this.alertLevel3Lock = tradePolicyDetailRow.GetColumn <decimal>("AlertLevel3Lock");
            this.alertLevel4Lock = tradePolicyDetailRow.GetColumn <decimal>("AlertLevel4Lock");

            this.isAcceptNewStop   = (LimitOption)tradePolicyDetailRow.GetColumn <int>("IsAcceptNewStop");
            this.isAcceptNewMOOMOC = tradePolicyDetailRow.GetColumn <bool>("IsAcceptNewMOOMOC");
            this.isAcceptNewLimit  = (LimitOption)tradePolicyDetailRow.GetColumn <int>("IsAcceptNewLimit");
            this.oiPercent         = tradePolicyDetailRow.GetColumn <decimal>("OIPercent");
            if (!tradePolicyDetailRow.ExistsColumn("AccountMaxOpenLot") || tradePolicyDetailRow["AccountMaxOpenLot"] == DBNull.Value)
            {
                this.accountMaxOpenLot = null;
            }
            else
            {
                this.accountMaxOpenLot = (decimal)tradePolicyDetailRow["AccountMaxOpenLot"];
            }

            if (tradePolicyDetailRow.ExistsColumn("AllowNewOCO"))
            {
                this.allowNewOCO = tradePolicyDetailRow.GetColumn <bool>("AllowNewOCO");
            }
            else
            {
                this.allowNewOCO = false;
            }

            this.VolumeNecessaryId         = tradePolicyDetailRow.GetColumn <Guid?>("VolumeNecessaryId");
            this.instalmentPolicyId        = tradePolicyDetailRow.GetColumn <Guid?>("InstalmentPolicyId");
            this.physicalPaymentDiscountId = tradePolicyDetailRow["PhysicalPaymentDiscountId"] == DBNull.Value ? null : (Guid?)tradePolicyDetailRow["PhysicalPaymentDiscountId"];

            if (tradePolicyDetailRow.ExistsColumn("BOPolicyID") && tradePolicyDetailRow["BOPolicyID"] != DBNull.Value)
            {
                this.binaryOptionPolicyId = (Guid?)tradePolicyDetailRow["BOPolicyID"];
            }
            else
            {
                this.binaryOptionPolicyId = null;
            }

            this.allowedPhysicalTradeSides = (PhysicalTradeSide)tradePolicyDetailRow.GetColumn <int>("AllowedPhysicalTradeSides");
            this.buyInterestValueDay       = tradePolicyDetailRow.GetColumn <int>("BuyInterestValueDay");
            this.sellInterestValueDay      = tradePolicyDetailRow.GetColumn <int>("SellInterestValueDay");
            this.frozenFundMatureDay       = tradePolicyDetailRow.GetColumn <int>("PhysicalValueMatureDay");
            this.discountOfOdd             = tradePolicyDetailRow.GetColumn <decimal>("DiscountOfOdd");
            this.valueDiscountAsMargin     = tradePolicyDetailRow.GetColumn <decimal>("ValueDiscountAsMargin");
            this.instalmentPledgeDiscount  = tradePolicyDetailRow.GetColumn <decimal>("InstalmentPledgeDiscount");
            this.shortSellDownPayment      = tradePolicyDetailRow.GetColumn <decimal>("ShortSellDownPayment");
            this.partPaidPhysicalNecessary = tradePolicyDetailRow.GetColumn <decimal>("PartPaidPhysicalNecessary");
            this.OtherFeeClose             = (decimal)tradePolicyDetailRow["OtherFeeClose"];
            this.OtherFeeOpen = (decimal)tradePolicyDetailRow["OtherFeeOpen"];
            this.InterestCut  = (byte)tradePolicyDetailRow["InterestCut"];
        }
Exemplo n.º 17
0
 internal InstrumentTradeDaySetting(IDBRow dr, Guid instrumentId, DateTime tradeDate, Settings.Setting setting)
 {
     this.InterestMultiple                = dr.GetColumn <int>("InterestMultiple");
     this.BeginTime                       = dr.GetColumn <DateTime>("BeginTime");
     this.ResetTime                       = dr.GetColumn <DateTime>("ResetTime");
     this.ValueDate                       = dr.GetColumn <DateTime?>("ValueDate");
     this.ShouldValueCurrentDayPL         = dr.GetColumn <bool>("ShouldValueCurrentDayPL");
     this.IsUseSettlementPriceForInterest = dr.GetColumn <bool>("IsUseSettlementPriceForInterest");
     this.StoragePerLotInterestRateBuy    = dr.GetColumn <decimal>("StoragePerLotInterestRateBuy");
     this.StoragePerLotInterestRateSell   = dr.GetColumn <decimal>("StoragePerLotInterestRateSell");
     this.InterestRateBuy                 = dr.GetColumn <decimal>("InterestRateBuy");
     this.InterestRateSell                = dr.GetColumn <decimal>("InterestRateSell");
     this.InstalmentInterestRateBuy       = dr.GetColumn <decimal>("InstalmentInterestRateBuy");
     this.InstalmentInterestRateSell      = dr.GetColumn <decimal>("InstalmentInterestRateSell");
     this.IsMonthLastDay                  = dr.GetColumn <bool>("IsMonthLastDay");
     this.WeekDay = dr.GetColumn <int>("WeekDay");
     this.IsInterestUseAccountCurrency = dr.GetColumn <bool>("IsInterestUseAccountCurrency");
 }
Exemplo n.º 18
0
        internal virtual void Update(IDBRow dataRow)
        {
            this._maxDQLot      = dataRow.GetColumn <decimal>("MaxDQLot");
            this._maxOtherLot   = dataRow.GetColumn <decimal>("MaxOtherLot");
            this._dqQuoteMinLot = dataRow.GetColumn <decimal>("DQQuoteMinLot");

            this._autoDQMaxLot      = dataRow.GetColumn <decimal>("AutoDQMaxLot");
            this._acceptDQVariation = dataRow.GetColumn <int>("AcceptDQVariation");

            this._autoLmtMktMaxLot        = dataRow.GetColumn <decimal>("AutoLmtMktMaxLot");
            this._acceptLmtVariation      = dataRow.GetColumn <int>("AcceptLmtVariation");
            this._acceptCloseLmtVariation = dataRow.GetColumn <int>("AcceptCloseLmtVariation");

            this._cancelLmtVariation = dataRow.GetColumn <int>("CancelLmtVariation");
            this._autoDQDelay        = TimeSpan.FromSeconds(dataRow.GetColumn <Int16>("AutoDQDelay"));

            this._autoAcceptMaxLot = dataRow.GetColumn <decimal>("AutoAcceptMaxLot");
            this._autoCancelMaxLot = dataRow.GetColumn <decimal>("AutoCancelMaxLot");

            this._hitPriceVariationForSTP = dataRow.GetColumn <int>("HitPriceVariationForSTP");
            this._allowedNewTradeSides    = (AllowedOrderSides)dataRow.GetColumn <byte>("AllowedNewTradeSides");
            if (dataRow.Contains("PlaceSptMktTimeSpan"))
            {
                this._placeSptMktTimeSpan = TimeSpan.FromSeconds((int)dataRow["PlaceSptMktTimeSpan"]);
            }
        }
Exemplo n.º 19
0
        private Protocal.Physical.OrderInstalmentData CreateInstalment(IDBRow dr)
        {
            var result = new Protocal.Physical.OrderInstalmentData();

            result.OrderId               = dr.GetColumn <Guid>("OrderId");
            result.Sequence              = dr.GetColumn <int>("Sequence");
            result.InterestRate          = dr.GetColumn <decimal>("InterestRate");
            result.Principal             = dr.GetColumn <decimal>("Principal");
            result.Interest              = dr.GetColumn <decimal>("Interest");
            result.DebitInterest         = dr.GetColumn <decimal>("DebitInterest");
            result.PaymentDateTimeOnPlan = dr.GetColumn <DateTime?>("PaymentDateTimeOnPlan");
            result.PaidDateTime          = dr.GetColumn <DateTime?>("PaidDateTime");
            result.UpdatePersonId        = dr.GetColumn <Guid?>("UpdatePersonId");
            result.UpdateTime            = dr.GetColumn <DateTime?>("UpdateTime");
            result.LotBalance            = dr.GetColumn <decimal?>("LotBalance");
            return(result);
        }
        internal static void ParseForGeneral(this OrderConstructParams constructParams, IDBRow dataRowOrder, Guid instrumentId, Guid accountId, DateTime?tradeDay)
        {
            constructParams.Id = (Guid)dataRowOrder["ID"];
            if (dataRowOrder["Code"] != DBNull.Value)
            {
                constructParams.Code = (string)dataRowOrder["Code"];
            }
            constructParams.BlotterCode = dataRowOrder["BlotterCode"] == DBNull.Value ? null : (string)dataRowOrder["BlotterCode"];
            constructParams.Phase       = (OrderPhase)(byte)dataRowOrder["Phase"];
            constructParams.TradeOption = (TradeOption)(byte)dataRowOrder["TradeOption"];
            constructParams.IsOpen      = (bool)dataRowOrder["IsOpen"];
            constructParams.IsBuy       = (bool)dataRowOrder["IsBuy"];

            if (dataRowOrder["SetPrice"] != DBNull.Value)
            {
                constructParams.SetPrice = PriceHelper.CreatePrice((string)dataRowOrder["SetPrice"], instrumentId, tradeDay);
            }


            if (dataRowOrder["ExecutePrice"] != DBNull.Value)
            {
                constructParams.ExecutePrice = PriceHelper.CreatePrice((string)dataRowOrder["ExecutePrice"], instrumentId, tradeDay);
            }

            if (dataRowOrder["SetPriceMaxMovePips"] != DBNull.Value)
            {
                constructParams.SetPriceMaxMovePips = (int)dataRowOrder["SetPriceMaxMovePips"];
            }
            if (dataRowOrder["DQMaxMove"] != DBNull.Value)
            {
                constructParams.DQMaxMove = (int)dataRowOrder["DQMaxMove"];
            }

            constructParams.Lot            = (decimal)dataRowOrder["Lot"];
            constructParams.OriginalLot    = (decimal)dataRowOrder["OriginalLot"];
            constructParams.LotBalance     = (decimal)dataRowOrder["LotBalance"];
            constructParams.InterestPerLot = dataRowOrder.GetColumn <decimal>("InterestPerLot");
            constructParams.StoragePerLot  = dataRowOrder.GetColumn <decimal>("StoragePerLot");
            constructParams.HitCount       = (short)dataRowOrder["HitCount"];

            if (dataRowOrder["InterestValueDate"] != DBNull.Value)
            {
                constructParams.InterestValueDate = (DateTime)dataRowOrder["InterestValueDate"];
            }

            if (constructParams.HitCount != 0 && dataRowOrder["BestPrice"] != DBNull.Value)
            {
                constructParams.BestPrice = PriceHelper.CreatePrice((string)dataRowOrder["BestPrice"], instrumentId, tradeDay);
            }

            if (constructParams.HitCount != 0 && dataRowOrder["BestTime"] != DBNull.Value)
            {
                constructParams.BestTime = (DateTime)dataRowOrder["BestTime"];
            }

            if (dataRowOrder["EstimateCloseCommission"] != DBNull.Value)
            {
                constructParams.EstimateCloseCommission = (decimal)dataRowOrder["EstimateCloseCommission"];
            }

            if (dataRowOrder["EstimateCloseLevy"] != DBNull.Value)
            {
                constructParams.EstimateCloseLevy = (decimal)dataRowOrder["EstimateCloseLevy"];
            }
        }
Exemplo n.º 21
0
        internal void Update(IDBRow accountRow)
        {
            this.id            = accountRow.GetColumn <Guid>("ID");
            this.customerId    = accountRow.GetColumn <Guid>("CustomerID");
            this.currencyId    = accountRow.GetColumn <Guid>("CurrencyID");
            this.tradePolicyId = accountRow.GetColumn <Guid>("TradePolicyID");

            if (accountRow["SpecialTradePolicyID"] != DBNull.Value)
            {
                this.specialTradePolicyId = (Guid)accountRow["SpecialTradePolicyID"];
            }

            this.type           = (AccountType)accountRow.GetColumn <int>("Type");
            this.code           = accountRow.GetColumn <string>("Code");
            this.organizationId = accountRow.GetColumn <Guid>("OrganizationID");

            this.isActive         = accountRow.GetColumn <bool>("IsActive");
            this.isTradingAllowed = accountRow.GetColumn <bool>("IsTradingAllowed");
            this.beginTime        = accountRow.GetColumn <DateTime>("BeginTime");
            this.endTime          = accountRow.GetColumn <DateTime>("EndTime");
            this.UpdateTime       = accountRow.GetColumn <DateTime>("UpdateTime");

            this.isSplitLot           = true;// (bool)accountRow["IsSplitLot"];
            this.maxNecessary         = accountRow.GetColumn <decimal>("MaxNecessary");
            this.isAutoClose          = accountRow.GetColumn <bool>("IsAutoClose");
            this.isMultiCurrency      = accountRow.GetColumn <bool>("IsMultiCurrency");
            this.creditLotD           = accountRow.GetColumn <decimal>("CreditLotD");
            this.creditLotO           = accountRow.GetColumn <decimal>("CreditLotO");
            this.creditAmount         = accountRow.GetColumn <decimal>("CreditAmount");
            this.shortMargin          = accountRow.GetColumn <decimal>("ShortMargin");
            this.rateMarginD          = accountRow.GetColumn <decimal>("RateMarginD");
            this.rateMarginO          = accountRow.GetColumn <decimal>("RateMarginO");
            this.rateMarginLockD      = (decimal)accountRow["RateMarginLockD"];
            this.rateMarginLockO      = (decimal)accountRow["RateMarginLockO"];
            this.rateCommission       = (decimal)accountRow["RateCommission"];
            this.rateLevy             = (decimal)accountRow["RateLevy"];
            this.rateRiskNecessary    = (decimal)accountRow["RateRiskNecessary"];
            this.BlotterID            = accountRow["BlotterID"] == DBNull.Value ? null : (Guid?)accountRow["BlotterID"];
            this.RateOtherFee         = (decimal)accountRow["RateOtherFee"];
            this.MarginInterestOption = (MarginInterestOption)((int)accountRow["MarginInterestOption"]);
            this.isAutoCut            = (bool)accountRow["IsAutoCut"];
            this.riskLevelAction      = (RiskLevelAction)(int)accountRow["RiskLevelAction"];
            this.forbiddenAlert       = (int)accountRow["ForbiddenAlert"];
            this.riskActionMode       = (RiskActionMode)(int)accountRow["RiskActionMode"];
            if (!accountRow.Contains("RiskActionMinimumEquity") || accountRow["RiskActionMinimumEquity"] == DBNull.Value)
            {
                this.riskActionMinimumEquity = null;
            }
            else
            {
                this.riskActionMinimumEquity = (decimal)accountRow["RiskActionMinimumEquity"];
            }
            if (!accountRow.Contains("MaxOpenLot") || accountRow["MaxOpenLot"] == DBNull.Value)
            {
                this.maxOpenLot = null;
            }
            else
            {
                this.maxOpenLot = (decimal)accountRow["MaxOpenLot"];
            }

            if (!accountRow.Contains("MaxPhyscialValue") || accountRow["MaxPhyscialValue"] == DBNull.Value)
            {
                //this.maxPhyscialValue = null; //MaxPhyscialValue has no history, use current settings
            }
            else
            {
                this.maxPhyscialValue = (decimal)accountRow["MaxPhyscialValue"];
            }

            if (accountRow["AgentID"] != DBNull.Value)
            {
                this.agentId = (Guid)accountRow["AgentID"];
            }
            else
            {
                this.agentId = Guid.Empty;
            }
            if (accountRow.Contains("AllowSalesTrading"))
            {
                this.allowSalesTrading = (bool)accountRow["AllowSalesTrading"];
            }
            if (accountRow.Contains("AllowManagerTrading"))
            {
                this.allowManagerTrading = (bool)accountRow["AllowManagerTrading"];
            }

            if (accountRow.Contains("QuotePolicyID"))
            {
                this.QuotePolicyID = accountRow.GetColumn <Guid?>("QuotePolicyID");
            }
        }