internal void Reset(FundData fundData) { if (_content.Balance == null) { _content.Balance = fundData.Balance; _content.FrozenFund = fundData.FrozenFund; } _content.TotalDeposit = fundData.TotalDeposit; _content.RiskRawData.Reset(fundData); }
internal void Add(FundData other) { var currencyRate = other.CurrencyRate; this.Balance += this.AddByExchange(other.Balance, currencyRate); this.FrozenFund += this.AddByExchange(other.FrozenFund, currencyRate); this.TotalDeposit += this.AddByExchange(other.TotalDeposit, currencyRate); this.Add(other.RiskData, other.CurrencyRate); }
private void CalculateSumFund() { FundData sumFund = FundDataPool.Default.Get(_account, _account.Setting().CurrencyId); bool hasPosition = _account.HasPosition(); foreach (var eachFund in _funds.Values) { var fund = _account.GetOrCreateFund(eachFund.CurrencyId); fund.ResetRiskData(eachFund); sumFund.Add(eachFund); } _account.SumFund.Reset(sumFund); }
private void CalculateSubFunds(DateTime baseTime, CalculateType calculateType, IQuotePolicyProvider quotePolicyProvider) { if (_instrumentManager.Count > 0) { foreach (var instrument in _instrumentManager.Instruments) { if (instrument.GetTransactions().Count == 0) { continue; } instrument.Calculate(baseTime, calculateType, instrument.GetQuotation(quotePolicyProvider)); FundData fund = this.GetOrCreateFund(instrument.CurrencyId); fund.Add(instrument.RiskRawData, null); } } }
private FundData GetOrCreateFund(Guid currencyId) { FundData fund = null; if (_account.IsMultiCurrency) { if (!_funds.TryGetValue(currencyId, out fund)) { fund = FundDataPool.Default.Get(_account, currencyId); } } else { if (!_funds.TryGetValue(_account.Setting().CurrencyId, out fund)) { fund = FundDataPool.Default.Get(_account, _account.Setting().CurrencyId); } } return(fund); }
internal void ResetRiskData(FundData FundData) { _content.RiskRawData.Reset(FundData); }