Exemplo n.º 1
0
 public static AccountHistoryBackendRequest ToBackendContract(this AccountHistoryFiltersClientRequest src, string clientId)
 {
     return(new AccountHistoryBackendRequest
     {
         AccountId = src.AccountId,
         ClientId = clientId,
         From = src.From,
         To = src.To
     });
 }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }