bbgo_origin/frontend/api/bbgo.js

51 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-01-25 09:40:37 +00:00
import axios from "axios";
const baseURL = process.env.NODE_ENV === "development" ? "http://localhost:8080" : ""
export function testSessionConnection(data, cb) {
return axios.post(baseURL + '/api/sessions/test-connection', data, {
headers: {
'Content-Type': 'application/json',
}
}).then(response => {
cb(response.data)
});
}
2021-01-25 10:29:31 +00:00
export function querySessions(cb) {
axios.get(baseURL + '/api/sessions', {})
.then(response => {
cb(response.data.sessions)
});
}
2021-01-29 10:48:39 +00:00
export function queryTrades(params, cb) {
axios.get(baseURL + '/api/trades', {params: params})
2021-01-29 10:48:39 +00:00
.then(response => {
cb(response.data.trades)
});
}
2021-01-29 10:34:03 +00:00
export function queryClosedOrders(params, cb) {
axios.get(baseURL + '/api/orders/closed', {params: params})
2021-01-29 08:50:06 +00:00
.then(response => {
cb(response.data.orders)
});
}
2021-01-25 09:40:37 +00:00
export function queryAssets(cb) {
axios.get(baseURL + '/api/assets', {})
.then(response => {
cb(response.data.assets)
});
}
2021-01-26 10:10:08 +00:00
export function queryTradingVolume(params, cb) {
axios.get(baseURL + '/api/trading-volume', {params: params})
2021-01-26 10:10:08 +00:00
.then(response => {
cb(response.data.tradingVolumes)
});
}