Code Monkey home page Code Monkey logo

Comments (11)

jaggedsoft avatar jaggedsoft commented on August 25, 2024 1

Opening a large amount of websockets at once is bad too, I have mine in a loop so one gets opened every 350ms

from node-binance-api.

bitcoinvsalts avatar bitcoinvsalts commented on August 25, 2024 1

I love this repo. You did a great job. Thank you.

not related, any idea where to find a list of all the pairs on binance?

from node-binance-api.

jaggedsoft avatar jaggedsoft commented on August 25, 2024 1

Thank you for the kind words!
Yes, there are a few different ways.
This one is very useful:

exchangeInfo(): Pull minimum order size, quantity, etc.

//minNotional = minimum order value (price * quantity)
binance.exchangeInfo(function(data) {
	let minimums = {};
	for ( let obj of data.symbols ) {
		let filters = {minNotional:0.001,minQty:1,maxQty:10000000,stepSize:1,minPrice:0.00000001,maxPrice:100000};
		for ( let filter of obj.filters ) {
			if ( filter.filterType == "MIN_NOTIONAL" ) {
				filters.minNotional = filter.minNotional;
			} else if ( filter.filterType == "PRICE_FILTER" ) {
				filters.minPrice = filter.minPrice;
				filters.maxPrice = filter.maxPrice;
			} else if ( filter.filterType == "LOT_SIZE" ) {
				filters.minQty = filter.minQty;
				filters.maxQty = filter.maxQty;
				filters.stepSize = filter.stepSize;
			}
		}
		minimums[obj.symbol] = filters;
	}
	console.log(minimums);
	fs.writeFile("minimums.json", JSON.stringify(minimums, null, 4), function(err){});
});

example

or you can subscribe to the 24h price change statistics

// For all symbols:
binance.websockets.prevDay(false, function(response) {
	console.log(response);
});

// For a specific symbol:
binance.websockets.prevDay('BNBBTC', function(response) {
	console.log(response);
});

You can get all symbols with the prices function

binance.prices(function(ticker) {
	console.log("prices()", ticker);
	console.log("Price of BNB: ", ticker.BNBBTC);
});

from node-binance-api.

jaggedsoft avatar jaggedsoft commented on August 25, 2024

Thank you for the report, I am testing this change for the next version

		depth: function(symbol, callback, limit = 100) {
			publicRequest(base+"v1/depth", {symbol:symbol, limit:limit}, function(data) {
				if ( typeof data.bids !== "undefined" && typeof data.asks !== "undefined" ) {
					return callback.call(this, depthData(data), symbol);
				}
			});
		},

from node-binance-api.

bitcoinvsalts avatar bitcoinvsalts commented on August 25, 2024

I am still getting the issue after making this new change.

from node-binance-api.

bitcoinvsalts avatar bitcoinvsalts commented on August 25, 2024

might be here

const depthData = function(data) { // Used for /depth endpoint
		let bids = {}, asks = {}, obj;
		for ( obj of data.bids ) {
			bids[obj[0]] = parseFloat(obj[1]);
		}
		for ( obj of data.asks ) {
			asks[obj[0]] = parseFloat(obj[1]);
		}
		return {bids:bids, asks:asks};
	}

from node-binance-api.

jaggedsoft avatar jaggedsoft commented on August 25, 2024

try this:

	const depthData = function(data) { // Used for /depth endpoint
		let bids = {}, asks = {}, obj;
		if ( typeof data.bids !== "undefined" ) {
			for ( obj of data.bids ) {
				bids[obj[0]] = parseFloat(obj[1]);
			}
		}
		if ( typeof data.asks !== "undefined" ) {
			for ( obj of data.asks ) {
				asks[obj[0]] = parseFloat(obj[1]);
			}
		}
		return {bids:bids, asks:asks};
	}

from node-binance-api.

bitcoinvsalts avatar bitcoinvsalts commented on August 25, 2024

I am getting this error return that's why:

{ code: -1003, msg: 'Way too many requests; IP banned until 1514259308510.' }

from node-binance-api.

jaggedsoft avatar jaggedsoft commented on August 25, 2024

Try to handle almost all your logic through websockets, then it's free
i try to only make requests when posting orders or cancelling them

from node-binance-api.

bitcoinvsalts avatar bitcoinvsalts commented on August 25, 2024

I am only using websockets but I am opening 50 of them.

from node-binance-api.

jaggedsoft avatar jaggedsoft commented on August 25, 2024

Your ban should be over in a few minutes
new Date(1514259308510).toLocaleString()

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.