Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions node-binance-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3177,6 +3177,41 @@ let api = function Binance( options = {} ) {
}
},

/**
* Gets all order of a given symbol
* @param {string} symbol - the symbol
* @param {number} startTime - the start time
* @param {number} endTime - the end time
* @param {function} callback - the callback function (can also accept options)
* @param {object} options - additional options
* @return {promise or undefined} - omitting the callback returns a promise
*/
allOrdersByDate: function ( symbol, startTime, endTime, callback, options = {} ) {
let parameters = Object.assign( { symbol: symbol, startTime: startTime, endTime: endTime }, options );
if ( typeof callback == 'object' ) {
options = callback;
callback = false;
}
if ( !callback ) {
return new Promise( ( resolve, reject ) => {
callback = ( error, response ) => {
if ( error ) {
reject( error );
} else {
resolve( response );
}
}
signedRequest( base + 'v3/allOrders', parameters, function ( error, data ) {
return callback.call( this, error, data, symbol, startTime, endTime );
} );
} )
} else {
signedRequest( base + 'v3/allOrders', parameters, function ( error, data ) {
return callback.call( this, error, data, symbol, startTime, endTime );
} );
}
},

/**
* Gets the depth information for a given symbol
* @param {string} symbol - the symbol
Expand Down Expand Up @@ -3645,6 +3680,37 @@ let api = function Binance( options = {} ) {
}
},

/**
* Get trades for a given symbol and date
* @param {string} symbol - the symbol
* @param {numver} startTime - the start time
* @param {number} endTime - the end time
* @param {function} callback - the callback function
* @param {object} options - additional options
* @return {promise or undefined} - omitting the callback returns a promise
*/
tradesByDate: ( symbol, startTime, endTime, callback, options = {} ) => {
let parameters = Object.assign( { symbol: symbol, startTime: startTime, endTime: endTime}, options );
if ( !callback ) {
return new Promise( ( resolve, reject ) => {
callback = ( error, response ) => {
if ( error ) {
reject( error );
} else {
resolve( response );
}
}
signedRequest( base + 'v3/myTrades', parameters, function ( error, data ) {
return callback.call( this, error, data, symbol, startTime, endTime );
} );
} )
} else {
signedRequest( base + 'v3/myTrades', parameters, function ( error, data ) {
return callback.call( this, error, data, symbol, startTime, endTime );
} );
}
},

/**
* Tell api to use the server time to offset time indexes
* @param {function} callback - the callback function
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"repository": {
"type": "git",
"url": "git://github.com/jaggedsoft/node-binance-api.git"
"url": "https://github.com/devshinon-br/node-binance-api"
},
"keywords": [
"binance",
Expand All @@ -49,5 +49,8 @@
"mocha": "^6.2.2",
"mocha-lcov-reporter": "^1.3.0",
"nyc": "^14.1.1"
},
"directories": {
"example": "examples"
}
}