Git Product home page Git Product logo

Comments (5)

jaggedsoft avatar jaggedsoft commented on June 20, 2024

Thank you for the report!
I created an update that fixes this issue. Please issue an npm update in your project directory.

I have verified it works with the following code:

const binance = require('node-binance-api');
binance.options({
  'APIKEY':'key',
  'APISECRET':'secret'
});
//Placing a MARKET order
var symbol = "BNBBTC", quantity = 1;
binance.buy(symbol, quantity, 0, {type:"MARKET"});

from node-binance-api.

tapesclub avatar tapesclub commented on June 20, 2024

from node-binance-api.

jaggedsoft avatar jaggedsoft commented on June 20, 2024

Thank you!
And great idea. I will work on this and keep you updated

from node-binance-api.

jaggedsoft avatar jaggedsoft commented on June 20, 2024

Thank you for the suggestion!

I added callbacks to buy/sell functions and added a shortcut to make market orders easier. Now you can chain orders together.

var quantity = 1;
binance.marketBuy("BNBBTC", quantity, function(response) {
	console.log("Market Buy response", response);
	// Now you can limit sell with a stop loss, etc.
});

Any other features/bugs/suggestions let me know and I will be happy to help. If you open it as a new issue I will see it sooner. Thanks again!

from node-binance-api.

jaggedsoft avatar jaggedsoft commented on June 20, 2024

Here are some new examples

Limit Buy

var quantity = 5, price = 0.00402030;
binance.buy("BNBETH", quantity, price, {}, function(response) {
	console.log("Limit Buy response", response);
	console.log("order id: " + response.orderId);
});
Limit Buy response { symbol: 'BNBETH',
  orderId: 4480717,
  clientOrderId: 'te38xGILZUXrPZHnTQPH6h',
  transactTime: 1509049732437,
  price: '0.00402030',
  origQty: '5.00000000',
  executedQty: '5.00000000',
  status: 'FILLED',
  timeInForce: 'GTC',
  type: 'LIMIT',
  side: 'BUY' }
//order id: 4480717

Market Buy

var quantity = 1;
binance.marketBuy("BNBBTC", quantity, function(response) {
	console.log("Market Buy response", response);
	console.log("order id: " + response.orderId)
	// Now you can limit sell with a stop loss, etc.
});
Market Buy response {
  symbol: 'BNBETH',
  orderId: 4480553,
  clientOrderId: 'rCGiCG08PGy7AwvbrG5d83',
  transactTime: 1509049376261,
  price: '0.00000000',
  origQty: '1.00000000',
  executedQty: '1.00000000',
  status: 'FILLED',
  timeInForce: 'GTC',
  type: 'MARKET',
  side: 'BUY' }
//order id: 4480553

Please navigate to your project directory and issue an npm update
Or run the command npm install node-binance-api --save

from node-binance-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.