-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.currency.js
52 lines (44 loc) · 2.16 KB
/
test.currency.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
'use strict'
// ----------------------------------------------------------------------------
const assert = require ('assert')
// ----------------------------------------------------------------------------
module.exports = (exchange, currency, method) => {
const format = {
'id': 'btc', // string literal for referencing within an exchange
'code': 'BTC', // uppercase string literal of a pair of currencies
//----------------------------------------------------------------------
// commented temporarily to bring currencies to consistency first
// 'name': 'Bitcoin', // uppercase string, base currency, 3 or more letters
// 'quote': 'USD', // uppercase string, quote currency, 3 or more letters
// 'withdraw': true, // can withdraw
// 'deposit': true, // can deposit
// 'active': true, // can both withdraw & deposit
// 'precision': 8, // number of decimal digits "after the dot"
// 'limits': { // value limits when placing orders on this market
// 'amount': {
// 'min': 0.01, // order amount should be > min
// 'max': 1000, // order amount should be < max
// },
// 'price': {
// 'min': 0.01, // order price should be > min
// 'max': 1000, // order price should be < max
// },
// 'cost': { // order cost = price * amount
// 'min': 0.01, // order cost should be > min
// 'max': 1000, // order cost should be < max
// },
// },
// 'info': {}, // the original unparsed market info from the exchange
//----------------------------------------------------------------------
}
const keys = Object.keys (format)
for (let i = 0; i < keys.length; i++) {
const key = keys[i]
assert (key in currency)
}
// expect (currency['precision']).to.not.be.undefined
// expect (currency['limits']['amount']['min']).to.not.be.undefined
// expect (currency['limits']['price']['min']).to.not.be.undefined
// expect (market['limits']['cost']['min']).to.not.be.undefined
return currency
}