Buy again in specific price
Closed this issue · 0 comments
EARES commented
Hi ! This is a question btw.
I would like to buy again in specific price in bot. Like "(sold price) x (0.05)" . I calculated already but I can't
make a buy order in calculated price. I put in the some code for how to calculate the sold price and make an buy order so may you can take a look.
const soldPrice = this.queue.meta.currPrice - ( this.queue.meta.currPrice * 0.05 )
I calculate here in sold price * 0.05 so its work. But when I create a buy order its buy again same price not calculate price !
price: (price && price.toFixed(priceSigFig)) || (this.ticker.meta.ask).toFixed(priceSigFig) || ( soldPrice.toFixed(priceSigFig) )
so you can see I added in last .
And my queue.js
this.meta = {
queue: {},
buyCount: 0,
sellCount: 0,
currPrice: 0
};
I define here currPrice mean CurrentPrice
if (side === 'PURCHASED') {
meta.buyCount += 1;
}
else {
meta.currPrice = txn.price;
meta.sellCount += 1;
}
And you can see currentprice = price .
Any helps ?
Cheers !