public async Task <IMarginTradingAccount> UpdateTradingConditionIdAsync(string clientId, string accountId, string tradingConditionId) { return(await _tableStorage.MergeAsync(MarginTradingAccountEntity.GeneratePartitionKey(clientId), MarginTradingAccountEntity.GenerateRowKey(accountId), a => { a.TradingConditionId = tradingConditionId; return a; })); }
public async Task <MarginTradingAccount> UpdateBalanceAsync(string clientId, string accountId, decimal amount, bool changeLimit) { var account = await _tableStorage.GetDataAsync(MarginTradingAccountEntity.GeneratePartitionKey(clientId), MarginTradingAccountEntity.GenerateRowKey(accountId)); if (account != null) { account.Balance += (double)amount; if (changeLimit) { account.WithdrawTransferLimit += (double)amount; } await _tableStorage.InsertOrMergeAsync(account); return(MarginTradingAccount.Create(account)); } return(null); }
public async Task DeleteAsync(string clientId, string accountId) { await _tableStorage.DeleteAsync(MarginTradingAccountEntity.GeneratePartitionKey(clientId), MarginTradingAccountEntity.GenerateRowKey(accountId)); }
public async Task <IMarginTradingAccount> GetAsync(string clientId, string accountId) { return(await _tableStorage.GetDataAsync(MarginTradingAccountEntity.GeneratePartitionKey(clientId), MarginTradingAccountEntity.GenerateRowKey(accountId))); }