forked from poloniex/poloniex.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
39 lines (30 loc) · 900 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var Poloniex = require('./lib/poloniex'),
// When using as an NPM module, use `require('poloniex.js')`
// Create a new instance, with optional API key and secret
poloniex = new Poloniex(
// 'API_KEY',
// 'API_SECRET'
);
// * IMPORTANT *
// The line below is temporary, to avoid API server certficiate failure `Error: CERT_UNTRUSTED`
// This is presumably a temporary issue and has been reported to Poloniex.
// Do not include the line below once the issue is resolved.
Poloniex.STRICT_SSL = false;
// Public call
poloniex.getTicker(function(err, data){
if (err){
console.log('ERROR', err);
return;
}
console.log(data);
});
// Private call - requires API key and secret
/*
poloniex.buy('VTC', 'BTC', 0.1, 100, function(err, data){
if (err){
console.log('ERROR', err);
return;
}
console.log(data);
});
*/