Files
managing-apps/src/Managing.Web3Proxy/test/plugins/get-spot-position-history.test.ts
2025-12-10 23:16:46 +07:00

28 lines
998 B
TypeScript

import {test} from 'node:test'
import assert from 'node:assert'
import {getClientForAddress, getSpotPositionHistoryImpl} from '../../src/plugins/custom/gmx.js'
import {Ticker} from '../../src/generated/ManagingApiTypes.js'
test('GMX get spot position history - Market swaps', async (t) => {
await t.test('should get spot swap executions', async () => {
const sdk = await getClientForAddress('0x932167388dD9aad41149b3cA23eBD489E2E2DD78')
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
)
console.log('\n📊 Spot Swap History Summary:')
console.log(`Total swaps: ${result.length}`)
console.log(`📊 Result:`, result);
assert.ok(result, 'Spot position history result should be defined')
assert.ok(Array.isArray(result), 'Spot position history should be an array')
})
})