Fetch closed position to get last pnl realized

This commit is contained in:
2025-10-05 23:31:17 +07:00
parent 1b060fb145
commit dac0a9641f
14 changed files with 749 additions and 23 deletions

View File

@@ -75,4 +75,22 @@ public interface IEvmManager
/// <param name="chain">The blockchain chain</param>
/// <param name="publicAddress">The public address</param>
void ClearBalancesCache(Chain chain, string publicAddress);
/// <summary>
/// Gets the position history for a specific ticker and account from GMX
/// </summary>
/// <param name="account">The trading account</param>
/// <param name="ticker">The ticker to get history for</param>
/// <param name="fromDate">Optional start date for filtering</param>
/// <param name="toDate">Optional end date for filtering</param>
/// <param name="pageIndex">Page index for pagination (default: 0)</param>
/// <param name="pageSize">Page size for pagination (default: 20)</param>
/// <returns>Position history response with actual GMX PnL data</returns>
Task<List<Position>> GetPositionHistory(
Account account,
Ticker ticker,
DateTime? fromDate = null,
DateTime? toDate = null,
int pageIndex = 0,
int pageSize = 20);
}

View File

@@ -67,4 +67,10 @@ public interface IExchangeService
Task<Trade> GetTrade(string reference, string orderId, Ticker ticker);
Task<List<FundingRate>> GetFundingRates();
Task<IEnumerable<Position>> GetBrokerPositions(Account account);
Task<List<Position>> GetPositionHistory(
Account account,
Ticker ticker,
DateTime? fromDate = null,
DateTime? toDate = null);
}

View File

@@ -1,5 +1,6 @@
using Managing.Domain.Accounts;
using Managing.Domain.Evm;
using Managing.Domain.Trades;
using static Managing.Common.Enums;
namespace Managing.Application.Abstractions.Services
@@ -22,5 +23,7 @@ namespace Managing.Application.Abstractions.Services
Task<decimal> GetEstimatedGasFeeUsdAsync();
Task<GasFeeData> GetGasFeeDataAsync();
Task<List<Position>> GetGmxPositionHistoryAsync(string account, int pageIndex = 0, int pageSize = 20, string? ticker = null);
}
}