Implement spot position history retrieval in SpotBot and related services

- Added CheckSpotPositionInExchangeHistory method to SpotBot for verifying closed positions against exchange history.
- Enhanced logging for Web3Proxy errors during position verification.
- Introduced GetSpotPositionHistory method in IEvmManager, IExchangeService, and IWeb3ProxyService interfaces.
- Implemented GetSpotPositionHistory in EvmManager and ExchangeService to fetch historical swap data.
- Updated GMX SDK integration to support fetching spot position history.
- Modified generated API types to include new trading type and position history structures.
This commit is contained in:
2025-12-07 19:20:47 +07:00
parent 15d8b38d8b
commit a2ed4edd32
17 changed files with 978 additions and 84 deletions

View File

@@ -47,4 +47,12 @@ public interface IExchangeProcessor
Ticker ticker,
DateTime? fromDate = null,
DateTime? toDate = null);
Task<List<Position>> GetSpotPositionHistory(
Account account,
Ticker ticker,
DateTime? fromDate = null,
DateTime? toDate = null,
int pageIndex = 0,
int pageSize = 20);
}

View File

@@ -193,6 +193,18 @@ namespace Managing.Infrastructure.Exchanges
return processor.GetPositionHistory(account, ticker, fromDate, toDate);
}
public Task<List<Position>> GetSpotPositionHistory(
Account account,
Ticker ticker,
DateTime? fromDate = null,
DateTime? toDate = null,
int pageIndex = 0,
int pageSize = 20)
{
var processor = GetProcessor(account);
return processor.GetSpotPositionHistory(account, ticker, fromDate, toDate, pageIndex, pageSize);
}
public async Task<List<Trade>> GetTrades(Account account, Ticker ticker)
{
var processor = GetProcessor(account);

View File

@@ -48,5 +48,13 @@ namespace Managing.Infrastructure.Exchanges.Exchanges
Ticker ticker,
DateTime? fromDate = null,
DateTime? toDate = null);
public abstract Task<List<Position>> GetSpotPositionHistory(
Account account,
Ticker ticker,
DateTime? fromDate = null,
DateTime? toDate = null,
int pageIndex = 0,
int pageSize = 20);
}
}

View File

@@ -217,6 +217,17 @@ public class EvmProcessor : BaseProcessor
return await _evmManager.GetPositionHistory(account, ticker, fromDate, toDate);
}
public override async Task<List<Position>> GetSpotPositionHistory(
Account account,
Ticker ticker,
DateTime? fromDate = null,
DateTime? toDate = null,
int pageIndex = 0,
int pageSize = 20)
{
return await _evmManager.GetSpotPositionHistory(account, ticker, fromDate, toDate, pageIndex, pageSize);
}
#region Not implemented
public override void LoadClient(Account account)