예제 #1
0
        /// <summary>
        /// updated portfolio information
        /// обновилась информация о портфелях
        /// </summary>
        /// <param name="accaunt"></param>
        private void ClientPortfoliosEvent(Accaunt accaunt)
        {
            foreach (var wallet in accaunt.data)
            {
                var needPortfolio = _portfolios.Find(p => p.Number == wallet.assetCode);
                if (needPortfolio != null)
                {
                    needPortfolio.ValueCurrent =
                        wallet.totalAmount.ToDecimal();
                    needPortfolio.ValueBlocked =
                        wallet.inOrderAmount.ToDecimal();
                }
                else
                {
                    var valueCurrent =
                        wallet.totalAmount.ToDecimal();

                    var valueBlocked =
                        wallet.inOrderAmount.ToDecimal();
                    if (valueCurrent != 0 || valueBlocked != 0)
                    {
                        _portfolios.Add(new Portfolio
                        {
                            Number       = wallet.assetCode,
                            ValueCurrent = valueCurrent,
                            ValueBlocked = valueBlocked,
                        });
                    }
                }
            }
            PortfolioEvent?.Invoke(_portfolios);
        }
예제 #2
0
        /// <summary>
        /// updated portfolio information
        /// обновилась информация о портфелях
        /// </summary>
        /// <param name="accaunt"></param>
        private void ClientPortfoliosEvent(Accaunt accaunt)
        {
            foreach (var wallet in accaunt.data)
            {
                var needPortfolio = _portfolios.Find(p => p.Number == wallet.assetCode);
                if (needPortfolio != null)
                {
                    needPortfolio.ValueCurrent = Convert.ToDecimal(
                        wallet.totalAmount.Replace(".",
                                                   CultureInfo.InvariantCulture.NumberFormat.NumberDecimalSeparator),
                        CultureInfo.InvariantCulture);
                    needPortfolio.ValueBlocked = Convert.ToDecimal(
                        wallet.inOrderAmount.Replace(".",
                                                     CultureInfo.InvariantCulture.NumberFormat.NumberDecimalSeparator),
                        CultureInfo.InvariantCulture);
                }
                else
                {
                    var valueCurrent = Convert.ToDecimal(
                        wallet.totalAmount.Replace(".",
                                                   CultureInfo.InvariantCulture.NumberFormat.NumberDecimalSeparator),
                        CultureInfo.InvariantCulture);

                    var valueBlocked = Convert.ToDecimal(
                        wallet.inOrderAmount.Replace(".",
                                                     CultureInfo.InvariantCulture.NumberFormat.NumberDecimalSeparator),
                        CultureInfo.InvariantCulture);
                    if (valueCurrent != 0 || valueBlocked != 0)
                    {
                        _portfolios.Add(new Portfolio
                        {
                            Number       = wallet.assetCode,
                            ValueCurrent = valueCurrent,
                            ValueBlocked = valueBlocked,
                        });
                    }
                }
            }
            PortfolioEvent?.Invoke(_portfolios);
        }