node-dsx-api
Version:
Node api for DSX.uk crypto exchange
45 lines (44 loc) • 1.67 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const exchange_1 = require("./exchange");
var TransactionsRequestStatus;
(function (TransactionsRequestStatus) {
TransactionsRequestStatus[TransactionsRequestStatus["Failed"] = 1] = "Failed";
TransactionsRequestStatus[TransactionsRequestStatus["Completed"] = 2] = "Completed";
TransactionsRequestStatus[TransactionsRequestStatus["Processing"] = 3] = "Processing";
TransactionsRequestStatus[TransactionsRequestStatus["Rejected"] = 4] = "Rejected";
})(TransactionsRequestStatus = exports.TransactionsRequestStatus || (exports.TransactionsRequestStatus = {}));
/**
* Reports and history
*/
class ExchangeHistory extends exchange_1.Exchange {
async transactions(req) {
const res = await this.request(this.sign("history/transactions", "tapi", "POST", req));
if (res.success != 1) {
throw res;
}
return res.return;
}
async historyTrades(req) {
const res = await this.request(this.sign("history/trades", "tapi", "POST", req));
if (res.success != 1) {
throw res;
}
return res.return;
}
async historyOrders(req) {
const res = await this.request(this.sign("history/orders", "tapi", "POST", req));
if (res.success != 1) {
throw res;
}
return res.return;
}
async getActiveOrders(symbol) {
const res = await this.request(this.sign("orders", "tapi", "POST", { pair: symbol }));
if (res.success != 1) {
throw res;
}
return res.return;
}
}
exports.ExchangeHistory = ExchangeHistory;