UNPKG

fyers-api-v2

Version:

Fyers data.

46 lines (33 loc) 971 B
const apiService = require("../apiService/apiService"); const token = require("../token/tokenGeneration"); const helper = require('../helper/helper'); const quoteApi =helper.quotesAccessPoint(); class MarketDepth { #urlSubPath = 'depth/' #symbol; #ohlcv_flag; constructor() { this.token = token.getAuthToken() } setSymbol(value) { this.#symbol = value; return this; } setOhlcvFlag(value){ this.#ohlcv_flag = value return this; } async getMarketDepth() { let uri = quoteApi + this.#urlSubPath let url = apiService.generateUrl(uri, this.getUserValueObject()); let result = await new apiService(url, this.token).get(); return result } getUserValueObject() { let userObject = {} userObject.symbol = this.#symbol; userObject.ohlcv_flag = this.#ohlcv_flag return userObject } } module.exports = MarketDepth;