Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@fugle/marketdata

Package Overview
Dependencies
Maintainers
5
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fugle/marketdata - npm Package Compare versions

Comparing version
1.3.1
to
1.3.2
+10
lib/client-factory.d.ts
export interface ClientOptions {
apiKey?: string;
sdkToken?: string;
bearerToken?: string;
baseUrl?: string;
}
export declare abstract class ClientFactory {
protected readonly options: ClientOptions;
constructor(options: ClientOptions);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientFactory = void 0;
class ClientFactory {
constructor(options) {
this.options = options;
const { apiKey, bearerToken, sdkToken } = options;
const tokenCount = [apiKey, bearerToken, sdkToken].filter(Boolean).length;
if (tokenCount === 0) {
throw new TypeError('One of the "apiKey", "bearerToken", or "sdkToken" options must be specified');
}
if (tokenCount > 1) {
throw new TypeError('Only one of the "apiKey", "bearerToken", or "sdkToken" options must be specified');
}
}
}
exports.ClientFactory = ClientFactory;
export declare const FUGLE_MARKETDATA_API_REST_BASE_URL = "https://api.fugle.tw/marketdata";
export declare const FUGLE_MARKETDATA_API_WEBSOCKET_BASE_URL = "wss://api.fugle.tw/marketdata";
export declare const FUGLE_MARKETDATA_API_VERSION = "v1.0";
export declare const CONNECT_EVENT = "connect";
export declare const DISCONNECT_EVENT = "disconnect";
export declare const MESSAGE_EVENT = "message";
export declare const ERROR_EVENT = "error";
export declare const AUTHENTICATED_EVENT = "authenticated";
export declare const UNAUTHENTICATED_EVENT = "unauthenticated";
export declare const UNAUTHENTICATED_MESSAGE = "Invalid authentication credentials";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UNAUTHENTICATED_MESSAGE = exports.UNAUTHENTICATED_EVENT = exports.AUTHENTICATED_EVENT = exports.ERROR_EVENT = exports.MESSAGE_EVENT = exports.DISCONNECT_EVENT = exports.CONNECT_EVENT = exports.FUGLE_MARKETDATA_API_VERSION = exports.FUGLE_MARKETDATA_API_WEBSOCKET_BASE_URL = exports.FUGLE_MARKETDATA_API_REST_BASE_URL = void 0;
exports.FUGLE_MARKETDATA_API_REST_BASE_URL = 'https://api.fugle.tw/marketdata';
exports.FUGLE_MARKETDATA_API_WEBSOCKET_BASE_URL = 'wss://api.fugle.tw/marketdata';
exports.FUGLE_MARKETDATA_API_VERSION = 'v1.0';
exports.CONNECT_EVENT = 'connect';
exports.DISCONNECT_EVENT = 'disconnect';
exports.MESSAGE_EVENT = 'message';
exports.ERROR_EVENT = 'error';
exports.AUTHENTICATED_EVENT = 'authenticated';
exports.UNAUTHENTICATED_EVENT = 'unauthenticated';
exports.UNAUTHENTICATED_MESSAGE = 'Invalid authentication credentials';
export { RestClientFactory as RestClient } from './rest';
export { WebSocketClientFactory as WebSocketClient } from './websocket';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebSocketClient = exports.RestClient = void 0;
var rest_1 = require("./rest");
Object.defineProperty(exports, "RestClient", { enumerable: true, get: function () { return rest_1.RestClientFactory; } });
var websocket_1 = require("./websocket");
Object.defineProperty(exports, "WebSocketClient", { enumerable: true, get: function () { return websocket_1.WebSocketClientFactory; } });
export type RestClientRequest = (endpoint: string, params: Record<string, any>) => Promise<any>;
export interface RestClientOptions {
baseUrl: string;
apiKey?: string;
bearerToken?: string;
sdkToken?: string;
}
export declare abstract class RestClient {
protected readonly options: RestClientOptions;
constructor(options: RestClientOptions);
protected request: (endpoint: string, params?: Record<string, any>) => Promise<any>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RestClient = void 0;
const fetch = require("isomorphic-fetch");
const queryString = require("query-string");
class RestClient {
constructor(options) {
this.options = options;
this.request = async (endpoint, params) => {
const url = queryString.stringifyUrl({ url: `${this.options.baseUrl}/${endpoint}`, query: params });
const headers = Object.assign({}, this.options.apiKey && { 'X-API-KEY': this.options.apiKey }, this.options.bearerToken && { Authorization: `Bearer ${this.options.bearerToken}` }, this.options.sdkToken && { 'X-SDK-TOKEN': this.options.sdkToken });
return fetch(url, { headers }).then(res => res.json());
};
}
}
exports.RestClient = RestClient;
import { RestStockClient } from './stock/client';
import { RestFutOptClient } from './futopt/client';
import { ClientFactory } from '../client-factory';
export declare class RestClientFactory extends ClientFactory {
private readonly clients;
get stock(): RestStockClient;
get futopt(): RestFutOptClient;
private getClient;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RestClientFactory = void 0;
const client_1 = require("./stock/client");
const client_2 = require("./futopt/client");
const client_factory_1 = require("../client-factory");
const constants_1 = require("../constants");
class RestClientFactory extends client_factory_1.ClientFactory {
constructor() {
super(...arguments);
this.clients = new Map();
}
get stock() {
return this.getClient('stock');
}
get futopt() {
return this.getClient('futopt');
}
getClient(type) {
let client = this.clients.get(type);
if (!client) {
const baseUrl = this.options.baseUrl || `${constants_1.FUGLE_MARKETDATA_API_REST_BASE_URL}/${constants_1.FUGLE_MARKETDATA_API_VERSION}`;
const url = `${baseUrl.replace(/\/+$/, '')}/${type}`;
/* istanbul ignore else */
if (type === 'stock') {
client = new client_1.RestStockClient(Object.assign(Object.assign({}, this.options), { baseUrl: url }));
}
else if (type === 'futopt') {
client = new client_2.RestFutOptClient(Object.assign(Object.assign({}, this.options), { baseUrl: url }));
}
else {
throw new TypeError('invalid client type');
}
this.clients.set(type, client);
}
return client;
}
}
exports.RestClientFactory = RestClientFactory;
import { RestClient } from '../client';
import { RestFutOptIntradayProductsParams } from './intraday/products';
import { RestFutOptIntradayTickersParams } from './intraday/tickers';
import { RestFutOptIntradayTickerParams } from './intraday/ticker';
import { RestFutOptIntradayQuoteParams } from './intraday/quote';
import { RestFutOptIntradayCandlesParams } from './intraday/candles';
import { RestFutOptIntradayTradesParams } from './intraday/trades';
import { RestFutOptIntradayVolumesParams } from './intraday/volumes';
import { RestFutOptHistoricalCandlesParams } from './historical/candles';
import { RestFutOptHistoricalDailyParams } from './historical/daily';
export declare class RestFutOptClient extends RestClient {
get intraday(): {
products: (params: RestFutOptIntradayProductsParams) => Promise<import("./intraday/products").RestFutOptIntradayProductsResponse>;
tickers: (params: RestFutOptIntradayTickersParams) => Promise<import("./intraday/tickers").RestFutOptIntradayTickersResponse>;
ticker: (params: RestFutOptIntradayTickerParams) => Promise<import("./intraday/ticker").RestFutOptIntradayTickerResponse>;
quote: (params: RestFutOptIntradayQuoteParams) => Promise<import("./intraday/quote").RestFutOptIntradayQuoteResponse>;
candles: (params: RestFutOptIntradayCandlesParams) => Promise<import("./intraday/candles").RestFutOptIntradayCandlesResponse>;
trades: (params: RestFutOptIntradayTradesParams) => Promise<import("./intraday/trades").RestFutOptIntradayTradesResponse>;
volumes: (params: RestFutOptIntradayVolumesParams) => Promise<import("./intraday/volumes").RestFutOptIntradayVolumesResponse>;
};
get historical(): {
candles: (params: RestFutOptHistoricalCandlesParams) => Promise<import("./historical/candles").RestFutOptHistoricalCandlesResponse>;
daily: (params: RestFutOptHistoricalDailyParams) => Promise<import("./historical/daily").RestFutOptHistoricalDailyResponse>;
};
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RestFutOptClient = void 0;
const client_1 = require("../client");
const products_1 = require("./intraday/products");
const tickers_1 = require("./intraday/tickers");
const ticker_1 = require("./intraday/ticker");
const quote_1 = require("./intraday/quote");
const candles_1 = require("./intraday/candles");
const trades_1 = require("./intraday/trades");
const volumes_1 = require("./intraday/volumes");
const candles_2 = require("./historical/candles");
const daily_1 = require("./historical/daily");
class RestFutOptClient extends client_1.RestClient {
get intraday() {
const request = this.request;
return {
products: (params) => (0, products_1.products)(request, params),
tickers: (params) => (0, tickers_1.tickers)(request, params),
ticker: (params) => (0, ticker_1.ticker)(request, params),
quote: (params) => (0, quote_1.quote)(request, params),
candles: (params) => (0, candles_1.candles)(request, params),
trades: (params) => (0, trades_1.trades)(request, params),
volumes: (params) => (0, volumes_1.volumes)(request, params),
};
}
get historical() {
const request = this.request;
return {
candles: (params) => (0, candles_2.candles)(request, params),
daily: (params) => (0, daily_1.daily)(request, params),
};
}
}
exports.RestFutOptClient = RestFutOptClient;
import { RestClientRequest } from "../../client";
export interface RestFutOptHistoricalCandlesParams {
symbol: string;
contractMonth?: string;
from?: string;
to?: string;
fields?: string;
timeframe?: string;
}
export interface RestFutOptHistoricalCandlesResponse {
symbol: string;
contractMonth?: string;
exchange: string;
timeframe: string;
data: Array<{
date: string;
open: number;
high: number;
low: number;
close: number;
volume: number;
turnover: number;
change: number;
}>;
}
export declare const candles: (request: RestClientRequest, params: RestFutOptHistoricalCandlesParams) => Promise<RestFutOptHistoricalCandlesResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.candles = void 0;
const candles = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`historical/candles/${symbol}`, options);
};
exports.candles = candles;
import { RestClientRequest } from "../../client";
export interface RestFutOptHistoricalDailyParams {
symbol: string;
date?: string;
afterhours?: boolean;
}
export interface RestFutOptHistoricalDailyResponse {
date: string;
symbol: string;
exchange: string;
session: string;
data: Array<{
contractMonth: string;
openPrice: number;
highPrice: number;
lowPrice: number;
closePrice: number;
change: number;
changePercent: number;
volume: number;
volumeSpread: number;
openInterest: number;
settlementPrice: number;
}>;
}
export declare const daily: (request: RestClientRequest, params: RestFutOptHistoricalDailyParams) => Promise<RestFutOptHistoricalDailyResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.daily = void 0;
const daily = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`historical/daily/${symbol}`, options);
};
exports.daily = daily;
import { RestClientRequest } from '../../client';
export interface RestFutOptIntradayCandlesParams {
symbol: string;
session?: 'afterhours';
timeframe?: '1' | '5' | '10' | '15' | '30' | '60';
}
export interface RestFutOptIntradayCandlesResponse {
date: string;
type: string;
exchange: string;
symbol: string;
timeframe: string;
data: Array<{
open: number;
high: number;
low: number;
close: number;
volume: number;
average: number;
time: number;
}>;
}
export declare const candles: (request: RestClientRequest, params: RestFutOptIntradayCandlesParams) => Promise<RestFutOptIntradayCandlesResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.candles = void 0;
const candles = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`intraday/candles/${symbol}`, options);
};
exports.candles = candles;
import { RestClientRequest } from '../../client';
export interface RestFutOptIntradayProductsParams {
type: 'FUTURE' | 'OPTION';
exchange?: 'TAIFEX';
session?: 'REGULAR' | 'AFTERHOURS';
contractType?: 'I' | 'R' | 'B' | 'C' | 'S' | 'E';
status?: 'N' | 'P' | 'U';
}
export interface RestFutOptIntradayProductsResponse {
date: string;
type: string;
session: string;
contractType: string;
status: string;
data: Array<{
type: string;
exchange: string;
symbol: string;
name: string;
underlyingSymbol: string;
contractType: string;
contractSize: number;
statusCode: string;
tradingCurrency: string;
quoteAcceptable: true;
startDate: string;
canBlockTrade: true;
expiryType: string;
underlyingType: string;
marketCloseGroup: number;
endSession: number;
}>;
}
export declare const products: (request: RestClientRequest, params: RestFutOptIntradayProductsParams) => Promise<RestFutOptIntradayProductsResponse>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.products = void 0;
const products = (request, params) => {
return request(`intraday/products`, params);
};
exports.products = products;
import { RestClientRequest } from '../../client';
export interface RestFutOptIntradayQuoteParams {
symbol: string;
session?: 'afterhours';
}
export interface RestFutOptIntradayQuoteResponse {
date: string;
type: string;
exchange: string;
symbol: string;
name: string;
previousClose: number;
openPrice: number;
openTime: number;
highPrice: number;
highTime: number;
lowPrice: number;
lowTime: number;
closePrice: number;
closeTime: number;
lastPrice: number;
lastSize: number;
avgPrice: number;
change: number;
changePercent: number;
amplitude: number;
bids: Array<{
price: number;
size: number;
}>;
asks: Array<{
price: number;
size: number;
}>;
total: {
tradeVolume: number;
totalBidMatch: number;
totalAskMatch: number;
};
lastTrade: {
price: number;
size: number;
time: number;
};
lastUpdated: number;
}
export declare const quote: (request: RestClientRequest, params: RestFutOptIntradayQuoteParams) => Promise<RestFutOptIntradayQuoteResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.quote = void 0;
const quote = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`intraday/quote/${symbol}`, options);
};
exports.quote = quote;
import { RestClientRequest } from '../../client';
export interface RestFutOptIntradayTickerParams {
symbol: string;
session?: 'afterhours';
}
export interface RestFutOptIntradayTickerResponse {
date: string;
type: string;
exchange: string;
symbol: string;
name: string;
referencePrice: number;
startDate: string;
endDate: string;
settlementDate: string;
}
export declare const ticker: (request: RestClientRequest, params: RestFutOptIntradayTickerParams) => Promise<RestFutOptIntradayTickerResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ticker = void 0;
const ticker = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`intraday/ticker/${symbol}`, options);
};
exports.ticker = ticker;
import { RestClientRequest } from '../../client';
export interface RestFutOptIntradayTickersParams {
type: 'FUTURE' | 'OPTION';
exchange?: 'TAIFEX';
session?: 'REGULAR' | 'AFTERHOURS';
product?: string;
contractType?: 'I' | 'R' | 'B' | 'C' | 'S' | 'E';
}
export interface RestFutOptIntradayTickersResponse {
type: string;
exchange: string;
session: string;
product?: string;
contractType?: string;
data: Array<{
type: string;
contractType: string;
symbol: string;
name: string;
referencePrice: number;
isDynamicBanding: boolean;
flowGroup: number;
startDate: string;
endDate: string;
settlementDate: string;
}>;
}
export declare const tickers: (request: RestClientRequest, params: RestFutOptIntradayTickersParams) => Promise<RestFutOptIntradayTickersResponse>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tickers = void 0;
const tickers = (request, params) => {
return request('intraday/tickers', params);
};
exports.tickers = tickers;
import { RestClientRequest } from '../../client';
export interface RestFutOptIntradayTradesParams {
symbol: string;
session?: 'afterhours';
offset?: number;
limit?: number;
}
export interface RestFutOptIntradayTradesResponse {
date: string;
type: string;
exchange: string;
symbol: string;
data: Array<{
price: number;
size: number;
time: number;
}>;
}
export declare const trades: (request: RestClientRequest, params: RestFutOptIntradayTradesParams) => Promise<RestFutOptIntradayTradesResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.trades = void 0;
const trades = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`intraday/trades/${symbol}`, options);
};
exports.trades = trades;
import { RestClientRequest } from '../../client';
export interface RestFutOptIntradayVolumesParams {
symbol: string;
session?: 'afterhours';
}
export interface RestFutOptIntradayVolumesResponse {
date: string;
type: string;
exchange: string;
symbol: string;
data: Array<{
price: number;
volume: number;
}>;
}
export declare const volumes: (request: RestClientRequest, params: RestFutOptIntradayVolumesParams) => Promise<RestFutOptIntradayVolumesResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.volumes = void 0;
const volumes = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`intraday/volumes/${symbol}`, options);
};
exports.volumes = volumes;
export * from './factory';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./factory"), exports);
import { RestClient } from '../client';
import { RestStockIntradayTickersParams } from './intraday/tickers';
import { RestStockIntradayTickerParams } from './intraday/ticker';
import { RestStockIntradayQuoteParams } from './intraday/quote';
import { RestStockIntradayCandlesParams } from './intraday/candles';
import { RestStockIntradayTradesParams } from './intraday/trades';
import { RestStockIntradayVolumesParams } from './intraday/volumes';
import { RestStockHistoricalCandlesParams } from './historical/candles';
import { RestStockHistoricalStatsParams } from './historical/stats';
import { RestStockSnapshotQuotesParams } from './snapshot/quotes';
import { RestStockSnapshotMoversParams } from './snapshot/movers';
import { RestStockSnapshotActivesParams } from './snapshot/actives';
import { RestStockTechnicalSmaParams } from './technical/sma';
import { RestStockTechnicalRsiParams } from './technical/rsi';
import { RestStockTechnicalKdjParams } from './technical/kdj';
import { RestStockTechnicalMacdParams } from './technical/macd';
import { RestStockTechnicalBbParams } from './technical/bb';
export declare class RestStockClient extends RestClient {
get intraday(): {
tickers: (params: RestStockIntradayTickersParams) => Promise<import("./intraday/tickers").RestStockIntradayTickersResponse>;
ticker: (params: RestStockIntradayTickerParams) => Promise<import("./intraday/ticker").RestStockIntradayTickerResponse>;
quote: (params: RestStockIntradayQuoteParams) => Promise<import("./intraday/quote").RestStockIntradayQuoteResponse>;
candles: (params: RestStockIntradayCandlesParams) => Promise<import("./intraday/candles").RestStockIntradayCandlesResponse>;
trades: (params: RestStockIntradayTradesParams) => Promise<import("./intraday/trades").RestStockIntradayTradesResponse>;
volumes: (params: RestStockIntradayVolumesParams) => Promise<import("./intraday/volumes").RestStockIntradayVolumesResponse>;
};
get historical(): {
candles: (params: RestStockHistoricalCandlesParams) => Promise<import("./historical/candles").RestStockHistoricalCandlesResponse>;
stats: (params: RestStockHistoricalStatsParams) => Promise<import("./historical/stats").RestStockHistoricalStatsResponse>;
};
get snapshot(): {
quotes: (params: RestStockSnapshotQuotesParams) => Promise<import("./snapshot/quotes").RestStockSnapshotQuotesResponse>;
movers: (params: RestStockSnapshotMoversParams) => Promise<import("./snapshot/movers").RestStockSnapshotMoversResponse>;
actives: (params: RestStockSnapshotActivesParams) => Promise<import("./snapshot/actives").RestStockSnapshotActivesResponse>;
};
get technical(): {
sma: (params: RestStockTechnicalSmaParams) => Promise<import("./technical/sma").RestStockTechnicalSmaResponse>;
rsi: (params: RestStockTechnicalRsiParams) => Promise<import("./technical/rsi").RestStockTechnicalRsiResponse>;
kdj: (params: RestStockTechnicalKdjParams) => Promise<import("./technical/kdj").RestStockTechnicalKdjResponse>;
macd: (params: RestStockTechnicalMacdParams) => Promise<import("./technical/macd").RestStockTechnicalMacdResponse>;
bb: (params: RestStockTechnicalBbParams) => Promise<import("./technical/bb").RestStockTechnicalBbResponse>;
};
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RestStockClient = void 0;
const client_1 = require("../client");
const tickers_1 = require("./intraday/tickers");
const ticker_1 = require("./intraday/ticker");
const quote_1 = require("./intraday/quote");
const candles_1 = require("./intraday/candles");
const trades_1 = require("./intraday/trades");
const volumes_1 = require("./intraday/volumes");
const candles_2 = require("./historical/candles");
const stats_1 = require("./historical/stats");
const quotes_1 = require("./snapshot/quotes");
const movers_1 = require("./snapshot/movers");
const actives_1 = require("./snapshot/actives");
const sma_1 = require("./technical/sma");
const rsi_1 = require("./technical/rsi");
const kdj_1 = require("./technical/kdj");
const macd_1 = require("./technical/macd");
const bb_1 = require("./technical/bb");
class RestStockClient extends client_1.RestClient {
get intraday() {
const request = this.request;
return {
tickers: (params) => (0, tickers_1.tickers)(request, params),
ticker: (params) => (0, ticker_1.ticker)(request, params),
quote: (params) => (0, quote_1.quote)(request, params),
candles: (params) => (0, candles_1.candles)(request, params),
trades: (params) => (0, trades_1.trades)(request, params),
volumes: (params) => (0, volumes_1.volumes)(request, params),
};
}
get historical() {
const request = this.request;
return {
candles: (params) => (0, candles_2.candles)(request, params),
stats: (params) => (0, stats_1.stats)(request, params),
};
}
get snapshot() {
const request = this.request;
return {
quotes: (params) => (0, quotes_1.quotes)(request, params),
movers: (params) => (0, movers_1.movers)(request, params),
actives: (params) => (0, actives_1.actives)(request, params),
};
}
get technical() {
const request = this.request;
return {
sma: (params) => (0, sma_1.sma)(request, params),
rsi: (params) => (0, rsi_1.rsi)(request, params),
kdj: (params) => (0, kdj_1.kdj)(request, params),
macd: (params) => (0, macd_1.macd)(request, params),
bb: (params) => (0, bb_1.bb)(request, params),
};
}
}
exports.RestStockClient = RestStockClient;
import { RestClientRequest } from '../../client';
export interface RestStockHistoricalCandlesParams {
symbol: string;
from?: string;
to?: string;
timeframe?: 'D' | 'W' | 'M' | '1' | '3' | '5' | '10' | '15' | '30' | '60';
fields?: string;
sort?: 'asc' | 'desc';
}
export interface RestStockHistoricalCandlesResponse {
symbol: string;
type: string;
exchange: string;
market: string;
timeframe: string;
data: Array<{
date: string;
open: number;
high: number;
low: number;
close: number;
volume: number;
turnover: number;
change: number;
}>;
}
export declare const candles: (request: RestClientRequest, params: RestStockHistoricalCandlesParams) => Promise<RestStockHistoricalCandlesResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.candles = void 0;
const candles = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`historical/candles/${symbol}`, options);
};
exports.candles = candles;
import { RestClientRequest } from '../../client';
export interface RestStockHistoricalStatsParams {
symbol: string;
}
export interface RestStockHistoricalStatsResponse {
date: string;
type: string;
exchange: string;
market: string;
symbol: string;
name: string;
openPrice: number;
highPrice: number;
lowPrice: number;
closePrice: number;
change: number;
changePercent: number;
tradeVolume: number;
tradeValue: number;
previousClose: number;
week52High: number;
week52Low: number;
}
export declare const stats: (request: RestClientRequest, params: RestStockHistoricalStatsParams) => Promise<RestStockHistoricalStatsResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.stats = void 0;
const stats = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`historical/stats/${symbol}`, options);
};
exports.stats = stats;
import { RestClientRequest } from '../../client';
export interface RestStockIntradayCandlesParams {
symbol: string;
type?: 'oddlot';
timeframe?: '1' | '5' | '10' | '15' | '30' | '60';
}
export interface RestStockIntradayCandlesResponse {
date: string;
type: string;
exchange: string;
market: string;
symbol: string;
timeframe: string;
data: Array<{
open: number;
high: number;
low: number;
close: number;
volume: number;
average: number;
time: number;
}>;
}
export declare const candles: (request: RestClientRequest, params: RestStockIntradayCandlesParams) => Promise<RestStockIntradayCandlesResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.candles = void 0;
const candles = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`intraday/candles/${symbol}`, options);
};
exports.candles = candles;
import { RestClientRequest } from '../../client';
export interface RestStockIntradayQuoteParams {
symbol: string;
type?: 'oddlot';
}
export interface RestStockIntradayQuoteResponse {
date: string;
type: string;
exchange: string;
market: string;
symbol: string;
name: string;
openPrice: number;
openTime: number;
highPrice: number;
highTime: number;
lowPrice: number;
lowTime: number;
closePrice: number;
closeTime: number;
lastPrice: number;
lastSize: number;
avgPrice: number;
change: number;
changePercent: number;
amplitude: number;
bids: Array<{
price: number;
size: number;
}>;
asks: Array<{
price: number;
size: number;
}>;
total: {
tradeValue: number;
tradeVolume: number;
tradeVolumeAtBid: number;
tradeVolumeAtAsk: number;
transaction: number;
time: number;
};
lastTrade: {
bid: number;
ask: number;
price: number;
size: number;
time: number;
};
lastTrial: {
bid: number;
ask: number;
price: number;
size: number;
time: number;
};
tradingHalt: {
isHalted: boolean;
time: number;
};
isLimitDownPrice: boolean;
isLimitUpPrice: boolean;
isLimitDownBid: boolean;
isLimitUpBid: boolean;
isLimitDownAsk: boolean;
isLimitUpAsk: boolean;
isLimitDownHalt: boolean;
isLimitUpHalt: boolean;
isTrial: boolean;
isDelayedOpen: boolean;
isDelayedClose: boolean;
isContinuous: boolean;
isOpen: boolean;
isClose: boolean;
lastUpdated: number;
}
export declare const quote: (request: RestClientRequest, params: RestStockIntradayQuoteParams) => Promise<RestStockIntradayQuoteResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.quote = void 0;
const quote = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`intraday/quote/${symbol}`, options);
};
exports.quote = quote;
import { RestClientRequest } from '../../client';
export interface RestStockIntradayTickerParams {
symbol: string;
type?: 'oddlot';
}
export interface RestStockIntradayTickerResponse {
date: string;
type: string;
exchange: string;
market: string;
symbol: string;
name: string;
nameEn: string;
industry: string;
securityType: string;
referencePrice: number;
limitUpPrice: number;
limitDownPrice: number;
canDayTrade: boolean;
canBuyDayTrade: boolean;
canBelowFlatMarginShortSell: boolean;
canBelowFlatSBLShortSell: boolean;
isAttention: boolean;
isDisposition: boolean;
isUnusuallyRecommended: boolean;
isSpecificAbnormally: boolean;
matchingInterval: number;
securityStatus: string;
boardLot: number;
tradingCurrency: string;
exercisePrice: number;
exercisedVolume: number;
cancelledVolume: number;
remainingVolume: number;
exerciseRatio: number;
capPrice: number;
floorPrice: number;
maturityDate: string;
previousClose: number;
openTime: string;
closeTime: string;
isNewlyCompiled: boolean;
}
export declare const ticker: (request: RestClientRequest, params: RestStockIntradayTickerParams) => Promise<RestStockIntradayTickerResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ticker = void 0;
const ticker = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`intraday/ticker/${symbol}`, options);
};
exports.ticker = ticker;
import { RestClientRequest } from '../../client';
export interface RestStockIntradayTickersParams {
type: string;
exchange?: string;
market?: string;
industry?: string;
isNormal?: boolean;
isAttention?: boolean;
isDisposition?: boolean;
isHalted?: boolean;
}
export interface RestStockIntradayTickersResponse {
date: string;
type: string;
exchange: string;
market?: string;
industry?: string;
isNormal?: boolean;
isAttention?: boolean;
isDisposition?: boolean;
isHalted?: boolean;
data: Array<{
symbol: string;
name: string;
}>;
}
export declare const tickers: (request: RestClientRequest, params: RestStockIntradayTickersParams) => Promise<RestStockIntradayTickersResponse>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tickers = void 0;
const tickers = (request, params) => {
return request('intraday/tickers', params);
};
exports.tickers = tickers;
import { RestClientRequest } from '../../client';
export interface RestStockIntradayTradesParams {
symbol: string;
type?: 'oddlot';
offset?: number;
limit?: number;
isTrial?: boolean;
}
export interface RestStockIntradayTradesResponse {
date: string;
type: string;
exchange: string;
market: string;
symbol: string;
data: Array<{
bid: number;
ask: number;
price: number;
size: number;
time: number;
}>;
}
export declare const trades: (request: RestClientRequest, params: RestStockIntradayTradesParams) => Promise<RestStockIntradayTradesResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.trades = void 0;
const trades = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`intraday/trades/${symbol}`, options);
};
exports.trades = trades;
import { RestClientRequest } from '../../client';
export interface RestStockIntradayVolumesParams {
symbol: string;
type?: 'oddlot';
}
export interface RestStockIntradayVolumesResponse {
date: string;
type: string;
exchange: string;
market: string;
symbol: string;
data: Array<{
price: number;
volume: number;
volumeAtBid: number;
volumeAtAsk: number;
}>;
}
export declare const volumes: (request: RestClientRequest, params: RestStockIntradayVolumesParams) => Promise<RestStockIntradayVolumesResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.volumes = void 0;
const volumes = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`intraday/volumes/${symbol}`, options);
};
exports.volumes = volumes;
import { RestClientRequest } from '../../client';
export interface RestStockSnapshotActivesParams {
market: 'TSE' | 'OTC' | 'ESB' | 'TIB' | 'PSB';
trade: 'volume' | 'value';
type?: 'ALL' | 'ALLBUT0999' | 'COMMONSTOCK';
}
export interface RestStockSnapshotActivesResponse {
date: string;
time: string;
market: string;
data: Array<{
type: string;
symbol: string;
name: string;
openPrice: number;
highPrice: number;
lowPrice: number;
closePrice: number;
change: number;
changePercent: number;
tradeVolume: number;
tradeValue: number;
lastUpdated: number;
}>;
}
export declare const actives: (request: RestClientRequest, params: RestStockSnapshotActivesParams) => Promise<RestStockSnapshotActivesResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.actives = void 0;
const actives = (request, params) => {
const { market } = params, options = __rest(params, ["market"]);
return request(`snapshot/actives/${market}`, options);
};
exports.actives = actives;
import { RestClientRequest } from '../../client';
export interface RestStockSnapshotMoversParams {
market: 'TSE' | 'OTC' | 'ESB' | 'TIB' | 'PSB';
direction: 'up' | 'down';
change: 'percent' | 'value';
type?: 'ALL' | 'ALLBUT0999' | 'COMMONSTOCK';
gt?: number;
gte?: number;
lt?: number;
lte?: number;
eq?: number;
}
export interface RestStockSnapshotMoversResponse {
date: string;
time: string;
market: string;
data: Array<{
type: string;
symbol: string;
name: string;
openPrice: number;
highPrice: number;
lowPrice: number;
closePrice: number;
change: number;
changePercent: number;
tradeVolume: number;
tradeValue: number;
lastUpdated: number;
}>;
}
export declare const movers: (request: RestClientRequest, params: RestStockSnapshotMoversParams) => Promise<RestStockSnapshotMoversResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.movers = void 0;
const movers = (request, params) => {
const { market } = params, options = __rest(params, ["market"]);
return request(`snapshot/movers/${market}`, options);
};
exports.movers = movers;
import { RestClientRequest } from '../../client';
export interface RestStockSnapshotQuotesParams {
market: 'TSE' | 'OTC' | 'ESB' | 'TIB' | 'PSB';
type?: 'ALL' | 'ALLBUT0999' | 'COMMONSTOCK';
}
export interface RestStockSnapshotQuotesResponse {
date: string;
time: string;
market: string;
data: Array<{
type: string;
symbol: string;
name: string;
openPrice: number;
highPrice: number;
lowPrice: number;
closePrice: number;
change: number;
changePercent: number;
tradeVolume: number;
tradeValue: number;
lastUpdated: number;
}>;
}
export declare const quotes: (request: RestClientRequest, params: RestStockSnapshotQuotesParams) => Promise<RestStockSnapshotQuotesResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.quotes = void 0;
const quotes = (request, params) => {
const { market } = params, options = __rest(params, ["market"]);
return request(`snapshot/quotes/${market}`, options);
};
exports.quotes = quotes;
import { RestClientRequest } from '../../client';
export interface RestStockTechnicalBbParams {
symbol: string;
from?: string;
to?: string;
timeframe?: 'D' | 'W' | 'M' | '1' | '3' | '5' | '10' | '15' | '30' | '60';
period: number;
}
export interface RestStockTechnicalBbResponse {
symbol: string;
type: string;
exchange: string;
market: string;
timeframe: string;
data: Array<{
date: string;
upper: number;
middle: number;
lower: number;
}>;
}
export declare const bb: (request: RestClientRequest, params: RestStockTechnicalBbParams) => Promise<RestStockTechnicalBbResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.bb = void 0;
const bb = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`technical/bb/${symbol}`, options);
};
exports.bb = bb;
import { RestClientRequest } from '../../client';
export interface RestStockTechnicalKdjParams {
symbol: string;
from?: string;
to?: string;
timeframe?: 'D' | 'W' | 'M' | '1' | '3' | '5' | '10' | '15' | '30' | '60';
rPeriod: number;
kPeriod: number;
dPeriod: number;
}
export interface RestStockTechnicalKdjResponse {
symbol: string;
type: string;
exchange: string;
market: string;
timeframe: string;
data: Array<{
date: string;
k: number;
d: number;
j: number;
}>;
}
export declare const kdj: (request: RestClientRequest, params: RestStockTechnicalKdjParams) => Promise<RestStockTechnicalKdjResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.kdj = void 0;
const kdj = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`technical/kdj/${symbol}`, options);
};
exports.kdj = kdj;
import { RestClientRequest } from '../../client';
export interface RestStockTechnicalMacdParams {
symbol: string;
from?: string;
to?: string;
timeframe?: 'D' | 'W' | 'M' | '1' | '3' | '5' | '10' | '15' | '30' | '60';
fast: number;
slow: number;
signal: number;
}
export interface RestStockTechnicalMacdResponse {
symbol: string;
type: string;
exchange: string;
market: string;
timeframe: string;
data: Array<{
date: string;
macdLine: number;
signalLine: number;
}>;
}
export declare const macd: (request: RestClientRequest, params: RestStockTechnicalMacdParams) => Promise<RestStockTechnicalMacdResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.macd = void 0;
const macd = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`technical/macd/${symbol}`, options);
};
exports.macd = macd;
import { RestClientRequest } from '../../client';
export interface RestStockTechnicalRsiParams {
symbol: string;
from?: string;
to?: string;
timeframe?: 'D' | 'W' | 'M' | '1' | '3' | '5' | '10' | '15' | '30' | '60';
period: number;
}
export interface RestStockTechnicalRsiResponse {
symbol: string;
type: string;
exchange: string;
market: string;
timeframe: string;
data: Array<{
date: string;
rsi: number;
}>;
}
export declare const rsi: (request: RestClientRequest, params: RestStockTechnicalRsiParams) => Promise<RestStockTechnicalRsiResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.rsi = void 0;
const rsi = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`technical/rsi/${symbol}`, options);
};
exports.rsi = rsi;
import { RestClientRequest } from '../../client';
export interface RestStockTechnicalSmaParams {
symbol: string;
from?: string;
to?: string;
timeframe?: 'D' | 'W' | 'M' | '1' | '3' | '5' | '10' | '15' | '30' | '60';
period: number;
}
export interface RestStockTechnicalSmaResponse {
symbol: string;
type: string;
exchange: string;
market: string;
timeframe: string;
data: Array<{
date: string;
sma: number;
}>;
}
export declare const sma: (request: RestClientRequest, params: RestStockTechnicalSmaParams) => Promise<RestStockTechnicalSmaResponse>;
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.sma = void 0;
const sma = (request, params) => {
const { symbol } = params, options = __rest(params, ["symbol"]);
return request(`technical/sma/${symbol}`, options);
};
exports.sma = sma;
/// <reference types="node" />
import * as events from 'events';
export interface WebSocketClientOptions {
url: string;
apiKey?: string;
bearerToken?: string;
sdkToken?: string;
}
export declare class WebSocketClient extends events.EventEmitter {
protected readonly options: WebSocketClientOptions;
private socket;
constructor(options: WebSocketClientOptions);
connect(): Promise<unknown>;
disconnect(): void;
subscribe(params: {
channel: string;
[key: string]: any;
}): void;
unsubscribe(params: {
id?: string;
ids?: string[];
}): void;
ping(params: {
state?: any;
}): void;
subscriptions(): void;
private authenticate;
private send;
private handleMessage;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebSocketClient = void 0;
const events = require("events");
const WebSocket = require("isomorphic-ws");
const constants_1 = require("../constants");
class WebSocketClient extends events.EventEmitter {
constructor(options) {
super();
this.options = options;
}
connect() {
this.socket = new WebSocket(this.options.url);
this.socket.onopen = () => this.emit(constants_1.CONNECT_EVENT);
this.socket.onmessage = event => this.emit(constants_1.MESSAGE_EVENT, event.data);
this.socket.onerror = event => this.emit(constants_1.ERROR_EVENT, event.error);
this.socket.onclose = event => this.emit(constants_1.DISCONNECT_EVENT, event);
this.on(constants_1.CONNECT_EVENT, () => this.authenticate());
this.on(constants_1.MESSAGE_EVENT, message => this.handleMessage(message));
return new Promise((resolve, reject) => {
this.on(constants_1.AUTHENTICATED_EVENT, (data) => resolve(data));
this.on(constants_1.UNAUTHENTICATED_EVENT, (data) => reject(data));
});
}
disconnect() {
this.socket.close();
}
subscribe(params) {
this.send({ event: 'subscribe', data: params });
}
unsubscribe(params) {
this.send({ event: 'unsubscribe', data: params });
}
ping(params) {
this.send({ event: 'ping', data: params });
}
subscriptions() {
this.send({ event: 'subscriptions' });
}
authenticate() {
if (this.options.apiKey) {
this.send({ event: 'auth', data: { apikey: this.options.apiKey } });
}
if (this.options.bearerToken) {
this.send({ event: 'auth', data: { token: this.options.bearerToken } });
}
if (this.options.sdkToken) {
this.send({ event: 'auth', data: { sdkToken: this.options.sdkToken } });
}
}
send(message) {
this.socket.send(JSON.stringify(message));
}
handleMessage(message) {
try {
const { event, data } = JSON.parse(message);
if (event === constants_1.AUTHENTICATED_EVENT) {
this.emit(constants_1.AUTHENTICATED_EVENT, data);
}
if (event === constants_1.ERROR_EVENT) {
if (data && data.message === constants_1.UNAUTHENTICATED_MESSAGE) {
this.emit(constants_1.UNAUTHENTICATED_EVENT, data);
}
}
}
catch (err) { }
}
}
exports.WebSocketClient = WebSocketClient;
import { WebSocketStockClient } from './stock/client';
import { WebSocketFutOptClient } from './futopt/client';
import { ClientFactory } from '../client-factory';
export declare class WebSocketClientFactory extends ClientFactory {
private readonly clients;
get stock(): WebSocketStockClient;
get futopt(): WebSocketFutOptClient;
private getClient;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebSocketClientFactory = void 0;
const client_1 = require("./stock/client");
const client_2 = require("./futopt/client");
const constants_1 = require("../constants");
const client_factory_1 = require("../client-factory");
class WebSocketClientFactory extends client_factory_1.ClientFactory {
constructor() {
super(...arguments);
this.clients = new Map();
}
get stock() {
return this.getClient('stock');
}
get futopt() {
return this.getClient('futopt');
}
getClient(type) {
let client = this.clients.get(type);
if (!client) {
const baseUrl = this.options.baseUrl || `${constants_1.FUGLE_MARKETDATA_API_WEBSOCKET_BASE_URL}/${constants_1.FUGLE_MARKETDATA_API_VERSION}`;
const url = `${baseUrl.replace(/\/+$/, '')}/${type}/streaming`;
/* istanbul ignore else */
if (type === 'stock') {
client = new client_1.WebSocketStockClient(Object.assign(Object.assign({}, this.options), { url }));
}
else if (type === 'futopt') {
client = new client_2.WebSocketFutOptClient(Object.assign(Object.assign({}, this.options), { url }));
}
else {
throw new TypeError('invalid client type');
}
this.clients.set(type, client);
}
return client;
}
}
exports.WebSocketClientFactory = WebSocketClientFactory;
import { WebSocketClient } from '../client';
export interface WebSocketFutOptSubscribeParams {
channel: 'trades' | 'books' | 'candles' | 'aggregates';
symbol?: string;
symbols?: string[];
afterHours?: boolean;
}
export interface WebSocketFutOptUnsubscribeParams {
id?: string;
ids?: string[];
}
export declare class WebSocketFutOptClient extends WebSocketClient {
subscribe(params: WebSocketFutOptSubscribeParams): void;
unsubscribe(params: WebSocketFutOptUnsubscribeParams): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebSocketFutOptClient = void 0;
const client_1 = require("../client");
class WebSocketFutOptClient extends client_1.WebSocketClient {
subscribe(params) {
super.subscribe(params);
}
unsubscribe(params) {
super.unsubscribe(params);
}
}
exports.WebSocketFutOptClient = WebSocketFutOptClient;
export * from './factory';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./factory"), exports);
import { WebSocketClient } from '../client';
export interface WebSocketStockSubscribeParams {
channel: 'trades' | 'books' | 'candles' | 'aggregates';
symbol?: string;
symbols?: string[];
intradayOddLot?: boolean;
}
export interface WebSocketStockUnsubscribeParams {
id?: string;
ids?: string[];
}
export declare class WebSocketStockClient extends WebSocketClient {
subscribe(params: WebSocketStockSubscribeParams): void;
unsubscribe(params: WebSocketStockUnsubscribeParams): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebSocketStockClient = void 0;
const client_1 = require("../client");
class WebSocketStockClient extends client_1.WebSocketClient {
subscribe(params) {
super.subscribe(params);
}
unsubscribe(params) {
super.unsubscribe(params);
}
}
exports.WebSocketStockClient = WebSocketStockClient;
+1
-1
{
"name": "@fugle/marketdata",
"version": "1.3.1",
"version": "1.3.2",
"description": "Fugle MarketData API client library for Node.js",

@@ -5,0 +5,0 @@ "main": "lib/index.js",