Add net Pnl in db
This commit is contained in:
@@ -3563,6 +3563,7 @@ export class UserClient extends AuthorizedApiBase {
|
||||
}
|
||||
|
||||
export interface Account {
|
||||
id?: number;
|
||||
name: string;
|
||||
exchange: TradingExchanges;
|
||||
type: AccountType;
|
||||
@@ -3909,8 +3910,8 @@ export enum SignalType {
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
accountName: string;
|
||||
date: Date;
|
||||
accountId: number;
|
||||
originDirection: TradeDirection;
|
||||
ticker: Ticker;
|
||||
moneyManagement: LightMoneyManagement;
|
||||
@@ -3919,6 +3920,8 @@ export interface Position {
|
||||
TakeProfit1: Trade;
|
||||
TakeProfit2?: Trade | null;
|
||||
ProfitAndLoss?: ProfitAndLoss | null;
|
||||
uiFees?: number;
|
||||
gasFees?: number;
|
||||
status: PositionStatus;
|
||||
signalIdentifier?: string | null;
|
||||
identifier: string;
|
||||
@@ -3982,7 +3985,6 @@ export enum PositionStatus {
|
||||
Canceled = "Canceled",
|
||||
Rejected = "Rejected",
|
||||
Updating = "Updating",
|
||||
PartiallyFilled = "PartiallyFilled",
|
||||
Filled = "Filled",
|
||||
Flipped = "Flipped",
|
||||
Finished = "Finished",
|
||||
@@ -4502,6 +4504,7 @@ export interface TopStrategiesViewModel {
|
||||
export interface StrategyPerformance {
|
||||
strategyName?: string | null;
|
||||
pnL?: number;
|
||||
netPnL?: number;
|
||||
agentName?: string | null;
|
||||
}
|
||||
|
||||
@@ -4513,6 +4516,7 @@ export interface StrategyRoiPerformance {
|
||||
strategyName?: string | null;
|
||||
roi?: number;
|
||||
pnL?: number;
|
||||
netPnL?: number;
|
||||
volume?: number;
|
||||
}
|
||||
|
||||
@@ -4523,6 +4527,7 @@ export interface TopAgentsByPnLViewModel {
|
||||
export interface AgentPerformance {
|
||||
agentName?: string | null;
|
||||
pnL?: number;
|
||||
netPnL?: number;
|
||||
totalROI?: number;
|
||||
totalVolume?: number;
|
||||
activeStrategiesCount?: number;
|
||||
@@ -4533,6 +4538,7 @@ export interface UserStrategyDetailsViewModel {
|
||||
name?: string | null;
|
||||
state?: BotStatus;
|
||||
pnL?: number;
|
||||
netPnL?: number;
|
||||
roiPercentage?: number;
|
||||
runtime?: Date;
|
||||
winRate?: number;
|
||||
@@ -4569,6 +4575,7 @@ export interface DailySnapshot {
|
||||
totalStrategies?: number;
|
||||
totalVolume?: number;
|
||||
totalPnL?: number;
|
||||
netPnL?: number;
|
||||
totalOpenInterest?: number;
|
||||
totalPositionCount?: number;
|
||||
}
|
||||
@@ -4590,16 +4597,18 @@ export interface PaginatedAgentIndexResponse {
|
||||
export interface AgentSummaryViewModel {
|
||||
agentName?: string | null;
|
||||
totalPnL?: number;
|
||||
netPnL?: number;
|
||||
totalROI?: number;
|
||||
wins?: number;
|
||||
losses?: number;
|
||||
activeStrategiesCount?: number;
|
||||
totalVolume?: number;
|
||||
totalBalance?: number;
|
||||
totalFees?: number;
|
||||
}
|
||||
|
||||
export enum SortableFields {
|
||||
TotalPnL = "TotalPnL",
|
||||
NetPnL = "NetPnL",
|
||||
TotalROI = "TotalROI",
|
||||
Wins = "Wins",
|
||||
Losses = "Losses",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
|
||||
export interface Account {
|
||||
id?: number;
|
||||
name: string;
|
||||
exchange: TradingExchanges;
|
||||
type: AccountType;
|
||||
@@ -357,8 +358,8 @@ export enum SignalType {
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
accountName: string;
|
||||
date: Date;
|
||||
accountId: number;
|
||||
originDirection: TradeDirection;
|
||||
ticker: Ticker;
|
||||
moneyManagement: LightMoneyManagement;
|
||||
@@ -367,6 +368,8 @@ export interface Position {
|
||||
TakeProfit1: Trade;
|
||||
TakeProfit2?: Trade | null;
|
||||
ProfitAndLoss?: ProfitAndLoss | null;
|
||||
uiFees?: number;
|
||||
gasFees?: number;
|
||||
status: PositionStatus;
|
||||
signalIdentifier?: string | null;
|
||||
identifier: string;
|
||||
@@ -430,7 +433,6 @@ export enum PositionStatus {
|
||||
Canceled = "Canceled",
|
||||
Rejected = "Rejected",
|
||||
Updating = "Updating",
|
||||
PartiallyFilled = "PartiallyFilled",
|
||||
Filled = "Filled",
|
||||
Flipped = "Flipped",
|
||||
Finished = "Finished",
|
||||
@@ -950,6 +952,7 @@ export interface TopStrategiesViewModel {
|
||||
export interface StrategyPerformance {
|
||||
strategyName?: string | null;
|
||||
pnL?: number;
|
||||
netPnL?: number;
|
||||
agentName?: string | null;
|
||||
}
|
||||
|
||||
@@ -961,6 +964,7 @@ export interface StrategyRoiPerformance {
|
||||
strategyName?: string | null;
|
||||
roi?: number;
|
||||
pnL?: number;
|
||||
netPnL?: number;
|
||||
volume?: number;
|
||||
}
|
||||
|
||||
@@ -971,6 +975,7 @@ export interface TopAgentsByPnLViewModel {
|
||||
export interface AgentPerformance {
|
||||
agentName?: string | null;
|
||||
pnL?: number;
|
||||
netPnL?: number;
|
||||
totalROI?: number;
|
||||
totalVolume?: number;
|
||||
activeStrategiesCount?: number;
|
||||
@@ -981,6 +986,7 @@ export interface UserStrategyDetailsViewModel {
|
||||
name?: string | null;
|
||||
state?: BotStatus;
|
||||
pnL?: number;
|
||||
netPnL?: number;
|
||||
roiPercentage?: number;
|
||||
runtime?: Date;
|
||||
winRate?: number;
|
||||
@@ -1017,6 +1023,7 @@ export interface DailySnapshot {
|
||||
totalStrategies?: number;
|
||||
totalVolume?: number;
|
||||
totalPnL?: number;
|
||||
netPnL?: number;
|
||||
totalOpenInterest?: number;
|
||||
totalPositionCount?: number;
|
||||
}
|
||||
@@ -1038,16 +1045,18 @@ export interface PaginatedAgentIndexResponse {
|
||||
export interface AgentSummaryViewModel {
|
||||
agentName?: string | null;
|
||||
totalPnL?: number;
|
||||
netPnL?: number;
|
||||
totalROI?: number;
|
||||
wins?: number;
|
||||
losses?: number;
|
||||
activeStrategiesCount?: number;
|
||||
totalVolume?: number;
|
||||
totalBalance?: number;
|
||||
totalFees?: number;
|
||||
}
|
||||
|
||||
export enum SortableFields {
|
||||
TotalPnL = "TotalPnL",
|
||||
NetPnL = "NetPnL",
|
||||
TotalROI = "TotalROI",
|
||||
Wins = "Wins",
|
||||
Losses = "Losses",
|
||||
|
||||
@@ -2,12 +2,12 @@ import React, {useEffect, useState} from 'react'
|
||||
import {PlayIcon, StopIcon} from '@heroicons/react/solid'
|
||||
import moment from 'moment'
|
||||
import {
|
||||
BotClient,
|
||||
BotStatus,
|
||||
DataClient,
|
||||
Position,
|
||||
TradeDirection,
|
||||
UserStrategyDetailsViewModel
|
||||
BotClient,
|
||||
BotStatus,
|
||||
DataClient,
|
||||
Position,
|
||||
TradeDirection,
|
||||
UserStrategyDetailsViewModel
|
||||
} from '../../generated/ManagingApi'
|
||||
import useApiUrlStore from '../../app/store/apiStore'
|
||||
import {Toast} from '../../components/mollecules'
|
||||
@@ -203,8 +203,8 @@ const AgentStrategy: React.FC<AgentStrategyProps> = ({ index }) => {
|
||||
<div className="stat-value text-success">{strategyData.winRate || 0}%</div>
|
||||
</div>
|
||||
<div className="stat bg-base-200 rounded-lg">
|
||||
<div className="stat-title">PnL</div>
|
||||
<div className="stat-value text-success">{formatCurrency(strategyData.pnL)}</div>
|
||||
<div className="stat-title">Net PnL</div>
|
||||
<div className="stat-value text-success">{formatCurrency(strategyData.netPnL)}</div>
|
||||
</div>
|
||||
<div className="stat bg-base-200 rounded-lg">
|
||||
<div className="stat-title">Backtest</div>
|
||||
@@ -283,8 +283,8 @@ const AgentStrategy: React.FC<AgentStrategyProps> = ({ index }) => {
|
||||
<div className="card-body">
|
||||
<h3 className="card-title">PnL $</h3>
|
||||
<div className="text-2xl font-bold">{formatCurrency(strategyData.pnL)}</div>
|
||||
<div className="text-sm">
|
||||
{formatCurrency((strategyData.pnL || 0) * 0.1)} Today
|
||||
<div className="text-sm text-gray-400">
|
||||
Net: {formatCurrency(strategyData.netPnL)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -210,8 +210,8 @@ function PlatformSummary({index}: { index: number }) {
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className={`text-sm font-bold ${strategy.pnL && strategy.pnL >= 0 ? 'text-green-500' : 'text-red-500'}`}>
|
||||
{strategy.pnL && strategy.pnL >= 0 ? '+' : ''}{formatCurrency(strategy.pnL || 0)}
|
||||
className={`text-sm font-bold ${strategy.netPnL && strategy.netPnL >= 0 ? 'text-green-500' : 'text-red-500'}`}>
|
||||
{strategy.netPnL && strategy.netPnL >= 0 ? '+' : ''}{formatCurrency(strategy.netPnL || 0)}
|
||||
</div>
|
||||
</div>
|
||||
)) || (
|
||||
@@ -250,8 +250,8 @@ function PlatformSummary({index}: { index: number }) {
|
||||
{(strategy.roi || 0) >= 0 ? '+' : ''}{strategy.roi?.toFixed(2) || 0}%
|
||||
</div>
|
||||
<div
|
||||
className={`text-xs ${(strategy.pnL || 0) >= 0 ? 'text-green-400' : 'text-red-400'}`}>
|
||||
{(strategy.pnL || 0) >= 0 ? '+' : ''}{formatCurrency(strategy.pnL || 0)}
|
||||
className={`text-xs ${(strategy.netPnL || 0) >= 0 ? 'text-green-400' : 'text-red-400'}`}>
|
||||
{(strategy.netPnL || 0) >= 0 ? '+' : ''}{formatCurrency(strategy.netPnL || 0)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -287,8 +287,8 @@ function PlatformSummary({index}: { index: number }) {
|
||||
</div>
|
||||
<div className="text-right">
|
||||
<div
|
||||
className={`text-sm font-bold ${(agent.pnL || 0) >= 0 ? 'text-green-500' : 'text-red-500'}`}>
|
||||
{(agent.pnL || 0) >= 0 ? '+' : ''}{formatCurrency(agent.pnL || 0)}
|
||||
className={`text-sm font-bold ${(agent.netPnL || 0) >= 0 ? 'text-green-500' : 'text-red-500'}`}>
|
||||
{(agent.netPnL || 0) >= 0 ? '+' : ''}{formatCurrency(agent.netPnL || 0)}
|
||||
</div>
|
||||
<div className="text-xs text-gray-400">
|
||||
{(agent.totalROI || 0).toFixed(2)}% ROI
|
||||
@@ -332,6 +332,9 @@ function PlatformSummary({index}: { index: number }) {
|
||||
className={`text-3xl font-bold ${(platformData?.totalPlatformPnL || 0) >= 0 ? 'text-green-500' : 'text-red-500'}`}>
|
||||
{(platformData?.totalPlatformPnL || 0) >= 0 ? '+' : ''}{formatCurrency(platformData?.totalPlatformPnL || 0)}
|
||||
</div>
|
||||
<div className="text-sm text-gray-400 mb-1">
|
||||
Fees: {formatCurrency(platformData?.totalPlatformFees || 0)}
|
||||
</div>
|
||||
<div
|
||||
className={`text-sm ${changesToday.pnLChange >= 0 ? 'text-green-500' : 'text-red-500'}`}>
|
||||
{changesToday.pnLChange >= 0 ? '+' : ''}{formatCurrency(changesToday.pnLChange)} Today
|
||||
|
||||
Reference in New Issue
Block a user