コード例 #1
0
 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);
 }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: AccountRisk.cs プロジェクト: dreamsql/Outter
            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);
            }
コード例 #4
0
ファイル: AccountRisk.cs プロジェクト: dreamsql/Outter
 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);
         }
     }
 }
コード例 #5
0
ファイル: AccountRisk.cs プロジェクト: dreamsql/Outter
            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);
            }
コード例 #6
0
 internal void ResetRiskData(FundData FundData)
 {
     _content.RiskRawData.Reset(FundData);
 }