forked from ignaciop000/binance-traderBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest.js
More file actions
29 lines (22 loc) · 643 Bytes
/
Copy pathrequest.js
File metadata and controls
29 lines (22 loc) · 643 Bytes
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
"use strict"
const axios = require("axios")
const getSignature = require('./signature')
/**
* return an axios instance with base url and default header
* @param {Object} config config provided to the binance rest constructor
* @return {Axios} an axios instance
*/
const binanceRequest = function(config = {}) {
const { api, secret, timeout } = config
const axiosDefinition = {
baseURL: "https://www.binance.com/"
}
if (api) {
axiosDefinition.headers = {'X-MBX-APIKEY': api}
}
if (timeout) {
axiosDefinition.timeout = timeout
}
return axios.create(axiosDefinition)
}
module.exports = binanceRequest