|
|
|
|
@@ -3,7 +3,6 @@ using Managing.Application.Abstractions;
|
|
|
|
|
using Managing.Application.Abstractions.Services;
|
|
|
|
|
using Managing.Application.Hubs;
|
|
|
|
|
using Managing.Application.ManageBot.Commands;
|
|
|
|
|
using Managing.Application.Workers.Abstractions;
|
|
|
|
|
using Managing.Domain.Bots;
|
|
|
|
|
using Managing.Domain.Candles;
|
|
|
|
|
using Managing.Domain.Shared.Helpers;
|
|
|
|
|
@@ -88,13 +87,18 @@ public class DataController : ControllerBase
|
|
|
|
|
{ "AAVE", "https://assets.coingecko.com/coins/images/12645/standard/AAVE.png?1696512452" },
|
|
|
|
|
{ "ADA", "https://assets.coingecko.com/coins/images/975/standard/cardano.png?1696502090" },
|
|
|
|
|
{ "APE", "https://assets.coingecko.com/coins/images/24383/standard/apecoin.jpg?1696523566" },
|
|
|
|
|
{ "ARB", "https://assets.coingecko.com/coins/images/16547/small/photo_2023-03-29_21.47.00.jpeg?1680097630" },
|
|
|
|
|
{
|
|
|
|
|
"ARB", "https://assets.coingecko.com/coins/images/16547/small/photo_2023-03-29_21.47.00.jpeg?1680097630"
|
|
|
|
|
},
|
|
|
|
|
{ "ATOM", "https://assets.coingecko.com/coins/images/1481/standard/cosmos_hub.png?1696502525" },
|
|
|
|
|
{ "AVAX", "https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png?1604021818" },
|
|
|
|
|
{ "BNB", "https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970" },
|
|
|
|
|
{ "BTC", "https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579" },
|
|
|
|
|
{ "DOGE", "https://assets.coingecko.com/coins/images/5/small/dogecoin.png?1547792256" },
|
|
|
|
|
{ "DOT", "https://static.coingecko.com/s/polkadot-73b0c058cae10a2f076a82dcade5cbe38601fad05d5e6211188f09eb96fa4617.gif" },
|
|
|
|
|
{
|
|
|
|
|
"DOT",
|
|
|
|
|
"https://static.coingecko.com/s/polkadot-73b0c058cae10a2f076a82dcade5cbe38601fad05d5e6211188f09eb96fa4617.gif"
|
|
|
|
|
},
|
|
|
|
|
{ "ETH", "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1595348880" },
|
|
|
|
|
{ "FIL", "https://assets.coingecko.com/coins/images/12817/standard/filecoin.png?1696512609" },
|
|
|
|
|
{ "GMX", "https://assets.coingecko.com/coins/images/18323/small/arbit.png?1631532468" },
|
|
|
|
|
@@ -121,15 +125,24 @@ public class DataController : ControllerBase
|
|
|
|
|
{ "TAO", "https://assets.coingecko.com/coins/images/28452/standard/ARUsPeNQ_400x400.jpeg?1696527447" },
|
|
|
|
|
{ "BONK", "https://assets.coingecko.com/coins/images/28600/standard/bonk.jpg?1696527587" },
|
|
|
|
|
{ "WLD", "https://assets.coingecko.com/coins/images/31069/standard/worldcoin.jpeg?1696529903" },
|
|
|
|
|
{ "tBTC", "https://assets.coingecko.com/coins/images/11224/standard/0x18084fba666a33d37592fa2633fd49a74dd93a88.png?1696511155" },
|
|
|
|
|
{
|
|
|
|
|
"tBTC",
|
|
|
|
|
"https://assets.coingecko.com/coins/images/11224/standard/0x18084fba666a33d37592fa2633fd49a74dd93a88.png?1696511155"
|
|
|
|
|
},
|
|
|
|
|
{ "EIGEN", "https://assets.coingecko.com/coins/images/37441/standard/eigen.jpg?1728023974" },
|
|
|
|
|
{ "SUI", "https://assets.coingecko.com/coins/images/26375/standard/sui-ocean-square.png?1727791290" },
|
|
|
|
|
{ "SEI", "https://assets.coingecko.com/coins/images/28205/standard/Sei_Logo_-_Transparent.png?1696527207" },
|
|
|
|
|
{ "DAI", "https://assets.coingecko.com/coins/images/9956/thumb/4943.png?1636636734" },
|
|
|
|
|
{ "TIA", "https://assets.coingecko.com/coins/images/31967/standard/tia.jpg?1696530772" },
|
|
|
|
|
{ "TRX", "https://assets.coingecko.com/coins/images/1094/standard/tron-logo.png?1696502193" },
|
|
|
|
|
{ "TON", "https://assets.coingecko.com/coins/images/17980/standard/photo_2024-09-10_17.09.00.jpeg?1725963446" },
|
|
|
|
|
{ "PENDLE", "https://assets.coingecko.com/coins/images/15069/standard/Pendle_Logo_Normal-03.png?1696514728" },
|
|
|
|
|
{
|
|
|
|
|
"TON",
|
|
|
|
|
"https://assets.coingecko.com/coins/images/17980/standard/photo_2024-09-10_17.09.00.jpeg?1725963446"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"PENDLE",
|
|
|
|
|
"https://assets.coingecko.com/coins/images/15069/standard/Pendle_Logo_Normal-03.png?1696514728"
|
|
|
|
|
},
|
|
|
|
|
{ "wstETH", "https://assets.coingecko.com/coins/images/18834/standard/wstETH.png?1696518295" },
|
|
|
|
|
{ "USDe", "https://assets.coingecko.com/coins/images/33613/standard/USDE.png?1716355685" },
|
|
|
|
|
{ "SATS", "https://assets.coingecko.com/coins/images/30666/standard/_dD8qr3M_400x400.png?1702913020" },
|
|
|
|
|
@@ -147,11 +160,17 @@ public class DataController : ControllerBase
|
|
|
|
|
{ "ANIME", "https://assets.coingecko.com/coins/images/53575/standard/anime.jpg?1736748703" },
|
|
|
|
|
{ "BERA", "https://assets.coingecko.com/coins/images/25235/standard/BERA.png?1738822008" },
|
|
|
|
|
{ "VIRTUAL", "https://assets.coingecko.com/coins/images/34057/standard/LOGOMARK.png?1708356054" },
|
|
|
|
|
{ "PENGU", "https://assets.coingecko.com/coins/images/52622/standard/PUDGY_PENGUINS_PENGU_PFP.png?1733809110" },
|
|
|
|
|
{
|
|
|
|
|
"PENGU",
|
|
|
|
|
"https://assets.coingecko.com/coins/images/52622/standard/PUDGY_PENGUINS_PENGU_PFP.png?1733809110"
|
|
|
|
|
},
|
|
|
|
|
{ "FET", "https://assets.coingecko.com/coins/images/5681/standard/ASI.png?1719827289" },
|
|
|
|
|
{ "ONDO", "https://assets.coingecko.com/coins/images/26580/standard/ONDO.png?1696525656" },
|
|
|
|
|
{ "AIXBT", "https://assets.coingecko.com/coins/images/51784/standard/3.png?1731981138" },
|
|
|
|
|
{ "CAKE", "https://assets.coingecko.com/coins/images/12632/standard/pancakeswap-cake-logo_%281%29.png?1696512440" },
|
|
|
|
|
{
|
|
|
|
|
"CAKE",
|
|
|
|
|
"https://assets.coingecko.com/coins/images/12632/standard/pancakeswap-cake-logo_%281%29.png?1696512440"
|
|
|
|
|
},
|
|
|
|
|
{ "S", "https://assets.coingecko.com/coins/images/38108/standard/200x200_Sonic_Logo.png?1734679256" },
|
|
|
|
|
{ "JUP", "https://assets.coingecko.com/coins/images/34188/standard/jup.png?1704266489" },
|
|
|
|
|
{ "HYPE", "https://assets.coingecko.com/coins/images/50882/standard/hyperliquid.jpg?1729431300" },
|
|
|
|
|
@@ -163,7 +182,8 @@ public class DataController : ControllerBase
|
|
|
|
|
var tickerInfo = new TickerInfos
|
|
|
|
|
{
|
|
|
|
|
Ticker = ticker,
|
|
|
|
|
ImageUrl = tokens.GetValueOrDefault(ticker.ToString(), "https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579") // Default to BTC image if not found
|
|
|
|
|
ImageUrl = tokens.GetValueOrDefault(ticker.ToString(),
|
|
|
|
|
"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579") // Default to BTC image if not found
|
|
|
|
|
};
|
|
|
|
|
tickerInfos.Add(tickerInfo);
|
|
|
|
|
}
|
|
|
|
|
@@ -539,4 +559,64 @@ public class DataController : ControllerBase
|
|
|
|
|
|
|
|
|
|
return Ok(summary);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieves balance history for a specific agent within a date range
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="agentName">The name of the agent to retrieve balances for</param>
|
|
|
|
|
/// <param name="startDate">The start date for the balance history</param>
|
|
|
|
|
/// <param name="endDate">Optional end date for the balance history (defaults to current time)</param>
|
|
|
|
|
/// <returns>A list of agent balances within the specified date range</returns>
|
|
|
|
|
[HttpGet("GetAgentBalances")]
|
|
|
|
|
public async Task<ActionResult<IList<AgentBalance>>> GetAgentBalances(
|
|
|
|
|
string agentName,
|
|
|
|
|
DateTime startDate,
|
|
|
|
|
DateTime? endDate = null)
|
|
|
|
|
{
|
|
|
|
|
string cacheKey = $"AgentBalances_{agentName}_{startDate:yyyyMMdd}_{endDate?.ToString("yyyyMMdd") ?? "now"}";
|
|
|
|
|
|
|
|
|
|
// Check if the balances are already cached
|
|
|
|
|
var cachedBalances = _cacheService.GetValue<IList<AgentBalance>>(cacheKey);
|
|
|
|
|
|
|
|
|
|
if (cachedBalances != null)
|
|
|
|
|
{
|
|
|
|
|
return Ok(cachedBalances);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var balances = await _statisticService.GetAgentBalances(agentName, startDate, endDate);
|
|
|
|
|
|
|
|
|
|
// Cache the results for 5 minutes
|
|
|
|
|
_cacheService.SaveValue(cacheKey, balances, TimeSpan.FromMinutes(5));
|
|
|
|
|
|
|
|
|
|
return Ok(balances);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieves a paginated list of the best performing agents based on their total value
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="startDate">The start date for calculating agent performance</param>
|
|
|
|
|
/// <param name="endDate">Optional end date for calculating agent performance (defaults to current time)</param>
|
|
|
|
|
/// <param name="page">Page number (defaults to 1)</param>
|
|
|
|
|
/// <param name="pageSize">Number of items per page (defaults to 10)</param>
|
|
|
|
|
/// <returns>A paginated list of agent balances and total count</returns>
|
|
|
|
|
[HttpGet("GetBestAgents")]
|
|
|
|
|
public async Task<ActionResult<BestAgentsResponse>> GetBestAgents(
|
|
|
|
|
DateTime startDate,
|
|
|
|
|
DateTime? endDate = null,
|
|
|
|
|
int page = 1,
|
|
|
|
|
int pageSize = 10)
|
|
|
|
|
{
|
|
|
|
|
var (agents, totalCount) = await _statisticService.GetBestAgents(startDate, endDate, page, pageSize);
|
|
|
|
|
|
|
|
|
|
var response = new BestAgentsResponse
|
|
|
|
|
{
|
|
|
|
|
Agents = agents,
|
|
|
|
|
TotalCount = totalCount,
|
|
|
|
|
CurrentPage = page,
|
|
|
|
|
PageSize = pageSize,
|
|
|
|
|
TotalPages = (int)Math.Ceiling(totalCount / (double)pageSize)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return Ok(response);
|
|
|
|
|
}
|
|
|
|
|
}
|