25 lines
723 B
TypeScript
25 lines
723 B
TypeScript
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.ETH,
|
|
TradeDirection.Long,
|
|
0.00678,
|
|
2,
|
|
4410,
|
|
3500,
|
|
6000
|
|
)
|
|
console.log('Position opening result:', result)
|
|
assert.ok(result, 'Position opening result should be defined')
|
|
})
|
|
})
|
|
|