How to use the node-binance-api.buy function in node-binance-api

To help you get started, we’ve selected a few node-binance-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github andresilvasantos / bitprophet / exchange_utils.js View on Github external
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) {