Fix futures open positions

This commit is contained in:
2025-12-19 16:29:34 +07:00
parent e6880c9b18
commit af20a2c503
6 changed files with 263 additions and 45 deletions

View File

@@ -5,7 +5,7 @@ import {Ticker} from '../../src/generated/ManagingApiTypes'
test('GMX Orders Closing', async (t) => {
await t.test('should close all orders for BTC', async () => {
const sdk = await getClientForAddress('0x0b4A132cb6ed8fa66953bf61a53D0B91DaCaAd78')
const sdk = await getClientForAddress('0x932167388dD9aad41149b3cA23eBD489E2E2DD78')
const result = await cancelGmxOrdersImpl(
sdk,

View File

@@ -5,17 +5,17 @@ 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('0x0b4A132cb6ed8fa66953bf61a53D0B91DaCaAd78')
const sdk = await getClientForAddress('0x932167388dD9aad41149b3cA23eBD489E2E2DD78')
const result = await openGmxPositionImpl(
sdk,
Ticker.BTC,
TradeDirection.Long,
0.00009129924572776991,
0.00012, // ~5.3 USDC collateral with 2x leverage (fits available balance of 5.69 USDC)
2,
111350,
110000,
114000
87856,
undefined, // No stop-loss
undefined // No take-profit
)
console.log('Position opening result:', result)
assert.ok(result, 'Position opening result should be defined')

View File

@@ -13,9 +13,9 @@ describe('swap tokens implementation', () => {
console.log('Account', sdk.account)
const result = await swapGmxTokensImpl(
sdk,
Ticker.BTC,
Ticker.USDC,
0.00006893,
Ticker.SOL,
3,
'market',
undefined,
0.5