Repository navigation
Expand file tree
/
Copy pathcreateaddress.js
More file actions
129 lines (99 loc) · 4.17 KB
/
Copy pathcreateaddress.js
File metadata and controls
129 lines (99 loc) · 4.17 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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
"use strict";
var baseCoins = [ "ADA", "BTG","DASH","EOS", "ETC", "ICX", "LSK", "IOTA", "NEO", "OMG", "QTUM", "SC", "TRX", "USDT", "XEM", "XLM", "XMR", "XRB", "XVG", "ZEC", "DOGE", "LTC", "BTC", "ETH", "XRP", "BCH"];
/* ------------------------------------------------------------------------ */
const ccxt = require ('ccxt')
, asTable = require ('as-table') // .configure ({ print: require ('string.ify').noPretty })
, log = require ('ololog').noLocate
, ansi = require ('ansicolor').nice
require('./settings.js')();
let result = {};
var capabilities = [
'publicAPI',
'privateAPI',
'CORS',
'fetchTicker',
'fetchTickers',
'fetchOrderBook',
'fetchTrades',
'fetchOHLCV',
'fetchBalance',
'createOrder',
'cancelOrder',
'fetchOrder',
'fetchOrders',
'fetchOpenOrders',
'fetchClosedOrders',
'fetchMyTrades',
'fetchCurrencies',
'fetchDepositAddress',
'withdraw',
];
;(async function test () {
let total = 0
let missing = 0
let implemented = 0
var accounts = require ('./credentials-1.json')
let exchange
const ids = ccxt.exchanges.filter (id => id in accounts)
var exchanges = ccxt.indexBy (await Promise.all (ids.map (async id => {
// instantiate the exchange
let exchange
if (id==='therock') {
exchange = new therocksqv (ccxt.extend ( { ENABLE_RATE_LIMIT }, accounts[id]))
} else {
exchange = new ccxt[id] (ccxt.extend ( { ENABLE_RATE_LIMIT }, accounts[id]) )
}
return exchange
})), 'id')
//ids[ids.length] = "therock";
//exchanges["therock"] = new therocksqv (ccxt.extend ( { ENABLE_RATE_LIMIT }, accounts["therock"]))
for (let i = 0; i < ids.length; i++) {
exchange = exchanges[ids[i]]
capabilities.forEach (key => {
total += 1
let capability = exchange.has[key].toString ()
if (!exchanges[ids[i]].has[key]) {
capability = exchange.id.red
missing += 1
} else {
capability = exchange.id.green
implemented += 1
}
result[key] = capability
})
log.cyan (ids[i])
//if (exchanges[ids[i]].has["createDepositAddress"]) {
if (ids[i]==="cryptopia") {
//wite exchange 'header'
var minimum = ""
for(var index = 0; index < baseCoins.length;index++){
var currency = baseCoins[index]
var exhange = exchanges[ids[i]]
exhange.proxy =exchange.has['CORS']?'http://localhost:8080/':undefined
try {
var params = {
nonce: Date.now().toString()
}
var addresses = await exhange.fetchDepositAddress(currency, params)
// addresses = await exhange.createDepositAddress(currency, params)
log.green("exchange",ids[i].toString().magenta, "currency", currency, "address created", addresses)
// await ccxt.sleep(exchange.rateLimit)
} catch (error) {
log.red(error.message)
log.red("exchange",ids[i].toString().magenta, "currency", currency, "address not available")
}
}
}/* else {
try {
if (ids[i]==='cryptopia') {
}
}
catch (error) {
log.red(error.message)
}
} */
}
log (result)
log (implemented.toString ().green, 'implemented and', missing.toString ().red, 'missing methods of', total.toString ().yellow, 'methods it total')
}
) ()