コード例 #1
0
        private async Task <bool> CheckIfEnoughBalance(IAssetPair assetPair, TraderOrderBase order, double exchangedVolume)
        {
            var balances = await _srvBalanceAccess.GetCurrencyBalances(order.TraderId);

            if (order.Action == OrderAction.Buy)
            {
                return((balances.GetBalance(assetPair.BaseAssetId) - exchangedVolume) >= 0);
            }

            return((balances.GetBalance(assetPair.QuotingAssetId) - order.Volume) >= 0);
        }
コード例 #2
0
        public async Task <ActionResult> Index()
        {
            var id        = this.GetTraderId();
            var viewModel = new MarketPlaceIndexViewModel
            {
                Assets           = _assetsDictionary.GetAll().ToDictionary(itm => itm.Id),
                Trader           = await _clientAccountsRepository.GetByIdAsync(id),
                CurrencyBalances = await _srvBalanceAccess.GetCurrencyBalances(id)
            };

            return(View(viewModel));
        }