docker files fixes from liaqat
This commit is contained in:
85
src/Managing.Infrastructure.Web3/Subgraphs/Uniswap.cs
Normal file
85
src/Managing.Infrastructure.Web3/Subgraphs/Uniswap.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using GraphQL.Client.Abstractions;
|
||||
using GraphQL;
|
||||
using Managing.Infrastructure.Evm.Abstractions;
|
||||
using Managing.Infrastructure.Evm.Subgraphs.Models;
|
||||
using Managing.Domain.Candles;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Infrastructure.Evm.Subgraphs;
|
||||
|
||||
public class Uniswap : IUniswap
|
||||
{
|
||||
SubgraphProvider ISubgraphPrices.GetProvider() => SubgraphProvider.UniswapV2;
|
||||
|
||||
private readonly IGraphQLClient _graphQLClient;
|
||||
|
||||
public Uniswap(IGraphQLClient graphQLHttpClient)
|
||||
{
|
||||
_graphQLClient = graphQLHttpClient ?? throw new ArgumentNullException(nameof(graphQLHttpClient));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the first 150 most liquid market pairs ordered by desc
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<Pools> GetMostLiquidMarketPairs()
|
||||
{
|
||||
var query = new GraphQLRequest
|
||||
{
|
||||
Query = @"
|
||||
{
|
||||
pairs(first: 150, orderBy: reserveETH orderDirection: desc){
|
||||
token0 {
|
||||
symbol
|
||||
}
|
||||
token1 {
|
||||
symbol
|
||||
}
|
||||
reserveETH
|
||||
reserveUSD
|
||||
}
|
||||
}
|
||||
"
|
||||
};
|
||||
|
||||
GraphQLResponse<Pools> response = await _graphQLClient.SendQueryAsync<Pools>(query);
|
||||
return response.Data;
|
||||
}
|
||||
|
||||
public async Task<TopTokens> GetTopTokens()
|
||||
{
|
||||
var query = new GraphQLRequest
|
||||
{
|
||||
Query = @"
|
||||
{
|
||||
tokens (first: 150, orderBy: tradeVolumeUSD orderDirection: desc){
|
||||
symbol
|
||||
name
|
||||
tradeVolume
|
||||
tradeVolumeUSD
|
||||
totalSupply
|
||||
totalLiquidity
|
||||
}
|
||||
}
|
||||
"
|
||||
};
|
||||
|
||||
GraphQLResponse<TopTokens> response = await _graphQLClient.SendQueryAsync<TopTokens>(query);
|
||||
return response.Data;
|
||||
}
|
||||
|
||||
public Task<IEnumerable<Candle>> GetPrices(Ticker ticker, DateTime startDate, Timeframe timeframe)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<decimal> GetVolume(Ticker ticker)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<IEnumerable<Ticker>> GetTickers()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user