Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createLimitOrder: function(pairName, sideBuy, price, quantity, next) {
quantity = this.normalizeAmount(pairName, quantity, price)
price = this.fixPrice(pairName, price)
//BUY
if(sideBuy) {
binance.buy(pairName, quantity, price, {type:'LIMIT'}, function(error, response) {
next(error, response.orderId, quantity, response.status == "FILLED")
});
}
//SELL
else {
binance.sell(pairName, quantity, price, {type:'LIMIT'}, function(error, response) {
next(error, response.orderId, quantity, response.status == "FILLED")
});
}
},
createStopLimitOrder: function(pairName, sideBuy, price, stopPrice, quantity, next) {
sell = (price) => {
binance.sell(this.state.selectedCrypto.symbol, this.state.quantity, price);
const alert = Object.assign({}, this.state.alert);
alert.isOpen = true;
alert.message = `Trading bot sold ${this.state.quantity} ${this.state.selectedCrypto.baseAsset}
at ${price} ${this.state.selectedCrypto.symbol}. Refresh the page for a new strategy.`
alert.color = 'success';
this.setState({
sold: true,
alert,
});
};