Add ticker to the UserStrategies list and set debit credit to 1 for backtest

This commit is contained in:
2025-09-10 20:41:36 +07:00
parent 12c6aea053
commit cb6778d9a0
6 changed files with 16 additions and 9 deletions

View File

@@ -554,6 +554,7 @@ public class DataController : ControllerBase
Positions = positions, Positions = positions,
Identifier = strategy.Identifier, Identifier = strategy.Identifier,
WalletBalances = new Dictionary<DateTime, decimal>(), WalletBalances = new Dictionary<DateTime, decimal>(),
Ticker = strategy.Ticker
}; };
} }

View File

@@ -71,5 +71,6 @@ namespace Managing.Api.Models.Responses
public Guid Identifier { get; set; } public Guid Identifier { get; set; }
public Dictionary<DateTime, decimal> WalletBalances { get; set; } = new Dictionary<DateTime, decimal>(); public Dictionary<DateTime, decimal> WalletBalances { get; set; } = new Dictionary<DateTime, decimal>();
public Enums.Ticker Ticker { get; set; }
} }
} }

View File

@@ -80,7 +80,7 @@ namespace Managing.Application.Backtests
{ {
try try
{ {
creditRequestId = await _kaigenService.DebitUserCreditsAsync(user, 3); creditRequestId = await _kaigenService.DebitUserCreditsAsync(user, 1);
_logger.LogInformation( _logger.LogInformation(
"Successfully debited credits for user {UserName} with request ID {RequestId}", "Successfully debited credits for user {UserName} with request ID {RequestId}",
user.Name, creditRequestId); user.Name, creditRequestId);

View File

@@ -4502,6 +4502,7 @@ export interface UserStrategyDetailsViewModel {
positions?: Position[] | null; positions?: Position[] | null;
identifier?: string; identifier?: string;
walletBalances?: { [key: string]: number; } | null; walletBalances?: { [key: string]: number; } | null;
ticker?: Ticker;
} }
export interface PlatformSummaryViewModel { export interface PlatformSummaryViewModel {

View File

@@ -985,6 +985,7 @@ export interface UserStrategyDetailsViewModel {
positions?: Position[] | null; positions?: Position[] | null;
identifier?: string; identifier?: string;
walletBalances?: { [key: string]: number; } | null; walletBalances?: { [key: string]: number; } | null;
ticker?: Ticker;
} }
export interface PlatformSummaryViewModel { export interface PlatformSummaryViewModel {

View File

@@ -3,6 +3,7 @@ import {Card, FormInput, GridTile} from '../../components/mollecules'
import useApiUrlStore from '../../app/store/apiStore' import useApiUrlStore from '../../app/store/apiStore'
import { import {
type AgentBalanceHistory, type AgentBalanceHistory,
BotStatus,
DataClient, DataClient,
type Position, type Position,
TradeDirection, TradeDirection,
@@ -356,8 +357,9 @@ function AgentSearch({ index }: { index: number }) {
{agentData?.strategies && agentData.strategies.length > 0 && ( {agentData?.strategies && agentData.strategies.length > 0 && (
<GridTile title="Strategies"> <GridTile title="Strategies">
<div className="space-y-4"> <div className="space-y-4">
<div className="grid grid-cols-6 gap-4 p-3 bg-base-300 rounded-lg text-sm font-medium"> <div className="grid grid-cols-7 gap-4 p-3 bg-base-300 rounded-lg text-sm font-medium">
<span>Name</span> <span>Name</span>
<span>Ticker</span>
<span>Status</span> <span>Status</span>
<span>PnL</span> <span>PnL</span>
<span>ROI</span> <span>ROI</span>
@@ -366,9 +368,10 @@ function AgentSearch({ index }: { index: number }) {
</div> </div>
{agentData.strategies.map((strategy, index) => ( {agentData.strategies.map((strategy, index) => (
<div key={index} className="grid grid-cols-6 gap-4 p-3 bg-base-200 rounded-lg text-sm"> <div key={index} className="grid grid-cols-7 gap-4 p-3 bg-base-200 rounded-lg text-sm">
<span className="font-medium">{strategy.name}</span> <span className="font-medium">{strategy.name}</span>
<span className={`badge ${strategy.state === 'RUNNING' ? 'badge-success' : 'badge-warning'}`}> <span className="text-blue-500 font-medium">{strategy.ticker || '-'}</span>
<span className={`badge ${strategy.state == BotStatus.Running ? 'badge-success' : 'badge-warning'}`}>
{strategy.state} {strategy.state}
</span> </span>
<span className={strategy.pnL && strategy.pnL >= 0 ? 'text-green-500' : 'text-red-500'}> <span className={strategy.pnL && strategy.pnL >= 0 ? 'text-green-500' : 'text-red-500'}>