UNPKG

@crypdex/hydro-sdk

Version:

Javascript SDK for the Hydro API

40 lines (39 loc) 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Order_1 = require("./Order"); var PriceLevel_1 = require("./PriceLevel"); var Orderbook = /** @class */ (function () { function Orderbook(json, level) { this.marketId = json.marketId; if (level === OrderbookLevel.THREE) { this.bids = json.bids.map(function (bid) { return new Order_1.Order(bid); }); this.asks = json.asks.map(function (ask) { return new Order_1.Order(ask); }); } else { this.bids = json.bids.map(function (bid) { return new PriceLevel_1.PriceLevel(bid); }); this.asks = json.asks.map(function (ask) { return new PriceLevel_1.PriceLevel(ask); }); } } return Orderbook; }()); exports.Orderbook = Orderbook; /** * Each level represents a different amount of detail returned in * the orderbook. * * Level 1 returns only the best bid/ask prices * * Level 2 returns the top 50 bids and asks, with orders at the * same price being aggregated together * * Level 3 returns the full non-aggregated orderbook, with each * individual order id, and it's price and amount. * * See https://docs.ddex.io/#get-orderbook */ var OrderbookLevel; (function (OrderbookLevel) { OrderbookLevel["ONE"] = "1"; OrderbookLevel["TWO"] = "2"; OrderbookLevel["THREE"] = "3"; })(OrderbookLevel = exports.OrderbookLevel || (exports.OrderbookLevel = {}));