This repository has been archived by the owner on Mar 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
55 lines (41 loc) · 1.61 KB
/
index.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const { TokensNet } = require("../lib/index.js");
// Secrets
const key = "XXX";
const secret = "XXX";
const tokens = new TokensNet({
key,
secret
});
(async () => {
/*
The promise only rejects on network errors or timeouts.
A successfull promise always resolves in an object containing status, headers and body.
status is the http status code as number, headers is an object of http response headers
and body is the parsed JSON response body of the api, you dont need to parse the results
yourself you can simply continue by accessing the object.
*/
/* PUBLIC */
const ticker = await tokens.ticker("dtrbtc");
console.log(ticker.body);
const tickerHour = await tokens.tickerHour("dtrbtc");
console.log(tickerHour.body);
const trades = await tokens.trades("dtrbtc", "hour");
console.log(trades.body);
const pairs = await tokens.pairs();
console.log(pairs.body);
const orderbook = await tokens.orderBook("dtrbtc");
console.log(orderbook.body);
/* PRIVATE */
// const balance = await tokens.balance("btc");
// console.log(balance.body);
// const allOpenOrders = await tokens.openOrdersAll();
// console.log(allOpenOrders.body);
// const openOrders = await tokens.openOrders("dtrbtc");
// console.log(openOrders.body);
// const order = await tokens.getOrder("f227f073-dcd2-4caf-968d-ca6360bf145e");
// console.log(order.body);
// const cancled = await tokens.cancelOrder("f227f073-dcd2-4caf-968d-ca6360bf145e");
// console.log(cancled.body);
// const opened = await tokens.placeOrder(30, 0.00003000, "dtreth", "buy");
// console.log(opened.body);
})();