-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpositions.js
31 lines (26 loc) · 964 Bytes
/
positions.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
const Axios = require('axios');
const Crypto = require('crypto')
// Do not submit actual keys that give access to anything of value to GIT :-)
const API_KEY = 'w6AcfksrG7GiEFoN'
const SECRET = 'gZ0kkI9p8bHHDaBjO3Cyij87SrToYPA3'
var request = JSON.stringify({
projection: "Exchange/Symbol", // make sure it matches risk projections configured in ember.conf
// traderId: "11336866712", // optional filter
// account: "GOLD", // optional filter
// exchangeId: "CME" // optional filter
});
var signature = Crypto.createHmac('sha384', SECRET).update(request).digest('hex');
var a = Axios.post('http://localhost:8988/api/v1/positions', request, // https:// for PROD
{
headers: {
"Content-Type": "application/json",
"X-API-KEY": API_KEY,
"X-SIGNATURE": signature,
}
}
).then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);
});