Price reminder and init approval
* Start price reminder grain * Add config and init grain at startup * Save init wallet when already init
This commit is contained in:
@@ -29,12 +29,14 @@ public class Gbc : ISubgraphPrices
|
||||
var unixTimeframe = timeframe.GetUnixInterval();
|
||||
var start = startDate.ToUnixTimestamp();
|
||||
var end = DateTime.UtcNow.ToUnixTimestamp();
|
||||
var feedCondition = $@"{{ tokenAddress: ""_{tickerContract}"", interval: ""_{unixTimeframe}"", timestamp_gte: {start}, timestamp_lte: {end} }}";
|
||||
var feedCondition =
|
||||
$@"{{ tokenAddress: ""_{tickerContract}"", interval: ""_{unixTimeframe}"", timestamp_gte: {start}, timestamp_lte: {end} }}";
|
||||
|
||||
// Fetching prices from graphql ticker
|
||||
for (int i = 0; i < batchMax; i++)
|
||||
{
|
||||
var query = $"{{ pricefeeds(first: {batchSize}, skip: {i * batchSize}, orderBy: timestamp, orderDirection: desc, where: {feedCondition} ) {{ timestamp,o,h,l,c}} }}";
|
||||
var query =
|
||||
$"{{ pricefeeds(first: {batchSize}, skip: {i * batchSize}, orderBy: timestamp, orderDirection: desc, where: {feedCondition} ) {{ timestamp,o,h,l,c}} }}";
|
||||
var graphQuery = new GraphQLRequest
|
||||
{
|
||||
Query = query
|
||||
@@ -75,7 +77,7 @@ public class Gbc : ISubgraphPrices
|
||||
Low = FormatPrice(ohlc.L),
|
||||
Close = FormatPrice(ohlc.C),
|
||||
Exchange = TradingExchanges.Evm,
|
||||
Ticker = ticker.ToString(),
|
||||
Ticker = ticker,
|
||||
Timeframe = timeframe
|
||||
};
|
||||
}
|
||||
@@ -92,7 +94,8 @@ public class Gbc : ISubgraphPrices
|
||||
|
||||
public Task<IEnumerable<Ticker>> GetTickers()
|
||||
{
|
||||
var tickers = new List<Ticker>() {
|
||||
var tickers = new List<Ticker>()
|
||||
{
|
||||
Ticker.BTC,
|
||||
Ticker.LINK,
|
||||
Ticker.ETH,
|
||||
@@ -101,4 +104,4 @@ public class Gbc : ISubgraphPrices
|
||||
|
||||
return Task.FromResult(tickers.AsEnumerable());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user