-
Notifications
You must be signed in to change notification settings - Fork 2
/
tests.js
111 lines (93 loc) · 3.36 KB
/
tests.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
var bitstamp = new Bitstamp('clientid', 'api_key', 'api_secret');
function displayInputParams(params) {
$('#params').val(JSON.stringify(params));
}
function debugResponse(response) {
if ('error' in response) {
$('#response').val(response.error);
} else if ('data' in response) {
$('#response').val(JSON.stringify(response.data));
} else {
$('#response').val('Unknown error');
}
}
function getTicker() {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.ticker, debugResponse);
displayInputParams(params);
}
function getOrderBook() {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.orderbook, debugResponse);
displayInputParams(params);
}
function getTransactions(group) {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.transactions, debugResponse, {group: group});
displayInputParams(params);
}
function getEurUsdRate() {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.eurusd, debugResponse);
displayInputParams(params);
}
function getBalance() {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.balance, debugResponse);
displayInputParams(params);
}
function getUserTransactions(offset, limit, sort) {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.usertransactions, debugResponse, {offset: offset, limit: limit, sort: sort});
displayInputParams(params);
}
function getOpenOrders() {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.openorders, debugResponse);
displayInputParams(params);
}
function cancelOrder(orderid) {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.cancelorder, debugResponse, {id: orderid});
displayInputParams(params);
}
function orderBuy(amount, price) {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.orderbuy, debugResponse, {amount: amount, price: price});
displayInputParams(params);
}
function orderSell(amount, price) {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.ordersell, debugResponse, {amount:amount, price: price});
displayInputParams(params);
}
function withdrawalRequest() {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.withdrawalrequests, debugResponse);
displayInputParams(params);
}
function bitcoinWithdrawal(amount, address) {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.btcwithdrawal, debugResponse, {amount: amount, address: address});
displayInputParams(params);
}
function getBitcoinDepositAddress() {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.btcdepositaddress, debugResponse);
displayInputParams(params);
}
function listUnconfirmedBitcoinTransactions() {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.unconfirmedbtc, debugResponse);
displayInputParams(params);
}
function rippleWithdrawal(amount, address, currency) {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.ripplewithdrawal, debugResponse, {amount: amount, address: address, currency: currency});
displayInputParams(params);
}
function getRippleDepositAddress() {
$('#response').val('');
params = bitstamp.submitRequest(bitstamp.methods.rippledepositaddress, debugResponse);
displayInputParams(params);
}