public async Task <DataFundPerformance> GetPerformanceAsync(Symbol symbol, DateTime timeStamp)
        {
            var key = dataKeyProvider.GetKey(symbol);

            var response = await DynamoDB.GetItemAsync(
                TableName,
                new Dictionary <string, AttributeValue>()
            {
                [nameof(DataFundPerformance.Address)] = new AttributeValue(key),
                [nameof(DataFundPerformance.Date)]    = new AttributeValue(timeStamp.ToISO8601String())
            },
                CancellationToken);

            if (response.HttpStatusCode != HttpStatusCode.OK)
            {
                throw new HttpRequestException($"Response code did not indicate success: {response.HttpStatusCode}");
            }

            if (response.Item.Any())
            {
                return(Map(response.Item));
            }

            return(null);
        }
コード例 #2
0
        public async Task <DataOperation> GetOperationAsync(EthereumTransactionHash hash, int order)
        {
            var response = await DynamoDB.GetItemAsync(
                TableName,
                new Dictionary <string, AttributeValue>()
            {
                [nameof(DataOperation.Hash)]  = new AttributeValue(hash),
                [nameof(DataOperation.Order)] = new AttributeValue()
                {
                    N = order.ToString()
                }
            },
                CancellationToken);

            if (response.HttpStatusCode != HttpStatusCode.OK)
            {
                throw new HttpRequestException($"Response code did not indicate success: {response.HttpStatusCode}");
            }

            if (response.Item.Any())
            {
                return(Map(response.Item));
            }

            return(null);
        }
コード例 #3
0
        public async Task <DataTransaction> GetTransactionAsync(Symbol symbol, EthereumTransactionHash hash)
        {
            var key = dataKeyProvider.GetKey(symbol);

            var response = await DynamoDB.GetItemAsync(
                TableName,
                new Dictionary <string, AttributeValue>()
            {
                [nameof(DataTransaction.Address)] = new AttributeValue(key),
                [nameof(DataTransaction.Hash)]    = new AttributeValue(hash)
            },
                CancellationToken);

            if (response.HttpStatusCode != HttpStatusCode.OK)
            {
                throw new HttpRequestException($"Response code did not indicate success: {response.HttpStatusCode}");
            }

            if (response.Item.Any())
            {
                return(Map(response.Item));
            }

            return(null);
        }
コード例 #4
0
        public async Task <DataStakingPower> GetStakingPowerAsync(EthereumAddress stakeAddress, DateTime timeStamp)
        {
            var response = await DynamoDB.GetItemAsync(
                TableName,
                new Dictionary <string, AttributeValue>()
            {
                [nameof(DataStakingPower.Address)] = new AttributeValue(stakeAddress),
                [nameof(DataStakingPower.Date)]    = new AttributeValue(timeStamp.ToISO8601String())
            },
                CancellationToken);

            if (response.HttpStatusCode != HttpStatusCode.OK)
            {
                throw new HttpRequestException($"Response code did not indicate success: {response.HttpStatusCode}");
            }

            if (response.Item.Any())
            {
                return(Map(response.Item));
            }

            return(null);
        }