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));
}
///
/// Get the first 150 most liquid market pairs ordered by desc
///
///
public async Task GetMostLiquidMarketPairs()
{
var query = new GraphQLRequest
{
Query = @"
{
pairs(first: 150, orderBy: reserveETH orderDirection: desc){
token0 {
symbol
}
token1 {
symbol
}
reserveETH
reserveUSD
}
}
"
};
GraphQLResponse response = await _graphQLClient.SendQueryAsync(query);
return response.Data;
}
public async Task GetTopTokens()
{
var query = new GraphQLRequest
{
Query = @"
{
tokens (first: 150, orderBy: tradeVolumeUSD orderDirection: desc){
symbol
name
tradeVolume
tradeVolumeUSD
totalSupply
totalLiquidity
}
}
"
};
GraphQLResponse response = await _graphQLClient.SendQueryAsync(query);
return response.Data;
}
public Task> GetPrices(Ticker ticker, DateTime startDate, Timeframe timeframe)
{
throw new NotImplementedException();
}
public Task GetVolume(Ticker ticker)
{
throw new NotImplementedException();
}
public Task> GetTickers()
{
throw new NotImplementedException();
}
}