Skip to content

Commit 3197b55

Browse files
committed
add static tests
1 parent ddf7eb3 commit 3197b55

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

tests/binance-class-static.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,28 @@ describe( 'Static tests', async function () {
235235
assert(obj.newClientOrderId.startsWith(CONTRACT_PREFIX))
236236
})
237237

238+
it( 'Futures Limit trigger Buy', async function ( ) {
239+
await binance.futuresOrder('STOP', 'BUY', 'LTCUSDT', 0.5, 100, {'triggerPrice': 90} )
240+
assert.isTrue( interceptedUrl.startsWith('https://fapi.binance.com/fapi/v1/algoOrder' ))
241+
const obj = urlToObject( interceptedUrl.replace('https://fapi.binance.com/fapi/v1/algoOrder?', '') )
242+
assert.equal( obj.symbol, 'LTCUSDT' )
243+
assert.equal( obj.side, 'BUY' )
244+
assert.equal( obj.type, 'STOP' )
245+
assert.equal( obj.quantity, 0.5 )
246+
assert(obj.clientAlgoId.startsWith(CONTRACT_PREFIX))
247+
})
248+
249+
it( 'Futures Limit trigger Buy using dedicated endpoint', async function ( ) {
250+
await binance.futuresAlgoOrder('STOP', 'BUY', 'LTCUSDT', 0.5, 100, {'triggerPrice': 90} )
251+
assert.isTrue( interceptedUrl.startsWith('https://fapi.binance.com/fapi/v1/algoOrder' ))
252+
const obj = urlToObject( interceptedUrl.replace('https://fapi.binance.com/fapi/v1/algoOrder?', '') )
253+
assert.equal( obj.symbol, 'LTCUSDT' )
254+
assert.equal( obj.side, 'BUY' )
255+
assert.equal( obj.type, 'STOP' )
256+
assert.equal( obj.quantity, 0.5 )
257+
assert(obj.clientAlgoId.startsWith(CONTRACT_PREFIX))
258+
})
259+
238260
it( 'Futures LimitSell', async function ( ) {
239261
await binance.futuresOrder('LIMIT', 'SELL', 'LTCUSDT', 0.5, 100 )
240262
assert.isTrue( interceptedUrl.startsWith('https://fapi.binance.com/fapi/v1/order' ))

0 commit comments

Comments
 (0)