public static AccountHistoryBackendRequest ToBackendContract(this AccountHistoryFiltersClientRequest src, string clientId) { return(new AccountHistoryBackendRequest { AccountId = src.AccountId, ClientId = clientId, From = src.From, To = src.To }); }
public async Task <AccountHistoryItemClient[]> GetAccountHistoryTimeline(string clientId, AccountHistoryFiltersClientRequest request) { var isLive = !string.IsNullOrEmpty(request.AccountId) ? IsLiveAccount(request.AccountId) : request.IsLive; var marginTradingEnabled = await _marginTradingSettingsCacheService.IsMarginTradingEnabled(clientId, isLive); if (!marginTradingEnabled) { return(Array.Empty <AccountHistoryItemClient>()); } var accountHistoryBackendResponse = await _dataReaderClients.Get(isLive).AccountHistory.Timeline(new AccountHistoryRequest { AccountId = request.AccountId, ClientId = clientId, From = request.From, To = request.To }); return(ToClientContract(accountHistoryBackendResponse)); }
public async Task <ResponseModel <AccountHistoryItemClient[]> > GetAccountHistoryTimeline([FromQuery] AccountHistoryFiltersClientRequest request) { var clientId = this.GetClientId(); if (clientId == null) { return(this.UserNotFoundError <AccountHistoryItemClient[]>()); } var history = await _rpcFacade.GetAccountHistoryTimeline(clientId, request); return(ResponseModel <AccountHistoryItemClient[]> .CreateOk(history)); }
public async Task <AccountHistoryClientResponse> GetAccountHistory(string clientId, AccountHistoryFiltersClientRequest request) { var isLive = !string.IsNullOrEmpty(request.AccountId) ? IsLiveAccount(request.AccountId) : request.IsLive; var marginTradingEnabled = await _marginTradingSettingsCacheService.IsMarginTradingEnabled(clientId, isLive); if (!marginTradingEnabled) { return(new AccountHistoryClientResponse { Account = Array.Empty <AccountHistoryClientContract>(), OpenPositions = Array.Empty <OrderHistoryClientContract>(), PositionsHistory = Array.Empty <OrderHistoryClientContract>(), }); } var accountHistoryBackendResponse = await _dataReaderClients.Get(isLive).AccountHistory.ByTypes( new AccountHistoryRequest { AccountId = request.AccountId, ClientId = clientId, From = request.From, To = request.To }); return(ToClientContract(accountHistoryBackendResponse)); }