forked from cryptopupua/kuna-api-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorder.js
More file actions
22 lines (17 loc) · 709 Bytes
/
order.js
File metadata and controls
22 lines (17 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const keys = require('./keys');
const kuna = require('./v3')(keys);
const prompt = require('prompt-sync')();
function startOrder(data) {
console.log(data);
// [limit, market, market_by_quote]
const inamount = prompt('Input amount: ');
const intype = prompt('Type [limit, market, market_by_quote]: ');
const inprice = prompt('Input price (mandatory when type = limit ): ');
try {
orderrequest = {symbol: 'bchuah', type: intype , amount: inamount , price :inprice};
kuna.private.createOrder(orderrequest).then((data) => console.log(data));
} catch (error) {
return error.message;
};
}
console.log(kuna.public.getMarkets().then((data) => startOrder(data)));