internal DeliveryRequest(Account owner, IDBRow dataRow) : base(BusinessRecordNames.DeliveryRequest, DEFAULT_ITEMS_FACTOR) { this._owner = owner; var constructParams = this.Parse(dataRow); this.Initialize(constructParams); owner.AddDeliveryRequest(this, OperationType.None); }
public PhysicalPaymentDiscountPolicy(IDBRow dataRow) { this.ID = (Guid)dataRow["ID"]; this.Option = (DiscountOption)(int)dataRow["Option"]; this.AllowedPaymentForms = (AllowedPaymentForm)(int)dataRow["AllowedPaymentForm"]; this.DiscountBasis = (DiscountBasis)(int)dataRow["DiscountBasis"]; this.Details = new List <PhysicalPaymentDiscountPolicyDetail>(); }
internal CurrencyRate(IDBRow currencyRateRow, Currency sourceCurrency, Currency targetCurrency) { this.sourceCurrency = sourceCurrency; this.targetCurrency = targetCurrency; this.rateIn = (decimal)(double)currencyRateRow["RateIn"]; this.rateOut = (decimal)(double)currencyRateRow["RateOut"]; this.dependingInstrumentId = currencyRateRow["DependingInstrumentId"] == DBNull.Value ? null : (Guid?)currencyRateRow["DependingInstrumentId"]; this.inverted = currencyRateRow["Inverted"] == DBNull.Value ? false : (bool)currencyRateRow["Inverted"]; }
public override void AddDBRow(int id, IDBRow dbRow) { if (m_DataSet.ContainsKey(id)) { throw new GameFrameworkException("DBRow is exist.id:" + id); } m_DataSet.Add(id, (T)dbRow); }
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"); }
internal void Initialize(IDBRow dr) { string originCode = (string)dr["OriginCode"]; if (dr["PriceStatus"] != DBNull.Value) { InstrumentPriceStatus status = (InstrumentPriceStatus)((int)dr["PriceStatus"]); this.statusStore[originCode] = status; } }
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 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"); }
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"); }
internal void InitializeOrderPLNotValued(IDBRow dr, Dictionary <Guid, Order> orderDict) { Guid orderId = (Guid)dr["OrderID"]; Order order; if (!orderDict.TryGetValue(orderId, out order)) { Logger.WarnFormat("Initialize orderPLNotValued orderId= {0}, can't find related order", orderId); return; } order.NotValuedDayInterestAndStorage.Add((decimal)dr["DayInterestPLNotValued"], (decimal)dr["DayStoragePLNotValued"]); }
internal DeliveryRequestOrderRelation(DeliveryRequest request, IDBRow dataRow) : base(BusinessRecordNames.DeliveryRequestOrderRelation, DEFAULT_ITEMS_FACTOR) { this._owner = request; var key = (Guid)dataRow["OpenOrderId"]; this._deliveryRequestId = BusinessItemFactory.Create(DeliveryRequestRelationBusinessItemNames.DeliveryRequestId, (Guid)dataRow["DeliveryRequestId"], PermissionFeature.Key, this); this._openOrderId = BusinessItemFactory.Create(DeliveryRequestRelationBusinessItemNames.OpenOrderId, key, PermissionFeature.Key, this); this._deliveryQuantity = BusinessItemFactory.Create(DeliveryRequestRelationBusinessItemNames.DeliveryQuantity, (decimal)dataRow["DeliveryQuantity"], PermissionFeature.Dumb, this); this._deliveryLot = BusinessItemFactory.Create(DeliveryRequestRelationBusinessItemNames.DeliveryLot, (decimal)dataRow["DeliveryLot"], PermissionFeature.Dumb, this); request.AddDeliveryRequestOrderRelation(this, OperationType.None); }
public AccountRisk(Account account, IDBRow dr, InstrumentManager manager) : base(account) { _account = account; _instrumentManager = manager; _riskDataCalculator = new RiskDataCalculator(account, manager); ConstructParams constructParams = new AccountRisk.ConstructParams(); constructParams.AlertLevel = (AlertLevel)dr["AlertLevel"]; constructParams.AlertTime = null; constructParams.AlertLevelAfterCut = constructParams.AlertLevel; this.Parse(constructParams); }
internal PLBill(IDBRow dr) : base(dr) { DateTime?valueTime = null; if (dr["ValueTime"] != DBNull.Value) { valueTime = (DateTime)dr["ValueTime"]; } bool isValued = (bool)dr["IsValued"]; this.Initialize(valueTime, isValued); }
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); }
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"); }
private void ParseOrder(IDBRow dr, Transaction tran, Dictionary <Guid, Order> orders) { var addOrderCommandFactory = OrderFacade.Default.GetAddOrderCommandFactory(tran); var command = addOrderCommandFactory.CreateByDataRow(tran, dr); command.Execute(); var order = command.Result; orders.Add(order.Id, order); if (tran.OrderType == OrderType.Limit && tran.CanExecute && order.BestPrice != null && order.CalculateLimitMarketHitStatus(false) == OrderHitStatus.Hit) { tran.Owner.AddPendingConfirmLimitOrder(order); } }
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"]; } }
internal void InitializeAccountResetStatus(IDBRow dr) { if (dr["LastResetDay"] != DBNull.Value) { Guid accountId = (Guid)dr["AccountID"]; DateTime lastResetDay = (DateTime)dr["LastResetDay"]; var account = _tradingSetting.GetAccount(accountId); if (account == null) { Logger.WarnFormat("ParseAccountLastResetDay can't find account = {0}, lastResetDay = {1}", accountId, lastResetDay); return; } account.LastResetDay = lastResetDay; } }
public static T GetColumn <T>(this IDBRow row, string columnName) { try { var value = row[columnName]; if (value == DBNull.Value) { return(default(T)); } return((T)value); } catch { throw; } }
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); }
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 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"); }
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"); }
private static CurrencyRate ParseCurrencyRate(IDBRow dr, Dictionary <Guid, Currency> currencyDict) { Guid sourceCurrencyId = (Guid)dr["SourceCurrencyID"]; if (!currencyDict.ContainsKey(sourceCurrencyId)) { throw new CurrencyRateParseException(sourceCurrencyId, string.Format("source currency = {0} not found", sourceCurrencyId)); } Currency sourceCurrency = currencyDict[sourceCurrencyId]; Guid targetCurrencyId = (Guid)dr["TargetCurrencyID"]; if (!currencyDict.ContainsKey(targetCurrencyId)) { throw new CurrencyRateParseException(targetCurrencyId, string.Format("target currency = {0} not found", targetCurrencyId)); } Currency targetCurrency = currencyDict[targetCurrencyId]; return(new CurrencyRate(dr, sourceCurrency, targetCurrency)); }
internal void InitializeInstrumentResetStatus(IDBRow dr) { if (dr["LastResetDay"] == DBNull.Value) { return; } Guid accountId = (Guid)dr["AccountID"]; Guid instrumentId = (Guid)dr["InstrumentID"]; DateTime lastResetDay = (DateTime)dr["LastResetDay"]; var account = _tradingSetting.GetAccount(accountId); if (account == null) { Logger.ErrorFormat("ParseInstrumentLastResetDay can't find account = {0}, instrumentId= {1}, lastResetDay = {2}", accountId, instrumentId, lastResetDay); return; } var instrument = account.GetOrCreateInstrument(instrumentId); instrument.LastResetDay = lastResetDay; }
private IEnumerable <IDBRow> GetCopyRows() { if (m_copyData == null || m_copyData.Count == 0) { yield break; } // fix temp ids _Records = _Records.ToDictionary(x => x.Value.Id, x => x.Value); foreach (var copyRow in m_copyData) { IDBRow rec = _Records[copyRow.Value].Clone(); rec.Data = new BitReader(recordsData); rec.Id = copyRow.Key; _Records[rec.Id] = rec; yield return(rec); } m_copyData.Clear(); }
private DeliveryRequestConstructParams Parse(IDBRow dr) { DeliveryRequestConstructParams result = new DeliveryRequestConstructParams(); result.Id = (Guid)dr["Id"]; result.AccountId = (Guid)dr["AccountId"]; result.InstrumentId = (Guid)dr["InstrumentId"]; result.Code = (string)dr["Code"]; result.PrintingCode = (string)dr["PrintingCode"]; result.Ask = (string)dr["Ask"]; result.Bid = (string)dr["Bid"]; result.DeliveryRequestStatus = (DeliveryRequestStatus)((byte)dr["Status"]); result.RequireQuantity = (decimal)dr["RequireQuantity"]; result.RequireLot = (decimal)dr["RequireLot"]; result.SubmitTime = (DateTime)dr["SubmitTime"]; result.SubmitorId = (Guid)dr["SubmitorId"]; if (dr["DeliveryTime"] != DBNull.Value) { result.DeliveryTime = (DateTime)dr["DeliveryTime"]; } return(result); }
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"); }
public BOPolicy(IDBRow row) { this.ID = (Guid)row["ID"]; this.Code = (string)row["Code"]; if (row["MaxOrderCount"] == DBNull.Value) { this.MaxOrderCount = null; } else { this.MaxOrderCount = (int)row["MaxOrderCount"]; } if (row["TotalBetLimit"] == DBNull.Value) { this.TotalBetLimit = null; } else { this.TotalBetLimit = (decimal)row["TotalBetLimit"]; } }
internal void LoadQuotations(IDBRow overridedQuotationRow, Dictionary <Guid, QuotePolicy2QuotationDict> instrumentQuotations) { lock (_mutex) { Guid instrumentId = (Guid)overridedQuotationRow["InstrumentID"]; Instrument instrument = _instruments[instrumentId]; string ask = overridedQuotationRow["Ask"] == DBNull.Value ? null : (string)overridedQuotationRow["Ask"]; string bid = overridedQuotationRow["Bid"] == DBNull.Value ? null : (string)overridedQuotationRow["Bid"]; string high = overridedQuotationRow["High"] == DBNull.Value ? null : (string)overridedQuotationRow["High"]; string low = overridedQuotationRow["Low"] == DBNull.Value ? null : (string)overridedQuotationRow["Low"]; DateTime timestamp = (DateTime)overridedQuotationRow["Timestamp"]; Quotation quotation = Quotation.Create(instrumentId, ask, bid, high, low, timestamp, Settings.Setting.Default); Guid quotePolicyId = (Guid)overridedQuotationRow["QuotePolicyID"]; QuotePolicy2QuotationDict dict; if (!instrumentQuotations.TryGetValue(instrumentId, out dict)) { dict = new QuotePolicy2QuotationDict(); instrumentQuotations.Add(instrumentId, dict); } dict.Add(quotePolicyId, quotation); } }