UNPKG

quadriga-node-api

Version:

An async/await Node.js api wrapper for QuadrigaCX

39 lines (33 loc) 937 B
const axios = require('axios') const Public = {} /* Get current trading information symbol = string (e.g. 'btc_usd') Default: 'btc_cad' OPTIONAL */ Public.tradingInfo = async function(symbol) { let url = this.baseURL + 'ticker?book=' + symbol return axios.get(url) } /* Get all open orders params = { book: string (e.g. 'btc_usd') Default: 'btc_cad' OPTIONAL group: integer (0 - false; 1 - true) Default: 1 OPTIONAL } */ Public.orderBook = async function(params) { let url = this.baseURL + 'order_book' + this.formatQuery(params) return axios.get(url) } /* Get list of recent trades params = { book: string (e.g. 'btc_usd') Default: 'btc_cad' OPTIONAL time: string (e.g. 'minute') Default: 'hour' OPTIONAL } */ Public.transactions = async function(params) { let url = this.baseURL + 'transactions' + this.formatQuery(params) return axios.get(url) } module.exports = Public