Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | 1x 1x 3x 2x 2x 2x 1x 2x 1x 1x 2x 2x | import { Common } from './common';
import { OrderBy } from './interfaces/common/orderBy.type';
import { Trade } from './interfaces/common/trade.interface';
import { Depth } from './interfaces/public/depth.interface';
import { Period } from './interfaces/public/k.interface';
import { KPending } from './interfaces/public/k_pending.interface';
import { Market } from './interfaces/public/markets.interface';
import { Orderbook } from './interfaces/public/orderbook.interface';
import { SingleTicker } from './interfaces/public/ticker.interface';
import { Tickers } from './interfaces/public/tickers.interface';
export class Public {
private common: Common;
constructor() {
this.common = new Common();
}
public async depth(market: string, limit?: number): Promise<Depth> {
const qs = {
market,
limit,
};
return this.common.request(false, 'GET', 'depth.json', qs);
}
public async k(market: string, limit?: number, period?: Period, timestamp?: number): Promise<number[][]> {
const qs = {
market,
limit,
period,
timestamp,
};
return this.common.request(false, 'GET', 'k.json', qs);
}
public async kPending(market: string, tradeId: number, limit?: number, period?: Period, timestamp?: number): Promise<KPending> {
const qs = {
market,
trade_id: tradeId,
limit,
period,
timestamp,
};
return this.common.request(false, 'GET', 'k_with_pending_trades.json', qs);
}
public async markets(): Promise<Market[]> {
return this.common.request(false, 'GET', 'markets.json');
}
public async orderbook(market: string, asksLimit?: number, bidsLimit?: number): Promise<Orderbook> {
const qs = {
market,
asks_limit: asksLimit,
bids_limit: bidsLimit,
};
return this.common.request(false, 'GET', 'order_book.json', qs);
}
public async tickers(): Promise<Tickers> {
return this.common.request(false, 'GET', 'tickers.json');
}
public async ticker(market: string): Promise<SingleTicker> {
return this.common.request(false, 'GET', `tickers/${market}.json`);
}
public async trades(market: string, limit?: number, timestamp?: number, from?: number, to?: number, orderBy?: OrderBy): Promise<Trade[]> {
const qs = {
market,
limit,
timestamp,
from,
to,
order_by: orderBy,
};
return this.common.request(false, 'GET', 'trades.json', qs);
}
public async timestamp(): Promise<number> {
return this.common.request(false, 'GET', 'timestamp.json');
}
}
|