Add reconcilliation for cancelled position if needed

This commit is contained in:
2025-12-11 18:35:25 +07:00
parent 1426f0b560
commit 65d00c0b9a
3 changed files with 138 additions and 7 deletions

View File

@@ -7,13 +7,20 @@ test('GMX get spot position history - Market swaps', async (t) => {
await t.test('should get spot swap executions', async () => {
const sdk = await getClientForAddress('0x932167388dD9aad41149b3cA23eBD489E2E2DD78')
// Get today's date range (start and end of today)
const today = new Date()
const startOfDay = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0, 0)
const endOfDay = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59, 999)
const fromDateTime = startOfDay.toISOString()
const toDateTime = endOfDay.toISOString()
const result = await getSpotPositionHistoryImpl(
sdk,
0, // pageIndex
100, // pageSize
Ticker.BTC, // ticker
'2025-12-09T00:00:00.000Z', // fromDateTime
'2025-12-11T00:00:00.000Z' // toDateTime
fromDateTime, // fromDateTime (today's start)
toDateTime // toDateTime (today's end)
)
console.log('\n📊 Spot Swap History Summary:')