internal void Add(RiskData other, CurrencyRate currencyRate = null) { this.Necessary += this.AddByExchange(other.Necessary, currencyRate); this.NetNecessary += this.AddByExchange(other.NetNecessary, currencyRate); this.HedgeNecessary += this.AddByExchange(other.HedgeNecessary, currencyRate); this.MinEquityAvoidRiskLevel1 += this.AddByExchange(other.MinEquityAvoidRiskLevel1, currencyRate); this.MinEquityAvoidRiskLevel2 += this.AddByExchange(other.MinEquityAvoidRiskLevel2, currencyRate); this.MinEquityAvoidRiskLevel3 += this.AddByExchange(other.MinEquityAvoidRiskLevel3, currencyRate); this.NecessaryFillingOpenOrder += this.AddByExchange(other.NecessaryFillingOpenOrder, currencyRate); this.NecessaryFillingCloseOrder += this.AddByExchange(other.NecessaryFillingCloseOrder, currencyRate); this.TradePLFloat += this.AddByExchange(other.TradePLFloat, currencyRate); this.InterestPLFloat += this.AddByExchange(other.InterestPLFloat, currencyRate); this.StoragePLFloat += this.AddByExchange(other.StoragePLFloat, currencyRate); this.ValueAsMargin += this.AddByExchange(other.ValueAsMargin, currencyRate); this.TradePLNotValued += this.AddByExchange(other.TradePLNotValued, currencyRate); this.InterestPLNotValued += this.AddByExchange(other.InterestPLNotValued, currencyRate); this.StoragePLNotValued += this.AddByExchange(other.StoragePLNotValued, currencyRate); this.LockOrderTradePLFloat += this.AddByExchange(other.LockOrderTradePLFloat, currencyRate); this.FeeForCutting += this.AddByExchange(other.FeeForCutting, currencyRate); this.RiskCredit += this.AddByExchange(other.RiskCredit, currencyRate); this.PartialPaymentPhysicalNecessary += this.AddByExchange(other.PartialPaymentPhysicalNecessary, currencyRate); this.TotalPaidAmount += this.AddByExchange(other.TotalPaidAmount, currencyRate); }
internal FundContent(BusinessRecord parent, decimal?balance, decimal?frozenFund, Account account) { _totalDeposit = BusinessItemFactory.Create("TotalDeposit", 0m, PermissionFeature.Sound, parent); _balance = BusinessItemFactory.Create(FundBusinessItemNames.Balance, balance, PermissionFeature.Sound, parent); _frozenFund = BusinessItemFactory.Create(FundBusinessItemNames.FrozenFund, frozenFund, PermissionFeature.Sound, parent); this._riskRawData = new RiskData(parent); _account = account; }
internal Instrument(Account owner, Guid id, QuotationBulk initQuotation, InstrumentServiceFactory factory) : base("Instrument", 15) { _owner = owner; this.Id = id; this.QuotationBulk = initQuotation; _orderCollector = new Lazy <OrderCollector>(() => factory.CreateOrderCollector(this)); _lotCalculator = new Lazy <LotCalculator>(() => factory.CreateLotCalculator(this)); _calculator = new Lazy <InstrumentCalculator>(() => factory.CreateInstrumentCalculator(this)); _riskRawData = new RiskData(null); _cuttingFee = new CuttingFee(this); _lastResetDay = BusinessItemFactory.Create <DateTime?>("LastResetDay", null, PermissionFeature.Sound, this); _id = BusinessItemFactory.Create("ID", id, PermissionFeature.Key, this); _accountId = BusinessItemFactory.Create("AccountID", owner.Id, PermissionFeature.Key, this); _resetItemHistoryDict = new BusinessRecordDictionary <DateTime, InstrumentResetItem>("ResetItemHistory", this); _currencyRate = this.DoGetCurrencyRate(null); _waitingForHitOrders = new CacheData <List <Order> >(_orderCollector.Value.CollectWaitingForHitOrders); _executedAndHasPositionOrders = new CacheData <List <Order> >(_orderCollector.Value.CollectExecutedAndHasPositionOrders); _totalBuyQuantity = new CacheData <decimal>(_lotCalculator.Value.CalculateBuyQuantity); _TotalSellQuantity = new CacheData <decimal>(_lotCalculator.Value.CalculateSellQuantity); _quotationManager = new QuotationManager(owner, this, initQuotation); }
private AlertLevel CalculateAlertLevelHelper(bool afterLock) { RiskData riskRawData = _account.SumFund.RiskRawData; decimal equity = _account.SumFund.Equity + _account.Setting().CreditAmount + riskRawData.RiskCredit; if (afterLock) { equity += riskRawData.LockOrderTradePLFloat; } AlertLevel alertLevel = AlertLevel.Normal; decimal? riskActionMinimumEquity = _account.Setting().RiskActionMinimumEquity; if (riskActionMinimumEquity != null) { if (equity < riskActionMinimumEquity.Value) { alertLevel = AlertLevel.Cut; } } else { var settingAccount = _account.Setting(); if (equity < (riskRawData.MinEquityAvoidRiskLevel3 * settingAccount.RateRiskNecessary)) { alertLevel = AlertLevel.Cut; } else if (equity < (riskRawData.MinEquityAvoidRiskLevel2 * settingAccount.RateRiskNecessary)) { alertLevel = AlertLevel.Notify; } else if (equity < (riskRawData.MinEquityAvoidRiskLevel1 * settingAccount.RateRiskNecessary)) { alertLevel = AlertLevel.Call; } } return(alertLevel); }
internal void Add(RiskData other, CurrencyRate currencyRate) { this.RiskData.Add(other, currencyRate); }
internal void AddRiskData(RiskData riskData) { _content.RiskRawData.Add(riskData); }