forked from Bincentive/node-trader-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathall.test
More file actions
128 lines (117 loc) · 3.29 KB
/
Copy pathall.test
File metadata and controls
128 lines (117 loc) · 3.29 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
var chai = require('chai'),
expect = chai.expect,
should = chai.should(),
debug = require('debug')('test'),
Bincentive = require('.');
require('dotenv').load()
var client
before(async () => {
var email = process.env.EMAIL || ""
var password = process.env.PASSWD || ""
client = new Bincentive(email, password)
// console.log(client)
// client._accessToken = '6e804fec8bef5ba0a9b30cf1e91cc127adc9ee921054b5ab967d5f00b11eb057bcbd5ff9132270e12b03daf0321782bd0111864c329438769b56aa2e0fe3c85e82bdf3663d766074435d969f94be564c6f757e3e0f8a4ef1bed01f181ecf6a041802e4e4622660f5baf04e93260ef3054601c8a808ee9686080c103a25164c4837635a78edd1932c435f67e30d7964d2ca1cd01a2ef6d027cee3d4c7ec4e1cc9e25d211b875f448cef9057f8539890a4'
})
describe('Begin Bicentive NodeJS SDK Test', function () {
this.timeout(3000)
this.slow(1000)
it('should able to create client object', async function () {
client.version.should.be.equal('0.1')
})
it('should able to get available exchanges', async function () {
var result
try {
result = await client.getAvailableExchanges()
} catch (e) {
debug(JSON.stringify(e.response.data))
} finally {
expect(result).exist
debug(result)
result.status.should.be.equal(0)
}
})
it('should able to get exchange list', async function () {
var result
try {
result = await client.getExchangeList()
} catch (e) {
debug(JSON.stringify(e.response.data))
} finally {
expect(result).exist
debug(result)
result.status.should.be.equal(0)
}
})
it('should able to get strategy list', async function () {
var result
try {
result = await client.getStrategyList()
} catch (e) {
// console.log(e)
} finally {
expect(result).exist
debug(result)
result.status.should.be.equal(0)
}
})
it('should able to get approved strategy list', async function () {
var result
try {
result = await client.getApprovedStrategyList()
} catch (e) {
// console.log(e)
} finally {
expect(result).exist
debug(result)
result.status.should.be.equal(0)
}
})
it('should able to add strategy order', async function () {
var result
try {
result = await client.addOrder(71, 2, "BTC", "USDT", "MARKET", "BUY", 1.5, 4500)
} catch (e) {
// console.log(e)
} finally {
expect(result).exist
debug(result)
result.status.should.be.equal(0)
}
})
it('should able to get apikey list', async function () {
var result
try {
result = await client.getApiKeyList()
} catch (e) {
// console.log(e)
} finally {
expect(result).exist
debug(result)
result.status.should.be.equal(0)
}
})
it('should able to add apikey', async function () {
var result
try {
result = await client.addApiKey('zxc', 'zxc', 2, 'zxc', true)
} catch (e) {
console.log(e)
} finally {
expect(result).exist
debug(result)
result.status.should.be.equal(0)
}
})
it('should able to del apikey', async function () {
var result
try {
result = await client.deleteApiKey(2)
} catch (e) {
// console.log(e)
} finally {
expect(result).exist
debug(result)
result.status.should.be.equal(0)
}
})
})