public async Task <WalletModel> CreateWallet([FromBody] CreateWalletRequest request) { var wallet = await _clientAccountService.CreateWalletAsync(_requestContext.ClientId, request.Type, request.Name, request.Description); return(new WalletModel { Id = wallet.Id, Name = wallet.Name, Type = wallet.Type, Description = wallet.Description }); }
private async Task <MarginTradingAccount> CreateAccount(string clientId, string baseAssetId, string tradingConditionId) { var tradingCondition = _tradingConditionsCacheService.GetTradingCondition(tradingConditionId) .RequiredNotNull("tradingCondition id " + tradingConditionId); var wallet = _marginSettings.IsLive ? await _clientAccountClient.CreateWalletAsync(clientId, WalletType.Trading, OwnerType.Mt, $"{baseAssetId} margin wallet", null) : null; var id = _marginSettings.IsLive ? wallet?.Id : $"{_marginSettings.DemoAccountIdPrefix}{Guid.NewGuid():N}"; var initialBalance = _marginSettings.IsLive ? 0 : LykkeConstants.DefaultDemoBalance; return(new MarginTradingAccount { Id = id, BaseAssetId = baseAssetId, ClientId = clientId, Balance = initialBalance, TradingConditionId = tradingConditionId, LegalEntity = tradingCondition.LegalEntity, }); }