Git Product home page Git Product logo

Comments (2)

jaggedsoft avatar jaggedsoft commented on September 26, 2024

Good idea, thank you for the suggestion.
You will need to update the api with npm update in your project directory, then you can run this code:

// Cancel all open orders for a symbol
binance.cancelOrders("XMRBTC", function(response, symbol) {
	console.log(symbol+" cancel response:", response);
});

or

binance.cancelOrders("XMRBTC");

or

// Cancel all open orders for a symbol
binance.openOrders("XMRBTC", function(json, symbol) {
	for ( let obj of json ) {
		let quantity = obj.origQty - obj.executedQty;
		console.log("cancel order: "+obj.side+" "+symbol+" "+quantity+" @ "+obj.price+" #"+obj.orderId);
		binance.cancel(symbol, obj.orderId, function(response) {
			//console.log("..response: ", response);
		});
	}
});

from node-binance-api.

jaggedsoft avatar jaggedsoft commented on September 26, 2024

You can also get a list of everything you have on order like this:

// Get list of open orders
binance.balance(function(balances) {
	//console.log("balances()", balances);
	for ( let symbol in balances ) {
		let obj = balances[symbol];
		let onOrder = parseFloat(obj.onOrder);
		//console.log(symbol+" balance: "+obj.available);
		if ( onOrder > 0 ) {
			console.log(symbol+" on order: "+onOrder);
		}
	}
});

Will output something like:

BTC on order: 0.24301
XMR on order: 945.03

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.