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"]; } }
//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); }
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"]); } }
internal TradePolicy(IDBRow tradePolicyRow) { this.id = (Guid)tradePolicyRow["ID"]; this.isFreeHedge = (bool)tradePolicyRow["IsFreeHedge"]; this.isFreeOverHedge = (bool)tradePolicyRow["IsFreeOverHedge"]; this.openNecessaryPolicy = new NecessaryPolicy(tradePolicyRow, "Open"); this.closeNecessaryPolicy = new NecessaryPolicy(tradePolicyRow, "Close"); this.alertLevel1 = (decimal)tradePolicyRow["AlertLevel1"]; this.alertLevel2 = (decimal)tradePolicyRow["AlertLevel2"]; this.alertLevel3 = (decimal)tradePolicyRow["AlertLevel3"]; this.alertLevel4 = (decimal)tradePolicyRow["AlertLevel4"]; this.alertLevel1Lock = (decimal)tradePolicyRow["AlertLevel1Lock"]; this.alertLevel2Lock = (decimal)tradePolicyRow["AlertLevel2Lock"]; this.alertLevel3Lock = (decimal)tradePolicyRow["AlertLevel3Lock"]; this.alertLevel4Lock = (decimal)tradePolicyRow["AlertLevel4Lock"]; if (tradePolicyRow.Contains("BinaryOptionBetLimit")) { this.BinaryOptionBetLimit = (decimal)tradePolicyRow["BinaryOptionBetLimit"]; } else { this.BinaryOptionBetLimit = 0; } }
public SystemParameter(IDBRow systemParameterRow) { this._tradeDayBeginTime = (DateTime)systemParameterRow["TradeDayBeginTime"]; this._mooMocAcceptDuration = (int)systemParameterRow["MooMocAcceptDuration"]; this._mooMocCancelDuration = (int)systemParameterRow["MooMocCancelDuration"]; this._dqDelayTimeOption = (DQDelayTimeOption)((int)systemParameterRow["DQDelayTimeOption"]); this._placeCheckType = (PlaceCheckType)(int)systemParameterRow["PlaceCheckType"]; this._needsFillCheck = (bool)systemParameterRow["NeedsFillCheck"]; this._canDealerViewAccountInfo = (bool)systemParameterRow["CanDealerViewAccountInfo"]; this._useNightNecessaryWhenBreak = (bool)systemParameterRow["UseNightNecessaryWhenBreak"]; this.BalanceDeficitAllowPay = (bool)systemParameterRow["BalanceDeficitAllowPay"]; if (systemParameterRow.Contains("IncludeFeeOnRiskAction")) { this._includeFeeOnRiskAction = (bool)systemParameterRow["IncludeFeeOnRiskAction"]; } if (systemParameterRow.Contains("EnableExportOrder")) { this._enableExportOrder = (bool)systemParameterRow["EnableExportOrder"]; } else { this._enableExportOrder = false; } if (systemParameterRow.Contains("EnableEmailNotify")) { this._enableEmailNotify = (bool)systemParameterRow["EnableEmailNotify"]; } else { this._enableEmailNotify = false; } if (systemParameterRow.Contains("EmailNotifyChangePassword")) { this._emailNotifyChangePassword = (bool)systemParameterRow["EmailNotifyChangePassword"]; } else { this._emailNotifyChangePassword = false; } if (systemParameterRow.Contains("CurrencyRateUpdateDuration")) { this._currencyRateUpdateDuration = (int)systemParameterRow["CurrencyRateUpdateDuration"]; } else { this._currencyRateUpdateDuration = -1; } if (systemParameterRow.Contains("DefaultQuotePolicyId")) { this._defaultQuotePolicyId = (Guid)systemParameterRow["DefaultQuotePolicyId"]; } this.MaxPriceDelayForSpotOrder = null; if (systemParameterRow.Contains("MaxPriceDelayForSpotOrder")) { object maxPriceDelayForSpotOrder = systemParameterRow["MaxPriceDelayForSpotOrder"]; if (maxPriceDelayForSpotOrder != DBNull.Value) { this.MaxPriceDelayForSpotOrder = TimeSpan.FromSeconds((int)maxPriceDelayForSpotOrder); } } if (systemParameterRow.Contains("RiskActionOnPendingConfirmLimit")) { this.RiskActionOnPendingConfirmLimit = (RiskActionOnPendingConfirmLimit)((byte)systemParameterRow["RiskActionOnPendingConfirmLimit"]); } this._executeActionWhenPendingOrderLotExceedMaxOtherLot = (ExecuteActionWhenPendingOrderLotExceedMaxOtherLot)((byte)systemParameterRow["LmtQuantityOnMaxLotChange"]); this._optionOfSTPAtHitPrice = (STPAtHitPriceOption)((byte)systemParameterRow["STPAtHitPriceOption"]); this._evaluateIfDonePlacingOnStpConfirm = (bool)systemParameterRow["EvaluateIfDonePlacingOnStpConfirm"]; this.EnableResetTelephonePin = (bool)systemParameterRow["EnableResetTelephonePin"]; if (systemParameterRow.Contains("EnableAutoResetAlertLevel")) { this.EnableAutoResetAlertLevel = (bool)systemParameterRow["EnableAutoResetAlertLevel"]; } else { this.EnableAutoResetAlertLevel = false; } }
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); }
public static bool ExistsColumn(this IDBRow row, string columnName) { return(row.Contains(columnName)); }
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"); } }