import { test } from 'node:test'
import assert from 'node:assert'
import { getClientForAddress, openGmxPositionImpl } from '../../src/plugins/custom/gmx'
import { Ticker, TradeDirection } from '../../src/generated/ManagingApiTypes'

test('GMX Position Opening', async (t) => {
  await t.test('should open a long position for BTC', async () => {
    const sdk = await getClientForAddress('0x932167388dD9aad41149b3cA23eBD489E2E2DD78')

    const result = await openGmxPositionImpl(
      sdk,
      Ticker.BTC,
      TradeDirection.Long,
      0.0002,
      2,
      50003,
      96001,
      85002
    )
    console.log('Position opening result:', result)
    assert.ok(result, 'Position opening result should be defined')
  })
})

