tylerfilla / node-poloniex-unofficial Goto Github PK
View Code? Open in Web Editor NEWAn API wrapper for Poloniex, a cryptocurrency exchange
License: MIT License
An API wrapper for Poloniex, a cryptocurrency exchange
License: MIT License
Hi,
when i use this :
poloniex-unofficial 1.1.1
poloTrading.returnTradeHistory("BTC_NOTE", (Date.now() - (3600*24*7*1000)), Date.now(), (err,response) => {
if (err) {
// Log error message
console.log("An error occurred: " + err.msg);
} else {
console.log(response);
}
});
there is no error.
I get an empty list : []
but i bougth some "NOTE" this 4 days.
Do I have a mistake ?
I use your javascript lib with 'browserify', this work :
I haven't used the others function for now.
The seq number delivered by the order book and trade push API feed is delivered in another package than normal data and is not exposed to the user. The seq number can be used to correlate changes in trade data with order book snapshots obtained from the public API. As a feature, expose the seq number.
Poloniex sporadically returns monetary values as a healthy mix of numbers and strings, and even uses numbers where strings are documented and vice-versa. This is all fine and dandy when the data is in JSON form, but when deserialized by JSON.parse()
, I believe this may be cause for concern if the value is particularly large. Those astronomical orders on DIEM come to mind here.
I am aware of a particular JSON parsing solution called json-bigint
which offers a JSONbig.parse()
function and converts all numbers to bignumber.js
numbers, but this isn't particularly desirable. At the very least, we must add another dependency, but the code change would simply be a 3 character addition.
One could also regex the raw JSON string for any monetary values and surround them in quotes. I think this would be a more direct solution to the problem, but must match a set of specific cases. Maybe we could "generalize" the matcher to get all decimal point-containing numbers. The result would be easily integrated into the already-string-number-handling codebase.
Right now, I'm leaning toward option 2.
Edit: Even if I'm concerned about nothing, I still want there to be some consistency. This change would probably have to be opt-in so the user knows what to expect.
Hello,
Trying to run this in Node.js, recent version, "=>" in leui of simply writing 'function' for callbacks is causing the code to not execute, this may be because "=>" is not valid Javascript.
As it stands, returning true from a push API callback signals to Autobahn|JS to unsubscribe from the respective feed. Alternatively, it might be useful to unsubscribe when an error is thrown from the callback.
Same question as on @rferro's project.
Thanks for releasing this package. Would love to learn more about the rationale for publishing it at a time when other packages already existed.
๐ for ES6, the neat docs, and all three APIs.
Guessing it was just an oversight, but the currencyPair was missing from the orderTrade method of the push api.
This information is super helpful to have when you are watching more than a single currency.
I went ahead and added it and submitted a PR, I hope it's helpful!
Using two push API wrapper functions consecutively makes Autobahn|JS cry.
Exhibit A
var polo = require("poloniex-unofficial");
var push = polo.api("push");
push.orderTrade("BTC_ETH", (err, data) => {
console.log("1: " + data);
});
push.orderTrade("BTC_ETH", (err, data) => {
console.log("2: " + data);
});
This yields the following error:
"connection already open (or opening)"
Adding an arbitrary delay to the second call fixes it:
// snip snip
setTimeout(function() {
push.orderTrade("BTC_ETH", (err, data) => {
console.log("2: " + data);
});
}, 2000);
Hypothesis: If one does not leave enough delay between two push API wrapper function calls, the second call will see the connection as established, but the WAMP session as closed, and will therefore try to establish a new connection over an existing one, yielding the error.
Feature development for the upcoming 1.1.0 release is complete. In lieu of a well-defined release procedure, here is the plan.
Final adjustments (no new features) will be made on branch staging-1.1.0. During the staging period (defined by the lifetime of this branch), new features and fixes to said features will occur on master as usual. Adjustments and fixes made on the staging branch will continuously be merged to master as appropriate. After the staging period, the staging branch will be removed and the project version will be incremented from 1.1.0-SNAPSHOT to 1.1.0 and the repository tagged as such. Immediately after tagging, the version will be incremented to 1.1.1-SNAPSHOT in preparation for future developments. Finally, code from the tagged commit will be published to npm.
Edit: Tagging and version increments will take place on the staging branch to maintain feature separation.
they should probebly check the _syncStatus variable instead of those undefined variables it checks now
Hi!
I found a bug! :D
.../src/node_modules/poloniex-unofficial/lib/api/trading.js:89
if (bodyObj.error) {
^
TypeError: Cannot read property 'error' of null
at Request._callback (/Users/polyclick/Repos/polyclick/filthy-rich/src/node_modules/poloniex-unofficial/lib/api/trading.js:89:24)
at Request.self.callback (/Users/polyclick/Repos/polyclick/filthy-rich/src/node_modules/request/request.js:187:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/Users/polyclick/Repos/polyclick/filthy-rich/src/node_modules/request/request.js:1044:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/Users/polyclick/Repos/polyclick/filthy-rich/src/node_modules/request/request.js:965:12)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:975:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
Probably doing a check if bodyObj
is null would be enough. I wish I knew what happend there in detail but I didn't have my debug proxy open so I can't see what Poloniex is retuning and wether this should be handled in an other way.
Hi,
On line 315 of push.js there is a typo.
315: updateParsed["amount"] = update.data.rate;
This should be:
updateParsed["amount"] = update.data.amount;
Known parameters at fault:
Solution is to not include those parameters when they are blank.
See PR:
#17
check API docs, please
Hi,
i can see the promise functions in github v 1.1.2
but not in the installed node with npm of the library in the "api" directory.
during install i see this :
โโโ [email protected] extraneous
i got this error:
Uncaught Poloniex: Nonce must be greater than 1474538171128001. You provided 1474639997036.
Might be useful to operate more than one account simultaneously...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.