示例#1
0
        private async Task <LimitOrderEntity> GetLimitOrderAsync(string clientId, string limitOrderId)
        {
            var clientIdByLimitOrder = await _tradesRepository.GetClientIdByLimitOrderAsync(limitOrderId, clientId);

            if (string.IsNullOrEmpty(clientIdByLimitOrder))
            {
                return(null);
            }
            var result = await((ILimitOrdersRepository)_repository).GetLimitOrderByIdAsync(clientIdByLimitOrder, limitOrderId);

            if (result != null)
            {
                return(result);
            }
            var loFromSql = OrdersFinder.GetLimitOrder(limitOrderId, _sqlConnectionString);

            if (loFromSql != null)
            {
                return new LimitOrderEntity
                       {
                           Id          = loFromSql.ExternalId,
                           MatchingId  = loFromSql.Id,
                           ClientId    = loFromSql.ClientId,
                           AssetPairId = loFromSql.AssetPairId,
                       }
            }
            ;
            return(null);
        }
        private async Task <LimitOrderEntity> GetLimitOrderAsync(string clientId, string limitOrderId)
        {
            var clientIdByLimitOrder = await _tradesRepository.GetClientIdByLimitOrderAsync(limitOrderId, clientId);

            if (string.IsNullOrEmpty(clientIdByLimitOrder))
            {
                return(null);
            }
            var result = await _limitOrdersRepository.GetLimitOrderByIdAsync(clientIdByLimitOrder, limitOrderId);

            if (result != null)
            {
                return(result);
            }
            var loFromSql = OrdersFinder.GetLimitOrder(limitOrderId, _sqlConnectionString);

            if (loFromSql != null)
            {
                return new LimitOrderEntity
                       {
                           Id          = loFromSql.ExternalId,
                           MatchingId  = loFromSql.Id,
                           ClientId    = loFromSql.ClientId,
                           AssetPairId = loFromSql.AssetPairId,
                       }
            }
            ;
            _log.WriteWarning(nameof(GetLimitOrderAsync), "LO not found", $"Could not find LimitOrder by id = {limitOrderId}");
            return(null);
        }