-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgox-cli.js
More file actions
executable file
·69 lines (58 loc) · 1.77 KB
/
gox-cli.js
File metadata and controls
executable file
·69 lines (58 loc) · 1.77 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#! /usr/bin/env node
var program = require('commander');
var currency = require('mtgox-currency');
var HttpGoxClient = require('mtgox-http-client');
var httpGoxClient = new HttpGoxClient({ key: 'MTGOX_API_KEY', secret: 'MTGOX_API_SECRET' });
program
.command('add')
.option('-t --type [type]', 'Type of order')
.option('-a --amount-int [amount_int]', 'Amount of the order', currency.btcFloat2btcInt)
.option('-p --price-int [price_int]', 'Price of the order', currency.usdFloat2UsdInt)
.action(function(options) {
httpGoxClient.add(options.type, options.amountInt, options.priceInt).pipe(process.stdout);
});
program
.command('cancel')
.option('-o --order-id [oid]', 'Order id')
.action(function(options) {
httpGoxClient.cancel(options.orderId).pipe(process.stdout);
});
program
.command('idkey')
.action(function () {
httpGoxClient.idKey().pipe(process.stdout);
});
program
.command('info')
.action(function () {
httpGoxClient.info().pipe(process.stdout);
});
program
.command('lag')
.action(function () {
httpGoxClient.lag().pipe(process.stdout);
});
program
.command('orders')
.action(function () {
httpGoxClient.orders().pipe(process.stdout);
});
program
.command('result')
.option('-t --type [type]', 'Trade type')
.option('-o --order [oid]', 'Order id')
.action(function(options) {
httpGoxClient.result(options.type, options.order).pipe(process.stdout);
});
program
.command('tickerFast')
.action(function () {
httpGoxClient.tickerFast().pipe(process.stdout);
});
program
.command('trades')
.option('-s --since [since]', 'Timestamp', (Date.now() - 60 * 60 * 1000) * 1000)
.action(function (options) {
httpGoxClient.trades(options.since).pipe(process.stdout);
});
program.parse(process.argv);