Fix a bit the spot trading

This commit is contained in:
2025-12-10 23:16:46 +07:00
parent 931af3d3af
commit 8ff9437400
8 changed files with 44 additions and 113 deletions

View File

@@ -12,8 +12,8 @@ test('GMX get spot position history - Market swaps', async (t) => {
0, // pageIndex
100, // pageSize
Ticker.BTC, // ticker
'2025-12-04T00:00:00.000Z', // fromDateTime
'2025-12-07T00:00:00.000Z' // toDateTime
'2025-12-09T00:00:00.000Z', // fromDateTime
'2025-12-11T00:00:00.000Z' // toDateTime
)
console.log('\n📊 Spot Swap History Summary:')
@@ -23,31 +23,5 @@ test('GMX get spot position history - Market swaps', async (t) => {
assert.ok(result, 'Spot position history result should be defined')
assert.ok(Array.isArray(result), 'Spot position history should be an array')
})
await t.test('should get spot swaps within date range', async () => {
const sdk = await getClientForAddress('0x932167388dD9aad41149b3cA23eBD489E2E2DD78')
const toDate = new Date()
const fromDate = new Date(toDate.getTime() - (60 * 60 * 1000)) // last 1 hour
const fromDateTime = fromDate.toISOString()
const toDateTime = toDate.toISOString()
const result = await getSpotPositionHistoryImpl(
sdk,
0,
50,
Ticker.BTC,
fromDateTime,
toDateTime
)
console.log(`\n📅 Spot swaps in last 1 hour: ${result.length}`)
console.log(`From: ${fromDateTime}`)
console.log(`To: ${toDateTime}`)
assert.ok(result, 'Spot position history result should be defined')
assert.ok(Array.isArray(result), 'Spot position history should be an array')
})
})