Remove endpoint update generatedClient

This commit is contained in:
2025-09-29 00:55:59 +07:00
parent 97304e468c
commit e2d7e75247
5 changed files with 8 additions and 113 deletions

View File

@@ -383,49 +383,6 @@ public class DataController : ControllerBase
return Ok(topStrategiesByRoi);
}
/// <summary>
/// Retrieves the top 3 performing agents based on PnL.
/// </summary>
/// <returns>A <see cref="TopAgentsByPnLViewModel"/> containing the top performing agents by PnL.</returns>
[HttpGet("GetTopAgentsByPnL")]
public async Task<ActionResult<TopAgentsByPnLViewModel>> GetTopAgentsByPnL()
{
try
{
// Get all agent summaries
var allAgentSummaries = await _mediator.Send(new GetAllAgentSummariesCommand());
// Filter agents with valid PnL data and order by NetPnL
var agentsWithPnL = allAgentSummaries
.Where(agent => agent.NetPnL != 0) // Only include agents with actual NetPnL
.OrderByDescending(agent => agent.NetPnL)
.Take(3)
.ToList();
// Map to view model
var topAgentsByPnL = new TopAgentsByPnLViewModel
{
TopAgentsByPnL = agentsWithPnL
.Select(agent => new AgentPerformance
{
AgentName = agent.AgentName,
PnL = agent.TotalPnL,
NetPnL = agent.NetPnL,
TotalROI = agent.TotalROI,
TotalVolume = agent.TotalVolume,
ActiveStrategiesCount = agent.ActiveStrategiesCount,
TotalBalance = agent.TotalBalance
})
.ToList()
};
return Ok(topAgentsByPnL);
}
catch (Exception ex)
{
return StatusCode(500, $"Error retrieving top agents by PnL: {ex.Message}");
}
}
/// <summary>
/// Retrieves list of the active strategies for a user with detailed information

View File

@@ -1974,41 +1974,6 @@ export class DataClient extends AuthorizedApiBase {
return Promise.resolve<TopStrategiesByRoiViewModel>(null as any);
}
data_GetTopAgentsByPnL(): Promise<TopAgentsByPnLViewModel> {
let url_ = this.baseUrl + "/Data/GetTopAgentsByPnL";
url_ = url_.replace(/[?&]$/, "");
let options_: RequestInit = {
method: "GET",
headers: {
"Accept": "application/json"
}
};
return this.transformOptions(options_).then(transformedOptions_ => {
return this.http.fetch(url_, transformedOptions_);
}).then((_response: Response) => {
return this.processData_GetTopAgentsByPnL(_response);
});
}
protected processData_GetTopAgentsByPnL(response: Response): Promise<TopAgentsByPnLViewModel> {
const status = response.status;
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
if (status === 200) {
return response.text().then((_responseText) => {
let result200: any = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as TopAgentsByPnLViewModel;
return result200;
});
} else if (status !== 200 && status !== 204) {
return response.text().then((_responseText) => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
});
}
return Promise.resolve<TopAgentsByPnLViewModel>(null as any);
}
data_GetUserStrategies(agentName: string | null | undefined): Promise<UserStrategyDetailsViewModel[]> {
let url_ = this.baseUrl + "/Data/GetUserStrategies?";
if (agentName !== undefined && agentName !== null)
@@ -4520,20 +4485,6 @@ export interface StrategyRoiPerformance {
volume?: number;
}
export interface TopAgentsByPnLViewModel {
topAgentsByPnL?: AgentPerformance[] | null;
}
export interface AgentPerformance {
agentName?: string | null;
pnL?: number;
netPnL?: number;
totalROI?: number;
totalVolume?: number;
activeStrategiesCount?: number;
totalBalance?: number;
}
export interface UserStrategyDetailsViewModel {
name?: string | null;
state?: BotStatus;

View File

@@ -968,20 +968,6 @@ export interface StrategyRoiPerformance {
volume?: number;
}
export interface TopAgentsByPnLViewModel {
topAgentsByPnL?: AgentPerformance[] | null;
}
export interface AgentPerformance {
agentName?: string | null;
pnL?: number;
netPnL?: number;
totalROI?: number;
totalVolume?: number;
activeStrategiesCount?: number;
totalBalance?: number;
}
export interface UserStrategyDetailsViewModel {
name?: string | null;
state?: BotStatus;

View File

@@ -268,7 +268,7 @@ function PlatformSummary({index}: { index: number }) {
<h3 className="text-lg font-semibold text-gray-400">Top 3 Agents by PnL</h3>
</div>
<div className="space-y-3">
{topAgentsByPnL?.topAgentsByPnL?.slice(0, 3).map((agent, index) => (
{topAgentsByPnL?.slice(0, 3).map((agent, index) => (
<div key={index} className="flex items-center justify-between">
<div className="flex items-center gap-3">
<div className="w-8 h-8 bg-purple-500 rounded-full flex items-center justify-center">

View File

@@ -1,33 +1,34 @@
import {
type AgentSummaryViewModel,
DataClient,
type PlatformSummaryViewModel,
SortableFields,
type TopStrategiesByRoiViewModel,
type TopStrategiesViewModel,
type TopAgentsByPnLViewModel
type TopStrategiesViewModel
} from '../generated/ManagingApi'
export interface PlatformData {
platform: PlatformSummaryViewModel
topStrategies: TopStrategiesViewModel
topStrategiesByRoi: TopStrategiesByRoiViewModel
topAgentsByPnL: TopAgentsByPnLViewModel
topAgentsByPnL: AgentSummaryViewModel[]
}
export const fetchPlatformData = async (apiUrl: string): Promise<PlatformData> => {
const client = new DataClient({}, apiUrl)
// Fetch all platform data in parallel
const [platform, topStrategies, topStrategiesByRoi, topAgentsByPnL] = await Promise.all([
const [platform, topStrategies, topStrategiesByRoi, agentIndexResponse] = await Promise.all([
client.data_GetPlatformSummary(),
client.data_GetTopStrategies(),
client.data_GetTopStrategiesByRoi(),
client.data_GetTopAgentsByPnL()
client.data_GetAgentIndexPaginated(1, 3, SortableFields.NetPnL, 'desc', null) // Get top 3 agents by NetPnL
])
return {
platform,
topStrategies,
topStrategiesByRoi,
topAgentsByPnL
topAgentsByPnL: agentIndexResponse.agentSummaries || []
}
}