-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
i never done crypto bot projects before so i may have some glitches here...
public methods are working just fine...
in private methods, placeOrder methods to be specific there is 2 error:
- the end point in trade.js file should change from '/api/v1/orders' to '/api/v1/margin/order'
- im getting 'You must enable Margin Trading.' with status 100000 and i know its about permissions. the point is i already gave this permission to api from kucoin dashboard api managment.
and i need help for sending a request with this details
- margin mode enabled with type 'market' so i give it the amount of USDT and api buy the coin (in my case XRP) with bestBid price that i'm getting from 'getTicker' method
- set the stopLoss and takeProfit by percent (price is ok. i will calculate it my self)
- defining SHORT or LONG for the order (i didn't figure it out. is it the side param? (BUY or SELL) )
thanks in advance...
placeOrder(side) {
return new Promise(async (resolve, reject) => {
let latestData = {}
await api.getTicker(process.env.CRYPTO_PAIR + '-USDT').then(r => latestData = r.data).then(r => console.log(r)).catch(err => reject(err))
let fund = 3
let params = {
clientOid: latestData.time,
side: side,
symbol: process.env.CRYPTO_PAIR + '-USDT',
tradeType: 'MARGIN_TRADE',
type: 'market',
stop: 'loss',
stopPrice: latestData.bestBid - (latestData.bestBid / 100 * process.env.STOP_LOSS_PERCENT),
timestamp: latestData.time,
fund,
size: fund / latestData.bestBid
}
await api.placeOrder(params).then(r => resolve(r)).catch(err => reject(err))
})
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels