UNPKG

korea-crypto-exchange

Version:

한국의 주요 암호화폐 거래소(업비트, 빗썸) API를 쉽게 구현할 수 있도록 도와주는 TypeScript 라이브러리

92 lines (91 loc) 3.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExchangeFacade = void 0; class ExchangeFacade { constructor(strategy) { this.strategy = strategy; } async getAccounts() { if ('getAccounts' in this.strategy) { return this.strategy.getAccounts(); } throw new Error('Current exchange does not support account information retrieval'); } async placeOrder(params) { return this.strategy.placeOrder(params); } async getOrderDetail(params) { if ('getOrderDetail' in this.strategy) { return this.strategy.getOrderDetail(params); } throw new Error('Current exchange does not support order detail retrieval'); } // UpbitQuotation 메서드들 async getMarkets(isDetails = false) { if ('getMarkets' in this.strategy) { return this.strategy.getMarkets(isDetails); } throw new Error('Current exchange does not support market information retrieval'); } async getTickers(params) { if ('getTickers' in this.strategy) { return this.strategy.getTickers(params); } throw new Error('Current exchange does not support ticker information retrieval'); } async getTickersAll(params) { if ('getTickersAll' in this.strategy) { return this.strategy.getTickersAll(params); } throw new Error('Current exchange does not support all ticker information retrieval'); } async getOrderbook(params) { if ('getOrderbook' in this.strategy) { return this.strategy.getOrderbook(params); } throw new Error('Current exchange does not support orderbook information retrieval'); } async getSupportedLevels(params) { if ('getSupportedLevels' in this.strategy) { return this.strategy.getSupportedLevels(params); } throw new Error('Current exchange does not support supported levels information retrieval'); } async getSecondCandles(params) { if ('getSecondCandles' in this.strategy) { return this.strategy.getSecondCandles(params); } throw new Error('Current exchange does not support second candle information retrieval'); } async getMinuteCandles(unit, params) { if ('getMinuteCandles' in this.strategy) { return this.strategy.getMinuteCandles(unit, params); } throw new Error('Current exchange does not support minute candle information retrieval'); } async getDayCandles(params) { if ('getDayCandles' in this.strategy) { return this.strategy.getDayCandles(params); } throw new Error('Current exchange does not support day candle information retrieval'); } async getWeekCandles(params) { if ('getWeekCandles' in this.strategy) { return this.strategy.getWeekCandles(params); } throw new Error('Current exchange does not support week candle information retrieval'); } async getYearCandles(params) { if ('getYearCandles' in this.strategy) { return this.strategy.getYearCandles(params); } throw new Error('Current exchange does not support year candle information retrieval'); } async getTradeTicks(params) { if ('getTradeTicks' in this.strategy) { return this.strategy.getTradeTicks(params); } throw new Error('Current exchange does not support trade tick information retrieval'); } } exports.ExchangeFacade = ExchangeFacade;