yahoo-finance2
Advanced tools
Comparing version 2.11.3 to 2.12.0
@@ -30,3 +30,3 @@ #!/usr/bin/env -S node --experimental-json-modules --experimental-vm-modules | ||
console.log( | ||
'$ yahoo-finance.js quoteSummary AAPL \'{"modules":["assetProfile", "secFilings"]}\'' | ||
'$ yahoo-finance.js quoteSummary AAPL \'{"modules":["assetProfile", "secFilings"]}\'', | ||
); | ||
@@ -33,0 +33,0 @@ console.log(); |
{ | ||
"name": "yahoo-finance2", | ||
"version": "2.11.3", | ||
"version": "2.12.0", | ||
"description": "JS API for Yahoo Finance", | ||
@@ -32,3 +32,3 @@ "type:": "commonjs", | ||
"engines": { | ||
"node": ">=16.0.0" | ||
"node": ">=18.0.0" | ||
}, | ||
@@ -41,11 +41,7 @@ "bin": { | ||
"lint": "eslint . --ext .js,.ts", | ||
"//schema": "ts-json-schema-generator -f tsconfig.json -p 'src/{modules/**/*.ts,lib/options.ts}' -t '*' | node bin/schema-tweak.js > schema.json", | ||
"schema": "node --loader ts-node/esm scripts/schema.js > schema.json", | ||
"timeseries": "node --loader ts-node/esm scripts/timeseries.js", | ||
"build": "yarn run build:esm && yarn run build:cjs && yarn run build:post", | ||
"build:esm": "tsc --module es2020 --target es2019 --outDir dist/esm", | ||
"build": "yarn run build:esm && yarn run build:cjs", | ||
"build:esm": "tsc --module esnext --target es2019 --outDir dist/esm", | ||
"build:cjs": "tsc --module commonjs --target es2015 --outDir dist/cjs && sed 's/\"type\": \"module\",/\"type:\": \"commonjs\",/' dist/cjs/package.json > dist/cjs/package-changed.json && mv dist/cjs/package-changed.json dist/cjs/package.json", | ||
"build:post": "scripts/json-transform.sh", | ||
"generateSchema": "yarn schema", | ||
"prepublishOnly": "yarn build && yarn generateSchema && yarn build:post", | ||
"prepublishOnly": "yarn build", | ||
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js", | ||
@@ -59,9 +55,7 @@ "test:ts": "tsc --noEmit", | ||
"files": [ | ||
"dist", | ||
"schema.json" | ||
"dist" | ||
], | ||
"dependencies": { | ||
"@sinclair/typebox": "^0.32.27", | ||
"@types/tough-cookie": "^4.0.2", | ||
"ajv": "8.10.0", | ||
"ajv-formats": "2.1.1", | ||
"node-fetch": "^2.6.1", | ||
@@ -78,2 +72,5 @@ "tough-cookie": "^4.1.2", | ||
"@semantic-release/release-notes-generator": "10.0.3", | ||
"@swc/core": "^1.7.26", | ||
"@swc/helpers": "^0.5.13", | ||
"@swc/jest": "^0.2.36", | ||
"@tsconfig/node12": "12.1.3", | ||
@@ -86,11 +83,8 @@ "@types/har-format": "^1.2.15", | ||
"eslint": "8.57.0", | ||
"eslint-config-prettier": "8.10.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"globby": "13.2.2", | ||
"jest": "29.7.0", | ||
"jest-tobetype": "1.2.3", | ||
"oas-schema-walker": "1.1.5", | ||
"prettier": "2.8.8", | ||
"prettier": "^3.3.3", | ||
"semantic-release": "19.0.5", | ||
"ts-jest": "29.1.2", | ||
"ts-json-schema-generator": "1.5.0", | ||
"ts-node": "10.9.2", | ||
@@ -97,0 +91,0 @@ "typescript": "5.4.3" |
import yahooFinanceFetch from "./lib/yahooFinanceFetch.js"; | ||
import setGlobalConfig from "./lib/setGlobalConfig.js"; | ||
import moduleExec from "./lib/moduleExec.js"; | ||
import setGlobalConfig from "./lib/setGlobalConfig.js"; | ||
import { disallowAdditionalProps } from "./lib/validateAndCoerceTypes.js"; | ||
import { suppressNotices } from "./lib/notices.js"; | ||
import autoc from "./modules/autoc.js"; | ||
@@ -24,3 +24,2 @@ import chart from "./modules/chart.js"; | ||
_opts: import("./lib/options.js").YahooFinanceOptions; | ||
_disallowAdditionalProps: typeof disallowAdditionalProps; | ||
errors: { | ||
@@ -30,2 +29,3 @@ [key: string]: any; | ||
setGlobalConfig: typeof setGlobalConfig; | ||
suppressNotices: typeof suppressNotices; | ||
autoc: typeof autoc; | ||
@@ -32,0 +32,0 @@ chart: typeof chart; |
@@ -31,7 +31,7 @@ "use strict"; | ||
const yahooFinanceFetch_js_1 = __importDefault(require("./lib/yahooFinanceFetch.js")); | ||
const moduleExec_js_1 = __importDefault(require("./lib/moduleExec.js")); | ||
const options_js_1 = __importDefault(require("./lib/options.js")); | ||
const errors_js_1 = __importDefault(require("./lib/errors.js")); | ||
const setGlobalConfig_js_1 = __importDefault(require("./lib/setGlobalConfig.js")); | ||
const validateAndCoerceTypes_js_1 = require("./lib/validateAndCoerceTypes.js"); | ||
const moduleExec_js_1 = __importDefault(require("./lib/moduleExec.js")); | ||
const notices_js_1 = require("./lib/notices.js"); | ||
// modules | ||
@@ -59,6 +59,6 @@ const autoc_js_1 = __importDefault(require("./modules/autoc.js")); | ||
_opts: options_js_1.default, | ||
_disallowAdditionalProps: validateAndCoerceTypes_js_1.disallowAdditionalProps, | ||
// common | ||
errors: errors_js_1.default, | ||
setGlobalConfig: setGlobalConfig_js_1.default, | ||
suppressNotices: notices_js_1.suppressNotices, | ||
// modules, | ||
@@ -65,0 +65,0 @@ autoc: autoc_js_1.default, |
@@ -1,5 +0,6 @@ | ||
import type { ErrorObject } from "ajv/dist/types"; | ||
import { TransformDecodeError, TransformDecodeCheckError } from "@sinclair/typebox/build/cjs/value"; | ||
export declare class BadRequestError extends Error { | ||
name: string; | ||
} | ||
type ValidationError = TransformDecodeError | TransformDecodeCheckError; | ||
export declare class HTTPError extends Error { | ||
@@ -17,6 +18,6 @@ name: string; | ||
result: any; | ||
errors?: null | ErrorObject[]; | ||
errors?: null | ValidationError[]; | ||
constructor(message: string, { result, errors }: { | ||
result: any; | ||
errors?: null | ErrorObject[]; | ||
errors?: null | ValidationError[]; | ||
}); | ||
@@ -23,0 +24,0 @@ } |
@@ -16,4 +16,7 @@ "use strict"; | ||
exports.getCrumbClear = exports._getCrumb = void 0; | ||
const package_json_1 = __importDefault(require("../../package.json.js")); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: we have to ignore this for csm output. | ||
const package_json_1 = __importDefault(require("../../package.json")); | ||
const tough_cookie_1 = require("tough-cookie"); | ||
const notices_js_1 = require("./notices.js"); | ||
const CONFIG_FAKE_URL = "http://config.yf2/"; | ||
@@ -193,10 +196,4 @@ let crumb = null; | ||
exports.getCrumbClear = getCrumbClear; | ||
let shownYahooSurvey = false; | ||
function getCrumb(cookieJar, fetch, fetchOptionsBase, logger, url = "https://finance.yahoo.com/quote/AAPL", __getCrumb = _getCrumb) { | ||
if (!shownYahooSurvey) { | ||
logger.info("Please consider completing the survey at https://bit.ly/yahoo-finance-api-feedback " + | ||
"if you haven't already; for more info see " + | ||
"https://github.com/gadicc/node-yahoo-finance2/issues/764#issuecomment-2056623851."); | ||
shownYahooSurvey = true; | ||
} | ||
(0, notices_js_1.showNotice)("yahooSurvey"); | ||
if (!promise) | ||
@@ -203,0 +200,0 @@ promise = __getCrumb(cookieJar, fetch, fetchOptionsBase, logger, url); |
@@ -0,1 +1,2 @@ | ||
import moduleExec from "./moduleExec"; | ||
export interface ModuleOptions { | ||
@@ -14,3 +15,3 @@ validateResult?: boolean; | ||
[key: string]: any; | ||
_moduleExec: any; | ||
_moduleExec: typeof moduleExec; | ||
} |
"use strict"; | ||
//import ModuleExec from "./moduleExec.js"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -1,3 +0,3 @@ | ||
type TransformFunc = (arg: any) => any; | ||
interface ModuleExecOptions { | ||
import { TSchema } from "@sinclair/typebox"; | ||
interface ModuleExecOptions<TOpts, TResult> { | ||
/** | ||
@@ -19,6 +19,5 @@ * Name of the module, e.g. "search", "quoteSummary", etc. Used in error | ||
/** | ||
* Key of schema used to validate user-provider query options. | ||
* e.g. yf.search('AAPL', { isThisAValidOption: "maybe" }) | ||
* The schema to use to validate the options overrides | ||
*/ | ||
schemaKey: string; | ||
schema: TSchema; | ||
/** | ||
@@ -45,3 +44,3 @@ * Defaults for this query, e.g. { period: '1d' } in history, | ||
*/ | ||
transformWith?: TransformFunc; | ||
transformWith?: (opts: TOpts) => unknown; | ||
/** | ||
@@ -54,9 +53,9 @@ * Default: 'json'. Can be 'text' or 'csv' (augments fetch's "text"). | ||
*/ | ||
needsCrumb: boolean; | ||
needsCrumb?: boolean; | ||
}; | ||
result: { | ||
/** | ||
* Key of schema to validate (and coerce) the retruned result from Yahoo. | ||
* The schema to validate (and coerce) the retruned result from Yahoo. | ||
*/ | ||
schemaKey: string; | ||
schema: TSchema; | ||
/** | ||
@@ -66,3 +65,3 @@ * Mutate the Yahoo result *before* validating and coercion. Mostly used | ||
*/ | ||
transformWith?: TransformFunc; | ||
transformWith?: (result: unknown) => TResult; | ||
}; | ||
@@ -80,7 +79,5 @@ moduleOptions?: { | ||
} | ||
type ThisWithModExec = { | ||
declare function moduleExec<TOpts = unknown, TResult = unknown>(this: { | ||
[key: string]: any; | ||
_moduleExec: typeof moduleExec; | ||
}; | ||
declare function moduleExec(this: ThisWithModExec, opts: ModuleExecOptions): Promise<any>; | ||
}, opts: ModuleExecOptions<TOpts, TResult>): Promise<any>; | ||
export default moduleExec; |
@@ -31,7 +31,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const validateAndCoerceTypes_js_1 = __importDefault(require("./validateAndCoerceTypes.js")); | ||
const validateAndCoerceTypes_js_1 = require("./validateAndCoerceTypes.js"); | ||
const csv2json_js_1 = __importDefault(require("./csv2json.js")); | ||
function moduleExec(opts) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
var _a, _b; | ||
const queryOpts = opts.query; | ||
@@ -48,7 +48,6 @@ const moduleOpts = opts.moduleOptions; | ||
// Check that query options passed by the user are valid for this module | ||
(0, validateAndCoerceTypes_js_1.default)({ | ||
source: moduleName, | ||
(0, validateAndCoerceTypes_js_1.validateAndCoerceTypebox)({ | ||
type: "options", | ||
object: (_a = queryOpts.overrides) !== null && _a !== void 0 ? _a : {}, | ||
schemaKey: queryOpts.schemaKey, | ||
data: (_a = queryOpts.overrides) !== null && _a !== void 0 ? _a : {}, | ||
schema: queryOpts.schema, | ||
options: this._opts.validation, | ||
@@ -62,14 +61,17 @@ }); | ||
*/ | ||
if (queryOpts.transformWith) | ||
if (queryOpts.transformWith) { | ||
queryOptions = queryOpts.transformWith(queryOptions); | ||
} | ||
// this._fetch is lib/yahooFinanceFetch | ||
let result = yield this._fetch(queryOpts.url, queryOptions, moduleOpts, queryOpts.fetchType, queryOpts.needsCrumb); | ||
if (queryOpts.fetchType === "csv") | ||
let result = yield this._fetch(queryOpts.url, queryOptions, moduleOpts, queryOpts.fetchType, (_b = queryOpts.needsCrumb) !== null && _b !== void 0 ? _b : false); | ||
if (queryOpts.fetchType === "csv") { | ||
result = (0, csv2json_js_1.default)(result); | ||
} | ||
/* | ||
* Mutate the Yahoo result *before* validating and coercion. Mostly used | ||
* to e.g. throw if no (resault.returnField) and return result.returnField. | ||
* to e.g. throw if no (result.returnField) and return result.returnField. | ||
*/ | ||
if (opts.result.transformWith) | ||
result = opts.result.transformWith(result); | ||
if (resultOpts.transformWith) { | ||
result = resultOpts.transformWith(result); | ||
} | ||
const validateResult = !moduleOpts || | ||
@@ -99,7 +101,6 @@ moduleOpts.validateResult === undefined || | ||
try { | ||
(0, validateAndCoerceTypes_js_1.default)({ | ||
source: moduleName, | ||
(0, validateAndCoerceTypes_js_1.validateAndCoerceTypebox)({ | ||
type: "result", | ||
object: result, | ||
schemaKey: resultOpts.schemaKey, | ||
data: result, | ||
schema: resultOpts.schema, | ||
options: validationOpts, | ||
@@ -106,0 +107,0 @@ }); |
@@ -1,5 +0,4 @@ | ||
import type { ValidationOptions } from "./validateAndCoerceTypes.js"; | ||
import type { QueueOptions } from "./queue.js"; | ||
import { ExtendedCookieJar } from "./cookieJar.js"; | ||
export interface Logger { | ||
import { Static } from "@sinclair/typebox"; | ||
export type Logger = { | ||
info: (...args: any[]) => void; | ||
@@ -9,11 +8,33 @@ warn: (...args: any[]) => void; | ||
debug: (...args: any[]) => void; | ||
} | ||
export interface YahooFinanceOptions { | ||
YF_QUERY_HOST?: string; | ||
cookieJar?: ExtendedCookieJar; | ||
queue?: QueueOptions; | ||
validation?: ValidationOptions; | ||
}; | ||
declare const ValidationOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
logErrors: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
logOptionsErrors: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
_internalThrowOnAdditionalProperties: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>; | ||
export type ValidationOptions = Static<typeof ValidationOptionsSchema>; | ||
export declare const YahooFinanceOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
YF_QUERY_HOST: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
cookieJar: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
queue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
concurrency: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>; | ||
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>; | ||
}>>; | ||
validation: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
logErrors: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
logOptionsErrors: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
_internalThrowOnAdditionalProperties: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>>; | ||
logger: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
info: import("@sinclair/typebox").TFunction<[], import("@sinclair/typebox").TVoid>; | ||
warn: import("@sinclair/typebox").TFunction<[], import("@sinclair/typebox").TVoid>; | ||
error: import("@sinclair/typebox").TFunction<[], import("@sinclair/typebox").TVoid>; | ||
debug: import("@sinclair/typebox").TFunction<[], import("@sinclair/typebox").TVoid>; | ||
}>>; | ||
}>; | ||
export type YahooFinanceOptions = Static<typeof YahooFinanceOptionsSchema> & { | ||
cookieJar: ExtendedCookieJar; | ||
logger?: Logger; | ||
} | ||
}; | ||
declare const options: YahooFinanceOptions; | ||
export default options; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.YahooFinanceOptionsSchema = void 0; | ||
const cookieJar_js_1 = require("./cookieJar.js"); | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const queue_js_1 = require("./queue.js"); | ||
const LoggerSchema = typebox_1.Type.Object({ | ||
info: typebox_1.Type.Function([], typebox_1.Type.Void()), | ||
warn: typebox_1.Type.Function([], typebox_1.Type.Void()), | ||
error: typebox_1.Type.Function([], typebox_1.Type.Void()), | ||
debug: typebox_1.Type.Function([], typebox_1.Type.Void()), | ||
}); | ||
const ValidationOptionsSchema = typebox_1.Type.Object({ | ||
logErrors: typebox_1.Type.Optional(typebox_1.Type.Boolean()), | ||
logOptionsErrors: typebox_1.Type.Optional(typebox_1.Type.Boolean()), | ||
_internalThrowOnAdditionalProperties: typebox_1.Type.Optional(typebox_1.Type.Boolean({ | ||
default: process.env.NODE_ENV === "test", | ||
description: "Use this property to throw when properties beyond what is explicitly specified in the schema are provided. It is an internal option and subject to change, use at your own risk", | ||
})), | ||
}); | ||
exports.YahooFinanceOptionsSchema = typebox_1.Type.Object({ | ||
YF_QUERY_HOST: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
cookieJar: typebox_1.Type.Optional(typebox_1.Type.Any()), | ||
queue: typebox_1.Type.Optional(queue_js_1.QueueOptionsSchema), | ||
validation: typebox_1.Type.Optional(ValidationOptionsSchema), | ||
logger: typebox_1.Type.Optional(LoggerSchema), | ||
}, { title: "YahooFinanceOptions" }); | ||
const options = { | ||
@@ -5,0 +29,0 @@ YF_QUERY_HOST: process.env.YF_QUERY_HOST || "query2.finance.yahoo.com", |
@@ -0,1 +1,2 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
interface Job { | ||
@@ -6,6 +7,7 @@ func: () => Promise<void>; | ||
} | ||
export interface QueueOptions { | ||
concurrency?: number; | ||
timeout?: number; | ||
} | ||
export declare const QueueOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
concurrency: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>; | ||
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>; | ||
}>; | ||
export type QueueOptions = Static<typeof QueueOptionsSchema>; | ||
export default class Queue { | ||
@@ -12,0 +14,0 @@ concurrency: number; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.QueueOptionsSchema = void 0; | ||
const typebox_1 = require("@sinclair/typebox"); | ||
exports.QueueOptionsSchema = typebox_1.Type.Object({ | ||
// TODO: adds func type to json schema which is not supported | ||
//_queue?: Queue; | ||
concurrency: typebox_1.Type.Optional(typebox_1.Type.Number()), | ||
timeout: typebox_1.Type.Optional(typebox_1.Type.Number()), // TODO | ||
}, { | ||
additionalProperties: false, | ||
title: "QueueOptions", | ||
}); | ||
class Queue { | ||
@@ -4,0 +15,0 @@ constructor(opts = {}) { |
@@ -1,3 +0,3 @@ | ||
import type { YahooFinanceOptions } from "./options.js"; | ||
import { type YahooFinanceOptions } from "./options.js"; | ||
import type { ModuleThis } from "./moduleCommon.js"; | ||
export default function setGlobalConfig(this: ModuleThis, _config: YahooFinanceOptions): void; |
@@ -17,14 +17,14 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const options_js_1 = require("./options.js"); | ||
const validateAndCoerceTypes_js_1 = __importDefault(require("./validateAndCoerceTypes.js")); | ||
const cookieJar_js_1 = require("./cookieJar.js"); | ||
function setGlobalConfig(_config) { | ||
// Instances (e.g. cookieJar) don't validate well :) | ||
const { cookieJar, logger } = _config, config = __rest(_config, ["cookieJar", "logger"]); | ||
(0, validateAndCoerceTypes_js_1.default)({ | ||
object: config, | ||
source: "setGlobalConfig", | ||
const parsed = (0, validateAndCoerceTypes_js_1.default)({ | ||
data: _config, | ||
type: "options", | ||
options: this._opts.validation, | ||
schemaKey: "#/definitions/YahooFinanceOptions", | ||
schema: options_js_1.YahooFinanceOptionsSchema, | ||
}); | ||
// Instances (e.g. cookieJar) don't validate well :) | ||
const { cookieJar } = parsed, config = __rest(parsed, ["cookieJar"]); | ||
mergeObjects(this._opts, config); | ||
@@ -36,13 +36,2 @@ if (cookieJar) { | ||
} | ||
if (logger) { | ||
if (typeof logger.info !== "function") | ||
throw new Error("logger.info must be a function"); | ||
if (typeof logger.warn !== "function") | ||
throw new Error("logger.warn must be a function"); | ||
if (typeof logger.error !== "function") | ||
throw new Error("logger.error must be a function"); | ||
if (typeof logger.debug !== "function") | ||
throw new Error("logger.debug must be a function"); | ||
this._opts.logger = logger; | ||
} | ||
} | ||
@@ -49,0 +38,0 @@ exports.default = setGlobalConfig; |
@@ -1,18 +0,9 @@ | ||
import Ajv from "ajv"; | ||
export declare const ajv: Ajv; | ||
export declare function resolvePath(obj: any, instancePath: string): any; | ||
export interface ValidationOptions { | ||
logErrors?: boolean; | ||
logOptionsErrors?: boolean; | ||
} | ||
export interface ValidateParams { | ||
source: string; | ||
type: "options" | "result"; | ||
object: object; | ||
schemaKey: string; | ||
import { StaticDecode, type TSchema } from "@sinclair/typebox"; | ||
import { ValidationOptions } from "./options"; | ||
export declare const validateAndCoerceTypebox: <T extends TSchema>({ type, data, schema, options, }: { | ||
type?: "result" | "options" | undefined; | ||
data: unknown; | ||
schema: T; | ||
options: ValidationOptions; | ||
} | ||
declare function disallowAdditionalProps(show?: boolean): void; | ||
declare function validate({ source, type, object, schemaKey, options, }: ValidateParams): void; | ||
export { disallowAdditionalProps }; | ||
export default validate; | ||
}) => StaticDecode<T>; | ||
export default validateAndCoerceTypebox; |
@@ -5,314 +5,71 @@ "use strict"; | ||
}; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.disallowAdditionalProps = exports.resolvePath = exports.ajv = void 0; | ||
const ajv_1 = __importDefault(require("ajv")); | ||
const ajv_formats_1 = __importDefault(require("ajv-formats")); | ||
//import schema from '../../schema.json'; | ||
const schema_json_1 = __importDefault(require("../../schema.json.js")); | ||
const package_json_1 = __importDefault(require("../../package.json.js")); | ||
exports.validateAndCoerceTypebox = void 0; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: we have to ignore this for csm output. | ||
const package_json_1 = __importDefault(require("../../package.json")); | ||
const errors_js_1 = require("./errors.js"); | ||
// https://ajv.js.org/docs/api.html#options | ||
exports.ajv = new ajv_1.default({ | ||
// All rules, all errors. Don't end early after first error. | ||
allErrors: true, | ||
// Allow multiple non-null types, like in TypeSript. | ||
allowUnionTypes: true, | ||
}); | ||
(0, ajv_formats_1.default)(exports.ajv); | ||
exports.ajv.addKeyword({ | ||
keyword: "yahooFinanceType", | ||
modifying: true, | ||
errors: true, | ||
schema: true, | ||
compile(schema /*, parentSchema, it */) { | ||
const validate = (data, dataCtx) => { | ||
const { parentData, parentDataProperty } = dataCtx; | ||
function set(value) { | ||
parentData[parentDataProperty] = value; | ||
return true; | ||
} | ||
if (schema === "number" || schema === "number|null") { | ||
if (typeof data === "number") | ||
return true; | ||
if (typeof data === "string") { | ||
let float = Number.parseFloat(data); | ||
if (Number.isNaN(float)) { | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "Number.parseFloat returned NaN", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
} | ||
return set(float); | ||
} | ||
if (data === null) { | ||
if (schema === "number|null") { | ||
return true; | ||
} | ||
else { | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "Expecting number'ish but got null", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
} | ||
} | ||
if (typeof data === "object") { | ||
if (Object.keys(data).length === 0) { | ||
// Value of {} becomes null | ||
// Note, TypeScript types should be "number | null" | ||
if (schema === "number|null") { | ||
return set(null); | ||
} | ||
else { | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "Got {}->null for 'number', did you want 'number | null' ?", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
} | ||
} | ||
if (typeof data.raw === "number") | ||
return set(data.raw); | ||
} | ||
} | ||
else if (schema === "date" || schema === "date|null") { | ||
if (data instanceof Date) { | ||
// Validate existing date objects. | ||
// Generally we receive JSON but in the case of "historical", the | ||
// csv parser does the date conversion, and we want to validate | ||
// afterwards. | ||
return true; | ||
} | ||
if (typeof data === "number") | ||
return set(new Date(data * 1000)); | ||
if (data === null) { | ||
if (schema === "date|null") { | ||
return true; | ||
} | ||
else { | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "Expecting date'ish but got null", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
} | ||
} | ||
if (typeof data === "object") { | ||
if (Object.keys(data).length === 0) { | ||
// Value of {} becomes null | ||
// Note, TypeScript types should be "data | null" | ||
if (schema === "date|null") { | ||
return set(null); | ||
} | ||
else { | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "Got {}->null for 'date', did you want 'date | null' ?", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
} | ||
} | ||
if (typeof data.raw === "number") | ||
return set(new Date(data.raw * 1000)); | ||
} | ||
if (typeof data === "string") { | ||
if (data.match(/^\d{4,4}-\d{2,2}-\d{2,2}$/) || | ||
data.match(/^\d{4,4}-\d{2,2}-\d{2,2}T\d{2,2}:\d{2,2}:\d{2,2}(\.\d{3,3})?Z$/)) | ||
return set(new Date(data)); | ||
} | ||
} | ||
else if (schema === "DateInMs") { | ||
return set(new Date(data)); | ||
} | ||
else if (schema === "TwoNumberRange") { | ||
if (typeof data === "object" && | ||
typeof data.low === "number" && | ||
typeof data.high === "number") | ||
return true; | ||
if (typeof data === "string") { | ||
const parts = data.split("-").map(parseFloat); | ||
if (Number.isNaN(parts[0]) || Number.isNaN(parts[1])) { | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "Number.parseFloat returned NaN: [" + parts.join(",") + "]", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
} | ||
return set({ low: parts[0], high: parts[1] }); | ||
} | ||
} | ||
else { | ||
throw new Error("No such yahooFinanceType: " + schema); | ||
} | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "No matching type", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
}; | ||
return validate; | ||
}, | ||
}); | ||
exports.ajv.addSchema(schema_json_1.default); | ||
/* istanbul ignore next */ | ||
const logObj = typeof process !== "undefined" && ((_a = process === null || process === void 0 ? void 0 : process.stdout) === null || _a === void 0 ? void 0 : _a.isTTY) | ||
? (obj) => console.dir(obj, { depth: 4, colors: true }) | ||
: (obj) => console.log(JSON.stringify(obj, null, 2)); | ||
function resolvePath(obj, instancePath) { | ||
const path = instancePath.split("/"); | ||
let ref = obj; | ||
for (let i = 1; i < path.length; i++) | ||
ref = ref[path[i]]; | ||
return ref; | ||
} | ||
exports.resolvePath = resolvePath; | ||
function disallowAdditionalProps(show = false) { | ||
const disallowed = new Set(); | ||
// @ts-ignore: this can cause a breaking catch-22 on schema generation | ||
for (let key of Object.keys(schema_json_1.default.definitions)) { | ||
if (key.match(/Options$/)) { | ||
continue; | ||
} | ||
// @ts-ignore | ||
const def = schema_json_1.default.definitions[key]; | ||
if (def.type === "object" && def.additionalProperties === undefined) { | ||
def.additionalProperties = false; | ||
disallowed.add(key); | ||
} | ||
const value_1 = require("@sinclair/typebox/value"); | ||
const handleResultError = (e, options) => { | ||
const title = e.schema.title; | ||
if (options.logErrors) { | ||
console.log(JSON.stringify(e, null, 2)); | ||
console.log(` | ||
This may happen intermittently and you should catch errors appropriately. | ||
However: 1) if this recently started happening on every request for a symbol | ||
that used to work, Yahoo may have changed their API. 2) If this happens on | ||
every request for a symbol you've never used before, but not for other | ||
symbols, you've found an edge-case (OR, we may just be protecting you from | ||
"bad" data sometimes stored for e.g. misspelt symbols on Yahoo's side). | ||
Please see if anyone has reported this previously: | ||
${package_json_1.default.repository}/issues?q=is%3Aissue+${title} | ||
or open a new issue (and mention the symbol): ${package_json_1.default.name} v${package_json_1.default.version} | ||
${package_json_1.default.repository}/issues/new?labels=bug%2C+validation&template=validation.md&title=${title} | ||
For information on how to turn off the above logging or skip these errors, | ||
see https://github.com/gadicc/node-yahoo-finance2/tree/devel/docs/validation.md. | ||
At the end of the doc, there's also a section on how to | ||
[Help Fix Validation Errors](https://github.com/gadicc/node-yahoo-finance2/blob/devel/docs/validation.md#help-fix) | ||
in case you'd like to contribute to the project. Most of the time, these | ||
fixes are very quick and easy; it's just hard for our small core team to keep up, | ||
so help is always appreciated! | ||
`); | ||
} | ||
/* istanbul ignore next */ | ||
if (show) | ||
console.log("Disallowed additional props in " + Array.from(disallowed).join(", ")); | ||
} | ||
exports.disallowAdditionalProps = disallowAdditionalProps; | ||
if (process.env.NODE_ENV === "test") | ||
disallowAdditionalProps(); | ||
function validate({ source, type, object, schemaKey, options, }) { | ||
const validator = exports.ajv.getSchema(schemaKey); | ||
if (!validator) | ||
throw new Error("No such schema with key: " + schemaKey); | ||
const valid = validator(object); | ||
if (valid) | ||
return; | ||
if (type === "result") { | ||
/* istanbul ignore else */ | ||
if (validator.errors) { | ||
let origData = false; | ||
validator.errors.forEach((error) => { | ||
// For now let's ignore the base object which could be huge. | ||
/* istanbul ignore else */ | ||
if (error.instancePath !== "") | ||
// Note, not the regular ajv data value from verbose:true | ||
error.data = resolvePath(object, error.instancePath); | ||
if (error.schemaPath === "#/anyOf") { | ||
if (origData === false) { | ||
origData = error.data; | ||
} | ||
else if (origData === error.data) { | ||
error.data = "[shortened by validateAndCoerceTypes]"; | ||
} | ||
} | ||
}); | ||
// Becaue of the "anyOf" in quote, errors are huuuuge and mostly | ||
// irrelevant... so let's filter out (some of) the latter | ||
validator.errors = validator.errors.filter((error) => { | ||
var _a, _b; | ||
if (error.schemaPath.startsWith("#/definitions/Quote")) { | ||
const schemaQuoteType = error.schemaPath | ||
.substring(19) | ||
.split("/")[0] | ||
.toUpperCase(); | ||
/* | ||
* Filter out entries for non-matching schema type, i.e. | ||
* { | ||
* schemaPath: '#/definitions/QuoteCryptoCurrency/properties...' | ||
* data: { | ||
* quoteType: "EQUITY" | ||
* } | ||
* } | ||
*/ | ||
if (typeof error.data === "object" && | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: Properrty "quoteType" does not exist on type "object" | ||
((_a = error.data) === null || _a === void 0 ? void 0 : _a.quoteType) !== schemaQuoteType) | ||
return false; | ||
/* | ||
* Filter out the non-matching "const" for the above. | ||
* { | ||
* schemaPath: '#/definitions/QuoteCryptoCurrency/properties/quoteType/const' | ||
* keyword: "const", | ||
* params: { allowedValue: "CRYPTOCURRENCY"}}, | ||
* data: "EQUITY" | ||
* } | ||
*/ | ||
if (typeof error.data === "string" && | ||
((_b = error.params) === null || _b === void 0 ? void 0 : _b.allowedValue) === schemaQuoteType) | ||
return false; | ||
} | ||
return true; | ||
}); | ||
// In the case of there being NO match in #anyOf, bring back the data | ||
if (validator.errors.length === 1 && | ||
validator.errors[0].schemaPath === "#/anyOf") | ||
validator.errors[0].data = origData; | ||
throw new errors_js_1.FailedYahooValidationError("Failed Yahoo Schema validation", { | ||
result: e.value, | ||
errors: [e], | ||
}); | ||
}; | ||
const handleOptionsError = (e, { logOptionsErrors }) => { | ||
if (logOptionsErrors) { | ||
console.error(`[yahooFinance] Invalid options ("${JSON.stringify(e.error, null, 2)}")`); | ||
} | ||
throw new errors_js_1.InvalidOptionsError("Validation called with invalid options"); | ||
}; | ||
const validateAndCoerceTypebox = ({ type, data, schema, options, }) => { | ||
try { | ||
const validationSchema = options._internalThrowOnAdditionalProperties | ||
? Object.assign(Object.assign({}, schema), { additionalProperties: false }) : schema; | ||
return value_1.Value.Decode(validationSchema, data); | ||
} | ||
catch (e) { | ||
if (e instanceof value_1.TransformDecodeError || | ||
e instanceof value_1.TransformDecodeCheckError) { | ||
// TODO: The existing implementation of 'validate' assumes that the `type` parameter may not be provided | ||
// and defaults to validating the options if it is not. | ||
// We should probably explore validating this further up in the call chain. | ||
// It'd be nice to do this in the body of a module (e.g. search) so that we can avoid | ||
// polluting core code with type checks and edge cases | ||
type === "result" | ||
? handleResultError(e, options) | ||
: handleOptionsError(e, options); | ||
} | ||
if (options.logErrors === true) { | ||
const title = encodeURIComponent("Failed validation: " + schemaKey); | ||
console.log("The following result did not validate with schema: " + schemaKey); | ||
logObj(validator.errors); | ||
// logObj(object); | ||
console.log(` | ||
This may happen intermittently and you should catch errors appropriately. | ||
However: 1) if this recently started happening on every request for a symbol | ||
that used to work, Yahoo may have changed their API. 2) If this happens on | ||
every request for a symbol you've never used before, but not for other | ||
symbols, you've found an edge-case (OR, we may just be protecting you from | ||
"bad" data sometimes stored for e.g. misspelt symbols on Yahoo's side). | ||
Please see if anyone has reported this previously: | ||
${package_json_1.default.repository}/issues?q=is%3Aissue+${title} | ||
or open a new issue (and mention the symbol): ${package_json_1.default.name} v${package_json_1.default.version} | ||
${package_json_1.default.repository}/issues/new?labels=bug%2C+validation&template=validation.md&title=${title} | ||
For information on how to turn off the above logging or skip these errors, | ||
see https://github.com/gadicc/node-yahoo-finance2/tree/devel/docs/validation.md. | ||
At the end of the doc, there's also a section on how to | ||
[Help Fix Validation Errors](https://github.com/gadicc/node-yahoo-finance2/blob/devel/docs/validation.md#help-fix) | ||
in case you'd like to contribute to the project. Most of the time, these | ||
fixes are very quick and easy; it's just hard for our small core team to keep up, | ||
so help is always appreciated! | ||
`); | ||
} /* if (logErrors) */ | ||
throw new errors_js_1.FailedYahooValidationError("Failed Yahoo Schema validation", { | ||
result: object, | ||
errors: validator.errors, | ||
}); | ||
} /* if (type === 'options') */ | ||
else { | ||
if (options.logOptionsErrors === true) { | ||
console.error(`[yahooFinance.${source}] Invalid options ("${schemaKey}")`); | ||
logObj({ errors: validator.errors, input: object }); | ||
} | ||
throw new errors_js_1.InvalidOptionsError(`yahooFinance.${source} called with invalid options.`); | ||
throw e; | ||
} | ||
} | ||
exports.default = validate; | ||
}; | ||
exports.validateAndCoerceTypebox = validateAndCoerceTypebox; | ||
exports.default = exports.validateAndCoerceTypebox; |
@@ -18,3 +18,5 @@ "use strict"; | ||
const errors_js_1 = __importDefault(require("./errors.js")); | ||
const package_json_1 = __importDefault(require("../../package.json.js")); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: we have to ignore this for csm output.assert | ||
const package_json_1 = __importDefault(require("../../package.json")); | ||
const getCrumb_js_1 = __importDefault(require("./getCrumb.js")); | ||
@@ -21,0 +23,0 @@ const userAgent = `${package_json_1.default.name}/${package_json_1.default.version} (+${package_json_1.default.repository})`; |
@@ -0,125 +1,352 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export interface ChartResultObject { | ||
[key: string]: any; | ||
meta: ChartMeta; | ||
timestamp?: Array<number>; | ||
events?: ChartEventsObject; | ||
indicators: ChartIndicatorsObject; | ||
} | ||
export interface ChartResultArray { | ||
meta: ChartMeta; | ||
events?: ChartEventsArray; | ||
quotes: Array<ChartResultArrayQuote>; | ||
} | ||
export interface ChartResultArrayQuote { | ||
[key: string]: any; | ||
date: Date; | ||
high: number | null; | ||
low: number | null; | ||
open: number | null; | ||
close: number | null; | ||
volume: number | null; | ||
adjclose?: number | null; | ||
} | ||
export interface ChartMeta { | ||
[key: string]: any; | ||
currency: string; | ||
symbol: string; | ||
exchangeName: string; | ||
instrumentType: string; | ||
firstTradeDate: Date | null; | ||
regularMarketTime: Date; | ||
gmtoffset: number; | ||
timezone: string; | ||
exchangeTimezoneName: string; | ||
regularMarketPrice: number; | ||
chartPreviousClose?: number; | ||
previousClose?: number; | ||
scale?: number; | ||
priceHint: number; | ||
currentTradingPeriod: { | ||
[key: string]: any; | ||
pre: ChartMetaTradingPeriod; | ||
regular: ChartMetaTradingPeriod; | ||
post: ChartMetaTradingPeriod; | ||
}; | ||
tradingPeriods?: ChartMetaTradingPeriods; | ||
dataGranularity: string; | ||
range: string; | ||
validRanges: Array<string>; | ||
} | ||
export interface ChartMetaTradingPeriod { | ||
[key: string]: any; | ||
timezone: string; | ||
start: Date; | ||
end: Date; | ||
gmtoffset: number; | ||
} | ||
export interface ChartMetaTradingPeriods { | ||
[key: string]: any; | ||
pre?: Array<Array<ChartMetaTradingPeriod>>; | ||
post?: Array<Array<ChartMetaTradingPeriod>>; | ||
regular?: Array<Array<ChartMetaTradingPeriod>>; | ||
} | ||
export interface ChartEventsObject { | ||
[key: string]: any; | ||
dividends?: ChartEventDividends; | ||
splits?: ChartEventSplits; | ||
} | ||
export interface ChartEventsArray { | ||
[key: string]: any; | ||
dividends?: Array<ChartEventDividend>; | ||
splits?: Array<ChartEventSplit>; | ||
} | ||
export interface ChartEventDividends { | ||
[key: string]: ChartEventDividend; | ||
} | ||
export interface ChartEventDividend { | ||
[key: string]: any; | ||
amount: number; | ||
date: Date; | ||
} | ||
export interface ChartEventSplits { | ||
[key: string]: ChartEventSplit; | ||
} | ||
export interface ChartEventSplit { | ||
[key: string]: any; | ||
date: Date; | ||
numerator: number; | ||
denominator: number; | ||
splitRatio: string; | ||
} | ||
export interface ChartIndicatorsObject { | ||
[key: string]: any; | ||
quote: Array<ChartIndicatorQuote>; | ||
adjclose?: Array<ChartIndicatorAdjclose>; | ||
} | ||
export interface ChartIndicatorQuote { | ||
[key: string]: any; | ||
high: Array<number | null>; | ||
low: Array<number | null>; | ||
open: Array<number | null>; | ||
close: Array<number | null>; | ||
volume: Array<number | null>; | ||
} | ||
export interface ChartIndicatorAdjclose { | ||
[key: string]: any; | ||
adjclose?: Array<number | null>; | ||
} | ||
export interface ChartOptions { | ||
period1: Date | string | number; | ||
period2?: Date | string | number; | ||
useYfid?: boolean; | ||
interval?: "1m" | "2m" | "5m" | "15m" | "30m" | "60m" | "90m" | "1h" | "1d" | "5d" | "1wk" | "1mo" | "3mo"; | ||
includePrePost?: boolean; | ||
events?: string; | ||
lang?: string; | ||
return?: "array" | "object"; | ||
} | ||
export interface ChartOptionsWithReturnArray extends ChartOptions { | ||
return?: "array"; | ||
} | ||
export interface ChartOptionsWithReturnObject extends ChartOptions { | ||
return: "object"; | ||
} | ||
declare const ChartResultArraySchema: import("@sinclair/typebox").TObject<{ | ||
meta: import("@sinclair/typebox").TObject<{ | ||
currency: import("@sinclair/typebox").TString; | ||
symbol: import("@sinclair/typebox").TString; | ||
exchangeName: import("@sinclair/typebox").TString; | ||
instrumentType: import("@sinclair/typebox").TString; | ||
firstTradeDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>, import("@sinclair/typebox").TNull]>; | ||
regularMarketTime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timezone: import("@sinclair/typebox").TString; | ||
exchangeTimezoneName: import("@sinclair/typebox").TString; | ||
regularMarketPrice: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
chartPreviousClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
previousClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
scale: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
priceHint: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
currentTradingPeriod: import("@sinclair/typebox").TObject<{ | ||
pre: import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
regular: import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
post: import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
}>; | ||
tradingPeriods: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
pre: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>>>; | ||
post: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>>>; | ||
regular: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>>>; | ||
}>>; | ||
dataGranularity: import("@sinclair/typebox").TString; | ||
range: import("@sinclair/typebox").TString; | ||
validRanges: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>; | ||
}>; | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
dividends: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
amount: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
}>>>; | ||
splits: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
numerator: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
denominator: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
splitRatio: import("@sinclair/typebox").TString; | ||
}>>>; | ||
}>>; | ||
quotes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
high: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>; | ||
low: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>; | ||
open: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>; | ||
close: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>; | ||
volume: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>; | ||
adjclose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>; | ||
}>>; | ||
}>; | ||
declare const ChartResultObjectSchema: import("@sinclair/typebox").TObject<{ | ||
meta: import("@sinclair/typebox").TObject<{ | ||
currency: import("@sinclair/typebox").TString; | ||
symbol: import("@sinclair/typebox").TString; | ||
exchangeName: import("@sinclair/typebox").TString; | ||
instrumentType: import("@sinclair/typebox").TString; | ||
firstTradeDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>, import("@sinclair/typebox").TNull]>; | ||
regularMarketTime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timezone: import("@sinclair/typebox").TString; | ||
exchangeTimezoneName: import("@sinclair/typebox").TString; | ||
regularMarketPrice: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
chartPreviousClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
previousClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
scale: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
priceHint: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
currentTradingPeriod: import("@sinclair/typebox").TObject<{ | ||
pre: import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
regular: import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
post: import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
}>; | ||
tradingPeriods: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
pre: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>>>; | ||
post: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>>>; | ||
regular: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>>>; | ||
}>>; | ||
dataGranularity: import("@sinclair/typebox").TString; | ||
range: import("@sinclair/typebox").TString; | ||
validRanges: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>; | ||
}>; | ||
timestamp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>>; | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
dividends: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{}>>; | ||
splits: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{}>>; | ||
}>>; | ||
indicators: import("@sinclair/typebox").TObject<{ | ||
quote: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
high: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>; | ||
low: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>; | ||
open: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>; | ||
close: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>; | ||
volume: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>; | ||
}>>; | ||
adjclose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
adjclose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>>; | ||
}>>>; | ||
}>; | ||
}>; | ||
export declare const ChartOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>]>>; | ||
useYfid: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1m">, import("@sinclair/typebox").TLiteral<"2m">, import("@sinclair/typebox").TLiteral<"5m">, import("@sinclair/typebox").TLiteral<"15m">, import("@sinclair/typebox").TLiteral<"30m">, import("@sinclair/typebox").TLiteral<"60m">, import("@sinclair/typebox").TLiteral<"90m">, import("@sinclair/typebox").TLiteral<"1h">, import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"5d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">, import("@sinclair/typebox").TLiteral<"3mo">]>>; | ||
includePrePost: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
return: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"array">, import("@sinclair/typebox").TLiteral<"object">]>>; | ||
}>; | ||
declare const ChartOptionsWithReturnArraySchema: import("@sinclair/typebox").TObject<{ | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>]>>; | ||
useYfid: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1m">, import("@sinclair/typebox").TLiteral<"2m">, import("@sinclair/typebox").TLiteral<"5m">, import("@sinclair/typebox").TLiteral<"15m">, import("@sinclair/typebox").TLiteral<"30m">, import("@sinclair/typebox").TLiteral<"60m">, import("@sinclair/typebox").TLiteral<"90m">, import("@sinclair/typebox").TLiteral<"1h">, import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"5d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">, import("@sinclair/typebox").TLiteral<"3mo">]>>; | ||
includePrePost: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
return: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"array">, import("@sinclair/typebox").TLiteral<"object">]>, import("@sinclair/typebox").TLiteral<"array">]>>; | ||
}>; | ||
declare const ChartOptionsWithReturnObjectSchema: import("@sinclair/typebox").TObject<{ | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>]>>; | ||
useYfid: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1m">, import("@sinclair/typebox").TLiteral<"2m">, import("@sinclair/typebox").TLiteral<"5m">, import("@sinclair/typebox").TLiteral<"15m">, import("@sinclair/typebox").TLiteral<"30m">, import("@sinclair/typebox").TLiteral<"60m">, import("@sinclair/typebox").TLiteral<"90m">, import("@sinclair/typebox").TLiteral<"1h">, import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"5d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">, import("@sinclair/typebox").TLiteral<"3mo">]>>; | ||
includePrePost: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
return: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"array">, import("@sinclair/typebox").TLiteral<"object">]>, import("@sinclair/typebox").TLiteral<"object">]>; | ||
}>; | ||
type ChartOptions = Static<typeof ChartOptionsSchema>; | ||
type ChartOptionsWithReturnObject = Static<typeof ChartOptionsWithReturnObjectSchema>; | ||
type ChartResultObject = Static<typeof ChartResultObjectSchema>; | ||
type ChartOptionsWithReturnArray = Static<typeof ChartOptionsWithReturnArraySchema>; | ||
type ChartResultArray = Static<typeof ChartResultArraySchema>; | ||
export declare const _chart: typeof chart; | ||
@@ -129,1 +356,2 @@ export default function chart(this: ModuleThis, symbol: string, queryOptionsOverrides: ChartOptionsWithReturnObject, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<ChartResultObject>; | ||
export default function chart(this: ModuleThis, symbol: string, queryOptionsOverrides: ChartOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
@@ -13,3 +13,179 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports._chart = void 0; | ||
exports._chart = exports.ChartOptionsSchema = void 0; | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const yahooFinanceTypes_js_1 = require("../lib/yahooFinanceTypes.js"); | ||
const ChartMetaTradingPeriod = typebox_1.Type.Object({ | ||
timezone: typebox_1.Type.String(), // "EST", | ||
start: yahooFinanceTypes_js_1.YahooFinanceDate, // new Date(1637355600 * 1000), | ||
end: yahooFinanceTypes_js_1.YahooFinanceDate, // new Date(1637370000 * 10000), | ||
gmtoffset: yahooFinanceTypes_js_1.YahooNumber, // -18000 | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "ChartMetaTradingPeriod", | ||
}); | ||
const ChartMetaTradingPeriods = typebox_1.Type.Object({ | ||
pre: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Array(ChartMetaTradingPeriod))), | ||
post: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Array(ChartMetaTradingPeriod))), | ||
regular: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Array(ChartMetaTradingPeriod))), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "ChartMetaTradingPeriods", | ||
}); | ||
const ChartResultArrayQuote = typebox_1.Type.Object({ | ||
date: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
high: typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.Null()]), | ||
low: typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.Null()]), | ||
open: typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.Null()]), | ||
close: typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.Null()]), | ||
volume: typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.Null()]), | ||
adjclose: typebox_1.Type.Optional(typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.Null()])), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "ChartResultArrayQuote", | ||
}); | ||
const ChartEventDividend = typebox_1.Type.Object({ | ||
amount: yahooFinanceTypes_js_1.YahooNumber, | ||
date: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "ChartEventDividend", | ||
}); | ||
const ChartEventDividends = typebox_1.Type.Object({}, { | ||
additionalProperties: ChartEventDividend, | ||
title: "ChartEventDividends", | ||
}); | ||
const ChartEventSplit = typebox_1.Type.Object({ | ||
date: yahooFinanceTypes_js_1.YahooFinanceDate, // new Date(1598880600 * 1000) | ||
numerator: yahooFinanceTypes_js_1.YahooNumber, // 4 | ||
denominator: yahooFinanceTypes_js_1.YahooNumber, // 1 | ||
splitRatio: typebox_1.Type.String(), // "4:1" | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}); | ||
const ChartEventsArray = typebox_1.Type.Object({ | ||
dividends: typebox_1.Type.Optional(typebox_1.Type.Array(ChartEventDividend)), | ||
splits: typebox_1.Type.Optional(typebox_1.Type.Array(ChartEventSplit)), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "ChartEventsArray", | ||
}); | ||
const ChartMeta = typebox_1.Type.Object({ | ||
currency: typebox_1.Type.String(), // "USD" | ||
symbol: typebox_1.Type.String(), // "AAPL", | ||
exchangeName: typebox_1.Type.String(), // "NMS", | ||
instrumentType: typebox_1.Type.String(), // "EQUITY", | ||
firstTradeDate: typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooFinanceDate, typebox_1.Type.Null()]), // new Date(345479400 * 1000); null in e.g. "APS.AX" | ||
regularMarketTime: yahooFinanceTypes_js_1.YahooFinanceDate, // new Date(1637355602 * 1000), | ||
gmtoffset: yahooFinanceTypes_js_1.YahooNumber, // -18000, | ||
timezone: typebox_1.Type.String(), /// "EST", | ||
exchangeTimezoneName: typebox_1.Type.String(), // "America/New_York", | ||
regularMarketPrice: yahooFinanceTypes_js_1.YahooNumber, // 160.55, | ||
chartPreviousClose: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 79.75; missing in e.g. "APS.AX" | ||
previousClose: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 1137.06 | ||
scale: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 3, | ||
priceHint: yahooFinanceTypes_js_1.YahooNumber, // 2, | ||
currentTradingPeriod: typebox_1.Type.Object({ | ||
pre: ChartMetaTradingPeriod, | ||
regular: ChartMetaTradingPeriod, | ||
post: ChartMetaTradingPeriod, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}), | ||
tradingPeriods: typebox_1.Type.Optional(ChartMetaTradingPeriods), | ||
dataGranularity: typebox_1.Type.String(), // "1d", | ||
range: typebox_1.Type.String(), // "" | ||
validRanges: typebox_1.Type.Array(typebox_1.Type.String()), // ["1d", "5d", "1mo", "3mo", "6mo", "1y", "2y", "5y", "10y", "ytd", "max"] | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "ChartMeta", | ||
}); | ||
const ChartResultArraySchema = typebox_1.Type.Object({ | ||
meta: ChartMeta, | ||
events: typebox_1.Type.Optional(ChartEventsArray), | ||
quotes: typebox_1.Type.Array(ChartResultArrayQuote), | ||
}, { title: "ChartResultArray" }); | ||
const ChartEventSplits = typebox_1.Type.Object({}, { | ||
additionalProperties: ChartEventSplit, | ||
title: "ChartEventSplits", | ||
}); | ||
const ChartIndicatorQuote = typebox_1.Type.Object({ | ||
high: typebox_1.Type.Array(typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.Null()])), | ||
low: typebox_1.Type.Array(typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.Null()])), | ||
open: typebox_1.Type.Array(typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.Null()])), | ||
close: typebox_1.Type.Array(typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.Null()])), | ||
volume: typebox_1.Type.Array(typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.Null()])), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "ChartIndicatorQuote", | ||
}); | ||
const ChartIndicatorAdjclose = typebox_1.Type.Object({ | ||
adjclose: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.Null()]))), // Missing in e.g. "APS.AX" | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "ChartIndicatorAdjClose", | ||
}); | ||
const ChartEventsObject = typebox_1.Type.Object({ | ||
dividends: typebox_1.Type.Optional(ChartEventDividends), | ||
splits: typebox_1.Type.Optional(ChartEventSplits), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}); | ||
const ChartIndicatorsObject = typebox_1.Type.Object({ | ||
quote: typebox_1.Type.Array(ChartIndicatorQuote), | ||
adjclose: typebox_1.Type.Optional(typebox_1.Type.Array(ChartIndicatorAdjclose)), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "ChartIndicatorObject", | ||
}); | ||
const ChartResultObjectSchema = typebox_1.Type.Object({ | ||
meta: ChartMeta, | ||
timestamp: typebox_1.Type.Optional(typebox_1.Type.Array(yahooFinanceTypes_js_1.YahooNumber)), | ||
events: typebox_1.Type.Optional(ChartEventsObject), | ||
indicators: ChartIndicatorsObject, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "ChartResultObject", | ||
}); | ||
exports.ChartOptionsSchema = typebox_1.Type.Object({ | ||
period1: typebox_1.Type.Union([typebox_1.Type.Date(), typebox_1.Type.String(), yahooFinanceTypes_js_1.YahooNumber]), | ||
period2: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Date(), typebox_1.Type.String(), yahooFinanceTypes_js_1.YahooNumber])), | ||
useYfid: typebox_1.Type.Optional(typebox_1.Type.Boolean()), // true | ||
interval: typebox_1.Type.Optional(typebox_1.Type.Union([ | ||
typebox_1.Type.Literal("1m"), | ||
typebox_1.Type.Literal("2m"), | ||
typebox_1.Type.Literal("5m"), | ||
typebox_1.Type.Literal("15m"), | ||
typebox_1.Type.Literal("30m"), | ||
typebox_1.Type.Literal("60m"), | ||
typebox_1.Type.Literal("90m"), | ||
typebox_1.Type.Literal("1h"), | ||
typebox_1.Type.Literal("1d"), | ||
typebox_1.Type.Literal("5d"), | ||
typebox_1.Type.Literal("1wk"), | ||
typebox_1.Type.Literal("1mo"), | ||
typebox_1.Type.Literal("3mo"), | ||
])), | ||
includePrePost: typebox_1.Type.Optional(typebox_1.Type.Boolean()), // true | ||
events: typebox_1.Type.Optional(typebox_1.Type.String()), // 'history', | ||
lang: typebox_1.Type.Optional(typebox_1.Type.String()), // "en-US" | ||
return: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Literal("array"), typebox_1.Type.Literal("object")])), | ||
}, { | ||
title: "ChartOptions", | ||
}); | ||
const ChartOptionsWithReturnArraySchema = typebox_1.Type.Composite([ | ||
exports.ChartOptionsSchema, | ||
typebox_1.Type.Object({ | ||
return: typebox_1.Type.Optional(typebox_1.Type.Literal("array")), | ||
}), | ||
], { | ||
title: "ChartOptionsWithReturnArray", | ||
}); | ||
const ChartOptionsWithReturnObjectSchema = typebox_1.Type.Composite([ | ||
exports.ChartOptionsSchema, | ||
typebox_1.Type.Object({ | ||
return: typebox_1.Type.Literal("object"), | ||
}), | ||
], { | ||
title: "ChartOptionsWithReturnObject", | ||
}); | ||
const queryOptionsDefaults = { | ||
@@ -35,3 +211,3 @@ useYfid: true, | ||
url: "https://${YF_QUERY_HOST}/v8/finance/chart/" + symbol, | ||
schemaKey: "#/definitions/ChartOptions", | ||
schema: exports.ChartOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
@@ -45,7 +221,15 @@ overrides: queryOptionsOverrides, | ||
const value = queryOptions[fieldName]; | ||
if (value instanceof Date) | ||
if (value instanceof Date) { | ||
queryOptions[fieldName] = Math.floor(value.getTime() / 1000); | ||
else | ||
typeof value === "string"; | ||
queryOptions[fieldName] = Math.floor(new Date(value).getTime() / 1000); | ||
} | ||
else if (typeof value === "string") { | ||
const timestamp = new Date(value).getTime(); | ||
if (isNaN(timestamp)) | ||
throw new Error("yahooFinance.chart() option '" + | ||
fieldName + | ||
"' invalid date provided: '" + | ||
value + | ||
"'"); | ||
queryOptions[fieldName] = Math.floor(timestamp / 1000); | ||
} | ||
} | ||
@@ -62,3 +246,3 @@ if (queryOptions.period1 === queryOptions.period2) { | ||
result: { | ||
schemaKey: "#/definitions/ChartResultObject", | ||
schema: ChartResultObjectSchema, | ||
transformWith(result) { | ||
@@ -120,2 +304,3 @@ if (!result.chart) | ||
result2.quotes[i] = { | ||
// @ts-expect-error (eatkinson): clean this up with type in followup | ||
date: new Date(timestamp[i] * 1000), | ||
@@ -134,3 +319,5 @@ high: result.indicators.quote[0].high[i], | ||
for (const event of ["dividends", "splits"]) { | ||
// @ts-expect-error (eatkinson): Fix up type in follow up | ||
if (result.events[event]) | ||
// @ts-expect-error (eatkinson): Fix up type in follow up | ||
result2.events[event] = Object.values(result.events[event]); | ||
@@ -137,0 +324,0 @@ } |
@@ -0,131 +1,272 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export interface DailyGainersResult { | ||
id: string; | ||
title: string; | ||
description: string; | ||
canonicalName: string; | ||
criteriaMeta: DailyGainersCriteriaMeta; | ||
rawCriteria: string; | ||
start: number; | ||
count: number; | ||
total: number; | ||
quotes: DailyGainersQuote[]; | ||
useRecords: boolean; | ||
predefinedScr: boolean; | ||
versionId: number; | ||
creationDate: number; | ||
lastUpdated: number; | ||
isPremium: boolean; | ||
iconUrl: string; | ||
} | ||
export interface DailyGainersCriteriaMeta { | ||
size: number; | ||
offset: number; | ||
sortField: string; | ||
sortType: string; | ||
quoteType: string; | ||
criteria: DailyGainersCriterum[]; | ||
topOperator: string; | ||
} | ||
export interface DailyGainersCriterum { | ||
field: string; | ||
operators: string[]; | ||
values: number[]; | ||
labelsSelected: number[]; | ||
dependentValues: any[]; | ||
} | ||
export interface DailyGainersQuote { | ||
language: string; | ||
region: string; | ||
quoteType: string; | ||
typeDisp: string; | ||
quoteSourceName: string; | ||
triggerable: boolean; | ||
customPriceAlertConfidence: string; | ||
lastCloseTevEbitLtm?: number; | ||
lastClosePriceToNNWCPerShare?: number; | ||
firstTradeDateMilliseconds: number; | ||
priceHint: number; | ||
postMarketChangePercent?: number; | ||
postMarketTime?: number; | ||
postMarketPrice?: number; | ||
postMarketChange?: number; | ||
regularMarketChange: number; | ||
regularMarketTime: number; | ||
regularMarketPrice: number; | ||
regularMarketDayHigh: number; | ||
regularMarketDayRange: string; | ||
currency: string; | ||
regularMarketDayLow: number; | ||
regularMarketVolume: number; | ||
regularMarketPreviousClose: number; | ||
bid?: number; | ||
ask?: number; | ||
bidSize?: number; | ||
askSize?: number; | ||
market: string; | ||
messageBoardId: string; | ||
fullExchangeName: string; | ||
longName: string; | ||
financialCurrency?: string; | ||
regularMarketOpen: number; | ||
averageDailyVolume3Month: number; | ||
averageDailyVolume10Day: number; | ||
fiftyTwoWeekLowChange: number; | ||
fiftyTwoWeekLowChangePercent: number; | ||
fiftyTwoWeekRange: string; | ||
fiftyTwoWeekHighChange: number; | ||
fiftyTwoWeekHighChangePercent: number; | ||
fiftyTwoWeekChangePercent: number; | ||
earningsTimestamp?: number; | ||
earningsTimestampStart?: number; | ||
earningsTimestampEnd?: number; | ||
trailingAnnualDividendRate: number; | ||
trailingAnnualDividendYield: number; | ||
marketState: string; | ||
epsTrailingTwelveMonths?: number; | ||
epsForward?: number; | ||
epsCurrentYear?: number; | ||
priceEpsCurrentYear?: number; | ||
sharesOutstanding: number; | ||
bookValue?: number; | ||
fiftyDayAverage: number; | ||
fiftyDayAverageChange: number; | ||
fiftyDayAverageChangePercent: number; | ||
twoHundredDayAverage: number; | ||
twoHundredDayAverageChange: number; | ||
twoHundredDayAverageChangePercent: number; | ||
marketCap: number; | ||
forwardPE?: number; | ||
priceToBook?: number; | ||
sourceInterval: number; | ||
exchangeDataDelayedBy: number; | ||
exchangeTimezoneName: string; | ||
exchangeTimezoneShortName: string; | ||
gmtOffSetMilliseconds: number; | ||
esgPopulated: boolean; | ||
tradeable: boolean; | ||
cryptoTradeable: boolean; | ||
exchange: string; | ||
fiftyTwoWeekLow: number; | ||
fiftyTwoWeekHigh: number; | ||
shortName: string; | ||
averageAnalystRating?: string; | ||
regularMarketChangePercent: number; | ||
symbol: string; | ||
dividendDate?: number; | ||
displayName?: string; | ||
trailingPE?: number; | ||
prevName?: string; | ||
nameChangeDate?: number; | ||
ipoExpectedDate?: number; | ||
dividendYield?: number; | ||
dividendRate?: number; | ||
} | ||
export interface DailyGainersOptions { | ||
lang?: string; | ||
region?: string; | ||
count?: number; | ||
} | ||
declare const DailyGainersOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
region: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>; | ||
declare const DailyGainersResultSchema: import("@sinclair/typebox").TObject<{ | ||
id: import("@sinclair/typebox").TString; | ||
title: import("@sinclair/typebox").TString; | ||
description: import("@sinclair/typebox").TString; | ||
canonicalName: import("@sinclair/typebox").TString; | ||
criteriaMeta: import("@sinclair/typebox").TObject<{ | ||
size: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
offset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sortField: import("@sinclair/typebox").TString; | ||
sortType: import("@sinclair/typebox").TString; | ||
quoteType: import("@sinclair/typebox").TString; | ||
criteria: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
field: import("@sinclair/typebox").TString; | ||
operators: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>; | ||
values: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
labelsSelected: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dependentValues: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>; | ||
}>>; | ||
topOperator: import("@sinclair/typebox").TString; | ||
}>; | ||
rawCriteria: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
count: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
total: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
quotes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
language: import("@sinclair/typebox").TString; | ||
region: import("@sinclair/typebox").TString; | ||
quoteType: import("@sinclair/typebox").TString; | ||
typeDisp: import("@sinclair/typebox").TString; | ||
quoteSourceName: import("@sinclair/typebox").TString; | ||
triggerable: import("@sinclair/typebox").TBoolean; | ||
customPriceAlertConfidence: import("@sinclair/typebox").TString; | ||
lastCloseTevEbitLtm: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
lastClosePriceToNNWCPerShare: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
firstTradeDateMilliseconds: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
priceHint: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
postMarketChangePercent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
postMarketTime: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
postMarketPrice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
postMarketChange: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
regularMarketChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketTime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketPrice: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketDayHigh: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketDayRange: import("@sinclair/typebox").TString; | ||
currency: import("@sinclair/typebox").TString; | ||
regularMarketDayLow: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketVolume: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketPreviousClose: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
bid: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
ask: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
bidSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
askSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
market: import("@sinclair/typebox").TString; | ||
messageBoardId: import("@sinclair/typebox").TString; | ||
fullExchangeName: import("@sinclair/typebox").TString; | ||
longName: import("@sinclair/typebox").TString; | ||
financialCurrency: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
regularMarketOpen: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
averageDailyVolume3Month: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
averageDailyVolume10Day: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekLowChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekLowChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekRange: import("@sinclair/typebox").TString; | ||
fiftyTwoWeekHighChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekHighChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
earningsTimestamp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
earningsTimestampStart: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
earningsTimestampEnd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
trailingAnnualDividendRate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
trailingAnnualDividendYield: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
marketState: import("@sinclair/typebox").TString; | ||
epsTrailingTwelveMonths: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
epsForward: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
epsCurrentYear: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
priceEpsCurrentYear: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sharesOutstanding: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
bookValue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
fiftyDayAverage: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyDayAverageChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyDayAverageChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
twoHundredDayAverage: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
twoHundredDayAverageChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
twoHundredDayAverageChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
marketCap: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
forwardPE: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
priceToBook: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sourceInterval: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
exchangeDataDelayedBy: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
exchangeTimezoneName: import("@sinclair/typebox").TString; | ||
exchangeTimezoneShortName: import("@sinclair/typebox").TString; | ||
gmtOffSetMilliseconds: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
esgPopulated: import("@sinclair/typebox").TBoolean; | ||
tradeable: import("@sinclair/typebox").TBoolean; | ||
cryptoTradeable: import("@sinclair/typebox").TBoolean; | ||
exchange: import("@sinclair/typebox").TString; | ||
fiftyTwoWeekLow: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekHigh: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
shortName: import("@sinclair/typebox").TString; | ||
averageAnalystRating: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
regularMarketChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
symbol: import("@sinclair/typebox").TString; | ||
dividendDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
displayName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
trailingPE: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
ipoExpectedDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dividendYield: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dividendRate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>>; | ||
useRecords: import("@sinclair/typebox").TBoolean; | ||
predefinedScr: import("@sinclair/typebox").TBoolean; | ||
versionId: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
creationDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
lastUpdated: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
isPremium: import("@sinclair/typebox").TBoolean; | ||
iconUrl: import("@sinclair/typebox").TString; | ||
}>; | ||
type DailyGainersResult = Static<typeof DailyGainersResultSchema>; | ||
type DailyGainersOptions = Static<typeof DailyGainersOptionsSchema>; | ||
export default function dailyGainers(this: ModuleThis, queryOptionsOverrides?: DailyGainersOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<DailyGainersResult>; | ||
export default function dailyGainers(this: ModuleThis, queryOptionsOverrides?: DailyGainersOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const yahooFinanceTypes_js_1 = require("../lib/yahooFinanceTypes.js"); | ||
const DailyGainersCriterum = typebox_1.Type.Object({ | ||
field: typebox_1.Type.String(), | ||
operators: typebox_1.Type.Array(typebox_1.Type.String()), | ||
values: typebox_1.Type.Array(yahooFinanceTypes_js_1.YahooNumber), | ||
labelsSelected: typebox_1.Type.Array(yahooFinanceTypes_js_1.YahooNumber), | ||
dependentValues: typebox_1.Type.Array(typebox_1.Type.Any()), | ||
}, { title: "DailyGainersCriterium" }); | ||
const DailyGainersQuote = typebox_1.Type.Object({ | ||
language: typebox_1.Type.String(), | ||
region: typebox_1.Type.String(), | ||
quoteType: typebox_1.Type.String(), | ||
typeDisp: typebox_1.Type.String(), | ||
quoteSourceName: typebox_1.Type.String(), | ||
triggerable: typebox_1.Type.Boolean(), | ||
customPriceAlertConfidence: typebox_1.Type.String(), | ||
lastCloseTevEbitLtm: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
lastClosePriceToNNWCPerShare: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
firstTradeDateMilliseconds: yahooFinanceTypes_js_1.YahooNumber, | ||
priceHint: yahooFinanceTypes_js_1.YahooNumber, | ||
postMarketChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
postMarketTime: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
postMarketPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
postMarketChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketChange: yahooFinanceTypes_js_1.YahooNumber, | ||
regularMarketTime: yahooFinanceTypes_js_1.YahooNumber, | ||
regularMarketPrice: yahooFinanceTypes_js_1.YahooNumber, | ||
regularMarketDayHigh: yahooFinanceTypes_js_1.YahooNumber, | ||
regularMarketDayRange: typebox_1.Type.String(), | ||
currency: typebox_1.Type.String(), | ||
regularMarketDayLow: yahooFinanceTypes_js_1.YahooNumber, | ||
regularMarketVolume: yahooFinanceTypes_js_1.YahooNumber, | ||
regularMarketPreviousClose: yahooFinanceTypes_js_1.YahooNumber, | ||
bid: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
ask: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
bidSize: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
askSize: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
market: typebox_1.Type.String(), | ||
messageBoardId: typebox_1.Type.String(), | ||
fullExchangeName: typebox_1.Type.String(), | ||
longName: typebox_1.Type.String(), | ||
financialCurrency: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
regularMarketOpen: yahooFinanceTypes_js_1.YahooNumber, | ||
averageDailyVolume3Month: yahooFinanceTypes_js_1.YahooNumber, | ||
averageDailyVolume10Day: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyTwoWeekLowChange: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyTwoWeekLowChangePercent: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyTwoWeekRange: typebox_1.Type.String(), | ||
fiftyTwoWeekHighChange: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyTwoWeekHighChangePercent: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyTwoWeekChangePercent: yahooFinanceTypes_js_1.YahooNumber, | ||
earningsTimestamp: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
earningsTimestampStart: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
earningsTimestampEnd: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
trailingAnnualDividendRate: yahooFinanceTypes_js_1.YahooNumber, | ||
trailingAnnualDividendYield: yahooFinanceTypes_js_1.YahooNumber, | ||
marketState: typebox_1.Type.String(), | ||
epsTrailingTwelveMonths: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
epsForward: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
epsCurrentYear: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
priceEpsCurrentYear: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
sharesOutstanding: yahooFinanceTypes_js_1.YahooNumber, | ||
bookValue: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fiftyDayAverage: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyDayAverageChange: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyDayAverageChangePercent: yahooFinanceTypes_js_1.YahooNumber, | ||
twoHundredDayAverage: yahooFinanceTypes_js_1.YahooNumber, | ||
twoHundredDayAverageChange: yahooFinanceTypes_js_1.YahooNumber, | ||
twoHundredDayAverageChangePercent: yahooFinanceTypes_js_1.YahooNumber, | ||
marketCap: yahooFinanceTypes_js_1.YahooNumber, | ||
forwardPE: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
priceToBook: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
sourceInterval: yahooFinanceTypes_js_1.YahooNumber, | ||
exchangeDataDelayedBy: yahooFinanceTypes_js_1.YahooNumber, | ||
exchangeTimezoneName: typebox_1.Type.String(), | ||
exchangeTimezoneShortName: typebox_1.Type.String(), | ||
gmtOffSetMilliseconds: yahooFinanceTypes_js_1.YahooNumber, | ||
esgPopulated: typebox_1.Type.Boolean(), | ||
tradeable: typebox_1.Type.Boolean(), | ||
cryptoTradeable: typebox_1.Type.Boolean(), | ||
exchange: typebox_1.Type.String(), | ||
fiftyTwoWeekLow: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyTwoWeekHigh: yahooFinanceTypes_js_1.YahooNumber, | ||
shortName: typebox_1.Type.String(), | ||
averageAnalystRating: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
regularMarketChangePercent: yahooFinanceTypes_js_1.YahooNumber, | ||
symbol: typebox_1.Type.String(), | ||
dividendDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
displayName: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
trailingPE: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
prevName: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
nameChangeDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
ipoExpectedDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
dividendYield: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
dividendRate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { title: "DailyGainersQuote" }); | ||
const DailyGainersOptionsSchema = typebox_1.Type.Object({ | ||
lang: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
region: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
count: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { title: "DailyGainersOptions" }); | ||
const DailyGainersCriteriaMeta = typebox_1.Type.Object({ | ||
size: yahooFinanceTypes_js_1.YahooNumber, | ||
offset: yahooFinanceTypes_js_1.YahooNumber, | ||
sortField: typebox_1.Type.String(), | ||
sortType: typebox_1.Type.String(), | ||
quoteType: typebox_1.Type.String(), | ||
criteria: typebox_1.Type.Array(DailyGainersCriterum), | ||
topOperator: typebox_1.Type.String(), | ||
}, { title: "DailyGainersCriteriaMeta" }); | ||
const DailyGainersResultSchema = typebox_1.Type.Object({ | ||
id: typebox_1.Type.String(), | ||
title: typebox_1.Type.String(), | ||
description: typebox_1.Type.String(), | ||
canonicalName: typebox_1.Type.String(), | ||
criteriaMeta: DailyGainersCriteriaMeta, | ||
rawCriteria: typebox_1.Type.String(), | ||
start: yahooFinanceTypes_js_1.YahooNumber, | ||
count: yahooFinanceTypes_js_1.YahooNumber, | ||
total: yahooFinanceTypes_js_1.YahooNumber, | ||
quotes: typebox_1.Type.Array(DailyGainersQuote), | ||
useRecords: typebox_1.Type.Boolean(), | ||
predefinedScr: typebox_1.Type.Boolean(), | ||
versionId: yahooFinanceTypes_js_1.YahooNumber, | ||
creationDate: yahooFinanceTypes_js_1.YahooNumber, | ||
lastUpdated: yahooFinanceTypes_js_1.YahooNumber, | ||
isPremium: typebox_1.Type.Boolean(), | ||
iconUrl: typebox_1.Type.String(), | ||
}, { title: "DailyGainersResult" }); | ||
const queryOptionsDefaults = { | ||
@@ -14,3 +144,3 @@ lang: "en-US", | ||
url: "https://${YF_QUERY_HOST}/v1/finance/screener/predefined/saved", | ||
schemaKey: "#/definitions/DailyGainersOptions", | ||
schema: DailyGainersOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
@@ -21,5 +151,4 @@ overrides: queryOptionsOverrides, | ||
result: { | ||
schemaKey: "#/definitions/DailyGainersResult", | ||
schema: DailyGainersResultSchema, | ||
transformWith(result) { | ||
// console.log(result); | ||
if (!result.finance) | ||
@@ -26,0 +155,0 @@ throw new Error("Unexpected result: " + JSON.stringify(result)); |
@@ -0,19 +1,28 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export declare const FundamentalsTimeSeries_Types: string[]; | ||
export declare const FundamentalsTimeSeries_Modules: string[]; | ||
export type FundamentalsTimeSeriesResults = Array<FundamentalsTimeSeriesResult>; | ||
export interface FundamentalsTimeSeriesResult { | ||
[key: string]: unknown; | ||
date: Date; | ||
} | ||
export interface FundamentalsTimeSeriesOptions { | ||
period1: Date | number | string; | ||
period2?: Date | number | string; | ||
type?: string; | ||
merge?: boolean; | ||
padTimeSeries?: boolean; | ||
lang?: string; | ||
region?: string; | ||
module: string; | ||
} | ||
declare const FundamentalsTimeSeriesResultSchema: import("@sinclair/typebox").TObject<{ | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
}>; | ||
declare const FundamentalsTimeSeriesOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TString]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TString]>>; | ||
type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
merge: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
padTimeSeries: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
region: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
module: import("@sinclair/typebox").TString; | ||
}>; | ||
type FundamentalsTimeSeriesOptions = Static<typeof FundamentalsTimeSeriesOptionsSchema>; | ||
type FundamentalsTimeSeriesResult = Static<typeof FundamentalsTimeSeriesResultSchema>; | ||
export default function fundamentalsTimeSeries(this: ModuleThis, symbol: string, queryOptionsOverrides: FundamentalsTimeSeriesOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<FundamentalsTimeSeriesResult>; | ||
@@ -41,1 +50,2 @@ export default function fundamentalsTimeSeries(this: ModuleThis, symbol: string, queryOptionsOverrides: FundamentalsTimeSeriesOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export declare const processResponse: (response: any) => any; | ||
export {}; |
@@ -6,6 +6,10 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.processResponse = exports.processQuery = exports.FundamentalsTimeSeries_Modules = exports.FundamentalsTimeSeries_Types = void 0; | ||
const timeseries_json_1 = __importDefault(require("../lib/timeseries.json.js")); | ||
exports.FundamentalsTimeSeries_Types = ["quarterly", "annual", "trailing"]; | ||
exports.FundamentalsTimeSeries_Modules = [ | ||
exports.processResponse = exports.processQuery = void 0; | ||
const typebox_1 = require("@sinclair/typebox"); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: we have to ignore this for csm output. | ||
const timeseries_json_1 = __importDefault(require("../lib/timeseries.json")); | ||
const yahooFinanceTypes_js_1 = require("../lib/yahooFinanceTypes.js"); | ||
const FundamentalsTimeSeries_Types = ["quarterly", "annual", "trailing"]; | ||
const FundamentalsTimeSeries_Modules = [ | ||
"financials", | ||
@@ -16,2 +20,21 @@ "balance-sheet", | ||
]; | ||
const FundamentalsTimeSeriesResultSchema = typebox_1.Type.Object({ | ||
date: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
}, { | ||
additionalProperties: typebox_1.Type.Unknown(), | ||
title: "FundamentalsTimeSeriesResult", | ||
}); | ||
const FundamentalsTimeSeriesOptionsSchema = typebox_1.Type.Object({ | ||
period1: typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooFinanceDate, yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.String()]), | ||
period2: typebox_1.Type.Optional(typebox_1.Type.Union([yahooFinanceTypes_js_1.YahooFinanceDate, yahooFinanceTypes_js_1.YahooNumber, typebox_1.Type.String()])), | ||
type: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
merge: typebox_1.Type.Optional(typebox_1.Type.Boolean()), // This returns a completely different format that will break the transformer | ||
padTimeSeries: typebox_1.Type.Optional(typebox_1.Type.Boolean()), // Not exactly sure what this does, assume it pads p1 and p2??? | ||
lang: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
region: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
module: typebox_1.Type.String(), | ||
}, { | ||
title: "FundamentalsTimeSeriesOptions", | ||
}); | ||
const FundamentalsTimeSeriesResultsSchema = typebox_1.Type.Array(FundamentalsTimeSeriesResultSchema); | ||
const queryOptionsDefaults = { | ||
@@ -31,3 +54,3 @@ merge: false, | ||
needsCrumb: false, | ||
schemaKey: "#/definitions/FundamentalsTimeSeriesOptions", | ||
schema: FundamentalsTimeSeriesOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
@@ -38,3 +61,3 @@ overrides: queryOptionsOverrides, | ||
result: { | ||
schemaKey: "#/definitions/FundamentalsTimeSeriesResults", | ||
schema: FundamentalsTimeSeriesResultsSchema, | ||
transformWith(response) { | ||
@@ -83,6 +106,6 @@ if (!response || !response.timeseries) | ||
} | ||
else if (!exports.FundamentalsTimeSeries_Types.includes(queryOptions.type || "")) { | ||
else if (!FundamentalsTimeSeries_Types.includes(queryOptions.type || "")) { | ||
throw new Error("yahooFinance.fundamentalsTimeSeries() option type invalid."); | ||
} | ||
else if (!exports.FundamentalsTimeSeries_Modules.includes(queryOptions.module || "")) { | ||
else if (!FundamentalsTimeSeries_Modules.includes(queryOptions.module || "")) { | ||
throw new Error("yahooFinance.fundamentalsTimeSeries() option module invalid."); | ||
@@ -121,3 +144,3 @@ } | ||
const keyedByTimestamp = {}; | ||
const replace = new RegExp(exports.FundamentalsTimeSeries_Types.join("|")); | ||
const replace = new RegExp(FundamentalsTimeSeries_Types.join("|")); | ||
for (let ct = 0; ct < response.timeseries.result.length; ct++) { | ||
@@ -124,0 +147,0 @@ const result = response.timeseries.result[ct]; |
@@ -0,40 +1,75 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export type HistoricalHistoryResult = Array<HistoricalRowHistory>; | ||
export type HistoricalDividendsResult = Array<HistoricalRowDividend>; | ||
export type HistoricalStockSplitsResult = Array<HistoricalRowStockSplit>; | ||
export type HistoricalResult = HistoricalHistoryResult | HistoricalDividendsResult | HistoricalStockSplitsResult; | ||
export interface HistoricalRowHistory { | ||
[key: string]: any; | ||
date: Date; | ||
open: number; | ||
high: number; | ||
low: number; | ||
close: number; | ||
adjClose?: number; | ||
volume: number; | ||
} | ||
export interface HistoricalRowDividend { | ||
date: Date; | ||
dividends: number; | ||
} | ||
export interface HistoricalRowStockSplit { | ||
date: Date; | ||
stockSplits: string; | ||
} | ||
export interface HistoricalOptions { | ||
period1: Date | string | number; | ||
period2?: Date | string | number; | ||
interval?: "1d" | "1wk" | "1mo"; | ||
events?: string; | ||
includeAdjustedClose?: boolean; | ||
} | ||
export interface HistoricalOptionsEventsHistory extends HistoricalOptions { | ||
events?: "history"; | ||
} | ||
export interface HistoricalOptionsEventsDividends extends HistoricalOptions { | ||
events: "dividends"; | ||
} | ||
export interface HistoricalOptionsEventsSplit extends HistoricalOptions { | ||
events: "split"; | ||
} | ||
declare const HistoricalOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">]>>; | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"history">, import("@sinclair/typebox").TLiteral<"dividends">, import("@sinclair/typebox").TLiteral<"split">]>>; | ||
includeAdjustedClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>; | ||
declare const HistoricalOptionsEventsHistorySchema: import("@sinclair/typebox").TObject<{ | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"history">, import("@sinclair/typebox").TLiteral<"dividends">, import("@sinclair/typebox").TLiteral<"split">]>, import("@sinclair/typebox").TLiteral<"history">]>>; | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">]>>; | ||
includeAdjustedClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>; | ||
declare const HistoricalOptionsEventsDividendsSchema: import("@sinclair/typebox").TObject<{ | ||
events: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"history">, import("@sinclair/typebox").TLiteral<"dividends">, import("@sinclair/typebox").TLiteral<"split">]>, import("@sinclair/typebox").TLiteral<"dividends">]>; | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">]>>; | ||
includeAdjustedClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>; | ||
declare const HistoricalOptionsEventsSplitSchema: import("@sinclair/typebox").TObject<{ | ||
events: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"history">, import("@sinclair/typebox").TLiteral<"dividends">, import("@sinclair/typebox").TLiteral<"split">]>, import("@sinclair/typebox").TLiteral<"split">]>; | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">]>>; | ||
includeAdjustedClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>; | ||
declare const HistoricalHistoryResultSchema: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
open: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
high: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
low: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
close: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
adjClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
volume: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>; | ||
declare const HistoricalDividendsResultSchema: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
dividends: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>; | ||
declare const HistoricalStockSplitsResultSchema: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
stockSplits: import("@sinclair/typebox").TString; | ||
}>>; | ||
type HistoricalOptions = Static<typeof HistoricalOptionsSchema>; | ||
type HistoricalOptionsEventsHistory = Static<typeof HistoricalOptionsEventsHistorySchema>; | ||
type HistoricalHistoryResult = Static<typeof HistoricalHistoryResultSchema>; | ||
type HistoricalDividendsResult = Static<typeof HistoricalDividendsResultSchema>; | ||
type HistoricalOptionsEventsDividends = Static<typeof HistoricalOptionsEventsDividendsSchema>; | ||
type HistoricalOptionsEventsSplit = Static<typeof HistoricalOptionsEventsSplitSchema>; | ||
type HistoricalStockSplitsResult = Static<typeof HistoricalStockSplitsResultSchema>; | ||
export default function historical(this: ModuleThis, symbol: string, queryOptionsOverrides: HistoricalOptionsEventsHistory, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<HistoricalHistoryResult>; | ||
@@ -44,1 +79,2 @@ export default function historical(this: ModuleThis, symbol: string, queryOptionsOverrides: HistoricalOptionsEventsDividends, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<HistoricalDividendsResult>; | ||
export default function historical(this: ModuleThis, symbol: string, queryOptionsOverrides: HistoricalOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const value_1 = require("@sinclair/typebox/value"); | ||
const yahooFinanceTypes_js_1 = require("../lib/yahooFinanceTypes.js"); | ||
const chart_js_1 = require("./chart.js"); | ||
const validateAndCoerceTypes_js_1 = __importDefault(require("../lib/validateAndCoerceTypes.js")); | ||
const notices_js_1 = require("../lib/notices.js"); | ||
const HistoricalRowHistory = typebox_1.Type.Object({ | ||
date: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
open: yahooFinanceTypes_js_1.YahooNumber, | ||
high: yahooFinanceTypes_js_1.YahooNumber, | ||
low: yahooFinanceTypes_js_1.YahooNumber, | ||
close: yahooFinanceTypes_js_1.YahooNumber, | ||
adjClose: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
volume: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "HistoricalRowHistory", | ||
}); | ||
const HistoricalRowDividend = typebox_1.Type.Object({ | ||
date: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
dividends: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { title: "HistoricalRowDividend" }); | ||
const HistoricalRowStockSplit = typebox_1.Type.Object({ | ||
date: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
stockSplits: typebox_1.Type.String(), | ||
}, { title: "HistoricalRowStockSplit" }); | ||
const HistoricalOptionsSchema = typebox_1.Type.Object({ | ||
period1: typebox_1.Type.Union([typebox_1.Type.Date(), typebox_1.Type.String(), typebox_1.Type.Number()]), | ||
period2: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Date(), typebox_1.Type.String(), typebox_1.Type.Number()])), | ||
interval: typebox_1.Type.Optional(typebox_1.Type.Union([ | ||
typebox_1.Type.Literal("1d"), | ||
typebox_1.Type.Literal("1wk"), | ||
typebox_1.Type.Literal("1mo"), | ||
])), | ||
// events: Type.Optional(Type.String()), | ||
events: typebox_1.Type.Optional(typebox_1.Type.Union([ | ||
typebox_1.Type.Literal("history"), | ||
typebox_1.Type.Literal("dividends"), | ||
typebox_1.Type.Literal("split"), | ||
])), | ||
includeAdjustedClose: typebox_1.Type.Optional(typebox_1.Type.Boolean()), | ||
}, { title: "HistoricalOptions" }); | ||
const HistoricalOptionsEventsHistorySchema = typebox_1.Type.Composite([ | ||
HistoricalOptionsSchema, | ||
typebox_1.Type.Object({ | ||
events: typebox_1.Type.Optional(typebox_1.Type.Literal("history")), | ||
}), | ||
], { title: "HistoricalOptionsEventsHistory" }); | ||
const HistoricalOptionsEventsDividendsSchema = typebox_1.Type.Composite([ | ||
HistoricalOptionsSchema, | ||
typebox_1.Type.Object({ | ||
events: typebox_1.Type.Literal("dividends"), | ||
}), | ||
], { title: "HistoricalOptionsEventsDividends" }); | ||
const HistoricalOptionsEventsSplitSchema = typebox_1.Type.Composite([ | ||
HistoricalOptionsSchema, | ||
typebox_1.Type.Object({ | ||
events: typebox_1.Type.Literal("split"), | ||
}), | ||
], { title: "HistoricalOptionsEventsSplit" }); | ||
const HistoricalHistoryResultSchema = typebox_1.Type.Array(HistoricalRowHistory, { | ||
title: "HistoricalHistoryResult", | ||
}); | ||
const HistoricalDividendsResultSchema = typebox_1.Type.Array(HistoricalRowDividend, { | ||
title: "HistoricalDividendsResult", | ||
}); | ||
const HistoricalStockSplitsResultSchema = typebox_1.Type.Array(HistoricalRowStockSplit, { | ||
title: "HistoricalRowStockSplit", | ||
}); | ||
const queryOptionsDefaults = { | ||
@@ -9,91 +90,174 @@ interval: "1d", | ||
function historical(symbol, queryOptionsOverrides, moduleOptions) { | ||
let schemaKey; | ||
if (!queryOptionsOverrides.events || | ||
queryOptionsOverrides.events === "history") | ||
schemaKey = "#/definitions/HistoricalHistoryResult"; | ||
else if (queryOptionsOverrides.events === "dividends") | ||
schemaKey = "#/definitions/HistoricalDividendsResult"; | ||
else if (queryOptionsOverrides.events === "split") | ||
schemaKey = "#/definitions/HistoricalStockSplitsResult"; | ||
else | ||
throw new Error("No such event type:" + queryOptionsOverrides.events); | ||
return this._moduleExec({ | ||
moduleName: "historical", | ||
query: { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a, _b, _c, _d; | ||
(0, notices_js_1.showNotice)("ripHistorical"); | ||
(0, validateAndCoerceTypes_js_1.default)({ | ||
type: "options", | ||
data: queryOptionsOverrides !== null && queryOptionsOverrides !== void 0 ? queryOptionsOverrides : {}, | ||
schema: HistoricalOptionsSchema, | ||
options: this._opts.validation, | ||
}); | ||
let schema; | ||
if (!queryOptionsOverrides.events || | ||
queryOptionsOverrides.events === "history") | ||
schema = HistoricalHistoryResultSchema; | ||
else if (queryOptionsOverrides.events === "dividends") | ||
schema = HistoricalDividendsResultSchema; | ||
else if (queryOptionsOverrides.events === "split") | ||
schema = HistoricalStockSplitsResultSchema; | ||
else | ||
throw new Error("No such event type:" + queryOptionsOverrides.events); | ||
const queryOpts = Object.assign(Object.assign({}, queryOptionsDefaults), queryOptionsOverrides); | ||
if (!value_1.Value.Check(HistoricalOptionsSchema, queryOpts)) | ||
throw new Error("Internal error, please report. Overrides validated but not defaults?"); | ||
// Don't forget that queryOpts are already validated and safe-safe. | ||
const eventsMap = { history: "", dividends: "div", split: "split" }; | ||
const chartQueryOpts = { | ||
period1: queryOpts.period1, | ||
period2: queryOpts.period2, | ||
interval: queryOpts.interval, | ||
events: eventsMap[queryOpts.events || "history"], | ||
}; | ||
if (!value_1.Value.Check(chart_js_1.ChartOptionsSchema, chartQueryOpts)) | ||
throw new Error("Internal error, please report. historical() provided invalid chart() query options."); | ||
// TODO: do we even care? | ||
if (queryOpts.includeAdjustedClose === false) { | ||
/* */ | ||
} | ||
const result = yield this.chart(symbol, chartQueryOpts, Object.assign(Object.assign({}, moduleOptions), { validateResult: true })); | ||
let out; | ||
if (queryOpts.events === "dividends") { | ||
out = ((_b = (_a = result.events) === null || _a === void 0 ? void 0 : _a.dividends) !== null && _b !== void 0 ? _b : []).map((d) => ({ | ||
date: d.date, | ||
dividends: d.amount, | ||
})); | ||
} | ||
else if (queryOpts.events === "split") { | ||
out = ((_d = (_c = result.events) === null || _c === void 0 ? void 0 : _c.splits) !== null && _d !== void 0 ? _d : []).map((s) => ({ | ||
date: s.date, | ||
stockSplits: s.splitRatio, | ||
})); | ||
} | ||
else { | ||
out = result.quotes; | ||
} | ||
const validateResult = !moduleOptions || | ||
moduleOptions.validateResult === undefined || | ||
moduleOptions.validateResult === true; | ||
const validationOpts = Object.assign(Object.assign({}, this._opts.validation), { | ||
// Set logErrors=false if validateResult=false | ||
logErrors: validateResult ? this._opts.validation.logErrors : false }); | ||
try { | ||
(0, validateAndCoerceTypes_js_1.default)({ | ||
type: "result", | ||
data: out, | ||
schema, | ||
options: validationOpts, | ||
}); | ||
} | ||
catch (error) { | ||
if (validateResult) | ||
throw error; | ||
} | ||
return out; | ||
/* | ||
// Original historical() retrieval code when Yahoo API still existed. | ||
return this._moduleExec({ | ||
moduleName: "historical", | ||
query: { | ||
assertSymbol: symbol, | ||
url: "https://${YF_QUERY_HOST}/v7/finance/download/" + symbol, | ||
schemaKey: "#/definitions/HistoricalOptions", | ||
schema: HistoricalOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
overrides: queryOptionsOverrides, | ||
fetchType: "csv", | ||
transformWith(queryOptions) { | ||
if (!queryOptions.period2) | ||
queryOptions.period2 = new Date(); | ||
const dates = ["period1", "period2"]; | ||
for (const fieldName of dates) { | ||
const value = queryOptions[fieldName]; | ||
if (value instanceof Date) | ||
queryOptions[fieldName] = Math.floor(value.getTime() / 1000); | ||
else if (typeof value === "string") { | ||
const timestamp = new Date(value).getTime(); | ||
if (isNaN(timestamp)) | ||
throw new Error("yahooFinance.historical() option '" + | ||
fieldName + | ||
"' invalid date provided: '" + | ||
value + | ||
"'"); | ||
queryOptions[fieldName] = Math.floor(timestamp / 1000); | ||
} | ||
transformWith(queryOptions: HistoricalOptions) { | ||
if (!queryOptions.period2) queryOptions.period2 = new Date(); | ||
const dates = ["period1", "period2"] as const; | ||
for (const fieldName of dates) { | ||
const value = queryOptions[fieldName]; | ||
if (value instanceof Date) | ||
queryOptions[fieldName] = Math.floor(value.getTime() / 1000); | ||
else if (typeof value === "string") { | ||
const timestamp = new Date(value as string).getTime(); | ||
if (isNaN(timestamp)) | ||
throw new Error( | ||
"yahooFinance.historical() option '" + | ||
fieldName + | ||
"' invalid date provided: '" + | ||
value + | ||
"'", | ||
); | ||
queryOptions[fieldName] = Math.floor(timestamp / 1000); | ||
} | ||
if (queryOptions.period1 === queryOptions.period2) { | ||
throw new Error("yahooFinance.historical() options `period1` and `period2` " + | ||
"cannot share the same value."); | ||
} | ||
return queryOptions; | ||
} | ||
if (queryOptions.period1 === queryOptions.period2) { | ||
throw new Error( | ||
"yahooFinance.historical() options `period1` and `period2` " + | ||
"cannot share the same value.", | ||
); | ||
} | ||
return queryOptions; | ||
}, | ||
}, | ||
result: { | ||
schemaKey, | ||
transformWith(result) { | ||
if (result.length === 0) | ||
return result; | ||
const filteredResults = []; | ||
const fieldCount = Object.keys(result[0]).length; | ||
// Count number of null values in object (1-level deep) | ||
function nullFieldCount(object) { | ||
let nullCount = 0; | ||
for (const val of Object.values(object)) | ||
if (val === null) | ||
nullCount++; | ||
return nullCount; | ||
}, | ||
result: { | ||
schema, | ||
transformWith(result: any) { | ||
if (result.length === 0) return result; | ||
const filteredResults = []; | ||
const fieldCount = Object.keys(result[0]).length; | ||
// Count number of null values in object (1-level deep) | ||
function nullFieldCount(object: unknown) { | ||
if (object == null) { | ||
return; | ||
} | ||
for (const row of result) { | ||
const nullCount = nullFieldCount(row); | ||
if (nullCount === 0) { | ||
// No nulls is a legit (regular) result | ||
filteredResults.push(row); | ||
} | ||
else if (nullCount !== fieldCount - 1 /* skip "date" */) { | ||
// Unhandled case: some but not all values are null. | ||
// Note: no need to check for null "date", validation does it for us | ||
console.error(nullCount, row); | ||
throw new Error("Historical returned a result with SOME (but not " + | ||
"all) null values. Please report this, and provide the " + | ||
"query that caused it."); | ||
} | ||
else { | ||
// All fields (except "date") are null: silently skip (no-op) | ||
} | ||
} | ||
/* | ||
* We may consider, for future optimization, to count rows and create | ||
* new array in advance, and skip consecutive blocks of null results. | ||
* Of doubtful utility. | ||
*/ | ||
return filteredResults; | ||
}, | ||
}, | ||
moduleOptions, | ||
let nullCount = 0; | ||
for (const val of Object.values(object)) | ||
if (val === null) nullCount++; | ||
return nullCount; | ||
} | ||
for (const row of result) { | ||
const nullCount = nullFieldCount(row); | ||
if (nullCount === 0) { | ||
// No nulls is a legit (regular) result | ||
filteredResults.push(row); | ||
} else if (nullCount !== fieldCount - 1 /* skip "date" */ /*) { | ||
// Unhandled case: some but not all values are null. | ||
// Note: no need to check for null "date", validation does it for us | ||
console.error(nullCount, row); | ||
throw new Error( | ||
"Historical returned a result with SOME (but not " + | ||
"all) null values. Please report this, and provide the " + | ||
"query that caused it.", | ||
); | ||
} else { | ||
// All fields (except "date") are null: silently skip (no-op) | ||
} | ||
} | ||
/* | ||
* We may consider, for future optimization, to count rows and create | ||
* new array in advance, and skip consecutive blocks of null results. | ||
* Of doubtful utility. | ||
*/ /* | ||
return filteredResults; | ||
}, | ||
}, | ||
moduleOptions, | ||
}); | ||
*/ | ||
}); | ||
} | ||
exports.default = historical; |
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
import type { DateInMs } from "../lib/commonTypes.js"; | ||
export interface InsightsResult { | ||
[key: string]: any; | ||
symbol: string; | ||
instrumentInfo?: InsightsInstrumentInfo; | ||
companySnapshot?: InsightsCompanySnapshot; | ||
recommendation?: { | ||
targetPrice?: number; | ||
provider: string; | ||
rating: "BUY" | "SELL" | "HOLD"; | ||
}; | ||
events?: InsightsEvent[]; | ||
reports?: InsightsReport[]; | ||
sigDevs: InsightsSigDev[]; | ||
upsell?: InsightsUpsell; | ||
upsellSearchDD?: { | ||
researchReports: InsightsResearchReport; | ||
}; | ||
secReports?: InsightsSecReport[]; | ||
} | ||
export interface InsightsSigDev { | ||
[key: string]: any; | ||
headline: string; | ||
date: Date; | ||
} | ||
export interface InsightsReport { | ||
[key: string]: any; | ||
id: string; | ||
headHtml: string; | ||
provider: string; | ||
reportDate: Date; | ||
reportTitle: string; | ||
reportType: string; | ||
targetPrice?: number; | ||
targetPriceStatus?: "Increased" | "Maintained" | "Decreased" | "-"; | ||
investmentRating?: "Bullish" | "Neutral" | "Bearish"; | ||
tickers?: string[]; | ||
} | ||
export interface InsightsResearchReport { | ||
reportId: string; | ||
provider: string; | ||
title: string; | ||
reportDate: Date; | ||
summary: string; | ||
investmentRating?: "Bullish" | "Neutral" | "Bearish"; | ||
} | ||
export interface InsightsSecReport { | ||
id: string; | ||
type: string; | ||
title: string; | ||
description: string; | ||
filingDate: DateInMs; | ||
snapshotUrl: string; | ||
formType: string; | ||
} | ||
export interface InsightsEvent { | ||
[key: string]: any; | ||
eventType: string; | ||
pricePeriod: string; | ||
tradingHorizon: string; | ||
tradeType: string; | ||
imageUrl: string; | ||
startDate: Date; | ||
endDate: Date; | ||
} | ||
import { Static } from "@sinclair/typebox"; | ||
declare const InsightsOutlookSchema: import("@sinclair/typebox").TObject<{ | ||
stateDescription: import("@sinclair/typebox").TString; | ||
direction: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
scoreDescription: import("@sinclair/typebox").TString; | ||
sectorDirection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>>; | ||
sectorScore: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sectorScoreDescription: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
indexDirection: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
indexScore: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
indexScoreDescription: import("@sinclair/typebox").TString; | ||
}>; | ||
declare const InsightsResultSchema: import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
instrumentInfo: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
keyTechnicals: import("@sinclair/typebox").TObject<{ | ||
provider: import("@sinclair/typebox").TString; | ||
support: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
resistance: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
stopLoss: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>; | ||
technicalEvents: import("@sinclair/typebox").TObject<{ | ||
provider: import("@sinclair/typebox").TString; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortTermOutlook: import("@sinclair/typebox").TObject<{ | ||
stateDescription: import("@sinclair/typebox").TString; | ||
direction: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
scoreDescription: import("@sinclair/typebox").TString; | ||
sectorDirection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>>; | ||
sectorScore: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sectorScoreDescription: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
indexDirection: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
indexScore: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
indexScoreDescription: import("@sinclair/typebox").TString; | ||
}>; | ||
intermediateTermOutlook: import("@sinclair/typebox").TObject<{ | ||
stateDescription: import("@sinclair/typebox").TString; | ||
direction: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
scoreDescription: import("@sinclair/typebox").TString; | ||
sectorDirection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>>; | ||
sectorScore: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sectorScoreDescription: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
indexDirection: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
indexScore: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
indexScoreDescription: import("@sinclair/typebox").TString; | ||
}>; | ||
longTermOutlook: import("@sinclair/typebox").TObject<{ | ||
stateDescription: import("@sinclair/typebox").TString; | ||
direction: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
scoreDescription: import("@sinclair/typebox").TString; | ||
sectorDirection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>>; | ||
sectorScore: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sectorScoreDescription: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
indexDirection: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
indexScore: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
indexScoreDescription: import("@sinclair/typebox").TString; | ||
}>; | ||
}>; | ||
valuation: import("@sinclair/typebox").TObject<{ | ||
color: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
discount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
provider: import("@sinclair/typebox").TString; | ||
relativeValue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
}>; | ||
}>>; | ||
companySnapshot: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
sectorInfo: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
company: import("@sinclair/typebox").TObject<{ | ||
innovativeness: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
hiring: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sustainability: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
insiderSentiments: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
earningsReports: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dividends: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>; | ||
sector: import("@sinclair/typebox").TObject<{ | ||
innovativeness: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
hiring: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sustainability: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
insiderSentiments: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
earningsReports: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dividends: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
}>>; | ||
recommendation: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
targetPrice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
provider: import("@sinclair/typebox").TString; | ||
rating: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"BUY">, import("@sinclair/typebox").TLiteral<"SELL">, import("@sinclair/typebox").TLiteral<"HOLD">]>; | ||
}>>; | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
eventType: import("@sinclair/typebox").TString; | ||
pricePeriod: import("@sinclair/typebox").TString; | ||
tradingHorizon: import("@sinclair/typebox").TString; | ||
tradeType: import("@sinclair/typebox").TString; | ||
imageUrl: import("@sinclair/typebox").TString; | ||
startDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
endDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
}>>>; | ||
reports: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
id: import("@sinclair/typebox").TString; | ||
headHtml: import("@sinclair/typebox").TString; | ||
provider: import("@sinclair/typebox").TString; | ||
reportDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
reportTitle: import("@sinclair/typebox").TString; | ||
reportType: import("@sinclair/typebox").TString; | ||
targetPrice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
targetPriceStatus: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Increased">, import("@sinclair/typebox").TLiteral<"Maintained">, import("@sinclair/typebox").TLiteral<"Decreased">, import("@sinclair/typebox").TLiteral<"-">]>>; | ||
investmentRating: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">, import("@sinclair/typebox").TLiteral<"Bearish">]>>; | ||
tickers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>; | ||
}>>>; | ||
sigDevs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
headline: import("@sinclair/typebox").TString; | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
}>>>; | ||
upsell: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
msBullishSummary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>; | ||
msBearishSummary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>; | ||
msBullishBearishSummariesPublishDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>>; | ||
companyName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
upsellReportType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
}>>; | ||
upsellSearchDD: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
researchReports: import("@sinclair/typebox").TObject<{ | ||
reportId: import("@sinclair/typebox").TString; | ||
provider: import("@sinclair/typebox").TString; | ||
title: import("@sinclair/typebox").TString; | ||
reportDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
summary: import("@sinclair/typebox").TString; | ||
investmentRating: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">, import("@sinclair/typebox").TLiteral<"Bearish">]>>; | ||
}>; | ||
}>>; | ||
secReports: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
id: import("@sinclair/typebox").TString; | ||
type: import("@sinclair/typebox").TString; | ||
title: import("@sinclair/typebox").TString; | ||
description: import("@sinclair/typebox").TString; | ||
filingDate: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
snapshotUrl: import("@sinclair/typebox").TString; | ||
formType: import("@sinclair/typebox").TString; | ||
}>>>; | ||
}>; | ||
type InsightsResult = Static<typeof InsightsResultSchema>; | ||
type InsightsOutlook = Static<typeof InsightsOutlookSchema>; | ||
export interface InsightsInstrumentInfo { | ||
@@ -115,30 +268,12 @@ [key: string]: any; | ||
} | ||
export type InsightsDirection = "Bearish" | "Bullish" | "Neutral"; | ||
export interface InsightsOutlook { | ||
[key: string]: any; | ||
stateDescription: string; | ||
direction: InsightsDirection; | ||
score: number; | ||
scoreDescription: string; | ||
sectorDirection?: InsightsDirection; | ||
sectorScore?: number; | ||
sectorScoreDescription?: string; | ||
indexDirection: InsightsDirection; | ||
indexScore: number; | ||
indexScoreDescription: string; | ||
} | ||
export interface InsightsUpsell { | ||
[key: string]: any; | ||
msBullishSummary?: Array<string>; | ||
msBearishSummary?: Array<string>; | ||
msBullishBearishSummariesPublishDate?: DateInMs; | ||
companyName?: string; | ||
upsellReportType?: string; | ||
} | ||
export interface InsightsOptions { | ||
lang?: string; | ||
region?: string; | ||
reportsCount?: number; | ||
} | ||
declare const InsightsOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
region: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
reportsCount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>; | ||
type InsightsOptions = Static<typeof InsightsOptionsSchema>; | ||
export default function trendingSymbols(this: ModuleThis, symbol: string, queryOptionsOverrides?: InsightsOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<InsightsResult>; | ||
export default function trendingSymbols(this: ModuleThis, symbol: string, queryOptionsOverrides?: InsightsOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const yahooFinanceTypes_js_1 = require("../lib/yahooFinanceTypes.js"); | ||
const InsightsDirection = typebox_1.Type.Union([typebox_1.Type.Literal("Bearish"), typebox_1.Type.Literal("Bullish"), typebox_1.Type.Literal("Neutral")], { title: "InsightsDirection" }); | ||
const InsightsOutlookSchema = typebox_1.Type.Object({ | ||
stateDescription: typebox_1.Type.String(), | ||
direction: InsightsDirection, | ||
score: yahooFinanceTypes_js_1.YahooNumber, | ||
scoreDescription: typebox_1.Type.String(), | ||
sectorDirection: typebox_1.Type.Optional(InsightsDirection), | ||
sectorScore: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
sectorScoreDescription: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
indexDirection: InsightsDirection, | ||
indexScore: yahooFinanceTypes_js_1.YahooNumber, | ||
indexScoreDescription: typebox_1.Type.String(), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "InsightsOutlook", | ||
}); | ||
const InsightsInstrumentInfo = typebox_1.Type.Object({ | ||
keyTechnicals: typebox_1.Type.Object({ | ||
provider: typebox_1.Type.String(), | ||
support: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
resistance: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
stopLoss: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}), | ||
technicalEvents: typebox_1.Type.Object({ | ||
provider: typebox_1.Type.String(), | ||
sector: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
shortTermOutlook: InsightsOutlookSchema, | ||
intermediateTermOutlook: InsightsOutlookSchema, | ||
longTermOutlook: InsightsOutlookSchema, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}), | ||
valuation: typebox_1.Type.Object({ | ||
color: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
description: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
discount: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
provider: typebox_1.Type.String(), | ||
relativeValue: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "InsightsInstrumentInfo", | ||
}); | ||
const InsightsCompanySnapshot = typebox_1.Type.Object({ | ||
sectorInfo: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
company: typebox_1.Type.Object({ | ||
innovativeness: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
hiring: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
sustainability: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
insiderSentiments: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
earningsReports: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
dividends: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}), | ||
sector: typebox_1.Type.Object({ | ||
innovativeness: yahooFinanceTypes_js_1.YahooNumber, | ||
hiring: yahooFinanceTypes_js_1.YahooNumber, | ||
sustainability: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
insiderSentiments: yahooFinanceTypes_js_1.YahooNumber, | ||
earningsReports: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
dividends: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}), | ||
}, { title: "InsightsCompanySnapshot", additionalProperties: typebox_1.Type.Any() }); | ||
const InsightsEventSchema = typebox_1.Type.Object({ | ||
eventType: typebox_1.Type.String(), | ||
pricePeriod: typebox_1.Type.String(), | ||
tradingHorizon: typebox_1.Type.String(), | ||
tradeType: typebox_1.Type.String(), | ||
imageUrl: typebox_1.Type.String(), | ||
startDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
endDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
}, { title: "InsightsEvent", additionalProperties: typebox_1.Type.Any() }); | ||
const InsightsReport = typebox_1.Type.Object({ | ||
id: typebox_1.Type.String(), | ||
headHtml: typebox_1.Type.String(), | ||
provider: typebox_1.Type.String(), | ||
reportDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
reportTitle: typebox_1.Type.String(), | ||
reportType: typebox_1.Type.String(), | ||
targetPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
targetPriceStatus: typebox_1.Type.Optional(typebox_1.Type.Union([ | ||
typebox_1.Type.Literal("Increased"), | ||
typebox_1.Type.Literal("Maintained"), | ||
typebox_1.Type.Literal("Decreased"), | ||
typebox_1.Type.Literal("-"), | ||
])), | ||
investmentRating: typebox_1.Type.Optional(typebox_1.Type.Union([ | ||
typebox_1.Type.Literal("Bullish"), | ||
typebox_1.Type.Literal("Neutral"), | ||
typebox_1.Type.Literal("Bearish"), | ||
])), | ||
tickers: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())), | ||
}, { title: "InsightsReport", additionalProperties: typebox_1.Type.Any() }); | ||
const InsightsSigDev = typebox_1.Type.Object({ | ||
headline: typebox_1.Type.String(), | ||
date: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
}, { title: "InsightsSigDev", additionalProperties: typebox_1.Type.Any() }); | ||
const InsightsUpsell = typebox_1.Type.Object({ | ||
msBullishSummary: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())), | ||
msBearishSummary: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())), | ||
msBullishBearishSummariesPublishDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooDateInMs), | ||
companyName: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
upsellReportType: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
}, { title: "InsightsUpsell", additionalProperties: typebox_1.Type.Any() }); | ||
const InsightsResearchReport = typebox_1.Type.Object({ | ||
reportId: typebox_1.Type.String(), | ||
provider: typebox_1.Type.String(), | ||
title: typebox_1.Type.String(), | ||
reportDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
summary: typebox_1.Type.String(), | ||
investmentRating: typebox_1.Type.Optional(typebox_1.Type.Union([ | ||
typebox_1.Type.Literal("Bullish"), | ||
typebox_1.Type.Literal("Neutral"), | ||
typebox_1.Type.Literal("Bearish"), | ||
])), | ||
}, { title: "InsightsResearchReport" }); | ||
const InsightsSecReport = typebox_1.Type.Object({ | ||
id: typebox_1.Type.String(), | ||
type: typebox_1.Type.String(), | ||
title: typebox_1.Type.String(), | ||
description: typebox_1.Type.String(), | ||
filingDate: yahooFinanceTypes_js_1.YahooDateInMs, | ||
snapshotUrl: typebox_1.Type.String(), | ||
formType: typebox_1.Type.String(), | ||
}, { | ||
title: "InsightsSecReport", | ||
additionalProperties: typebox_1.Type.Any(), | ||
}); | ||
const InsightsResultSchema = typebox_1.Type.Object({ | ||
symbol: typebox_1.Type.String(), | ||
instrumentInfo: typebox_1.Type.Optional(InsightsInstrumentInfo), | ||
companySnapshot: typebox_1.Type.Optional(InsightsCompanySnapshot), | ||
recommendation: typebox_1.Type.Optional(typebox_1.Type.Object({ | ||
targetPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
provider: typebox_1.Type.String(), | ||
rating: typebox_1.Type.Union([ | ||
typebox_1.Type.Literal("BUY"), | ||
typebox_1.Type.Literal("SELL"), | ||
typebox_1.Type.Literal("HOLD"), | ||
]), | ||
})), | ||
events: typebox_1.Type.Optional(typebox_1.Type.Array(InsightsEventSchema)), | ||
reports: typebox_1.Type.Optional(typebox_1.Type.Array(InsightsReport)), | ||
sigDevs: typebox_1.Type.Optional(typebox_1.Type.Array(InsightsSigDev)), | ||
upsell: typebox_1.Type.Optional(InsightsUpsell), | ||
upsellSearchDD: typebox_1.Type.Optional(typebox_1.Type.Object({ | ||
researchReports: InsightsResearchReport, | ||
})), | ||
secReports: typebox_1.Type.Optional(typebox_1.Type.Array(InsightsSecReport)), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "InsightsResult", | ||
}); | ||
const InsightsOptionsSchema = typebox_1.Type.Object({ | ||
lang: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
region: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
reportsCount: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { title: "InsightsOptions" }); | ||
const queryOptionsDefaults = { | ||
@@ -15,3 +182,3 @@ lang: "en-US", | ||
url: "https://${YF_QUERY_HOST}/ws/insights/v2/finance/insights", | ||
schemaKey: "#/definitions/InsightsOptions", | ||
schema: InsightsOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
@@ -22,3 +189,3 @@ overrides: queryOptionsOverrides, | ||
result: { | ||
schemaKey: "#/definitions/InsightsResult", | ||
schema: InsightsResultSchema, | ||
transformWith(result) { | ||
@@ -25,0 +192,0 @@ if (!result.finance) |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const yahooFinanceTypes_js_1 = require("../lib/yahooFinanceTypes.js"); | ||
const quote_js_1 = require("./quote.js"); | ||
const value_1 = require("@sinclair/typebox/value"); | ||
/* | ||
* [TODO] Fields seen in a query but not in this module yet: | ||
* | ||
* - extendedMarketChange | ||
* - extendedMarketChangePercent | ||
* - extendedMarketPrice | ||
* - extendedMarketTime | ||
* - dayHigh (separate to regularMarketDayHigh, etc) | ||
* - dayLow (separate to regularMarketDayLow, etc) | ||
* - volume (separate to regularMarketVolume, etc) | ||
* | ||
* i.e. on yahoo site, with ?fields=dayHigh,dayLow,etc. | ||
*/ | ||
/* | ||
* Guaranteed fields, even we don't ask for them | ||
*/ | ||
const QuoteCryptoCurrency = typebox_1.Type.Composite([ | ||
quote_js_1.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("CRYPTOCURRENCY"), | ||
circulatingSupply: yahooFinanceTypes_js_1.YahooNumber, | ||
fromCurrency: typebox_1.Type.String(), // 'BTC' | ||
toCurrency: typebox_1.Type.String(), // 'USD=X' | ||
lastMarket: typebox_1.Type.String(), // 'CoinMarketCap' | ||
coinImageUrl: typebox_1.Type.Optional(typebox_1.Type.String()), // 'https://s.yimg.com/uc/fin/img/reports-thumbnails/1.png' | ||
volume24Hr: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 62631043072 | ||
volumeAllCurrencies: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 62631043072 | ||
startDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // new Date(1367103600 * 1000) | ||
}), | ||
], { title: "QuoteCryptoCurrency" }); | ||
const QuoteCurrency = typebox_1.Type.Composite([ | ||
quote_js_1.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("CURRENCY"), | ||
}), | ||
], { title: "QuoteCurrency" }); | ||
const QuoteEtf = typebox_1.Type.Composite([ | ||
quote_js_1.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("ETF"), | ||
}), | ||
]); | ||
const QuoteEquity = typebox_1.Type.Composite([ | ||
quote_js_1.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("EQUITY"), | ||
dividendRate: typebox_1.Type.Optional(typebox_1.Type.Number()), | ||
dividendYield: typebox_1.Type.Optional(typebox_1.Type.Number()), | ||
}), | ||
], { title: "QuoteEquity" }); | ||
const QuoteFuture = typebox_1.Type.Composite([ | ||
quote_js_1.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("FUTURE"), | ||
headSymbolAsString: typebox_1.Type.String(), | ||
contractSymbol: typebox_1.Type.Boolean(), | ||
underlyingExchangeSymbol: typebox_1.Type.String(), | ||
expireDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
expireIsoDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
}), | ||
], { | ||
title: "QuoteFuture", | ||
}); | ||
const QuoteIndex = typebox_1.Type.Composite([ | ||
quote_js_1.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("INDEX"), | ||
}), | ||
], { | ||
title: "QuoteIndex", | ||
}); | ||
const QuoteOption = typebox_1.Type.Composite([ | ||
quote_js_1.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("OPTION"), | ||
strike: yahooFinanceTypes_js_1.YahooNumber, | ||
openInterest: yahooFinanceTypes_js_1.YahooNumber, | ||
expireDate: yahooFinanceTypes_js_1.YahooNumber, | ||
expireIsoDate: yahooFinanceTypes_js_1.YahooNumber, | ||
underlyingSymbol: typebox_1.Type.String(), | ||
}), | ||
], { | ||
title: "QuoteOption", | ||
}); | ||
const QuoteMutualfund = typebox_1.Type.Composite([ | ||
quote_js_1.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("MUTUALFUND"), | ||
}), | ||
], { | ||
title: "QuoteMutualFund", | ||
}); | ||
const QuoteSchema = typebox_1.Type.Union([ | ||
QuoteCryptoCurrency, | ||
QuoteCurrency, | ||
QuoteEtf, | ||
QuoteEquity, | ||
QuoteFuture, | ||
QuoteIndex, | ||
QuoteMutualfund, | ||
QuoteOption, | ||
], { | ||
title: "Quote", | ||
}); | ||
const CallOrPut = typebox_1.Type.Object({ | ||
contractSymbol: typebox_1.Type.String(), | ||
strike: yahooFinanceTypes_js_1.YahooNumber, | ||
currency: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
lastPrice: yahooFinanceTypes_js_1.YahooNumber, | ||
change: yahooFinanceTypes_js_1.YahooNumber, | ||
percentChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
volume: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
openInterest: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
bid: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
ask: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
contractSize: typebox_1.Type.Literal("REGULAR"), | ||
expiration: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
lastTradeDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
impliedVolatility: yahooFinanceTypes_js_1.YahooNumber, | ||
inTheMoney: typebox_1.Type.Boolean(), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "CallOrPut", | ||
}); | ||
const Option = typebox_1.Type.Object({ | ||
expirationDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
hasMiniOptions: typebox_1.Type.Boolean(), | ||
calls: typebox_1.Type.Array(CallOrPut), | ||
puts: typebox_1.Type.Array(CallOrPut), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "Option", | ||
}); | ||
const OptionsResultSchema = typebox_1.Type.Object({ | ||
underlyingSymbol: typebox_1.Type.String(), | ||
expirationDates: typebox_1.Type.Array(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
strikes: typebox_1.Type.Array(yahooFinanceTypes_js_1.YahooNumber), | ||
hasMiniOptions: typebox_1.Type.Boolean(), | ||
quote: QuoteSchema, | ||
options: typebox_1.Type.Array(Option), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "OptionsResult", | ||
}); | ||
const OptionsOptionsSchema = typebox_1.Type.Object({ | ||
formatted: typebox_1.Type.Optional(typebox_1.Type.Boolean()), | ||
lang: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
region: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
date: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
}, { | ||
title: "OptionsOptions", | ||
}); | ||
const queryOptionsDefaults = { | ||
@@ -15,17 +171,10 @@ formatted: false, | ||
needsCrumb: true, | ||
schemaKey: "#/definitions/OptionsOptions", | ||
schema: OptionsOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
overrides: queryOptionsOverrides, | ||
transformWith(queryOptions) { | ||
const date = queryOptions.date; | ||
if (date) { | ||
// yfDate will convert valid number/string to Date. | ||
if (date instanceof Date) { | ||
// now we convert back to unix epoch in seconds for query | ||
queryOptions.date = Math.floor(date.getTime() / 1000); | ||
} | ||
else { | ||
// yfDate didn't recognize it as a date. | ||
throw new Error("Unsupported date type: " + date); | ||
} | ||
// This is honestly the easiest way to coerce the date properly | ||
const parsed = value_1.Value.Decode(OptionsOptionsSchema, queryOptions); | ||
if (parsed.date) { | ||
queryOptions.date = Math.floor(parsed.date.getTime() / 1000); | ||
} | ||
@@ -36,3 +185,3 @@ return queryOptions; | ||
result: { | ||
schemaKey: "#/definitions/OptionsResult", | ||
schema: OptionsResultSchema, | ||
transformWith(result) { | ||
@@ -39,0 +188,0 @@ if (!result.optionChain) |
@@ -12,2 +12,236 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.QuoteOptionsSchema = exports.QuoteBase = void 0; | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const yahooFinanceTypes_js_1 = require("../lib/yahooFinanceTypes.js"); | ||
exports.QuoteBase = typebox_1.Type.Object({ | ||
language: typebox_1.Type.String(), // "en-US", | ||
region: typebox_1.Type.String(), // "US", | ||
quoteType: typebox_1.Type.String(), // "EQUITY" | "ETF" | "MUTUALFUND"; | ||
typeDisp: typebox_1.Type.Optional(typebox_1.Type.String()), // "Equity", not always present. | ||
quoteSourceName: typebox_1.Type.Optional(typebox_1.Type.String()), // "Delayed Quote", | ||
triggerable: typebox_1.Type.Boolean(), // true, | ||
currency: typebox_1.Type.Optional(typebox_1.Type.String()), // "USD", | ||
// Seems to appear / disappear based not on symbol but network load (#445) | ||
customPriceAlertConfidence: typebox_1.Type.Optional(typebox_1.Type.String()), // "HIGH" | "LOW"; TODO: anything else? | ||
marketState: typebox_1.Type.Union([ | ||
typebox_1.Type.Literal("REGULAR"), | ||
typebox_1.Type.Literal("CLOSED"), | ||
typebox_1.Type.Literal("PRE"), | ||
typebox_1.Type.Literal("PREPRE"), | ||
typebox_1.Type.Literal("POST"), | ||
typebox_1.Type.Literal("POSTPOST"), | ||
]), | ||
tradeable: typebox_1.Type.Boolean(), // false, | ||
cryptoTradeable: typebox_1.Type.Optional(typebox_1.Type.Boolean()), // false | ||
exchange: typebox_1.Type.String(), // "NMS", | ||
shortName: typebox_1.Type.Optional(typebox_1.Type.String()), // "NVIDIA Corporation", | ||
longName: typebox_1.Type.Optional(typebox_1.Type.String()), // "NVIDIA Corporation", | ||
messageBoardId: typebox_1.Type.Optional(typebox_1.Type.String()), // "finmb_32307", | ||
exchangeTimezoneName: typebox_1.Type.String(), // "America/New_York", | ||
exchangeTimezoneShortName: typebox_1.Type.String(), // "EST", | ||
gmtOffSetMilliseconds: yahooFinanceTypes_js_1.YahooNumber, // -18000000, | ||
market: typebox_1.Type.String(), // "us_market", | ||
esgPopulated: typebox_1.Type.Boolean(), // false, | ||
fiftyTwoWeekLowChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 362.96002, | ||
fiftyTwoWeekLowChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 2.0088556, | ||
fiftyTwoWeekRange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooTwoNumberRange), // "180.68 - 589.07" -> { low, high } | ||
fiftyTwoWeekHighChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // -45.429993, | ||
fiftyTwoWeekHighChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // -0.07712155, | ||
fiftyTwoWeekLow: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 180.68, | ||
fiftyTwoWeekHigh: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 589.07, | ||
fiftyTwoWeekChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 22.604025 | ||
dividendDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // 1609200000, | ||
// maybe always present on EQUITY? | ||
earningsTimestamp: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // 1614200400, | ||
earningsTimestampStart: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // 1614200400, | ||
earningsTimestampEnd: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // 1614200400, | ||
trailingAnnualDividendRate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 0.64, | ||
trailingPE: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 88.873634, | ||
trailingAnnualDividendYield: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 0.0011709387, | ||
epsTrailingTwelveMonths: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 6.117, | ||
epsForward: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 11.68, | ||
epsCurrentYear: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 9.72, | ||
priceEpsCurrentYear: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 55.930042, | ||
sharesOutstanding: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 619000000, | ||
bookValue: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 24.772, | ||
fiftyDayAverage: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 530.8828, | ||
fiftyDayAverageChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 12.757202, | ||
fiftyDayAverageChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 0.024030166, | ||
twoHundredDayAverage: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 515.8518, | ||
twoHundredDayAverageChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 27.788208, | ||
twoHundredDayAverageChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 0.053868588, | ||
marketCap: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 336513171456, | ||
forwardPE: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 46.54452, | ||
priceToBook: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 21.945745, | ||
sourceInterval: yahooFinanceTypes_js_1.YahooNumber, // 15, | ||
exchangeDataDelayedBy: yahooFinanceTypes_js_1.YahooNumber, // 0, | ||
firstTradeDateMilliseconds: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooDateInMs), // 917015400000 -> Date | ||
priceHint: yahooFinanceTypes_js_1.YahooNumber, // 2, | ||
postMarketChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 0.093813874, | ||
postMarketTime: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // 1612573179 -> new Date() | ||
postMarketPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 544.15, | ||
postMarketChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 0.51000977, | ||
regularMarketChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // -2.9299927, | ||
regularMarketChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // -0.53606904, | ||
regularMarketTime: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // 1612558802 -> new Date() | ||
regularMarketPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 543.64, | ||
regularMarketDayHigh: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 549.19, | ||
regularMarketDayRange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooTwoNumberRange), // "541.867 - 549.19" -> { low, high } | ||
regularMarketDayLow: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 541.867, | ||
regularMarketVolume: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 4228841, | ||
regularMarketPreviousClose: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 546.57, | ||
preMarketChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // -2.9299927, | ||
preMarketChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // -0.53606904, | ||
preMarketTime: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // 1612558802 -> new Date() | ||
preMarketPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 543.64, | ||
bid: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 543.84, | ||
ask: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 544.15, | ||
bidSize: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 18, | ||
askSize: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 8, | ||
fullExchangeName: typebox_1.Type.String(), // "NasdaqGS", | ||
financialCurrency: typebox_1.Type.Optional(typebox_1.Type.String()), // "USD", | ||
regularMarketOpen: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 549.0, | ||
averageDailyVolume3Month: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 7475022, | ||
averageDailyVolume10Day: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 5546385, | ||
displayName: typebox_1.Type.Optional(typebox_1.Type.String()), // "NVIDIA", | ||
symbol: typebox_1.Type.String(), // "NVDA" | ||
underlyingSymbol: typebox_1.Type.Optional(typebox_1.Type.String()), // "LD.MI" (for LDO.MI, #363) | ||
// only on ETF? not on EQUITY? | ||
ytdReturn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 0.31 | ||
trailingThreeMonthReturns: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 16.98 | ||
trailingThreeMonthNavReturns: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 17.08 | ||
ipoExpectedDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // "2020-08-13", | ||
newListingDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // "2021-02-16", | ||
nameChangeDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
prevName: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
averageAnalystRating: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
pageViewGrowthWeekly: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // Since 2021-11-11 (#326) | ||
openInterest: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // SOHO (#248) | ||
beta: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}); | ||
/* | ||
* [TODO] Fields seen in a query but not in this module yet: | ||
* | ||
* - extendedMarketChange | ||
* - extendedMarketChangePercent | ||
* - extendedMarketPrice | ||
* - extendedMarketTime | ||
* - dayHigh (separate to regularMarketDayHigh, etc) | ||
* - dayLow (separate to regularMarketDayLow, etc) | ||
* - volume (separaet to regularMarketVolume, etc) | ||
* | ||
* i.e. on yahoo site, with ?fields=dayHigh,dayLow,etc. | ||
*/ | ||
/* | ||
* Guaranteed fields, even we don't ask for them | ||
*/ | ||
const QuoteCryptoCurrency = typebox_1.Type.Composite([ | ||
exports.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("CRYPTOCURRENCY"), | ||
circulatingSupply: yahooFinanceTypes_js_1.YahooNumber, | ||
fromCurrency: typebox_1.Type.String(), // 'BTC' | ||
toCurrency: typebox_1.Type.String(), // 'USD=X' | ||
lastMarket: typebox_1.Type.String(), // 'CoinMarketCap' | ||
coinImageUrl: typebox_1.Type.Optional(typebox_1.Type.String()), // 'https://s.yimg.com/uc/fin/img/reports-thumbnails/1.png' | ||
volume24Hr: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 62631043072 | ||
volumeAllCurrencies: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 62631043072 | ||
startDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // new Date(1367103600 * 1000) | ||
}), | ||
]); | ||
const QuoteCurrency = typebox_1.Type.Composite([ | ||
exports.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("CURRENCY"), | ||
}), | ||
]); | ||
const QuoteEtf = typebox_1.Type.Composite([ | ||
exports.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("ETF"), | ||
}), | ||
]); | ||
const QuoteEquity = typebox_1.Type.Composite([ | ||
exports.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("EQUITY"), | ||
dividendRate: typebox_1.Type.Optional(typebox_1.Type.Number()), | ||
dividendYield: typebox_1.Type.Optional(typebox_1.Type.Number()), | ||
}), | ||
]); | ||
const QuoteFuture = typebox_1.Type.Composite([ | ||
exports.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("FUTURE"), | ||
headSymbolAsString: typebox_1.Type.String(), | ||
contractSymbol: typebox_1.Type.Boolean(), | ||
underlyingExchangeSymbol: typebox_1.Type.String(), | ||
expireDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
expireIsoDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
}), | ||
]); | ||
const QuoteIndex = typebox_1.Type.Composite([ | ||
exports.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("INDEX"), | ||
}), | ||
]); | ||
const QuoteOption = typebox_1.Type.Composite([ | ||
exports.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("OPTION"), | ||
strike: yahooFinanceTypes_js_1.YahooNumber, | ||
openInterest: yahooFinanceTypes_js_1.YahooNumber, | ||
expireDate: yahooFinanceTypes_js_1.YahooNumber, | ||
expireIsoDate: yahooFinanceTypes_js_1.YahooNumber, | ||
underlyingSymbol: typebox_1.Type.String(), | ||
}), | ||
]); | ||
const QuoteMutualfund = typebox_1.Type.Composite([ | ||
exports.QuoteBase, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("MUTUALFUND"), | ||
}), | ||
]); | ||
const QuoteSchema = typebox_1.Type.Union([ | ||
QuoteCryptoCurrency, | ||
QuoteCurrency, | ||
QuoteEtf, | ||
QuoteEquity, | ||
QuoteFuture, | ||
QuoteIndex, | ||
QuoteMutualfund, | ||
QuoteOption, | ||
]); | ||
const QuoteField = typebox_1.Type.KeyOf(QuoteSchema); | ||
const ResultType = typebox_1.Type.Union([ | ||
typebox_1.Type.Literal("array"), | ||
typebox_1.Type.Literal("object"), | ||
typebox_1.Type.Literal("map"), | ||
]); | ||
const QuoteResponseArraySchema = typebox_1.Type.Array(QuoteSchema); | ||
exports.QuoteOptionsSchema = typebox_1.Type.Object({ | ||
fields: typebox_1.Type.Optional(typebox_1.Type.Array(QuoteField)), | ||
return: typebox_1.Type.Optional(ResultType), | ||
}); | ||
const QuoteOptionsWithReturnArraySchema = typebox_1.Type.Composite([ | ||
exports.QuoteOptionsSchema, | ||
typebox_1.Type.Object({ | ||
return: typebox_1.Type.Optional(typebox_1.Type.Literal("array")), | ||
}), | ||
]); | ||
const QuoteOptionsWithReturnMapSchema = typebox_1.Type.Composite([ | ||
exports.QuoteOptionsSchema, | ||
typebox_1.Type.Object({ | ||
return: typebox_1.Type.Literal("map"), | ||
}), | ||
]); | ||
const QuoteOptionsWithReturnObjectSchema = typebox_1.Type.Composite([ | ||
exports.QuoteOptionsSchema, | ||
typebox_1.Type.Object({ | ||
return: typebox_1.Type.Literal("object"), | ||
}), | ||
]); | ||
const queryOptionsDefaults = {}; | ||
@@ -23,3 +257,3 @@ function quote(query, queryOptionsOverrides, moduleOptions) { | ||
needsCrumb: true, | ||
schemaKey: "#/definitions/QuoteOptions", | ||
schema: exports.QuoteOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
@@ -38,5 +272,6 @@ runtime: { symbols }, | ||
result: { | ||
schemaKey: "#/definitions/QuoteResponseArray", | ||
schema: QuoteResponseArraySchema, | ||
transformWith(rawResult) { | ||
var _a; | ||
// console.log({ rawResult: JSON.stringify(rawResult, null, 2) }); | ||
let results = (_a = rawResult === null || rawResult === void 0 ? void 0 : rawResult.quoteResponse) === null || _a === void 0 ? void 0 : _a.result; | ||
@@ -57,12 +292,14 @@ if (!results || !Array.isArray(results)) | ||
return results; | ||
case "object": | ||
case "object": { | ||
const object = {}; | ||
for (let result of results) | ||
for (const result of results) | ||
object[result.symbol] = result; | ||
return object; // TODO: type | ||
case "map": | ||
} | ||
case "map": { | ||
const map = new Map(); | ||
for (let result of results) | ||
for (const result of results) | ||
map.set(result.symbol, result); | ||
return map; // TODO: type | ||
} | ||
} | ||
@@ -69,0 +306,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.QuoteSummaryResult = void 0; | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const yahooFinanceTypes_js_1 = require("../lib/yahooFinanceTypes.js"); | ||
/* | ||
* To generate the initial file, we took the output of all submodules for | ||
* 'AAPL', 'OCDO.L', '0700.HK' and '^IXIC' and ran the results through | ||
* the awesome https://app.quicktype.io/. | ||
* the awesome https://app.quicktype.io/ | ||
* and then the smashing https://sinclairzx81.github.io/typebox-workbench | ||
* | ||
@@ -12,26 +17,66 @@ * Manual cleanup afterwards: | ||
* 3) Alphabeticalize QuoteSummaryResult | ||
* 4) RawNumberObj type to Date|number for coersion | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Grade = exports.Action = exports.OwnershipEnum = exports.Relation = void 0; | ||
var Relation; | ||
(function (Relation) { | ||
Relation["ChairmanOfTheBoard"] = "Chairman of the Board"; | ||
Relation["ChiefExecutiveOfficer"] = "Chief Executive Officer"; | ||
Relation["ChiefFinancialOfficer"] = "Chief Financial Officer"; | ||
Relation["ChiefOperatingOfficer"] = "Chief Operating Officer"; | ||
Relation["ChiefTechnologyOfficer"] = "Chief Technology Officer"; | ||
Relation["Director"] = "Director"; | ||
Relation["DirectorIndependent"] = "Director (Independent)"; | ||
Relation["Empty"] = ""; | ||
Relation["GeneralCounsel"] = "General Counsel"; | ||
Relation["IndependentNonExecutiveDirector"] = "Independent Non-Executive Director"; | ||
Relation["Officer"] = "Officer"; | ||
Relation["President"] = "President"; | ||
})(Relation || (exports.Relation = Relation = {})); | ||
var OwnershipEnum; | ||
(function (OwnershipEnum) { | ||
OwnershipEnum["D"] = "D"; | ||
OwnershipEnum["I"] = "I"; | ||
})(OwnershipEnum || (exports.OwnershipEnum = OwnershipEnum = {})); | ||
var EnumGrade; | ||
(function (EnumGrade) { | ||
EnumGrade["Accumulate"] = "Accumulate"; | ||
EnumGrade["Add"] = "Add"; | ||
EnumGrade["Average"] = "Average"; | ||
EnumGrade["BelowAverage"] = "Below Average"; | ||
EnumGrade["Buy"] = "Buy"; | ||
EnumGrade["ConvictionBuy"] = "Conviction Buy"; | ||
EnumGrade["Empty"] = ""; | ||
EnumGrade["EqualWeight"] = "Equal-Weight"; | ||
EnumGrade["FairValue"] = "Fair Value"; | ||
EnumGrade["GradeEqualWeight"] = "Equal-weight"; | ||
EnumGrade["GradeLongTermBuy"] = "Long-term Buy"; | ||
EnumGrade["Hold"] = "Hold"; | ||
EnumGrade["LongTermBuy"] = "Long-Term Buy"; | ||
EnumGrade["MarketOutperform"] = "Market Outperform"; | ||
EnumGrade["MarketPerform"] = "Market Perform"; | ||
EnumGrade["Mixed"] = "Mixed"; | ||
EnumGrade["Negative"] = "Negative"; | ||
EnumGrade["Neutral"] = "Neutral"; | ||
EnumGrade["InLine"] = "In-Line"; | ||
EnumGrade["Outperform"] = "Outperform"; | ||
EnumGrade["Overweight"] = "Overweight"; | ||
EnumGrade["PeerPerform"] = "Peer Perform"; | ||
EnumGrade["Perform"] = "Perform"; | ||
EnumGrade["Positive"] = "Positive"; | ||
EnumGrade["Reduce"] = "Reduce"; | ||
EnumGrade["SectorOutperform"] = "Sector Outperform"; | ||
EnumGrade["SectorPerform"] = "Sector Perform"; | ||
EnumGrade["SectorWeight"] = "Sector Weight"; | ||
EnumGrade["Sell"] = "Sell"; | ||
EnumGrade["StrongBuy"] = "Strong Buy"; | ||
EnumGrade["TopPick"] = "Top Pick"; | ||
EnumGrade["Underperform"] = "Underperform"; | ||
EnumGrade["Underperformer"] = "Underperformer"; | ||
EnumGrade["Underweight"] = "Underweight"; | ||
EnumGrade["Trim"] = "Trim"; | ||
EnumGrade["AboveAverage"] = "Above Average"; | ||
EnumGrade["Inline"] = "In-line"; | ||
EnumGrade["Outperformer"] = "Outperformer"; | ||
EnumGrade["OVerweight"] = "OVerweight"; | ||
EnumGrade["Cautious"] = "Cautious"; | ||
EnumGrade["MarketWeight"] = "Market Weight"; | ||
EnumGrade["SectorUnderperform"] = "Sector Underperform"; | ||
EnumGrade["MarketUnderperform"] = "Market Underperform"; | ||
EnumGrade["Peerperform"] = "Peer perform"; | ||
EnumGrade["GraduallyAccumulate"] = "Gradually Accumulate"; | ||
EnumGrade["ActionListBuy"] = "Action List Buy"; | ||
EnumGrade["Performer"] = "Performer"; | ||
EnumGrade["SectorPerformer"] = "Sector Performer"; | ||
EnumGrade["SpeculativeBuy"] = "Speculative Buy"; | ||
EnumGrade["StrongSell"] = "Strong Sell"; | ||
EnumGrade["SpeculativeHold"] = "Speculative Hold"; | ||
EnumGrade["NotRated"] = "Not Rated"; | ||
EnumGrade["HoldNeutral"] = "Hold Neutral"; | ||
EnumGrade["Developing"] = "Developing"; | ||
EnumGrade["buy"] = "buy"; | ||
EnumGrade["HOld"] = "HOld"; | ||
EnumGrade["TradingSell"] = "Trading Sell"; | ||
EnumGrade["Tender"] = "Tender"; | ||
EnumGrade["marketperform"] = "market perform"; | ||
EnumGrade["BUy"] = "BUy"; | ||
})(EnumGrade || (EnumGrade = {})); | ||
var Action; | ||
@@ -44,65 +89,1057 @@ (function (Action) { | ||
Action["Up"] = "up"; | ||
})(Action || (exports.Action = Action = {})); | ||
var Grade; | ||
(function (Grade) { | ||
Grade["Accumulate"] = "Accumulate"; | ||
Grade["Add"] = "Add"; | ||
Grade["Average"] = "Average"; | ||
Grade["BelowAverage"] = "Below Average"; | ||
Grade["Buy"] = "Buy"; | ||
Grade["ConvictionBuy"] = "Conviction Buy"; | ||
Grade["Empty"] = ""; | ||
Grade["EqualWeight"] = "Equal-Weight"; | ||
Grade["FairValue"] = "Fair Value"; | ||
Grade["GradeEqualWeight"] = "Equal-weight"; | ||
Grade["GradeLongTermBuy"] = "Long-term Buy"; | ||
Grade["Hold"] = "Hold"; | ||
Grade["LongTermBuy"] = "Long-Term Buy"; | ||
Grade["MarketOutperform"] = "Market Outperform"; | ||
Grade["MarketPerform"] = "Market Perform"; | ||
Grade["Mixed"] = "Mixed"; | ||
Grade["Negative"] = "Negative"; | ||
Grade["Neutral"] = "Neutral"; | ||
Grade["InLine"] = "In-Line"; | ||
Grade["Outperform"] = "Outperform"; | ||
Grade["Overweight"] = "Overweight"; | ||
Grade["PeerPerform"] = "Peer Perform"; | ||
Grade["Perform"] = "Perform"; | ||
Grade["Positive"] = "Positive"; | ||
Grade["Reduce"] = "Reduce"; | ||
Grade["SectorOutperform"] = "Sector Outperform"; | ||
Grade["SectorPerform"] = "Sector Perform"; | ||
Grade["SectorWeight"] = "Sector Weight"; | ||
Grade["Sell"] = "Sell"; | ||
Grade["StrongBuy"] = "Strong Buy"; | ||
Grade["TopPick"] = "Top Pick"; | ||
Grade["Underperform"] = "Underperform"; | ||
Grade["Underperformer"] = "Underperformer"; | ||
Grade["Underweight"] = "Underweight"; | ||
Grade["Trim"] = "Trim"; | ||
Grade["AboveAverage"] = "Above Average"; | ||
Grade["Inline"] = "In-line"; | ||
Grade["Outperformer"] = "Outperformer"; | ||
Grade["OVerweight"] = "OVerweight"; | ||
Grade["Cautious"] = "Cautious"; | ||
Grade["MarketWeight"] = "Market Weight"; | ||
Grade["SectorUnderperform"] = "Sector Underperform"; | ||
Grade["MarketUnderperform"] = "Market Underperform"; | ||
Grade["Peerperform"] = "Peer perform"; | ||
Grade["GraduallyAccumulate"] = "Gradually Accumulate"; | ||
Grade["ActionListBuy"] = "Action List Buy"; | ||
Grade["Performer"] = "Performer"; | ||
Grade["SectorPerformer"] = "Sector Performer"; | ||
Grade["SpeculativeBuy"] = "Speculative Buy"; | ||
Grade["StrongSell"] = "Strong Sell"; | ||
Grade["SpeculativeHold"] = "Speculative Hold"; | ||
Grade["NotRated"] = "Not Rated"; | ||
Grade["HoldNeutral"] = "Hold Neutral"; | ||
Grade["Developing"] = "Developing"; | ||
Grade["buy"] = "buy"; | ||
Grade["HOld"] = "HOld"; | ||
Grade["TradingSell"] = "Trading Sell"; | ||
Grade["Tender"] = "Tender"; | ||
Grade["marketperform"] = "market perform"; | ||
Grade["BUy"] = "BUy"; | ||
})(Grade || (exports.Grade = Grade = {})); | ||
})(Action || (Action = {})); | ||
const Grade = typebox_1.Type.Enum(EnumGrade, { title: "QuoteSummaryEnumGrade" }); | ||
const ActionSchema = typebox_1.Type.Enum(Action, { title: "QuoteSummaryAction" }); | ||
const UpgradeDowngradeHistoryHistory = typebox_1.Type.Object({ | ||
epochGradeDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
firm: typebox_1.Type.String(), | ||
toGrade: Grade, | ||
fromGrade: typebox_1.Type.Optional(Grade), | ||
action: ActionSchema, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryUpgradeDowngradeHistoryHistory", | ||
}); | ||
const UpgradeDowngradeHistory = typebox_1.Type.Object({ | ||
history: typebox_1.Type.Array(UpgradeDowngradeHistoryHistory), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryUpgradeDowngradeHistory", | ||
}); | ||
const TopHoldingsSectorWeighting = typebox_1.Type.Object({ | ||
realestate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
consumer_cyclical: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
basic_materials: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
consumer_defensive: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
technology: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
communication_services: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
financial_services: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
utilities: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
industrials: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
energy: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
healthcare: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryTopHoldingsSectorWeighting", | ||
}); | ||
const TopHoldingsBondRating = typebox_1.Type.Object({ | ||
a: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
aa: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
aaa: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
other: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
b: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
bb: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
bbb: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
below_b: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
us_government: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryTopHoldingsBondRating", | ||
}); | ||
const TopHoldingsEquityHoldings = typebox_1.Type.Object({ | ||
medianMarketCap: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
medianMarketCapCat: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
priceToBook: yahooFinanceTypes_js_1.YahooNumber, | ||
priceToBookCat: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
priceToCashflow: yahooFinanceTypes_js_1.YahooNumber, | ||
priceToCashflowCat: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
priceToEarnings: yahooFinanceTypes_js_1.YahooNumber, | ||
priceToEarningsCat: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
priceToSales: yahooFinanceTypes_js_1.YahooNumber, | ||
priceToSalesCat: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
threeYearEarningsGrowth: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
threeYearEarningsGrowthCat: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryTopHoldingsEquityHoldings", | ||
}); | ||
const TopHoldingsHolding = typebox_1.Type.Object({ | ||
symbol: typebox_1.Type.String(), | ||
holdingName: typebox_1.Type.String(), | ||
holdingPercent: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryTopHoldingsHolding", | ||
}); | ||
const TopHoldings = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
stockPosition: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
bondPosition: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
holdings: typebox_1.Type.Array(TopHoldingsHolding), | ||
equityHoldings: TopHoldingsEquityHoldings, | ||
bondHoldings: typebox_1.Type.Object({}), | ||
bondRatings: typebox_1.Type.Array(TopHoldingsBondRating), | ||
sectorWeightings: typebox_1.Type.Array(TopHoldingsSectorWeighting), | ||
cashPosition: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
otherPosition: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
preferredPosition: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
convertiblePosition: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryTopHoldings", | ||
}); | ||
const SummaryProfile = typebox_1.Type.Object({ | ||
address1: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
address2: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
address3: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
city: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
state: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
zip: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
country: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
phone: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
fax: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
website: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
industry: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
industryDisp: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
sector: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
sectorDisp: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
longBusinessSummary: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
fullTimeEmployees: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
companyOfficers: typebox_1.Type.Array(typebox_1.Type.Any()), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
twitter: typebox_1.Type.Optional(typebox_1.Type.String()), // in e.g. "ADA-USD" (#418) | ||
// seems like for cryptocurency only | ||
// TODO: how does this relate to Quote type. Common base? | ||
name: typebox_1.Type.Optional(typebox_1.Type.String()), // 'Bitcoin' | ||
startDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // new Date('2013-04-28') | ||
description: typebox_1.Type.Optional(typebox_1.Type.String()), // 'Bitcoin (BTC) is a cryptocurrency...' | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummarySummaryProfile", | ||
}); | ||
const SummaryDetail = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
priceHint: yahooFinanceTypes_js_1.YahooNumber, | ||
previousClose: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // missing in e.g. "APS.AX" | ||
open: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
dayLow: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
dayHigh: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketPreviousClose: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // missing in e.g. "APS.AX" | ||
regularMarketOpen: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketDayLow: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketDayHigh: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketVolume: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
dividendRate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
dividendYield: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
exDividendDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
payoutRatio: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fiveYearAvgDividendYield: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
beta: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
trailingPE: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
forwardPE: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
volume: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
averageVolume: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
averageVolume10days: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
averageDailyVolume10Day: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
bid: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
ask: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
bidSize: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
askSize: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
marketCap: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fiftyDayAverage: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fiftyTwoWeekLow: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fiftyTwoWeekHigh: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
twoHundredDayAverage: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
priceToSalesTrailing12Months: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
trailingAnnualDividendRate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
trailingAnnualDividendYield: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
currency: typebox_1.Type.String(), | ||
algorithm: typebox_1.Type.Null(), | ||
tradeable: typebox_1.Type.Boolean(), | ||
yield: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalAssets: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
navPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
ytdReturn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
// crypto only (optional, or null in other types) | ||
// TODO: how does Price / SummaryDetail compare? common base? | ||
fromCurrency: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]), // 'BTC' | ||
toCurrency: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()])), // 'USD-X' | ||
lastMarket: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]), // 'CoinMarketCap' | ||
volume24Hr: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 62650314752 | ||
volumeAllCurrencies: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 62650314752 | ||
circulatingSupply: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 18638932 | ||
startDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // new Date(1367107200 * 1000) | ||
coinMarketCapLink: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()])), // "https://coinmarketcap.com/currencies/cardano" | ||
// futures | ||
expireDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // 1656374400, | ||
openInterest: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 444411, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummarySummaryDetail", | ||
}); | ||
// May consider switching this to string, as we keep finding more and more. | ||
const FilingType = typebox_1.Type.Union([ | ||
typebox_1.Type.Literal("10-K"), | ||
typebox_1.Type.Literal("10-Q"), | ||
typebox_1.Type.Literal("8-K"), | ||
typebox_1.Type.Literal("8-K/A"), | ||
typebox_1.Type.Literal("10-K/A"), | ||
typebox_1.Type.Literal("10-Q/A"), | ||
typebox_1.Type.Literal("SD"), | ||
typebox_1.Type.Literal("PX14A6G"), | ||
typebox_1.Type.Literal("SC 13G/A"), | ||
typebox_1.Type.Literal("DEFA14A"), | ||
typebox_1.Type.Literal("25-NSE"), | ||
typebox_1.Type.Literal("S-8 POS"), | ||
typebox_1.Type.Literal("6-K"), | ||
typebox_1.Type.Literal("F-3ASR"), | ||
typebox_1.Type.Literal("SC 13D/A"), | ||
typebox_1.Type.Literal("20-F"), | ||
typebox_1.Type.Literal("425"), | ||
typebox_1.Type.Literal("SC14D9C"), | ||
typebox_1.Type.Literal("SC 13G"), | ||
typebox_1.Type.Literal("S-8"), | ||
typebox_1.Type.Literal("DEF 14A"), | ||
typebox_1.Type.Literal("F-10"), | ||
], { | ||
title: "QuoteSummaryFilingType", | ||
}); | ||
const Filing = typebox_1.Type.Object({ | ||
date: typebox_1.Type.String(), | ||
epochDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
type: FilingType, | ||
title: typebox_1.Type.String(), | ||
edgarUrl: typebox_1.Type.String(), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
url: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
exhibits: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({ | ||
type: typebox_1.Type.String(), | ||
url: typebox_1.Type.String(), | ||
downloadUrl: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
}))), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFiling", | ||
}); | ||
const SECFilings = typebox_1.Type.Object({ | ||
filings: typebox_1.Type.Array(Filing), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummarySECFilings", | ||
}); | ||
const RecommendationTrendTrend = typebox_1.Type.Object({ | ||
period: typebox_1.Type.String(), | ||
strongBuy: yahooFinanceTypes_js_1.YahooNumber, | ||
buy: yahooFinanceTypes_js_1.YahooNumber, | ||
hold: yahooFinanceTypes_js_1.YahooNumber, | ||
sell: yahooFinanceTypes_js_1.YahooNumber, | ||
strongSell: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryRecommendationTrendTrend", | ||
}); | ||
const RecommendationTrend = typebox_1.Type.Object({ | ||
trend: typebox_1.Type.Array(RecommendationTrendTrend), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryRecommendationTrend", | ||
}); | ||
const QuoteType = typebox_1.Type.Object({ | ||
exchange: typebox_1.Type.String(), | ||
quoteType: typebox_1.Type.String(), | ||
symbol: typebox_1.Type.String(), | ||
underlyingSymbol: typebox_1.Type.String(), | ||
shortName: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
longName: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
firstTradeDateEpochUtc: yahooFinanceTypes_js_1.NullableYahooFinanceDate, | ||
timeZoneFullName: typebox_1.Type.String(), | ||
timeZoneShortName: typebox_1.Type.String(), | ||
uuid: typebox_1.Type.String(), | ||
messageBoardId: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()])), | ||
gmtOffSetMilliseconds: yahooFinanceTypes_js_1.YahooNumber, | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryQuoteType", | ||
}); | ||
const Price = typebox_1.Type.Object({ | ||
averageDailyVolume10Day: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
averageDailyVolume3Month: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
exchange: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
exchangeName: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
exchangeDataDelayedBy: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
postMarketChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
postMarketChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
postMarketTime: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
postMarketPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
postMarketSource: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
preMarketChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
preMarketChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
preMarketTime: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
preMarketPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
preMarketSource: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
priceHint: yahooFinanceTypes_js_1.YahooNumber, | ||
regularMarketChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketTime: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
regularMarketPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketDayHigh: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketDayLow: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketVolume: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketPreviousClose: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketSource: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
regularMarketOpen: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
quoteSourceName: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
quoteType: typebox_1.Type.String(), | ||
symbol: typebox_1.Type.String(), | ||
underlyingSymbol: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
shortName: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
longName: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
lastMarket: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
marketState: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
marketCap: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
currency: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
currencySymbol: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
fromCurrency: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]), | ||
toCurrency: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()])), | ||
volume24Hr: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
volumeAllCurrencies: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
circulatingSupply: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
expireDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
openInterest: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryPrice", | ||
}); | ||
const NetSharePurchaseActivity = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
period: typebox_1.Type.String(), | ||
buyInfoCount: yahooFinanceTypes_js_1.YahooNumber, | ||
buyInfoShares: yahooFinanceTypes_js_1.YahooNumber, | ||
buyPercentInsiderShares: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
sellInfoCount: yahooFinanceTypes_js_1.YahooNumber, | ||
sellInfoShares: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
sellPercentInsiderShares: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
netInfoCount: yahooFinanceTypes_js_1.YahooNumber, | ||
netInfoShares: yahooFinanceTypes_js_1.YahooNumber, | ||
netPercentInsiderShares: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalInsiderShares: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryNetSharePurchaseActivity", | ||
}); | ||
const MajorHoldersBreakdown = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
insidersPercentHeld: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
institutionsPercentHeld: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
institutionsFloatPercentHeld: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
institutionsCount: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryMajorHoldersBreakdown", | ||
}); | ||
var EnumOwnership; | ||
(function (EnumOwnership) { | ||
EnumOwnership["D"] = "D"; | ||
EnumOwnership["I"] = "I"; | ||
})(EnumOwnership || (EnumOwnership = {})); | ||
var EnumRelation; | ||
(function (EnumRelation) { | ||
EnumRelation["ChairmanOfTheBoard"] = "Chairman of the Board"; | ||
EnumRelation["ChiefExecutiveOfficer"] = "Chief Executive Officer"; | ||
EnumRelation["ChiefFinancialOfficer"] = "Chief Financial Officer"; | ||
EnumRelation["ChiefOperatingOfficer"] = "Chief Operating Officer"; | ||
EnumRelation["ChiefTechnologyOfficer"] = "Chief Technology Officer"; | ||
EnumRelation["Director"] = "Director"; | ||
EnumRelation["DirectorIndependent"] = "Director (Independent)"; | ||
EnumRelation["Empty"] = ""; | ||
EnumRelation["GeneralCounsel"] = "General Counsel"; | ||
EnumRelation["IndependentNonExecutiveDirector"] = "Independent Non-Executive Director"; | ||
EnumRelation["Officer"] = "Officer"; | ||
EnumRelation["President"] = "President"; | ||
})(EnumRelation || (EnumRelation = {})); | ||
const Relation = typebox_1.Type.Enum(EnumRelation, { title: "QuoteSummaryRelation" }); | ||
const OwnershipSchema = typebox_1.Type.Enum(EnumOwnership, { | ||
title: "QuoteSummaryOwnership", | ||
}); | ||
const Transaction = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
shares: yahooFinanceTypes_js_1.YahooNumber, | ||
filerUrl: typebox_1.Type.String(), | ||
transactionText: typebox_1.Type.String(), | ||
filerName: typebox_1.Type.String(), | ||
filerRelation: typebox_1.Type.Union([Relation, typebox_1.Type.String()]), | ||
moneyText: typebox_1.Type.String(), | ||
startDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
ownership: typebox_1.Type.Union([OwnershipSchema, typebox_1.Type.String()]), | ||
value: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryTransaction", | ||
}); | ||
const InsiderTransactions = typebox_1.Type.Object({ | ||
transactions: typebox_1.Type.Array(Transaction), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryInsiderTransactions", | ||
}); | ||
const Holder = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
name: typebox_1.Type.String(), | ||
relation: typebox_1.Type.Union([Relation, typebox_1.Type.String()]), | ||
url: typebox_1.Type.String(), | ||
transactionDescription: typebox_1.Type.String(), | ||
latestTransDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
positionDirect: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
positionDirectDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
positionIndirect: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
positionIndirectDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
positionSummaryDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryHolder", | ||
}); | ||
const Holders = typebox_1.Type.Object({ | ||
holders: typebox_1.Type.Array(Holder), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryHolders", | ||
}); | ||
const Trend = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
symbol: typebox_1.Type.Null(), | ||
estimates: typebox_1.Type.Array(typebox_1.Type.Any()), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryTrend", | ||
}); | ||
const Estimate = typebox_1.Type.Object({ | ||
period: typebox_1.Type.String(), | ||
growth: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryEstimate", | ||
}); | ||
const IndexTrend = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
symbol: typebox_1.Type.String(), | ||
peRatio: yahooFinanceTypes_js_1.YahooNumber, | ||
pegRatio: yahooFinanceTypes_js_1.YahooNumber, | ||
estimates: typebox_1.Type.Array(Estimate), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryIndexTrend", | ||
}); | ||
const IncomeStatementHistoryElement = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
endDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
totalRevenue: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
costOfRevenue: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
grossProfit: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
researchDevelopment: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
sellingGeneralAdministrative: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
nonRecurring: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
otherOperatingExpenses: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
totalOperatingExpenses: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
operatingIncome: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
totalOtherIncomeExpenseNet: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
ebit: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
interestExpense: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
incomeBeforeTax: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
incomeTaxExpense: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
minorityInterest: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
netIncomeFromContinuingOps: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
discontinuedOperations: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
extraordinaryItems: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
effectOfAccountingCharges: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
otherItems: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
netIncome: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
netIncomeApplicableToCommonShares: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryIncomeStatementHistoryElement", | ||
}); | ||
const IncomeStatementHistory = typebox_1.Type.Object({ | ||
incomeStatementHistory: typebox_1.Type.Array(IncomeStatementHistoryElement), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryIncomeStatementHistory", | ||
}); | ||
const FundProfileBrokerage = typebox_1.Type.Object({}, { | ||
title: "QuoteSummaryFundProfileBrokerage", | ||
}); | ||
const FundProfileFeesExpensesInvestment = typebox_1.Type.Object({ | ||
annualHoldingsTurnover: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
annualReportExpenseRatio: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
grossExpRatio: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
netExpRatio: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
projectionValues: typebox_1.Type.Object({}), | ||
totalNetAssets: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFundProfileFeesExpensesInvestment", | ||
}); | ||
const FundProfileFeesExpensesInvestmentCat = typebox_1.Type.Composite([ | ||
typebox_1.Type.Omit(FundProfileFeesExpensesInvestment, ["projectionValues"]), | ||
typebox_1.Type.Object({ | ||
projectionValuesCat: typebox_1.Type.Object({}), | ||
}), | ||
], { | ||
title: "QuoteSummaryFundProfileFeesExpensesInvestmentCat", | ||
additionalProperties: typebox_1.Type.Any(), | ||
}); | ||
const FundProfileManagementInfo = typebox_1.Type.Object({ | ||
managerName: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
managerBio: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
startdate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFundProfileManagementInfo", | ||
}); | ||
const FundProfile = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
styleBoxUrl: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()])), | ||
family: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
categoryName: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
legalType: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
managementInfo: typebox_1.Type.Optional(FundProfileManagementInfo), | ||
feesExpensesInvestment: typebox_1.Type.Optional(FundProfileFeesExpensesInvestment), | ||
feesExpensesInvestmentCat: typebox_1.Type.Optional(FundProfileFeesExpensesInvestmentCat), | ||
brokerages: typebox_1.Type.Optional(typebox_1.Type.Array(FundProfileBrokerage)), | ||
initInvestment: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
initIraInvestment: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
initAipInvestment: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
subseqInvestment: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
subseqIraInvestment: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
subseqAipInvestment: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFundProfile", | ||
}); | ||
const FundPerformanceRiskOverviewStatsRow = typebox_1.Type.Object({ | ||
year: typebox_1.Type.String(), // "5y" | "3y" | "10y" | anything else? | ||
alpha: yahooFinanceTypes_js_1.YahooNumber, // 7.76 | ||
beta: yahooFinanceTypes_js_1.YahooNumber, // 1.04 | ||
meanAnnualReturn: yahooFinanceTypes_js_1.YahooNumber, // 2.05 | ||
rSquared: yahooFinanceTypes_js_1.YahooNumber, // 84.03 | ||
stdDev: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), // 17.12 | ||
sharpeRatio: yahooFinanceTypes_js_1.YahooNumber, // 1.37 | ||
treynorRatio: yahooFinanceTypes_js_1.YahooNumber, // 23.61 | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFundPerformanceRiskOverviewStatsRow", | ||
}); | ||
const FundPerformanceRiskOverviewStatsCat = typebox_1.Type.Object({ | ||
riskStatisticsCat: typebox_1.Type.Array(FundPerformanceRiskOverviewStatsRow), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFundPerformanceRiskOverviewStatsCat", | ||
}); | ||
const FundPerformanceRiskOverviewStats = typebox_1.Type.Object({ | ||
riskStatistics: typebox_1.Type.Array(FundPerformanceRiskOverviewStatsRow), | ||
riskRating: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFundPerformanceRiskOverviewStats", | ||
}); | ||
const FundPerformanceReturnsRow = typebox_1.Type.Object({ | ||
year: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
annualValue: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
q1: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
q2: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
q3: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
q4: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFundPerformanceReturnsRow", | ||
}); | ||
const FundPerformanceReturns = typebox_1.Type.Object({ | ||
returns: typebox_1.Type.Array(FundPerformanceReturnsRow), | ||
returnsCat: typebox_1.Type.Optional(typebox_1.Type.Array(FundPerformanceReturnsRow)), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFundPerformanceReturns", | ||
}); | ||
const FundPerformancePerformanceOverviewCat = typebox_1.Type.Object({ | ||
ytdReturnPct: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fiveYrAvgReturnPct: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFundPerformancePerformanceOverviewCat", | ||
}); | ||
const FundPerformancePerformanceOverview = typebox_1.Type.Object({ | ||
asOfDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
ytdReturnPct: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
oneYearTotalReturn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
threeYearTotalReturn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fiveYrAvgReturnPct: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
morningStarReturnRating: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
numYearsUp: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
numYearsDown: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
bestOneYrTotalReturn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
worstOneYrTotalReturn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
bestThreeYrTotalReturn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
worstThreeYrTotalReturn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFundPerformancePerformanceOverview", | ||
}); | ||
const PeriodRange = typebox_1.Type.Object({ | ||
asOfDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
ytd: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
oneMonth: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
threeMonth: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
oneYear: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
threeYear: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fiveYear: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
tenYear: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryPeriodRange", | ||
}); | ||
const FundPerformanceTrailingReturns = typebox_1.Type.Composite([ | ||
PeriodRange, | ||
typebox_1.Type.Object({ | ||
lastBullMkt: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
lastBearMkt: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}), | ||
], { | ||
title: "QuoteSummaryFundPerformanceTrailingReturns", | ||
}); | ||
const FundPerformance = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
loadAdjustedReturns: typebox_1.Type.Optional(PeriodRange), | ||
rankInCategory: typebox_1.Type.Optional(PeriodRange), | ||
performanceOverview: FundPerformancePerformanceOverview, | ||
performanceOverviewCat: FundPerformancePerformanceOverviewCat, | ||
trailingReturns: FundPerformanceTrailingReturns, | ||
trailingReturnsNav: FundPerformanceTrailingReturns, | ||
trailingReturnsCat: FundPerformanceTrailingReturns, | ||
annualTotalReturns: FundPerformanceReturns, | ||
pastQuarterlyReturns: FundPerformanceReturns, | ||
riskOverviewStatistics: FundPerformanceRiskOverviewStats, | ||
riskOverviewStatisticsCat: FundPerformanceRiskOverviewStatsCat, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFundPerformance", | ||
}); | ||
const OwnershipList = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
reportDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
organization: typebox_1.Type.String(), | ||
pctHeld: yahooFinanceTypes_js_1.YahooNumber, | ||
position: yahooFinanceTypes_js_1.YahooNumber, | ||
value: yahooFinanceTypes_js_1.YahooNumber, | ||
pctChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryOwnershipList", | ||
}); | ||
const Ownership = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
ownershipList: typebox_1.Type.Array(OwnershipList), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryOwnership", | ||
}); | ||
const FinancialData = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
currentPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
targetHighPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
targetLowPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
targetMeanPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
targetMedianPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
recommendationMean: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
recommendationKey: typebox_1.Type.String(), | ||
numberOfAnalystOpinions: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalCash: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalCashPerShare: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
ebitda: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalDebt: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
quickRatio: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
currentRatio: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalRevenue: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
debtToEquity: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
revenuePerShare: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
returnOnAssets: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
returnOnEquity: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
grossProfits: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
freeCashflow: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
operatingCashflow: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
earningsGrowth: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
revenueGrowth: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
grossMargins: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
ebitdaMargins: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
operatingMargins: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
profitMargins: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
financialCurrency: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFinancialData", | ||
}); | ||
const RevenueEstimate = typebox_1.Type.Object({ | ||
avg: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
low: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
high: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
numberOfAnalysts: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
yearAgoRevenue: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
growth: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryRevenueEstimate", | ||
}); | ||
const EpsTrend = typebox_1.Type.Object({ | ||
current: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
"7daysAgo": yahooFinanceTypes_js_1.NullableYahooNumber, | ||
"30daysAgo": yahooFinanceTypes_js_1.NullableYahooNumber, | ||
"60daysAgo": yahooFinanceTypes_js_1.NullableYahooNumber, | ||
"90daysAgo": yahooFinanceTypes_js_1.NullableYahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryEpsTrend", | ||
}); | ||
const EpsRevisions = typebox_1.Type.Object({ | ||
upLast7days: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
upLast30days: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
downLast30days: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
downLast90days: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryEpsRevisions", | ||
}); | ||
const EarningsEstimate = typebox_1.Type.Object({ | ||
avg: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
low: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
high: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
yearAgoEps: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
numberOfAnalysts: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
growth: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryEarningsEstimate", | ||
}); | ||
const EarningsTrendTrend = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
period: typebox_1.Type.String(), | ||
endDate: yahooFinanceTypes_js_1.NullableYahooFinanceDate, | ||
growth: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
earningsEstimate: EarningsEstimate, | ||
revenueEstimate: RevenueEstimate, | ||
epsTrend: EpsTrend, | ||
epsRevisions: EpsRevisions, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryEarningsTrendTrend", | ||
}); | ||
const EarningsTrend = typebox_1.Type.Object({ | ||
trend: typebox_1.Type.Array(EarningsTrendTrend), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryEarningsTrend", | ||
}); | ||
const EarningsHistoryHistory = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
epsActual: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
epsEstimate: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
epsDifference: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
surprisePercent: yahooFinanceTypes_js_1.NullableYahooNumber, | ||
quarter: yahooFinanceTypes_js_1.NullableYahooFinanceDate, | ||
period: typebox_1.Type.String(), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryEarningsHistoryHistory", | ||
}); | ||
const EarningsHistory = typebox_1.Type.Object({ | ||
history: typebox_1.Type.Array(EarningsHistoryHistory), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryEarningsHistory", | ||
}); | ||
const Yearly = typebox_1.Type.Object({ | ||
date: yahooFinanceTypes_js_1.YahooNumber, | ||
revenue: yahooFinanceTypes_js_1.YahooNumber, | ||
earnings: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryYearly", | ||
}); | ||
const FinancialsChartQuarterly = typebox_1.Type.Object({ | ||
date: typebox_1.Type.String(), | ||
revenue: yahooFinanceTypes_js_1.YahooNumber, | ||
earnings: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFinancialsChartQuarterly", | ||
}); | ||
const FinancialsChart = typebox_1.Type.Object({ | ||
yearly: typebox_1.Type.Array(Yearly), | ||
quarterly: typebox_1.Type.Array(FinancialsChartQuarterly), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryFinancialsChart", | ||
}); | ||
const EarningsChartQuarterly = typebox_1.Type.Object({ | ||
date: typebox_1.Type.String(), | ||
actual: yahooFinanceTypes_js_1.YahooNumber, | ||
estimate: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryEarningsChartQuarterly", | ||
}); | ||
const EarningsChart = typebox_1.Type.Object({ | ||
quarterly: typebox_1.Type.Array(EarningsChartQuarterly), | ||
currentQuarterEstimate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
currentQuarterEstimateDate: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
currentQuarterEstimateYear: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
earningsDate: typebox_1.Type.Array(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryEarningsChart", | ||
}); | ||
const QuoteSummaryEarnings = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
earningsChart: EarningsChart, | ||
financialsChart: FinancialsChart, | ||
financialCurrency: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryEarnings", | ||
}); | ||
const DefaultKeyStatistics = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
priceHint: yahooFinanceTypes_js_1.YahooNumber, | ||
enterpriseValue: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
forwardPE: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
profitMargins: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
floatShares: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
sharesOutstanding: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
sharesShort: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
sharesShortPriorMonth: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
sharesShortPreviousMonthDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
dateShortInterest: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
sharesPercentSharesOut: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
heldPercentInsiders: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
heldPercentInstitutions: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
shortRatio: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
shortPercentOfFloat: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
beta: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
impliedSharesOutstanding: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
category: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
bookValue: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
priceToBook: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fundFamily: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
legalType: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
lastFiscalYearEnd: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
nextFiscalYearEnd: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
mostRecentQuarter: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
earningsQuarterlyGrowth: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
netIncomeToCommon: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
trailingEps: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
forwardEps: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
pegRatio: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
lastSplitFactor: typebox_1.Type.Union([typebox_1.Type.Null(), typebox_1.Type.String()]), | ||
lastSplitDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
enterpriseToRevenue: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
enterpriseToEbitda: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
"52WeekChange": typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
SandP52WeekChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
lastDividendValue: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
lastDividendDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
ytdReturn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
beta3Year: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalAssets: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
yield: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fundInceptionDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
threeYearAverageReturn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fiveYearAverageReturn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
morningStarOverallRating: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
morningStarRiskRating: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
annualReportExpenseRatio: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
lastCapGain: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
annualHoldingsTurnover: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryDefaultKeyStatistics", | ||
}); | ||
const CashflowStatement = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
endDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
netIncome: yahooFinanceTypes_js_1.YahooNumber, | ||
depreciation: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
changeToNetincome: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
changeToAccountReceivables: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
changeToLiabilities: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
changeToInventory: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
changeToOperatingActivities: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalCashFromOperatingActivities: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
capitalExpenditures: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
investments: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
otherCashflowsFromInvestingActivities: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalCashflowsFromInvestingActivities: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
dividendsPaid: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
netBorrowings: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
otherCashflowsFromFinancingActivities: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalCashFromFinancingActivities: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
changeInCash: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
repurchaseOfStock: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
issuanceOfStock: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
effectOfExchangeRate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryCashflowStatement", | ||
}); | ||
const CashflowStatementHistory = typebox_1.Type.Object({ | ||
cashflowStatements: typebox_1.Type.Array(CashflowStatement), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryCashflowStatementHistory", | ||
}); | ||
const CalendarEventsEarnings = typebox_1.Type.Object({ | ||
earningsDate: typebox_1.Type.Array(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
earningsAverage: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
earningsLow: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
earningsHigh: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
revenueAverage: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
revenueLow: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
revenueHigh: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSumamryCalendarEventsEarnings", | ||
}); | ||
const CalendarEvents = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
earnings: CalendarEventsEarnings, | ||
exDividendDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
dividendDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryCalendarEvents", | ||
}); | ||
const BalanceSheetStatement = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
endDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
cash: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
shortTermInvestments: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
netReceivables: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
inventory: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
otherCurrentAssets: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalCurrentAssets: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
longTermInvestments: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
propertyPlantEquipment: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
otherAssets: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalAssets: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
accountsPayable: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
shortLongTermDebt: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
otherCurrentLiab: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
longTermDebt: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
otherLiab: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalCurrentLiabilities: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalLiab: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
commonStock: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
retainedEarnings: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
treasuryStock: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
otherStockholderEquity: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalStockholderEquity: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
netTangibleAssets: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
goodWill: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
intangibleAssets: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
deferredLongTermAssetCharges: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
deferredLongTermLiab: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
minorityInterest: typebox_1.Type.Optional(yahooFinanceTypes_js_1.NullableYahooNumber), | ||
capitalSurplus: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryBalanceSheetStatement", | ||
}); | ||
const BalanceSheetHistory = typebox_1.Type.Object({ | ||
balanceSheetStatements: typebox_1.Type.Array(BalanceSheetStatement), | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryBalanceSheetHistory", | ||
}); | ||
const CompanyOfficer = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
name: typebox_1.Type.String(), | ||
age: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
title: typebox_1.Type.String(), | ||
yearBorn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fiscalYear: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
totalPay: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
exercisedValue: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
unexercisedValue: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryCompanyOfficer", | ||
}); | ||
const AssetProfile = typebox_1.Type.Object({ | ||
maxAge: yahooFinanceTypes_js_1.YahooNumber, | ||
address1: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
address2: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
address3: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
city: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
state: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
zip: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
country: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
phone: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
fax: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
website: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
industry: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
industryDisp: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
industryKey: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
industrySymbol: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
sector: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
sectorDisp: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
sectorKey: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
longBusinessSummary: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
fullTimeEmployees: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
companyOfficers: typebox_1.Type.Array(CompanyOfficer), | ||
auditRisk: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
boardRisk: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
compensationRisk: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
shareHolderRightsRisk: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
overallRisk: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
governanceEpochDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
compensationAsOfEpochDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
name: typebox_1.Type.Optional(typebox_1.Type.String()), // 'Bitcoin'; | ||
startDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // new Date('2013-04-28') | ||
description: typebox_1.Type.Optional(typebox_1.Type.String()), // 'Bitcoin (BTC) is a cryptocurrency...' | ||
twitter: typebox_1.Type.Optional(typebox_1.Type.String()), // in e.g. "ADA-USD" (#418) | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryAssetProfile", | ||
}); | ||
exports.QuoteSummaryResult = typebox_1.Type.Object({ | ||
assetProfile: typebox_1.Type.Optional(AssetProfile), | ||
balanceSheetHistory: typebox_1.Type.Optional(BalanceSheetHistory), | ||
balanceSheetHistoryQuarterly: typebox_1.Type.Optional(BalanceSheetHistory), | ||
calendarEvents: typebox_1.Type.Optional(CalendarEvents), | ||
cashflowStatementHistory: typebox_1.Type.Optional(CashflowStatementHistory), | ||
cashflowStatementHistoryQuarterly: typebox_1.Type.Optional(CashflowStatementHistory), | ||
defaultKeyStatistics: typebox_1.Type.Optional(DefaultKeyStatistics), | ||
earnings: typebox_1.Type.Optional(QuoteSummaryEarnings), | ||
earningsHistory: typebox_1.Type.Optional(EarningsHistory), | ||
earningsTrend: typebox_1.Type.Optional(EarningsTrend), | ||
financialData: typebox_1.Type.Optional(FinancialData), | ||
fundOwnership: typebox_1.Type.Optional(Ownership), | ||
fundPerformance: typebox_1.Type.Optional(FundPerformance), | ||
fundProfile: typebox_1.Type.Optional(FundProfile), | ||
institutionOwnership: typebox_1.Type.Optional(Ownership), | ||
majorDirectHolders: typebox_1.Type.Optional(Holders), | ||
majorHoldersBreakdown: typebox_1.Type.Optional(MajorHoldersBreakdown), | ||
netSharePurchaseActivity: typebox_1.Type.Optional(NetSharePurchaseActivity), | ||
price: typebox_1.Type.Optional(Price), | ||
quoteType: typebox_1.Type.Optional(QuoteType), | ||
recommendationTrend: typebox_1.Type.Optional(RecommendationTrend), | ||
secFilings: typebox_1.Type.Optional(SECFilings), | ||
sectorTrend: typebox_1.Type.Optional(Trend), | ||
summaryDetail: typebox_1.Type.Optional(SummaryDetail), | ||
summaryProfile: typebox_1.Type.Optional(SummaryProfile), | ||
topHoldings: typebox_1.Type.Optional(TopHoldings), | ||
upgradeDowngradeHistory: typebox_1.Type.Optional(UpgradeDowngradeHistory), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "QuoteSummaryResult", | ||
}); |
@@ -0,10 +1,12 @@ | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
import { Static } from "@sinclair/typebox"; | ||
import { QuoteSummaryResult } from "./quoteSummary-iface.js"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export declare const quoteSummary_modules: string[]; | ||
export type QuoteSummaryModules = "assetProfile" | "balanceSheetHistory" | "balanceSheetHistoryQuarterly" | "calendarEvents" | "cashflowStatementHistory" | "cashflowStatementHistoryQuarterly" | "defaultKeyStatistics" | "earnings" | "earningsHistory" | "earningsTrend" | "financialData" | "fundOwnership" | "fundPerformance" | "fundProfile" | "incomeStatementHistory" | "incomeStatementHistoryQuarterly" | "indexTrend" | "industryTrend" | "insiderHolders" | "insiderTransactions" | "institutionOwnership" | "majorDirectHolders" | "majorHoldersBreakdown" | "netSharePurchaseActivity" | "price" | "quoteType" | "recommendationTrend" | "secFilings" | "sectorTrend" | "summaryDetail" | "summaryProfile" | "topHoldings" | "upgradeDowngradeHistory"; | ||
export interface QuoteSummaryOptions { | ||
formatted?: boolean; | ||
modules?: Array<QuoteSummaryModules> | "all"; | ||
} | ||
type QuoteSummaryOptions = Static<typeof QuoteSummaryOptions>; | ||
type QuoteSummaryResult = Static<typeof QuoteSummaryResult>; | ||
declare const QuoteSummaryOptions: import("@sinclair/typebox").TObject<{ | ||
formatted: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
modules: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"assetProfile">, import("@sinclair/typebox").TLiteral<"balanceSheetHistory">, import("@sinclair/typebox").TLiteral<"balanceSheetHistoryQuarterly">, import("@sinclair/typebox").TLiteral<"calendarEvents">, import("@sinclair/typebox").TLiteral<"cashflowStatementHistory">, import("@sinclair/typebox").TLiteral<"cashflowStatementHistoryQuarterly">, import("@sinclair/typebox").TLiteral<"defaultKeyStatistics">, import("@sinclair/typebox").TLiteral<"earnings">, import("@sinclair/typebox").TLiteral<"earningsHistory">, import("@sinclair/typebox").TLiteral<"earningsTrend">, import("@sinclair/typebox").TLiteral<"financialData">, import("@sinclair/typebox").TLiteral<"fundOwnership">, import("@sinclair/typebox").TLiteral<"fundPerformance">, import("@sinclair/typebox").TLiteral<"fundProfile">, import("@sinclair/typebox").TLiteral<"incomeStatementHistory">, import("@sinclair/typebox").TLiteral<"incomeStatementHistoryQuarterly">, import("@sinclair/typebox").TLiteral<"indexTrend">, import("@sinclair/typebox").TLiteral<"industryTrend">, import("@sinclair/typebox").TLiteral<"insiderHolders">, import("@sinclair/typebox").TLiteral<"insiderTransactions">, import("@sinclair/typebox").TLiteral<"institutionOwnership">, import("@sinclair/typebox").TLiteral<"majorDirectHolders">, import("@sinclair/typebox").TLiteral<"majorHoldersBreakdown">, import("@sinclair/typebox").TLiteral<"netSharePurchaseActivity">, import("@sinclair/typebox").TLiteral<"price">, import("@sinclair/typebox").TLiteral<"quoteType">, import("@sinclair/typebox").TLiteral<"recommendationTrend">, import("@sinclair/typebox").TLiteral<"secFilings">, import("@sinclair/typebox").TLiteral<"sectorTrend">, import("@sinclair/typebox").TLiteral<"summaryDetail">, import("@sinclair/typebox").TLiteral<"summaryProfile">, import("@sinclair/typebox").TLiteral<"topHoldings">, import("@sinclair/typebox").TLiteral<"upgradeDowngradeHistory">]>>, import("@sinclair/typebox").TLiteral<"all">]>>; | ||
}>; | ||
export default function quoteSummary(this: ModuleThis, symbol: string, queryOptionsOverrides?: QuoteSummaryOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<QuoteSummaryResult>; | ||
export default function quoteSummary(this: ModuleThis, symbol: string, queryOptionsOverrides?: QuoteSummaryOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.quoteSummary_modules = void 0; | ||
exports.quoteSummary_modules = [ | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const quoteSummary_iface_js_1 = require("./quoteSummary-iface.js"); | ||
const QuoteSummaryModules = typebox_1.Type.Union([ | ||
typebox_1.Type.Literal("assetProfile"), | ||
typebox_1.Type.Literal("balanceSheetHistory"), | ||
typebox_1.Type.Literal("balanceSheetHistoryQuarterly"), | ||
typebox_1.Type.Literal("calendarEvents"), | ||
typebox_1.Type.Literal("cashflowStatementHistory"), | ||
typebox_1.Type.Literal("cashflowStatementHistoryQuarterly"), | ||
typebox_1.Type.Literal("defaultKeyStatistics"), | ||
typebox_1.Type.Literal("earnings"), | ||
typebox_1.Type.Literal("earningsHistory"), | ||
typebox_1.Type.Literal("earningsTrend"), | ||
typebox_1.Type.Literal("financialData"), | ||
typebox_1.Type.Literal("fundOwnership"), | ||
typebox_1.Type.Literal("fundPerformance"), | ||
typebox_1.Type.Literal("fundProfile"), | ||
typebox_1.Type.Literal("incomeStatementHistory"), | ||
typebox_1.Type.Literal("incomeStatementHistoryQuarterly"), | ||
typebox_1.Type.Literal("indexTrend"), | ||
typebox_1.Type.Literal("industryTrend"), | ||
typebox_1.Type.Literal("insiderHolders"), | ||
typebox_1.Type.Literal("insiderTransactions"), | ||
typebox_1.Type.Literal("institutionOwnership"), | ||
typebox_1.Type.Literal("majorDirectHolders"), | ||
typebox_1.Type.Literal("majorHoldersBreakdown"), | ||
typebox_1.Type.Literal("netSharePurchaseActivity"), | ||
typebox_1.Type.Literal("price"), | ||
typebox_1.Type.Literal("quoteType"), | ||
typebox_1.Type.Literal("recommendationTrend"), | ||
typebox_1.Type.Literal("secFilings"), | ||
typebox_1.Type.Literal("sectorTrend"), | ||
typebox_1.Type.Literal("summaryDetail"), | ||
typebox_1.Type.Literal("summaryProfile"), | ||
typebox_1.Type.Literal("topHoldings"), | ||
typebox_1.Type.Literal("upgradeDowngradeHistory"), | ||
]); | ||
const quoteSummaryModules = [ | ||
"assetProfile", | ||
@@ -39,2 +75,6 @@ "balanceSheetHistory", | ||
]; | ||
const QuoteSummaryOptions = typebox_1.Type.Object({ | ||
formatted: typebox_1.Type.Optional(typebox_1.Type.Boolean()), | ||
modules: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.Array(QuoteSummaryModules), typebox_1.Type.Literal("all")])), | ||
}); | ||
const queryOptionsDefaults = { | ||
@@ -51,8 +91,12 @@ formatted: false, | ||
needsCrumb: true, | ||
schemaKey: "#/definitions/QuoteSummaryOptions", | ||
schema: QuoteSummaryOptions, | ||
defaults: queryOptionsDefaults, | ||
overrides: queryOptionsOverrides, | ||
transformWith(options) { | ||
if (options.modules === "all") | ||
options.modules = exports.quoteSummary_modules; | ||
if (typeof options === "object" && | ||
options != null && | ||
"modules" in options && | ||
options.modules === "all") | ||
options.modules = | ||
quoteSummaryModules; | ||
return options; | ||
@@ -62,3 +106,3 @@ }, | ||
result: { | ||
schemaKey: "#/definitions/QuoteSummaryResult", | ||
schema: quoteSummary_iface_js_1.QuoteSummaryResult, | ||
transformWith(result) { | ||
@@ -65,0 +109,0 @@ if (!result.quoteSummary) |
@@ -0,16 +1,28 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateFalse, ModuleOptionsWithValidateTrue, ModuleThis } from "../lib/moduleCommon.js"; | ||
export interface RecommendationsBySymbolResponse { | ||
[key: string]: any; | ||
recommendedSymbols: Array<{ | ||
[key: string]: any; | ||
score: number; | ||
symbol: string; | ||
}>; | ||
symbol: string; | ||
} | ||
export type RecommendationsBySymbolResponseArray = RecommendationsBySymbolResponse[]; | ||
export interface RecommendationsBySymbolOptions { | ||
} | ||
declare const RecommendationsBySymbolResponse: import("@sinclair/typebox").TObject<{ | ||
recommendedSymbols: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
symbol: import("@sinclair/typebox").TString; | ||
}>>; | ||
symbol: import("@sinclair/typebox").TString; | ||
}>; | ||
declare const RecommendationsBySymbolResponseArray: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
recommendedSymbols: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
symbol: import("@sinclair/typebox").TString; | ||
}>>; | ||
symbol: import("@sinclair/typebox").TString; | ||
}>>; | ||
declare const RecommendationsBySymbolOptions: import("@sinclair/typebox").TObject<{}>; | ||
type RecommendationsBySymbolResponse = Static<typeof RecommendationsBySymbolResponse>; | ||
type RecommendationsBySymbolOptions = Static<typeof RecommendationsBySymbolOptions>; | ||
type RecommendationsBySymbolResponseArray = Static<typeof RecommendationsBySymbolResponseArray>; | ||
export default function recommendationsBySymbol(this: ModuleThis, query: string, queryOptionsOverrides?: RecommendationsBySymbolOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<RecommendationsBySymbolResponse>; | ||
export default function recommendationsBySymbol(this: ModuleThis, query: string | string[], queryOptionsOverrides?: RecommendationsBySymbolOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<RecommendationsBySymbolResponseArray>; | ||
export default function recommendationsBySymbol(this: ModuleThis, query: string | string[], queryOptionsOverrides?: RecommendationsBySymbolOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const yahooFinanceTypes_js_1 = require("../lib/yahooFinanceTypes.js"); | ||
const RecommendationsBySymbolResponse = typebox_1.Type.Object({ | ||
recommendedSymbols: typebox_1.Type.Array(typebox_1.Type.Object({ | ||
score: yahooFinanceTypes_js_1.YahooNumber, // 0.1927 | ||
symbol: typebox_1.Type.String(), // "BMW.DE" | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
})), | ||
symbol: typebox_1.Type.String(), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}); | ||
const RecommendationsBySymbolResponseArray = typebox_1.Type.Array(RecommendationsBySymbolResponse); | ||
const RecommendationsBySymbolOptions = typebox_1.Type.Object({}); | ||
const queryOptionsDefaults = {}; | ||
@@ -11,3 +26,3 @@ function recommendationsBySymbol(query, queryOptionsOverrides, moduleOptions) { | ||
symbols, | ||
schemaKey: "#/definitions/RecommendationsBySymbolOptions", | ||
schema: RecommendationsBySymbolOptions, | ||
defaults: queryOptionsDefaults, | ||
@@ -17,3 +32,3 @@ overrides: queryOptionsOverrides, | ||
result: { | ||
schemaKey: "#/definitions/RecommendationsBySymbolResponseArray", | ||
schema: RecommendationsBySymbolResponseArray, | ||
transformWith(result) { | ||
@@ -20,0 +35,0 @@ if (!result.finance) |
@@ -0,141 +1,307 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export interface ScreenerResult { | ||
id: string; | ||
title: string; | ||
description: string; | ||
canonicalName: string; | ||
criteriaMeta: ScreenerCriteriaMeta; | ||
rawCriteria: string; | ||
start: number; | ||
count: number; | ||
total: number; | ||
quotes: ScreenerQuote[]; | ||
useRecords: boolean; | ||
predefinedScr: boolean; | ||
versionId: number; | ||
creationDate: number; | ||
lastUpdated: number; | ||
isPremium: boolean; | ||
iconUrl: string; | ||
} | ||
export interface ScreenerCriteriaMeta { | ||
size: number; | ||
offset: number; | ||
sortField: string; | ||
sortType: string; | ||
quoteType: string; | ||
criteria: ScreenerCriterum[]; | ||
topOperator: string; | ||
} | ||
export interface ScreenerCriterum { | ||
field: string; | ||
operators: string[]; | ||
values: number[]; | ||
labelsSelected: number[]; | ||
dependentValues: any[]; | ||
} | ||
export interface ScreenerQuote { | ||
language: string; | ||
region: string; | ||
quoteType: string; | ||
typeDisp: string; | ||
quoteSourceName: string; | ||
triggerable: boolean; | ||
customPriceAlertConfidence: string; | ||
lastCloseTevEbitLtm?: number; | ||
lastClosePriceToNNWCPerShare?: number; | ||
firstTradeDateMilliseconds: number; | ||
priceHint: number; | ||
postMarketChangePercent?: number; | ||
postMarketTime?: number; | ||
postMarketPrice?: number; | ||
postMarketChange?: number; | ||
regularMarketChange: number; | ||
regularMarketTime: number; | ||
regularMarketPrice: number; | ||
regularMarketDayHigh?: number; | ||
regularMarketDayRange?: string; | ||
currency: string; | ||
regularMarketDayLow?: number; | ||
regularMarketVolume?: number; | ||
regularMarketPreviousClose: number; | ||
bid?: number; | ||
ask?: number; | ||
bidSize?: number; | ||
askSize?: number; | ||
market: string; | ||
messageBoardId: string; | ||
fullExchangeName: string; | ||
longName: string; | ||
financialCurrency?: string; | ||
regularMarketOpen?: number; | ||
averageDailyVolume3Month: number; | ||
averageDailyVolume10Day: number; | ||
fiftyTwoWeekLowChange: number; | ||
fiftyTwoWeekLowChangePercent: number; | ||
fiftyTwoWeekRange: string; | ||
fiftyTwoWeekHighChange: number; | ||
fiftyTwoWeekHighChangePercent: number; | ||
fiftyTwoWeekChangePercent: number; | ||
earningsTimestamp?: number; | ||
earningsTimestampStart?: number; | ||
earningsTimestampEnd?: number; | ||
trailingAnnualDividendRate?: number; | ||
trailingAnnualDividendYield?: number; | ||
marketState: string; | ||
epsTrailingTwelveMonths?: number; | ||
epsForward?: number; | ||
epsCurrentYear?: number; | ||
priceEpsCurrentYear?: number; | ||
sharesOutstanding?: number; | ||
bookValue?: number; | ||
fiftyDayAverage: number; | ||
fiftyDayAverageChange: number; | ||
fiftyDayAverageChangePercent: number; | ||
twoHundredDayAverage: number; | ||
twoHundredDayAverageChange: number; | ||
twoHundredDayAverageChangePercent: number; | ||
marketCap?: number; | ||
forwardPE?: number; | ||
priceToBook?: number; | ||
sourceInterval: number; | ||
exchangeDataDelayedBy: number; | ||
exchangeTimezoneName: string; | ||
exchangeTimezoneShortName: string; | ||
gmtOffSetMilliseconds: number; | ||
esgPopulated: boolean; | ||
tradeable: boolean; | ||
cryptoTradeable: boolean; | ||
exchange: string; | ||
fiftyTwoWeekLow: number; | ||
fiftyTwoWeekHigh: number; | ||
shortName: string; | ||
averageAnalystRating?: string; | ||
regularMarketChangePercent: number; | ||
symbol: string; | ||
dividendDate?: number; | ||
displayName?: string; | ||
trailingPE?: number; | ||
prevName?: string; | ||
nameChangeDate?: number; | ||
ipoExpectedDate?: number; | ||
dividendYield?: number; | ||
dividendRate?: number; | ||
yieldTTM?: number; | ||
peTTM?: number; | ||
annualReturnNavY3?: number; | ||
annualReturnNavY5?: number; | ||
ytdReturn?: number; | ||
trailingThreeMonthReturns?: number; | ||
netAssets?: number; | ||
netExpenseRatio?: number; | ||
} | ||
export type PredefinedScreenerModules = "aggressive_small_caps" | "conservative_foreign_funds" | "day_gainers" | "day_losers" | "growth_technology_stocks" | "high_yield_bond" | "most_actives" | "most_shorted_stocks" | "portfolio_anchors" | "small_cap_gainers" | "solid_large_growth_funds" | "solid_midcap_growth_funds" | "top_mutual_funds" | "undervalued_growth_stocks" | "undervalued_large_caps"; | ||
export interface ScreenerOptions { | ||
lang?: string; | ||
region?: string; | ||
scrIds: PredefinedScreenerModules; | ||
count?: number; | ||
} | ||
declare const ScreenerResult: import("@sinclair/typebox").TObject<{ | ||
id: import("@sinclair/typebox").TString; | ||
title: import("@sinclair/typebox").TString; | ||
description: import("@sinclair/typebox").TString; | ||
canonicalName: import("@sinclair/typebox").TString; | ||
criteriaMeta: import("@sinclair/typebox").TObject<{ | ||
size: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
offset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sortField: import("@sinclair/typebox").TString; | ||
sortType: import("@sinclair/typebox").TString; | ||
quoteType: import("@sinclair/typebox").TString; | ||
criteria: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
field: import("@sinclair/typebox").TString; | ||
operators: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>; | ||
values: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
labelsSelected: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dependentValues: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>; | ||
}>>; | ||
topOperator: import("@sinclair/typebox").TString; | ||
}>; | ||
rawCriteria: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
count: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
total: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
quotes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
language: import("@sinclair/typebox").TString; | ||
region: import("@sinclair/typebox").TString; | ||
quoteType: import("@sinclair/typebox").TString; | ||
typeDisp: import("@sinclair/typebox").TString; | ||
quoteSourceName: import("@sinclair/typebox").TString; | ||
triggerable: import("@sinclair/typebox").TBoolean; | ||
customPriceAlertConfidence: import("@sinclair/typebox").TString; | ||
lastCloseTevEbitLtm: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
lastClosePriceToNNWCPerShare: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
firstTradeDateMilliseconds: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
priceHint: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
postMarketChangePercent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
postMarketTime: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
postMarketPrice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
postMarketChange: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
regularMarketChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketTime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketPrice: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketDayHigh: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
regularMarketDayRange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
low: import("@sinclair/typebox").TNumber; | ||
high: import("@sinclair/typebox").TNumber; | ||
}>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TRegExp, { | ||
low: number; | ||
high: number; | ||
}>]>; | ||
currency: import("@sinclair/typebox").TString; | ||
regularMarketDayLow: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
regularMarketVolume: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
regularMarketPreviousClose: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
bid: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
ask: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
bidSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
askSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
market: import("@sinclair/typebox").TString; | ||
messageBoardId: import("@sinclair/typebox").TString; | ||
fullExchangeName: import("@sinclair/typebox").TString; | ||
longName: import("@sinclair/typebox").TString; | ||
financialCurrency: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
regularMarketOpen: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
averageDailyVolume3Month: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
averageDailyVolume10Day: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekLowChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekLowChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekRange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
low: import("@sinclair/typebox").TNumber; | ||
high: import("@sinclair/typebox").TNumber; | ||
}>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TRegExp, { | ||
low: number; | ||
high: number; | ||
}>]>; | ||
fiftyTwoWeekHighChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekHighChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
earningsTimestamp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
earningsTimestampStart: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
earningsTimestampEnd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
trailingAnnualDividendRate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
trailingAnnualDividendYield: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
marketState: import("@sinclair/typebox").TString; | ||
epsTrailingTwelveMonths: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
epsForward: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
epsCurrentYear: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
priceEpsCurrentYear: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sharesOutstanding: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
bookValue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
fiftyDayAverage: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyDayAverageChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyDayAverageChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
twoHundredDayAverage: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
twoHundredDayAverageChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
twoHundredDayAverageChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
marketCap: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
forwardPE: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
priceToBook: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sourceInterval: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
exchangeDataDelayedBy: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
exchangeTimezoneName: import("@sinclair/typebox").TString; | ||
exchangeTimezoneShortName: import("@sinclair/typebox").TString; | ||
gmtOffSetMilliseconds: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
esgPopulated: import("@sinclair/typebox").TBoolean; | ||
tradeable: import("@sinclair/typebox").TBoolean; | ||
cryptoTradeable: import("@sinclair/typebox").TBoolean; | ||
exchange: import("@sinclair/typebox").TString; | ||
fiftyTwoWeekLow: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekHigh: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
shortName: import("@sinclair/typebox").TString; | ||
averageAnalystRating: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
regularMarketChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
symbol: import("@sinclair/typebox").TString; | ||
dividendDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
displayName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
trailingPE: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
ipoExpectedDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
dividendYield: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dividendRate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
yieldTTM: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
peTTM: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
annualReturnNavY3: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
annualReturnNavY5: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
ytdReturn: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
trailingThreeMonthReturns: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
netAssets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
netExpenseRatio: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>>; | ||
useRecords: import("@sinclair/typebox").TBoolean; | ||
predefinedScr: import("@sinclair/typebox").TBoolean; | ||
versionId: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
creationDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
lastUpdated: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
isPremium: import("@sinclair/typebox").TBoolean; | ||
iconUrl: import("@sinclair/typebox").TString; | ||
}>; | ||
type ScreenerResult = Static<typeof ScreenerResult>; | ||
type ScreenerOptions = Static<typeof ScreenerOptions>; | ||
declare const ScreenerOptions: import("@sinclair/typebox").TObject<{ | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
region: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
scrIds: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"aggressive_small_caps">, import("@sinclair/typebox").TLiteral<"conservative_foreign_funds">, import("@sinclair/typebox").TLiteral<"day_gainers">, import("@sinclair/typebox").TLiteral<"day_losers">, import("@sinclair/typebox").TLiteral<"growth_technology_stocks">, import("@sinclair/typebox").TLiteral<"high_yield_bond">, import("@sinclair/typebox").TLiteral<"most_actives">, import("@sinclair/typebox").TLiteral<"most_shorted_stocks">, import("@sinclair/typebox").TLiteral<"portfolio_anchors">, import("@sinclair/typebox").TLiteral<"small_cap_gainers">, import("@sinclair/typebox").TLiteral<"solid_large_growth_funds">, import("@sinclair/typebox").TLiteral<"solid_midcap_growth_funds">, import("@sinclair/typebox").TLiteral<"top_mutual_funds">, import("@sinclair/typebox").TLiteral<"undervalued_growth_stocks">, import("@sinclair/typebox").TLiteral<"undervalued_large_caps">]>; | ||
count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>; | ||
}>; | ||
export default function screener(this: ModuleThis, queryOptionsOverrides?: ScreenerOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<ScreenerResult>; | ||
export default function screener(this: ModuleThis, queryOptionsOverrides?: ScreenerOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const yahooFinanceTypes_js_1 = require("../lib/yahooFinanceTypes.js"); | ||
const ScreenerCriterum = typebox_1.Type.Object({ | ||
field: typebox_1.Type.String(), | ||
operators: typebox_1.Type.Array(typebox_1.Type.String()), | ||
values: typebox_1.Type.Array(yahooFinanceTypes_js_1.YahooNumber), | ||
labelsSelected: typebox_1.Type.Array(yahooFinanceTypes_js_1.YahooNumber), | ||
dependentValues: typebox_1.Type.Array(typebox_1.Type.Any()), | ||
}, { | ||
title: "ScreenerCriterum", | ||
}); | ||
const ScreenerCriteriaMeta = typebox_1.Type.Object({ | ||
size: yahooFinanceTypes_js_1.YahooNumber, | ||
offset: yahooFinanceTypes_js_1.YahooNumber, | ||
sortField: typebox_1.Type.String(), | ||
sortType: typebox_1.Type.String(), | ||
quoteType: typebox_1.Type.String(), | ||
criteria: typebox_1.Type.Array(ScreenerCriterum), | ||
topOperator: typebox_1.Type.String(), | ||
}, { | ||
title: "ScreenerCriteriaMeta", | ||
}); | ||
const ScreenerQuote = typebox_1.Type.Object({ | ||
language: typebox_1.Type.String(), | ||
region: typebox_1.Type.String(), | ||
quoteType: typebox_1.Type.String(), | ||
typeDisp: typebox_1.Type.String(), | ||
quoteSourceName: typebox_1.Type.String(), | ||
triggerable: typebox_1.Type.Boolean(), | ||
customPriceAlertConfidence: typebox_1.Type.String(), | ||
lastCloseTevEbitLtm: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
lastClosePriceToNNWCPerShare: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
firstTradeDateMilliseconds: yahooFinanceTypes_js_1.YahooNumber, | ||
priceHint: yahooFinanceTypes_js_1.YahooNumber, | ||
postMarketChangePercent: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
postMarketTime: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
postMarketPrice: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
postMarketChange: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketChange: yahooFinanceTypes_js_1.YahooNumber, | ||
regularMarketTime: yahooFinanceTypes_js_1.YahooNumber, | ||
regularMarketPrice: yahooFinanceTypes_js_1.YahooNumber, | ||
regularMarketDayHigh: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketDayRange: yahooFinanceTypes_js_1.YahooTwoNumberRange, | ||
currency: typebox_1.Type.String(), | ||
regularMarketDayLow: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketVolume: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
regularMarketPreviousClose: yahooFinanceTypes_js_1.YahooNumber, | ||
bid: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
ask: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
bidSize: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
askSize: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
market: typebox_1.Type.String(), | ||
messageBoardId: typebox_1.Type.String(), | ||
fullExchangeName: typebox_1.Type.String(), | ||
longName: typebox_1.Type.String(), | ||
financialCurrency: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
regularMarketOpen: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
averageDailyVolume3Month: yahooFinanceTypes_js_1.YahooNumber, | ||
averageDailyVolume10Day: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyTwoWeekLowChange: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyTwoWeekLowChangePercent: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyTwoWeekRange: yahooFinanceTypes_js_1.YahooTwoNumberRange, | ||
fiftyTwoWeekHighChange: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyTwoWeekHighChangePercent: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyTwoWeekChangePercent: yahooFinanceTypes_js_1.YahooNumber, | ||
earningsTimestamp: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
earningsTimestampStart: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
earningsTimestampEnd: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
trailingAnnualDividendRate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
trailingAnnualDividendYield: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
marketState: typebox_1.Type.String(), | ||
epsTrailingTwelveMonths: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
epsForward: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
epsCurrentYear: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
priceEpsCurrentYear: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
sharesOutstanding: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
bookValue: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
fiftyDayAverage: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyDayAverageChange: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyDayAverageChangePercent: yahooFinanceTypes_js_1.YahooNumber, | ||
twoHundredDayAverage: yahooFinanceTypes_js_1.YahooNumber, | ||
twoHundredDayAverageChange: yahooFinanceTypes_js_1.YahooNumber, | ||
twoHundredDayAverageChangePercent: yahooFinanceTypes_js_1.YahooNumber, | ||
marketCap: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
forwardPE: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
priceToBook: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
sourceInterval: yahooFinanceTypes_js_1.YahooNumber, | ||
exchangeDataDelayedBy: yahooFinanceTypes_js_1.YahooNumber, | ||
exchangeTimezoneName: typebox_1.Type.String(), | ||
exchangeTimezoneShortName: typebox_1.Type.String(), | ||
gmtOffSetMilliseconds: yahooFinanceTypes_js_1.YahooNumber, | ||
esgPopulated: typebox_1.Type.Boolean(), | ||
tradeable: typebox_1.Type.Boolean(), | ||
cryptoTradeable: typebox_1.Type.Boolean(), | ||
exchange: typebox_1.Type.String(), | ||
fiftyTwoWeekLow: yahooFinanceTypes_js_1.YahooNumber, | ||
fiftyTwoWeekHigh: yahooFinanceTypes_js_1.YahooNumber, | ||
shortName: typebox_1.Type.String(), | ||
averageAnalystRating: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
regularMarketChangePercent: yahooFinanceTypes_js_1.YahooNumber, | ||
symbol: typebox_1.Type.String(), | ||
dividendDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
displayName: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
trailingPE: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
prevName: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
nameChangeDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
ipoExpectedDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
dividendYield: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
dividendRate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
yieldTTM: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
peTTM: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
annualReturnNavY3: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
annualReturnNavY5: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
ytdReturn: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
trailingThreeMonthReturns: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
netAssets: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
netExpenseRatio: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
title: "ScreenerQuote", | ||
}); | ||
const ScreenerResult = typebox_1.Type.Object({ | ||
id: typebox_1.Type.String(), | ||
title: typebox_1.Type.String(), | ||
description: typebox_1.Type.String(), | ||
canonicalName: typebox_1.Type.String(), | ||
criteriaMeta: ScreenerCriteriaMeta, | ||
rawCriteria: typebox_1.Type.String(), | ||
start: yahooFinanceTypes_js_1.YahooNumber, | ||
count: yahooFinanceTypes_js_1.YahooNumber, | ||
total: yahooFinanceTypes_js_1.YahooNumber, | ||
quotes: typebox_1.Type.Array(ScreenerQuote), | ||
useRecords: typebox_1.Type.Boolean(), | ||
predefinedScr: typebox_1.Type.Boolean(), | ||
versionId: yahooFinanceTypes_js_1.YahooNumber, | ||
creationDate: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
lastUpdated: yahooFinanceTypes_js_1.YahooFinanceDate, | ||
isPremium: typebox_1.Type.Boolean(), | ||
iconUrl: typebox_1.Type.String(), | ||
}, { | ||
title: "ScreenerResult", | ||
}); | ||
const PredefinedScreenerModules = typebox_1.Type.Union([ | ||
typebox_1.Type.Literal("aggressive_small_caps"), | ||
typebox_1.Type.Literal("conservative_foreign_funds"), | ||
typebox_1.Type.Literal("day_gainers"), | ||
typebox_1.Type.Literal("day_losers"), | ||
typebox_1.Type.Literal("growth_technology_stocks"), | ||
typebox_1.Type.Literal("high_yield_bond"), | ||
typebox_1.Type.Literal("most_actives"), | ||
typebox_1.Type.Literal("most_shorted_stocks"), | ||
typebox_1.Type.Literal("portfolio_anchors"), | ||
typebox_1.Type.Literal("small_cap_gainers"), | ||
typebox_1.Type.Literal("solid_large_growth_funds"), | ||
typebox_1.Type.Literal("solid_midcap_growth_funds"), | ||
typebox_1.Type.Literal("top_mutual_funds"), | ||
typebox_1.Type.Literal("undervalued_growth_stocks"), | ||
typebox_1.Type.Literal("undervalued_large_caps"), | ||
], { | ||
title: "ScreenerPredefinedScreenerModules", | ||
}); | ||
const queryOptionsDefaults = { | ||
@@ -9,2 +169,8 @@ lang: "en-US", | ||
}; | ||
const ScreenerOptions = typebox_1.Type.Object({ | ||
lang: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
region: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
scrIds: PredefinedScreenerModules, | ||
count: typebox_1.Type.Optional(typebox_1.Type.Number()), | ||
}); | ||
function screener(queryOptionsOverrides, moduleOptions) { | ||
@@ -15,3 +181,3 @@ return this._moduleExec({ | ||
url: "https://${YF_QUERY_HOST}/v1/finance/screener/predefined/saved", | ||
schemaKey: "#/definitions/ScreenerOptions", | ||
schema: ScreenerOptions, | ||
defaults: queryOptionsDefaults, | ||
@@ -22,3 +188,3 @@ overrides: queryOptionsOverrides, | ||
result: { | ||
schemaKey: "#/definitions/ScreenerResult", | ||
schema: ScreenerResult, | ||
transformWith(result) { | ||
@@ -35,16 +201,1 @@ // console.log(result); | ||
exports.default = screener; | ||
// aggressive_small_caps | ||
// conservative_foreign_funds | ||
// day_gainers | ||
// day_losers | ||
// growth_technology_stocks | ||
// high_yield_bond | ||
// most_actives | ||
// most_shorted_stocks | ||
// portfolio_anchors | ||
// small_cap_gainers | ||
// solid_large_growth_funds | ||
// solid_midcap_growth_funds | ||
// top_mutual_funds | ||
// undervalued_growth_stocks | ||
// undervalued_large_caps |
@@ -0,113 +1,278 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export interface SearchQuoteYahoo { | ||
[key: string]: any; | ||
symbol: string; | ||
isYahooFinance: true; | ||
exchange: string; | ||
exchDisp?: string; | ||
shortname?: string; | ||
longname?: string; | ||
index: "quotes"; | ||
score: number; | ||
newListingDate?: Date; | ||
prevName?: string; | ||
nameChangeDate?: Date; | ||
sector?: string; | ||
industry?: string; | ||
dispSecIndFlag?: boolean; | ||
} | ||
export interface SearchQuoteYahooEquity extends SearchQuoteYahoo { | ||
quoteType: "EQUITY"; | ||
typeDisp: "Equity"; | ||
} | ||
export interface SearchQuoteYahooOption extends SearchQuoteYahoo { | ||
quoteType: "OPTION"; | ||
typeDisp: "Option"; | ||
} | ||
export interface SearchQuoteYahooETF extends SearchQuoteYahoo { | ||
quoteType: "ETF"; | ||
typeDisp: "ETF"; | ||
} | ||
export interface SearchQuoteYahooFund extends SearchQuoteYahoo { | ||
quoteType: "MUTUALFUND"; | ||
typeDisp: "Fund"; | ||
} | ||
export interface SearchQuoteYahooIndex extends SearchQuoteYahoo { | ||
quoteType: "INDEX"; | ||
typeDisp: "Index"; | ||
} | ||
export interface SearchQuoteYahooCurrency extends SearchQuoteYahoo { | ||
quoteType: "CURRENCY"; | ||
typeDisp: "Currency"; | ||
} | ||
export interface SearchQuoteYahooCryptocurrency extends SearchQuoteYahoo { | ||
quoteType: "CRYPTOCURRENCY"; | ||
typeDisp: "Cryptocurrency"; | ||
} | ||
export interface SearchQuoteYahooFuture extends SearchQuoteYahoo { | ||
quoteType: "FUTURE"; | ||
typeDisp: "Future" | "Futures"; | ||
} | ||
export interface SearchQuoteNonYahoo { | ||
[key: string]: any; | ||
index: string; | ||
name: string; | ||
permalink: string; | ||
isYahooFinance: false; | ||
} | ||
export interface SearchNews { | ||
[key: string]: any; | ||
uuid: string; | ||
title: string; | ||
publisher: string; | ||
link: string; | ||
providerPublishTime: Date; | ||
type: string; | ||
thumbnail?: { | ||
resolutions: SearchNewsThumbnailResolution[]; | ||
}; | ||
relatedTickers?: string[]; | ||
} | ||
export interface SearchNewsThumbnailResolution { | ||
url: string; | ||
width: number; | ||
height: number; | ||
tag: string; | ||
} | ||
export interface SearchResult { | ||
[key: string]: any; | ||
explains: Array<any>; | ||
count: number; | ||
quotes: Array<SearchQuoteYahooEquity | SearchQuoteYahooOption | SearchQuoteYahooETF | SearchQuoteYahooFund | SearchQuoteYahooIndex | SearchQuoteYahooCurrency | SearchQuoteYahooCryptocurrency | SearchQuoteNonYahoo | SearchQuoteYahooFuture>; | ||
news: Array<SearchNews>; | ||
nav: Array<any>; | ||
lists: Array<any>; | ||
researchReports: Array<any>; | ||
totalTime: number; | ||
screenerFieldResults?: Array<any>; | ||
culturalAssets?: Array<any>; | ||
timeTakenForQuotes: number; | ||
timeTakenForNews: number; | ||
timeTakenForAlgowatchlist: number; | ||
timeTakenForPredefinedScreener: number; | ||
timeTakenForCrunchbase: number; | ||
timeTakenForNav: number; | ||
timeTakenForResearchReports: number; | ||
timeTakenForScreenerField?: number; | ||
timeTakenForCulturalAssets?: number; | ||
} | ||
export interface SearchOptions { | ||
lang?: string; | ||
region?: string; | ||
quotesCount?: number; | ||
newsCount?: number; | ||
enableFuzzyQuery?: boolean; | ||
quotesQueryId?: string; | ||
multiQuoteQueryId?: string; | ||
newsQueryId?: string; | ||
enableCb?: boolean; | ||
enableNavLinks?: boolean; | ||
enableEnhancedTrivialQuery?: boolean; | ||
} | ||
type SearchResult = Static<typeof SearchResultSchema>; | ||
declare const SearchResultSchema: import("@sinclair/typebox").TObject<{ | ||
explains: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>; | ||
count: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
quotes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"EQUITY">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"Equity">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"OPTION">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"Option">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"ETF">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"ETF">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"MUTUALFUND">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"Fund">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"INDEX">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"Index">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"CURRENCY">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"Currency">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"CRYPTOCURRENCY">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"Cryptocurrency">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
index: import("@sinclair/typebox").TString; | ||
name: import("@sinclair/typebox").TString; | ||
permalink: import("@sinclair/typebox").TString; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<false>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"FUTURE">; | ||
typeDisp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Future">, import("@sinclair/typebox").TLiteral<"Futures">]>; | ||
}>]>>; | ||
news: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
uuid: import("@sinclair/typebox").TString; | ||
title: import("@sinclair/typebox").TString; | ||
publisher: import("@sinclair/typebox").TString; | ||
link: import("@sinclair/typebox").TString; | ||
providerPublishTime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
type: import("@sinclair/typebox").TString; | ||
thumbnail: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
resolutions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
url: import("@sinclair/typebox").TString; | ||
width: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
height: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
tag: import("@sinclair/typebox").TString; | ||
}>>; | ||
}>>; | ||
relatedTickers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>; | ||
}>>; | ||
nav: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>; | ||
lists: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>; | ||
researchReports: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>; | ||
totalTime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
screenerFieldResults: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>>; | ||
culturalAssets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>>; | ||
timeTakenForQuotes: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForNews: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForAlgowatchlist: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForPredefinedScreener: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForCrunchbase: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForNav: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForResearchReports: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForScreenerField: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
timeTakenForCulturalAssets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>; | ||
declare const SearchOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
region: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
quotesCount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
newsCount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
enableFuzzyQuery: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quotesQueryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
multiQuoteQueryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
newsQueryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
enableCb: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
enableNavLinks: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
enableEnhancedTrivialQuery: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>; | ||
type SearchOptions = Static<typeof SearchOptionsSchema>; | ||
export default function search(this: ModuleThis, query: string, queryOptionsOverrides?: SearchOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<SearchResult>; | ||
export default function search(this: ModuleThis, query: string, queryOptionsOverrides?: SearchOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const yahooFinanceTypes_js_1 = require("../lib/yahooFinanceTypes.js"); | ||
const SearchQuoteYahoo = typebox_1.Type.Object({ | ||
symbol: typebox_1.Type.String(), // "BABA" | ||
isYahooFinance: typebox_1.Type.Literal(true), // true | ||
exchange: typebox_1.Type.String(), // "NYQ" | ||
exchDisp: typebox_1.Type.Optional(typebox_1.Type.String()), // "London", e.g. with BJ0CDD2 | ||
shortname: typebox_1.Type.Optional(typebox_1.Type.String()), // "Alibaba Group Holding Limited" | ||
longname: typebox_1.Type.Optional(typebox_1.Type.String()), // "Alibaba Group Holding Limited" | ||
index: typebox_1.Type.Literal("quotes"), // "quotes" | ||
score: yahooFinanceTypes_js_1.YahooNumber, // 1111958.0 | ||
newListingDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), // "2021-02-16" | ||
prevName: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
nameChangeDate: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooFinanceDate), | ||
sector: typebox_1.Type.Optional(typebox_1.Type.String()), // "Industrials" | ||
industry: typebox_1.Type.Optional(typebox_1.Type.String()), // "Building Products & Equipment" | ||
dispSecIndFlag: typebox_1.Type.Optional(typebox_1.Type.Boolean()), // true | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}); | ||
const SearchQuoteYahooEquity = typebox_1.Type.Composite([ | ||
SearchQuoteYahoo, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("EQUITY"), | ||
typeDisp: typebox_1.Type.Literal("Equity"), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooEntity", | ||
}); | ||
const SearchQuoteYahooOption = typebox_1.Type.Composite([ | ||
SearchQuoteYahoo, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("OPTION"), | ||
typeDisp: typebox_1.Type.Literal("Option"), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooOption", | ||
}); | ||
const SearchQuoteYahooETF = typebox_1.Type.Composite([ | ||
SearchQuoteYahoo, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("ETF"), | ||
typeDisp: typebox_1.Type.Literal("ETF"), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooETF", | ||
}); | ||
const SearchQuoteYahooFund = typebox_1.Type.Composite([ | ||
SearchQuoteYahoo, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("MUTUALFUND"), | ||
typeDisp: typebox_1.Type.Literal("Fund"), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooFund", | ||
}); | ||
const SearchQuoteYahooIndex = typebox_1.Type.Composite([ | ||
SearchQuoteYahoo, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("INDEX"), | ||
typeDisp: typebox_1.Type.Literal("Index"), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooIndex", | ||
}); | ||
const SearchQuoteYahooCurrency = typebox_1.Type.Composite([ | ||
SearchQuoteYahoo, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("CURRENCY"), | ||
typeDisp: typebox_1.Type.Literal("Currency"), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooCurrency", | ||
}); | ||
const SearchQuoteYahooCryptocurrency = typebox_1.Type.Composite([ | ||
SearchQuoteYahoo, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("CRYPTOCURRENCY"), | ||
typeDisp: typebox_1.Type.Literal("Cryptocurrency"), | ||
}), | ||
]); | ||
const SearchQuoteYahooFuture = typebox_1.Type.Composite([ | ||
SearchQuoteYahoo, | ||
typebox_1.Type.Object({ | ||
quoteType: typebox_1.Type.Literal("FUTURE"), | ||
typeDisp: typebox_1.Type.Union([typebox_1.Type.Literal("Future"), typebox_1.Type.Literal("Futures")]), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooFuture", | ||
}); | ||
const SearchQuoteNonYahoo = typebox_1.Type.Object({ | ||
index: typebox_1.Type.String(), // '78ddc07626ff4bbcae663e88514c23a0' | ||
name: typebox_1.Type.String(), // 'AAPlasma' | ||
permalink: typebox_1.Type.String(), // 'aaplasma' | ||
isYahooFinance: typebox_1.Type.Literal(false), // false | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "SearchQuoteNonYahoo", | ||
}); | ||
const SearchNewsThumbnailResolution = typebox_1.Type.Object({ | ||
url: typebox_1.Type.String(), | ||
width: yahooFinanceTypes_js_1.YahooNumber, | ||
height: yahooFinanceTypes_js_1.YahooNumber, | ||
tag: typebox_1.Type.String(), | ||
}, { | ||
title: "SearchNewsThumbnailResolution", | ||
}); | ||
const SearchNews = typebox_1.Type.Object({ | ||
uuid: typebox_1.Type.String(), // "9aff624a-e84c-35f3-9c23-db39852006dc" | ||
title: typebox_1.Type.String(), // "Analyst Report: Alibaba Group Holding Limited" | ||
publisher: typebox_1.Type.String(), // "Morningstar Research" | ||
link: typebox_1.Type.String(), // "https://finance.yahoo.com/m/9aff624a-e84c-35f3-9c23-db39852006dc/analyst-report%3A-alibaba-group.html" | ||
providerPublishTime: yahooFinanceTypes_js_1.YahooFinanceDate, // coerced to New Date(1611285342 * 1000) | ||
type: typebox_1.Type.String(), // "STORY" TODO "STORY" | ??? | ||
thumbnail: typebox_1.Type.Optional(typebox_1.Type.Object({ | ||
resolutions: typebox_1.Type.Array(SearchNewsThumbnailResolution), | ||
})), | ||
relatedTickers: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.String())), // [ "AAPL" ] | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "SearchNews", | ||
}); | ||
const SearchResultSchema = typebox_1.Type.Object({ | ||
explains: typebox_1.Type.Array(typebox_1.Type.Any()), | ||
count: yahooFinanceTypes_js_1.YahooNumber, | ||
quotes: typebox_1.Type.Array(typebox_1.Type.Union([ | ||
SearchQuoteYahooEquity, | ||
SearchQuoteYahooOption, | ||
SearchQuoteYahooETF, | ||
SearchQuoteYahooFund, | ||
SearchQuoteYahooIndex, | ||
SearchQuoteYahooCurrency, | ||
SearchQuoteYahooCryptocurrency, | ||
SearchQuoteNonYahoo, | ||
SearchQuoteYahooFuture, | ||
])), | ||
news: typebox_1.Type.Array(SearchNews), | ||
nav: typebox_1.Type.Array(typebox_1.Type.Any()), | ||
lists: typebox_1.Type.Array(typebox_1.Type.Any()), | ||
researchReports: typebox_1.Type.Array(typebox_1.Type.Any()), | ||
totalTime: yahooFinanceTypes_js_1.YahooNumber, | ||
// ALWAYS present, but TEMPORARILY marked optional ("?") since its | ||
// sudden appearance, let's make sure it doesn't get suddenly removed. | ||
// Array<any> until we can find some examples of what it actually looks | ||
// like (#255). | ||
screenerFieldResults: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Any())), | ||
// ALWAYS present, but TEMPORARILY marked optional ("?") since its | ||
// sudden appearance, let's make sure it doesn't get suddenly removed. | ||
// Array<any> until we can find some examples of what it actually looks | ||
// like (#399). | ||
culturalAssets: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Any())), | ||
timeTakenForQuotes: yahooFinanceTypes_js_1.YahooNumber, // 26 | ||
timeTakenForNews: yahooFinanceTypes_js_1.YahooNumber, // 419 | ||
timeTakenForAlgowatchlist: yahooFinanceTypes_js_1.YahooNumber, // 700 | ||
timeTakenForPredefinedScreener: yahooFinanceTypes_js_1.YahooNumber, // 400 | ||
timeTakenForCrunchbase: yahooFinanceTypes_js_1.YahooNumber, // 400 | ||
timeTakenForNav: yahooFinanceTypes_js_1.YahooNumber, // 400 | ||
timeTakenForResearchReports: yahooFinanceTypes_js_1.YahooNumber, // 0 | ||
// ALWAYS present, but TEMPORARILY marked optional ("?") since its | ||
// sudden appearance, let's make sure it doesn't get suddenly removed. | ||
timeTakenForScreenerField: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
// ALWAYS present, but TEMPORARILY marked optional ("?") since its | ||
// sudden appearance, let's make sure it doesn't get suddenly removed. | ||
timeTakenForCulturalAssets: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "SearchResults", | ||
}); | ||
const SearchOptionsSchema = typebox_1.Type.Object({ | ||
lang: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
region: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
quotesCount: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
newsCount: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
enableFuzzyQuery: typebox_1.Type.Optional(typebox_1.Type.Boolean()), | ||
quotesQueryId: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
multiQuoteQueryId: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
newsQueryId: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
enableCb: typebox_1.Type.Optional(typebox_1.Type.Boolean()), | ||
enableNavLinks: typebox_1.Type.Optional(typebox_1.Type.Boolean()), | ||
enableEnhancedTrivialQuery: typebox_1.Type.Optional(typebox_1.Type.Boolean()), | ||
}, { | ||
title: "SearchOptions", | ||
additionalProperties: false, | ||
}); | ||
const queryOptionsDefaults = { | ||
@@ -18,12 +202,13 @@ lang: "en-US", | ||
return this._moduleExec({ | ||
moduleName: "search", | ||
moduleName: "searchTypebox", | ||
query: { | ||
url: "https://${YF_QUERY_HOST}/v1/finance/search", | ||
schemaKey: "#/definitions/SearchOptions", | ||
schema: SearchOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
runtime: { q: query }, | ||
overrides: queryOptionsOverrides, | ||
needsCrumb: false, | ||
}, | ||
result: { | ||
schemaKey: "#/definitions/SearchResult", | ||
schema: SearchResultSchema, | ||
}, | ||
@@ -30,0 +215,0 @@ moduleOptions, |
@@ -0,19 +1,28 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export interface TrendingSymbol { | ||
[key: string]: any; | ||
symbol: string; | ||
} | ||
export interface TrendingSymbolsResult { | ||
[key: string]: any; | ||
count: number; | ||
quotes: TrendingSymbol[]; | ||
jobTimestamp: number; | ||
startInterval: number; | ||
} | ||
export interface TrendingSymbolsOptions { | ||
lang?: string; | ||
region?: string; | ||
count?: number; | ||
} | ||
declare const TrendingSymbolsResult: import("@sinclair/typebox").TObject<{ | ||
count: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
quotes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
}>>; | ||
jobTimestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
startInterval: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
declare const TrendingSymbolsOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
region: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>>; | ||
type TrendingSymbolsResult = Static<typeof TrendingSymbolsResult>; | ||
type TrendingSymbolsOptions = Static<typeof TrendingSymbolsOptions>; | ||
export default function trendingSymbols(this: ModuleThis, query: string, queryOptionsOverrides?: TrendingSymbolsOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<TrendingSymbolsResult>; | ||
export default function trendingSymbols(this: ModuleThis, query: string, queryOptionsOverrides?: TrendingSymbolsOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const yahooFinanceTypes_js_1 = require("../lib/yahooFinanceTypes.js"); | ||
const TrendingSymbol = typebox_1.Type.Object({ | ||
symbol: typebox_1.Type.String(), | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
}); | ||
const TrendingSymbolsResult = typebox_1.Type.Object({ | ||
count: yahooFinanceTypes_js_1.YahooNumber, | ||
quotes: typebox_1.Type.Array(TrendingSymbol), | ||
jobTimestamp: yahooFinanceTypes_js_1.YahooNumber, | ||
startInterval: yahooFinanceTypes_js_1.YahooNumber, | ||
}, { | ||
additionalProperties: typebox_1.Type.Any(), | ||
title: "TrendingSymbolsResult", | ||
}); | ||
const TrendingSymbolsOptions = typebox_1.Type.Optional(typebox_1.Type.Object({ | ||
lang: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
region: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
count: typebox_1.Type.Optional(yahooFinanceTypes_js_1.YahooNumber), | ||
}, { | ||
title: "TrendingSymbolsOptions", | ||
})); | ||
const queryOptionsDefaults = { | ||
@@ -12,3 +35,3 @@ lang: "en-US", | ||
url: "https://${YF_QUERY_HOST}/v1/finance/trending/" + query, | ||
schemaKey: "#/definitions/TrendingSymbolsOptions", | ||
schema: TrendingSymbolsOptions, | ||
defaults: queryOptionsDefaults, | ||
@@ -18,3 +41,3 @@ overrides: queryOptionsOverrides, | ||
result: { | ||
schemaKey: "#/definitions/TrendingSymbolsResult", | ||
schema: TrendingSymbolsResult, | ||
transformWith(result) { | ||
@@ -21,0 +44,0 @@ if (!result.finance) |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const quote_js_1 = __importDefault(require("../modules/quote.js")); | ||
const validateAndCoerceTypes_js_1 = __importDefault(require("../lib/validateAndCoerceTypes.js")); | ||
const validateAndCoerceTypes_js_1 = require("../lib/validateAndCoerceTypes.js"); | ||
const quote_js_1 = __importStar(require("../modules/quote.js")); | ||
const DEBOUNCE_TIME = 50; | ||
@@ -15,7 +35,6 @@ const slugMap = new Map(); | ||
JSON.stringify(symbol, null, 2)); | ||
(0, validateAndCoerceTypes_js_1.default)({ | ||
source: "quoteCombine", | ||
(0, validateAndCoerceTypes_js_1.validateAndCoerceTypebox)({ | ||
type: "options", | ||
object: queryOptionsOverrides, | ||
schemaKey: "#/definitions/QuoteOptions", | ||
data: queryOptionsOverrides, | ||
schema: quote_js_1.QuoteOptionsSchema, | ||
options: this._opts.validation, | ||
@@ -51,4 +70,4 @@ }); | ||
.then((results) => { | ||
for (let result of results) { | ||
for (let promise of entry.symbols.get(result.symbol)) { | ||
for (const result of results) { | ||
for (const promise of entry.symbols.get(result.symbol)) { | ||
promise.resolve(result); | ||
@@ -59,5 +78,5 @@ promise.resolved = true; | ||
// Check for symbols we asked for and didn't get back, | ||
// e.g. non-existant symbols (#150) | ||
for (let [symbol, promises] of entry.symbols) { | ||
for (let promise of promises) { | ||
// e.g. non-existent symbols (#150) | ||
for (const [_, promises] of entry.symbols) { | ||
for (const promise of promises) { | ||
if (!promise.resolved) { | ||
@@ -70,4 +89,4 @@ promise.resolve(undefined); | ||
.catch((error) => { | ||
for (let symbolPromiseCallbacks of entry.symbols.values()) | ||
for (let promise of symbolPromiseCallbacks) | ||
for (const symbolPromiseCallbacks of entry.symbols.values()) | ||
for (const promise of symbolPromiseCallbacks) | ||
promise.reject(error); | ||
@@ -74,0 +93,0 @@ }); |
{ | ||
"name": "yahoo-finance2", | ||
"version": "2.11.3", | ||
"version": "2.12.0", | ||
"description": "JS API for Yahoo Finance", | ||
@@ -32,3 +32,3 @@ "type": "module", | ||
"engines": { | ||
"node": ">=16.0.0" | ||
"node": ">=18.0.0" | ||
}, | ||
@@ -41,11 +41,7 @@ "bin": { | ||
"lint": "eslint . --ext .js,.ts", | ||
"//schema": "ts-json-schema-generator -f tsconfig.json -p 'src/{modules/**/*.ts,lib/options.ts}' -t '*' | node bin/schema-tweak.js > schema.json", | ||
"schema": "node --loader ts-node/esm scripts/schema.js > schema.json", | ||
"timeseries": "node --loader ts-node/esm scripts/timeseries.js", | ||
"build": "yarn run build:esm && yarn run build:cjs && yarn run build:post", | ||
"build:esm": "tsc --module es2020 --target es2019 --outDir dist/esm", | ||
"build": "yarn run build:esm && yarn run build:cjs", | ||
"build:esm": "tsc --module esnext --target es2019 --outDir dist/esm", | ||
"build:cjs": "tsc --module commonjs --target es2015 --outDir dist/cjs && sed 's/\"type\": \"module\",/\"type:\": \"commonjs\",/' dist/cjs/package.json > dist/cjs/package-changed.json && mv dist/cjs/package-changed.json dist/cjs/package.json", | ||
"build:post": "scripts/json-transform.sh", | ||
"generateSchema": "yarn schema", | ||
"prepublishOnly": "yarn build && yarn generateSchema && yarn build:post", | ||
"prepublishOnly": "yarn build", | ||
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js", | ||
@@ -59,9 +55,7 @@ "test:ts": "tsc --noEmit", | ||
"files": [ | ||
"dist", | ||
"schema.json" | ||
"dist" | ||
], | ||
"dependencies": { | ||
"@sinclair/typebox": "^0.32.27", | ||
"@types/tough-cookie": "^4.0.2", | ||
"ajv": "8.10.0", | ||
"ajv-formats": "2.1.1", | ||
"node-fetch": "^2.6.1", | ||
@@ -78,2 +72,5 @@ "tough-cookie": "^4.1.2", | ||
"@semantic-release/release-notes-generator": "10.0.3", | ||
"@swc/core": "^1.7.26", | ||
"@swc/helpers": "^0.5.13", | ||
"@swc/jest": "^0.2.36", | ||
"@tsconfig/node12": "12.1.3", | ||
@@ -86,11 +83,8 @@ "@types/har-format": "^1.2.15", | ||
"eslint": "8.57.0", | ||
"eslint-config-prettier": "8.10.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"globby": "13.2.2", | ||
"jest": "29.7.0", | ||
"jest-tobetype": "1.2.3", | ||
"oas-schema-walker": "1.1.5", | ||
"prettier": "2.8.8", | ||
"prettier": "^3.3.3", | ||
"semantic-release": "19.0.5", | ||
"ts-jest": "29.1.2", | ||
"ts-json-schema-generator": "1.5.0", | ||
"ts-node": "10.9.2", | ||
@@ -97,0 +91,0 @@ "typescript": "5.4.3" |
import yahooFinanceFetch from "./lib/yahooFinanceFetch.js"; | ||
import setGlobalConfig from "./lib/setGlobalConfig.js"; | ||
import moduleExec from "./lib/moduleExec.js"; | ||
import setGlobalConfig from "./lib/setGlobalConfig.js"; | ||
import { disallowAdditionalProps } from "./lib/validateAndCoerceTypes.js"; | ||
import { suppressNotices } from "./lib/notices.js"; | ||
import autoc from "./modules/autoc.js"; | ||
@@ -24,3 +24,2 @@ import chart from "./modules/chart.js"; | ||
_opts: import("./lib/options.js").YahooFinanceOptions; | ||
_disallowAdditionalProps: typeof disallowAdditionalProps; | ||
errors: { | ||
@@ -30,2 +29,3 @@ [key: string]: any; | ||
setGlobalConfig: typeof setGlobalConfig; | ||
suppressNotices: typeof suppressNotices; | ||
autoc: typeof autoc; | ||
@@ -32,0 +32,0 @@ chart: typeof chart; |
// libs | ||
import yahooFinanceFetch from "./lib/yahooFinanceFetch.js"; | ||
import moduleExec from "./lib/moduleExec.js"; | ||
import options from "./lib/options.js"; | ||
import errors from "./lib/errors.js"; | ||
import setGlobalConfig from "./lib/setGlobalConfig.js"; | ||
import { disallowAdditionalProps } from "./lib/validateAndCoerceTypes.js"; | ||
import moduleExec from "./lib/moduleExec.js"; | ||
import { suppressNotices } from "./lib/notices.js"; | ||
// modules | ||
@@ -30,6 +30,6 @@ import autoc from "./modules/autoc.js"; | ||
_opts: options, | ||
_disallowAdditionalProps: disallowAdditionalProps, | ||
// common | ||
errors, | ||
setGlobalConfig, | ||
suppressNotices, | ||
// modules, | ||
@@ -36,0 +36,0 @@ autoc, |
@@ -1,5 +0,6 @@ | ||
import type { ErrorObject } from "ajv/dist/types"; | ||
import { TransformDecodeError, TransformDecodeCheckError } from "@sinclair/typebox/build/cjs/value"; | ||
export declare class BadRequestError extends Error { | ||
name: string; | ||
} | ||
type ValidationError = TransformDecodeError | TransformDecodeCheckError; | ||
export declare class HTTPError extends Error { | ||
@@ -17,6 +18,6 @@ name: string; | ||
result: any; | ||
errors?: null | ErrorObject[]; | ||
errors?: null | ValidationError[]; | ||
constructor(message: string, { result, errors }: { | ||
result: any; | ||
errors?: null | ErrorObject[]; | ||
errors?: null | ValidationError[]; | ||
}); | ||
@@ -23,0 +24,0 @@ } |
@@ -1,3 +0,6 @@ | ||
import pkg from "../../package.json.js"; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: we have to ignore this for csm output. | ||
import pkg from "../../package.json" assert { type: "json" }; | ||
import { Cookie } from "tough-cookie"; | ||
import { showNotice } from "./notices.js"; | ||
const CONFIG_FAKE_URL = "http://config.yf2/"; | ||
@@ -227,10 +230,4 @@ let crumb = null; | ||
} | ||
let shownYahooSurvey = false; | ||
export default function getCrumb(cookieJar, fetch, fetchOptionsBase, logger, url = "https://finance.yahoo.com/quote/AAPL", __getCrumb = _getCrumb) { | ||
if (!shownYahooSurvey) { | ||
logger.info("Please consider completing the survey at https://bit.ly/yahoo-finance-api-feedback " + | ||
"if you haven't already; for more info see " + | ||
"https://github.com/gadicc/node-yahoo-finance2/issues/764#issuecomment-2056623851."); | ||
shownYahooSurvey = true; | ||
} | ||
showNotice("yahooSurvey"); | ||
if (!promise) | ||
@@ -237,0 +234,0 @@ promise = __getCrumb(cookieJar, fetch, fetchOptionsBase, logger, url); |
@@ -0,1 +1,2 @@ | ||
import moduleExec from "./moduleExec"; | ||
export interface ModuleOptions { | ||
@@ -14,3 +15,3 @@ validateResult?: boolean; | ||
[key: string]: any; | ||
_moduleExec: any; | ||
_moduleExec: typeof moduleExec; | ||
} |
@@ -1,2 +0,1 @@ | ||
//import ModuleExec from "./moduleExec.js"; | ||
export {}; |
@@ -1,3 +0,3 @@ | ||
type TransformFunc = (arg: any) => any; | ||
interface ModuleExecOptions { | ||
import { TSchema } from "@sinclair/typebox"; | ||
interface ModuleExecOptions<TOpts, TResult> { | ||
/** | ||
@@ -19,6 +19,5 @@ * Name of the module, e.g. "search", "quoteSummary", etc. Used in error | ||
/** | ||
* Key of schema used to validate user-provider query options. | ||
* e.g. yf.search('AAPL', { isThisAValidOption: "maybe" }) | ||
* The schema to use to validate the options overrides | ||
*/ | ||
schemaKey: string; | ||
schema: TSchema; | ||
/** | ||
@@ -45,3 +44,3 @@ * Defaults for this query, e.g. { period: '1d' } in history, | ||
*/ | ||
transformWith?: TransformFunc; | ||
transformWith?: (opts: TOpts) => unknown; | ||
/** | ||
@@ -54,9 +53,9 @@ * Default: 'json'. Can be 'text' or 'csv' (augments fetch's "text"). | ||
*/ | ||
needsCrumb: boolean; | ||
needsCrumb?: boolean; | ||
}; | ||
result: { | ||
/** | ||
* Key of schema to validate (and coerce) the retruned result from Yahoo. | ||
* The schema to validate (and coerce) the retruned result from Yahoo. | ||
*/ | ||
schemaKey: string; | ||
schema: TSchema; | ||
/** | ||
@@ -66,3 +65,3 @@ * Mutate the Yahoo result *before* validating and coercion. Mostly used | ||
*/ | ||
transformWith?: TransformFunc; | ||
transformWith?: (result: unknown) => TResult; | ||
}; | ||
@@ -80,7 +79,5 @@ moduleOptions?: { | ||
} | ||
type ThisWithModExec = { | ||
declare function moduleExec<TOpts = unknown, TResult = unknown>(this: { | ||
[key: string]: any; | ||
_moduleExec: typeof moduleExec; | ||
}; | ||
declare function moduleExec(this: ThisWithModExec, opts: ModuleExecOptions): Promise<any>; | ||
}, opts: ModuleExecOptions<TOpts, TResult>): Promise<any>; | ||
export default moduleExec; |
@@ -17,6 +17,6 @@ /* | ||
*/ | ||
import validateAndCoerceTypes from "./validateAndCoerceTypes.js"; | ||
import { validateAndCoerceTypebox } from "./validateAndCoerceTypes.js"; | ||
import csv2json from "./csv2json.js"; | ||
async function moduleExec(opts) { | ||
var _a; | ||
var _a, _b; | ||
const queryOpts = opts.query; | ||
@@ -33,7 +33,6 @@ const moduleOpts = opts.moduleOptions; | ||
// Check that query options passed by the user are valid for this module | ||
validateAndCoerceTypes({ | ||
source: moduleName, | ||
validateAndCoerceTypebox({ | ||
type: "options", | ||
object: (_a = queryOpts.overrides) !== null && _a !== void 0 ? _a : {}, | ||
schemaKey: queryOpts.schemaKey, | ||
data: (_a = queryOpts.overrides) !== null && _a !== void 0 ? _a : {}, | ||
schema: queryOpts.schema, | ||
options: this._opts.validation, | ||
@@ -51,14 +50,17 @@ }); | ||
*/ | ||
if (queryOpts.transformWith) | ||
if (queryOpts.transformWith) { | ||
queryOptions = queryOpts.transformWith(queryOptions); | ||
} | ||
// this._fetch is lib/yahooFinanceFetch | ||
let result = await this._fetch(queryOpts.url, queryOptions, moduleOpts, queryOpts.fetchType, queryOpts.needsCrumb); | ||
if (queryOpts.fetchType === "csv") | ||
let result = await this._fetch(queryOpts.url, queryOptions, moduleOpts, queryOpts.fetchType, (_b = queryOpts.needsCrumb) !== null && _b !== void 0 ? _b : false); | ||
if (queryOpts.fetchType === "csv") { | ||
result = csv2json(result); | ||
} | ||
/* | ||
* Mutate the Yahoo result *before* validating and coercion. Mostly used | ||
* to e.g. throw if no (resault.returnField) and return result.returnField. | ||
* to e.g. throw if no (result.returnField) and return result.returnField. | ||
*/ | ||
if (opts.result.transformWith) | ||
result = opts.result.transformWith(result); | ||
if (resultOpts.transformWith) { | ||
result = resultOpts.transformWith(result); | ||
} | ||
const validateResult = !moduleOpts || | ||
@@ -90,7 +92,6 @@ moduleOpts.validateResult === undefined || | ||
try { | ||
validateAndCoerceTypes({ | ||
source: moduleName, | ||
validateAndCoerceTypebox({ | ||
type: "result", | ||
object: result, | ||
schemaKey: resultOpts.schemaKey, | ||
data: result, | ||
schema: resultOpts.schema, | ||
options: validationOpts, | ||
@@ -97,0 +98,0 @@ }); |
@@ -1,5 +0,4 @@ | ||
import type { ValidationOptions } from "./validateAndCoerceTypes.js"; | ||
import type { QueueOptions } from "./queue.js"; | ||
import { ExtendedCookieJar } from "./cookieJar.js"; | ||
export interface Logger { | ||
import { Static } from "@sinclair/typebox"; | ||
export type Logger = { | ||
info: (...args: any[]) => void; | ||
@@ -9,11 +8,33 @@ warn: (...args: any[]) => void; | ||
debug: (...args: any[]) => void; | ||
} | ||
export interface YahooFinanceOptions { | ||
YF_QUERY_HOST?: string; | ||
cookieJar?: ExtendedCookieJar; | ||
queue?: QueueOptions; | ||
validation?: ValidationOptions; | ||
}; | ||
declare const ValidationOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
logErrors: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
logOptionsErrors: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
_internalThrowOnAdditionalProperties: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>; | ||
export type ValidationOptions = Static<typeof ValidationOptionsSchema>; | ||
export declare const YahooFinanceOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
YF_QUERY_HOST: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
cookieJar: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
queue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
concurrency: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>; | ||
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>; | ||
}>>; | ||
validation: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
logErrors: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
logOptionsErrors: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
_internalThrowOnAdditionalProperties: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>>; | ||
logger: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
info: import("@sinclair/typebox").TFunction<[], import("@sinclair/typebox").TVoid>; | ||
warn: import("@sinclair/typebox").TFunction<[], import("@sinclair/typebox").TVoid>; | ||
error: import("@sinclair/typebox").TFunction<[], import("@sinclair/typebox").TVoid>; | ||
debug: import("@sinclair/typebox").TFunction<[], import("@sinclair/typebox").TVoid>; | ||
}>>; | ||
}>; | ||
export type YahooFinanceOptions = Static<typeof YahooFinanceOptionsSchema> & { | ||
cookieJar: ExtendedCookieJar; | ||
logger?: Logger; | ||
} | ||
}; | ||
declare const options: YahooFinanceOptions; | ||
export default options; |
import { ExtendedCookieJar } from "./cookieJar.js"; | ||
import { Type } from "@sinclair/typebox"; | ||
import { QueueOptionsSchema } from "./queue.js"; | ||
const LoggerSchema = Type.Object({ | ||
info: Type.Function([], Type.Void()), | ||
warn: Type.Function([], Type.Void()), | ||
error: Type.Function([], Type.Void()), | ||
debug: Type.Function([], Type.Void()), | ||
}); | ||
const ValidationOptionsSchema = Type.Object({ | ||
logErrors: Type.Optional(Type.Boolean()), | ||
logOptionsErrors: Type.Optional(Type.Boolean()), | ||
_internalThrowOnAdditionalProperties: Type.Optional(Type.Boolean({ | ||
default: process.env.NODE_ENV === "test", | ||
description: "Use this property to throw when properties beyond what is explicitly specified in the schema are provided. It is an internal option and subject to change, use at your own risk", | ||
})), | ||
}); | ||
export const YahooFinanceOptionsSchema = Type.Object({ | ||
YF_QUERY_HOST: Type.Optional(Type.String()), | ||
cookieJar: Type.Optional(Type.Any()), | ||
queue: Type.Optional(QueueOptionsSchema), | ||
validation: Type.Optional(ValidationOptionsSchema), | ||
logger: Type.Optional(LoggerSchema), | ||
}, { title: "YahooFinanceOptions" }); | ||
const options = { | ||
@@ -3,0 +26,0 @@ YF_QUERY_HOST: process.env.YF_QUERY_HOST || "query2.finance.yahoo.com", |
@@ -0,1 +1,2 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
interface Job { | ||
@@ -6,6 +7,7 @@ func: () => Promise<void>; | ||
} | ||
export interface QueueOptions { | ||
concurrency?: number; | ||
timeout?: number; | ||
} | ||
export declare const QueueOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
concurrency: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>; | ||
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>; | ||
}>; | ||
export type QueueOptions = Static<typeof QueueOptionsSchema>; | ||
export default class Queue { | ||
@@ -12,0 +14,0 @@ concurrency: number; |
@@ -0,1 +1,11 @@ | ||
import { Type } from "@sinclair/typebox"; | ||
export const QueueOptionsSchema = Type.Object({ | ||
// TODO: adds func type to json schema which is not supported | ||
//_queue?: Queue; | ||
concurrency: Type.Optional(Type.Number()), | ||
timeout: Type.Optional(Type.Number()), // TODO | ||
}, { | ||
additionalProperties: false, | ||
title: "QueueOptions", | ||
}); | ||
export default class Queue { | ||
@@ -2,0 +12,0 @@ constructor(opts = {}) { |
@@ -1,3 +0,3 @@ | ||
import type { YahooFinanceOptions } from "./options.js"; | ||
import { type YahooFinanceOptions } from "./options.js"; | ||
import type { ModuleThis } from "./moduleCommon.js"; | ||
export default function setGlobalConfig(this: ModuleThis, _config: YahooFinanceOptions): void; |
@@ -0,13 +1,13 @@ | ||
import { YahooFinanceOptionsSchema, } from "./options.js"; | ||
import validateAndCoerceTypes from "./validateAndCoerceTypes.js"; | ||
import { ExtendedCookieJar } from "./cookieJar.js"; | ||
export default function setGlobalConfig(_config) { | ||
// Instances (e.g. cookieJar) don't validate well :) | ||
const { cookieJar, logger, ...config } = _config; | ||
validateAndCoerceTypes({ | ||
object: config, | ||
source: "setGlobalConfig", | ||
const parsed = validateAndCoerceTypes({ | ||
data: _config, | ||
type: "options", | ||
options: this._opts.validation, | ||
schemaKey: "#/definitions/YahooFinanceOptions", | ||
schema: YahooFinanceOptionsSchema, | ||
}); | ||
// Instances (e.g. cookieJar) don't validate well :) | ||
const { cookieJar, ...config } = parsed; | ||
mergeObjects(this._opts, config); | ||
@@ -19,13 +19,2 @@ if (cookieJar) { | ||
} | ||
if (logger) { | ||
if (typeof logger.info !== "function") | ||
throw new Error("logger.info must be a function"); | ||
if (typeof logger.warn !== "function") | ||
throw new Error("logger.warn must be a function"); | ||
if (typeof logger.error !== "function") | ||
throw new Error("logger.error must be a function"); | ||
if (typeof logger.debug !== "function") | ||
throw new Error("logger.debug must be a function"); | ||
this._opts.logger = logger; | ||
} | ||
} | ||
@@ -32,0 +21,0 @@ function mergeObjects(original, objToMerge) { |
@@ -1,18 +0,9 @@ | ||
import Ajv from "ajv"; | ||
export declare const ajv: Ajv; | ||
export declare function resolvePath(obj: any, instancePath: string): any; | ||
export interface ValidationOptions { | ||
logErrors?: boolean; | ||
logOptionsErrors?: boolean; | ||
} | ||
export interface ValidateParams { | ||
source: string; | ||
type: "options" | "result"; | ||
object: object; | ||
schemaKey: string; | ||
import { StaticDecode, type TSchema } from "@sinclair/typebox"; | ||
import { ValidationOptions } from "./options"; | ||
export declare const validateAndCoerceTypebox: <T extends TSchema>({ type, data, schema, options, }: { | ||
type?: "result" | "options" | undefined; | ||
data: unknown; | ||
schema: T; | ||
options: ValidationOptions; | ||
} | ||
declare function disallowAdditionalProps(show?: boolean): void; | ||
declare function validate({ source, type, object, schemaKey, options, }: ValidateParams): void; | ||
export { disallowAdditionalProps }; | ||
export default validate; | ||
}) => StaticDecode<T>; | ||
export default validateAndCoerceTypebox; |
@@ -1,310 +0,68 @@ | ||
var _a; | ||
import Ajv from "ajv"; | ||
import addFormats from "ajv-formats"; | ||
//import schema from '../../schema.json'; | ||
import schema from "../../schema.json.js"; | ||
import pkg from "../../package.json.js"; | ||
import { InvalidOptionsError, FailedYahooValidationError } from "./errors.js"; | ||
// https://ajv.js.org/docs/api.html#options | ||
export const ajv = new Ajv({ | ||
// All rules, all errors. Don't end early after first error. | ||
allErrors: true, | ||
// Allow multiple non-null types, like in TypeSript. | ||
allowUnionTypes: true, | ||
}); | ||
addFormats(ajv); | ||
ajv.addKeyword({ | ||
keyword: "yahooFinanceType", | ||
modifying: true, | ||
errors: true, | ||
schema: true, | ||
compile(schema /*, parentSchema, it */) { | ||
const validate = (data, dataCtx) => { | ||
const { parentData, parentDataProperty } = dataCtx; | ||
function set(value) { | ||
parentData[parentDataProperty] = value; | ||
return true; | ||
} | ||
if (schema === "number" || schema === "number|null") { | ||
if (typeof data === "number") | ||
return true; | ||
if (typeof data === "string") { | ||
let float = Number.parseFloat(data); | ||
if (Number.isNaN(float)) { | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "Number.parseFloat returned NaN", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
} | ||
return set(float); | ||
} | ||
if (data === null) { | ||
if (schema === "number|null") { | ||
return true; | ||
} | ||
else { | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "Expecting number'ish but got null", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
} | ||
} | ||
if (typeof data === "object") { | ||
if (Object.keys(data).length === 0) { | ||
// Value of {} becomes null | ||
// Note, TypeScript types should be "number | null" | ||
if (schema === "number|null") { | ||
return set(null); | ||
} | ||
else { | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "Got {}->null for 'number', did you want 'number | null' ?", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
} | ||
} | ||
if (typeof data.raw === "number") | ||
return set(data.raw); | ||
} | ||
} | ||
else if (schema === "date" || schema === "date|null") { | ||
if (data instanceof Date) { | ||
// Validate existing date objects. | ||
// Generally we receive JSON but in the case of "historical", the | ||
// csv parser does the date conversion, and we want to validate | ||
// afterwards. | ||
return true; | ||
} | ||
if (typeof data === "number") | ||
return set(new Date(data * 1000)); | ||
if (data === null) { | ||
if (schema === "date|null") { | ||
return true; | ||
} | ||
else { | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "Expecting date'ish but got null", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
} | ||
} | ||
if (typeof data === "object") { | ||
if (Object.keys(data).length === 0) { | ||
// Value of {} becomes null | ||
// Note, TypeScript types should be "data | null" | ||
if (schema === "date|null") { | ||
return set(null); | ||
} | ||
else { | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "Got {}->null for 'date', did you want 'date | null' ?", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
} | ||
} | ||
if (typeof data.raw === "number") | ||
return set(new Date(data.raw * 1000)); | ||
} | ||
if (typeof data === "string") { | ||
if (data.match(/^\d{4,4}-\d{2,2}-\d{2,2}$/) || | ||
data.match(/^\d{4,4}-\d{2,2}-\d{2,2}T\d{2,2}:\d{2,2}:\d{2,2}(\.\d{3,3})?Z$/)) | ||
return set(new Date(data)); | ||
} | ||
} | ||
else if (schema === "DateInMs") { | ||
return set(new Date(data)); | ||
} | ||
else if (schema === "TwoNumberRange") { | ||
if (typeof data === "object" && | ||
typeof data.low === "number" && | ||
typeof data.high === "number") | ||
return true; | ||
if (typeof data === "string") { | ||
const parts = data.split("-").map(parseFloat); | ||
if (Number.isNaN(parts[0]) || Number.isNaN(parts[1])) { | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "Number.parseFloat returned NaN: [" + parts.join(",") + "]", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
} | ||
return set({ low: parts[0], high: parts[1] }); | ||
} | ||
} | ||
else { | ||
throw new Error("No such yahooFinanceType: " + schema); | ||
} | ||
validate.errors = validate.errors || []; | ||
validate.errors.push({ | ||
keyword: "yahooFinanceType", | ||
message: "No matching type", | ||
params: { schema, data }, | ||
}); | ||
return false; | ||
}; | ||
return validate; | ||
}, | ||
}); | ||
ajv.addSchema(schema); | ||
/* istanbul ignore next */ | ||
const logObj = typeof process !== "undefined" && ((_a = process === null || process === void 0 ? void 0 : process.stdout) === null || _a === void 0 ? void 0 : _a.isTTY) | ||
? (obj) => console.dir(obj, { depth: 4, colors: true }) | ||
: (obj) => console.log(JSON.stringify(obj, null, 2)); | ||
export function resolvePath(obj, instancePath) { | ||
const path = instancePath.split("/"); | ||
let ref = obj; | ||
for (let i = 1; i < path.length; i++) | ||
ref = ref[path[i]]; | ||
return ref; | ||
} | ||
function disallowAdditionalProps(show = false) { | ||
const disallowed = new Set(); | ||
// @ts-ignore: this can cause a breaking catch-22 on schema generation | ||
for (let key of Object.keys(schema.definitions)) { | ||
if (key.match(/Options$/)) { | ||
continue; | ||
} | ||
// @ts-ignore | ||
const def = schema.definitions[key]; | ||
if (def.type === "object" && def.additionalProperties === undefined) { | ||
def.additionalProperties = false; | ||
disallowed.add(key); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: we have to ignore this for csm output. | ||
import pkg from "../../package.json" assert { type: "json" }; | ||
import { FailedYahooValidationError, InvalidOptionsError } from "./errors.js"; | ||
import { TransformDecodeCheckError, TransformDecodeError, Value, } from "@sinclair/typebox/value"; | ||
const handleResultError = (e, options) => { | ||
const title = e.schema.title; | ||
if (options.logErrors) { | ||
console.log(JSON.stringify(e, null, 2)); | ||
console.log(` | ||
This may happen intermittently and you should catch errors appropriately. | ||
However: 1) if this recently started happening on every request for a symbol | ||
that used to work, Yahoo may have changed their API. 2) If this happens on | ||
every request for a symbol you've never used before, but not for other | ||
symbols, you've found an edge-case (OR, we may just be protecting you from | ||
"bad" data sometimes stored for e.g. misspelt symbols on Yahoo's side). | ||
Please see if anyone has reported this previously: | ||
${pkg.repository}/issues?q=is%3Aissue+${title} | ||
or open a new issue (and mention the symbol): ${pkg.name} v${pkg.version} | ||
${pkg.repository}/issues/new?labels=bug%2C+validation&template=validation.md&title=${title} | ||
For information on how to turn off the above logging or skip these errors, | ||
see https://github.com/gadicc/node-yahoo-finance2/tree/devel/docs/validation.md. | ||
At the end of the doc, there's also a section on how to | ||
[Help Fix Validation Errors](https://github.com/gadicc/node-yahoo-finance2/blob/devel/docs/validation.md#help-fix) | ||
in case you'd like to contribute to the project. Most of the time, these | ||
fixes are very quick and easy; it's just hard for our small core team to keep up, | ||
so help is always appreciated! | ||
`); | ||
} | ||
/* istanbul ignore next */ | ||
if (show) | ||
console.log("Disallowed additional props in " + Array.from(disallowed).join(", ")); | ||
} | ||
if (process.env.NODE_ENV === "test") | ||
disallowAdditionalProps(); | ||
function validate({ source, type, object, schemaKey, options, }) { | ||
const validator = ajv.getSchema(schemaKey); | ||
if (!validator) | ||
throw new Error("No such schema with key: " + schemaKey); | ||
const valid = validator(object); | ||
if (valid) | ||
return; | ||
if (type === "result") { | ||
/* istanbul ignore else */ | ||
if (validator.errors) { | ||
let origData = false; | ||
validator.errors.forEach((error) => { | ||
// For now let's ignore the base object which could be huge. | ||
/* istanbul ignore else */ | ||
if (error.instancePath !== "") | ||
// Note, not the regular ajv data value from verbose:true | ||
error.data = resolvePath(object, error.instancePath); | ||
if (error.schemaPath === "#/anyOf") { | ||
if (origData === false) { | ||
origData = error.data; | ||
} | ||
else if (origData === error.data) { | ||
error.data = "[shortened by validateAndCoerceTypes]"; | ||
} | ||
} | ||
}); | ||
// Becaue of the "anyOf" in quote, errors are huuuuge and mostly | ||
// irrelevant... so let's filter out (some of) the latter | ||
validator.errors = validator.errors.filter((error) => { | ||
var _a, _b; | ||
if (error.schemaPath.startsWith("#/definitions/Quote")) { | ||
const schemaQuoteType = error.schemaPath | ||
.substring(19) | ||
.split("/")[0] | ||
.toUpperCase(); | ||
/* | ||
* Filter out entries for non-matching schema type, i.e. | ||
* { | ||
* schemaPath: '#/definitions/QuoteCryptoCurrency/properties...' | ||
* data: { | ||
* quoteType: "EQUITY" | ||
* } | ||
* } | ||
*/ | ||
if (typeof error.data === "object" && | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: Properrty "quoteType" does not exist on type "object" | ||
((_a = error.data) === null || _a === void 0 ? void 0 : _a.quoteType) !== schemaQuoteType) | ||
return false; | ||
/* | ||
* Filter out the non-matching "const" for the above. | ||
* { | ||
* schemaPath: '#/definitions/QuoteCryptoCurrency/properties/quoteType/const' | ||
* keyword: "const", | ||
* params: { allowedValue: "CRYPTOCURRENCY"}}, | ||
* data: "EQUITY" | ||
* } | ||
*/ | ||
if (typeof error.data === "string" && | ||
((_b = error.params) === null || _b === void 0 ? void 0 : _b.allowedValue) === schemaQuoteType) | ||
return false; | ||
} | ||
return true; | ||
}); | ||
// In the case of there being NO match in #anyOf, bring back the data | ||
if (validator.errors.length === 1 && | ||
validator.errors[0].schemaPath === "#/anyOf") | ||
validator.errors[0].data = origData; | ||
throw new FailedYahooValidationError("Failed Yahoo Schema validation", { | ||
result: e.value, | ||
errors: [e], | ||
}); | ||
}; | ||
const handleOptionsError = (e, { logOptionsErrors }) => { | ||
if (logOptionsErrors) { | ||
console.error(`[yahooFinance] Invalid options ("${JSON.stringify(e.error, null, 2)}")`); | ||
} | ||
throw new InvalidOptionsError("Validation called with invalid options"); | ||
}; | ||
export const validateAndCoerceTypebox = ({ type, data, schema, options, }) => { | ||
try { | ||
const validationSchema = options._internalThrowOnAdditionalProperties | ||
? { ...schema, additionalProperties: false } | ||
: schema; | ||
return Value.Decode(validationSchema, data); | ||
} | ||
catch (e) { | ||
if (e instanceof TransformDecodeError || | ||
e instanceof TransformDecodeCheckError) { | ||
// TODO: The existing implementation of 'validate' assumes that the `type` parameter may not be provided | ||
// and defaults to validating the options if it is not. | ||
// We should probably explore validating this further up in the call chain. | ||
// It'd be nice to do this in the body of a module (e.g. search) so that we can avoid | ||
// polluting core code with type checks and edge cases | ||
type === "result" | ||
? handleResultError(e, options) | ||
: handleOptionsError(e, options); | ||
} | ||
if (options.logErrors === true) { | ||
const title = encodeURIComponent("Failed validation: " + schemaKey); | ||
console.log("The following result did not validate with schema: " + schemaKey); | ||
logObj(validator.errors); | ||
// logObj(object); | ||
console.log(` | ||
This may happen intermittently and you should catch errors appropriately. | ||
However: 1) if this recently started happening on every request for a symbol | ||
that used to work, Yahoo may have changed their API. 2) If this happens on | ||
every request for a symbol you've never used before, but not for other | ||
symbols, you've found an edge-case (OR, we may just be protecting you from | ||
"bad" data sometimes stored for e.g. misspelt symbols on Yahoo's side). | ||
Please see if anyone has reported this previously: | ||
${pkg.repository}/issues?q=is%3Aissue+${title} | ||
or open a new issue (and mention the symbol): ${pkg.name} v${pkg.version} | ||
${pkg.repository}/issues/new?labels=bug%2C+validation&template=validation.md&title=${title} | ||
For information on how to turn off the above logging or skip these errors, | ||
see https://github.com/gadicc/node-yahoo-finance2/tree/devel/docs/validation.md. | ||
At the end of the doc, there's also a section on how to | ||
[Help Fix Validation Errors](https://github.com/gadicc/node-yahoo-finance2/blob/devel/docs/validation.md#help-fix) | ||
in case you'd like to contribute to the project. Most of the time, these | ||
fixes are very quick and easy; it's just hard for our small core team to keep up, | ||
so help is always appreciated! | ||
`); | ||
} /* if (logErrors) */ | ||
throw new FailedYahooValidationError("Failed Yahoo Schema validation", { | ||
result: object, | ||
errors: validator.errors, | ||
}); | ||
} /* if (type === 'options') */ | ||
else { | ||
if (options.logOptionsErrors === true) { | ||
console.error(`[yahooFinance.${source}] Invalid options ("${schemaKey}")`); | ||
logObj({ errors: validator.errors, input: object }); | ||
} | ||
throw new InvalidOptionsError(`yahooFinance.${source} called with invalid options.`); | ||
throw e; | ||
} | ||
} | ||
export { disallowAdditionalProps }; | ||
export default validate; | ||
}; | ||
export default validateAndCoerceTypebox; |
import Queue from "./queue.js"; | ||
import errors from "./errors.js"; | ||
import pkg from "../../package.json.js"; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: we have to ignore this for csm output.assert | ||
import pkg from "../../package.json" assert { type: "json" }; | ||
import getCrumb from "./getCrumb.js"; | ||
@@ -5,0 +7,0 @@ const userAgent = `${pkg.name}/${pkg.version} (+${pkg.repository})`; |
@@ -0,125 +1,352 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export interface ChartResultObject { | ||
[key: string]: any; | ||
meta: ChartMeta; | ||
timestamp?: Array<number>; | ||
events?: ChartEventsObject; | ||
indicators: ChartIndicatorsObject; | ||
} | ||
export interface ChartResultArray { | ||
meta: ChartMeta; | ||
events?: ChartEventsArray; | ||
quotes: Array<ChartResultArrayQuote>; | ||
} | ||
export interface ChartResultArrayQuote { | ||
[key: string]: any; | ||
date: Date; | ||
high: number | null; | ||
low: number | null; | ||
open: number | null; | ||
close: number | null; | ||
volume: number | null; | ||
adjclose?: number | null; | ||
} | ||
export interface ChartMeta { | ||
[key: string]: any; | ||
currency: string; | ||
symbol: string; | ||
exchangeName: string; | ||
instrumentType: string; | ||
firstTradeDate: Date | null; | ||
regularMarketTime: Date; | ||
gmtoffset: number; | ||
timezone: string; | ||
exchangeTimezoneName: string; | ||
regularMarketPrice: number; | ||
chartPreviousClose?: number; | ||
previousClose?: number; | ||
scale?: number; | ||
priceHint: number; | ||
currentTradingPeriod: { | ||
[key: string]: any; | ||
pre: ChartMetaTradingPeriod; | ||
regular: ChartMetaTradingPeriod; | ||
post: ChartMetaTradingPeriod; | ||
}; | ||
tradingPeriods?: ChartMetaTradingPeriods; | ||
dataGranularity: string; | ||
range: string; | ||
validRanges: Array<string>; | ||
} | ||
export interface ChartMetaTradingPeriod { | ||
[key: string]: any; | ||
timezone: string; | ||
start: Date; | ||
end: Date; | ||
gmtoffset: number; | ||
} | ||
export interface ChartMetaTradingPeriods { | ||
[key: string]: any; | ||
pre?: Array<Array<ChartMetaTradingPeriod>>; | ||
post?: Array<Array<ChartMetaTradingPeriod>>; | ||
regular?: Array<Array<ChartMetaTradingPeriod>>; | ||
} | ||
export interface ChartEventsObject { | ||
[key: string]: any; | ||
dividends?: ChartEventDividends; | ||
splits?: ChartEventSplits; | ||
} | ||
export interface ChartEventsArray { | ||
[key: string]: any; | ||
dividends?: Array<ChartEventDividend>; | ||
splits?: Array<ChartEventSplit>; | ||
} | ||
export interface ChartEventDividends { | ||
[key: string]: ChartEventDividend; | ||
} | ||
export interface ChartEventDividend { | ||
[key: string]: any; | ||
amount: number; | ||
date: Date; | ||
} | ||
export interface ChartEventSplits { | ||
[key: string]: ChartEventSplit; | ||
} | ||
export interface ChartEventSplit { | ||
[key: string]: any; | ||
date: Date; | ||
numerator: number; | ||
denominator: number; | ||
splitRatio: string; | ||
} | ||
export interface ChartIndicatorsObject { | ||
[key: string]: any; | ||
quote: Array<ChartIndicatorQuote>; | ||
adjclose?: Array<ChartIndicatorAdjclose>; | ||
} | ||
export interface ChartIndicatorQuote { | ||
[key: string]: any; | ||
high: Array<number | null>; | ||
low: Array<number | null>; | ||
open: Array<number | null>; | ||
close: Array<number | null>; | ||
volume: Array<number | null>; | ||
} | ||
export interface ChartIndicatorAdjclose { | ||
[key: string]: any; | ||
adjclose?: Array<number | null>; | ||
} | ||
export interface ChartOptions { | ||
period1: Date | string | number; | ||
period2?: Date | string | number; | ||
useYfid?: boolean; | ||
interval?: "1m" | "2m" | "5m" | "15m" | "30m" | "60m" | "90m" | "1h" | "1d" | "5d" | "1wk" | "1mo" | "3mo"; | ||
includePrePost?: boolean; | ||
events?: string; | ||
lang?: string; | ||
return?: "array" | "object"; | ||
} | ||
export interface ChartOptionsWithReturnArray extends ChartOptions { | ||
return?: "array"; | ||
} | ||
export interface ChartOptionsWithReturnObject extends ChartOptions { | ||
return: "object"; | ||
} | ||
declare const ChartResultArraySchema: import("@sinclair/typebox").TObject<{ | ||
meta: import("@sinclair/typebox").TObject<{ | ||
currency: import("@sinclair/typebox").TString; | ||
symbol: import("@sinclair/typebox").TString; | ||
exchangeName: import("@sinclair/typebox").TString; | ||
instrumentType: import("@sinclair/typebox").TString; | ||
firstTradeDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>, import("@sinclair/typebox").TNull]>; | ||
regularMarketTime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timezone: import("@sinclair/typebox").TString; | ||
exchangeTimezoneName: import("@sinclair/typebox").TString; | ||
regularMarketPrice: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
chartPreviousClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
previousClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
scale: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
priceHint: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
currentTradingPeriod: import("@sinclair/typebox").TObject<{ | ||
pre: import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
regular: import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
post: import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
}>; | ||
tradingPeriods: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
pre: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>>>; | ||
post: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>>>; | ||
regular: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>>>; | ||
}>>; | ||
dataGranularity: import("@sinclair/typebox").TString; | ||
range: import("@sinclair/typebox").TString; | ||
validRanges: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>; | ||
}>; | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
dividends: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
amount: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
}>>>; | ||
splits: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
numerator: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
denominator: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
splitRatio: import("@sinclair/typebox").TString; | ||
}>>>; | ||
}>>; | ||
quotes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
high: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>; | ||
low: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>; | ||
open: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>; | ||
close: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>; | ||
volume: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>; | ||
adjclose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>; | ||
}>>; | ||
}>; | ||
declare const ChartResultObjectSchema: import("@sinclair/typebox").TObject<{ | ||
meta: import("@sinclair/typebox").TObject<{ | ||
currency: import("@sinclair/typebox").TString; | ||
symbol: import("@sinclair/typebox").TString; | ||
exchangeName: import("@sinclair/typebox").TString; | ||
instrumentType: import("@sinclair/typebox").TString; | ||
firstTradeDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>, import("@sinclair/typebox").TNull]>; | ||
regularMarketTime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timezone: import("@sinclair/typebox").TString; | ||
exchangeTimezoneName: import("@sinclair/typebox").TString; | ||
regularMarketPrice: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
chartPreviousClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
previousClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
scale: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
priceHint: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
currentTradingPeriod: import("@sinclair/typebox").TObject<{ | ||
pre: import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
regular: import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
post: import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
}>; | ||
tradingPeriods: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
pre: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>>>; | ||
post: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>>>; | ||
regular: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
timezone: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
end: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
gmtoffset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>>>; | ||
}>>; | ||
dataGranularity: import("@sinclair/typebox").TString; | ||
range: import("@sinclair/typebox").TString; | ||
validRanges: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>; | ||
}>; | ||
timestamp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>>; | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
dividends: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{}>>; | ||
splits: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{}>>; | ||
}>>; | ||
indicators: import("@sinclair/typebox").TObject<{ | ||
quote: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
high: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>; | ||
low: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>; | ||
open: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>; | ||
close: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>; | ||
volume: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>; | ||
}>>; | ||
adjclose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
adjclose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TNull]>>>; | ||
}>>>; | ||
}>; | ||
}>; | ||
export declare const ChartOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>]>>; | ||
useYfid: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1m">, import("@sinclair/typebox").TLiteral<"2m">, import("@sinclair/typebox").TLiteral<"5m">, import("@sinclair/typebox").TLiteral<"15m">, import("@sinclair/typebox").TLiteral<"30m">, import("@sinclair/typebox").TLiteral<"60m">, import("@sinclair/typebox").TLiteral<"90m">, import("@sinclair/typebox").TLiteral<"1h">, import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"5d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">, import("@sinclair/typebox").TLiteral<"3mo">]>>; | ||
includePrePost: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
return: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"array">, import("@sinclair/typebox").TLiteral<"object">]>>; | ||
}>; | ||
declare const ChartOptionsWithReturnArraySchema: import("@sinclair/typebox").TObject<{ | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>]>>; | ||
useYfid: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1m">, import("@sinclair/typebox").TLiteral<"2m">, import("@sinclair/typebox").TLiteral<"5m">, import("@sinclair/typebox").TLiteral<"15m">, import("@sinclair/typebox").TLiteral<"30m">, import("@sinclair/typebox").TLiteral<"60m">, import("@sinclair/typebox").TLiteral<"90m">, import("@sinclair/typebox").TLiteral<"1h">, import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"5d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">, import("@sinclair/typebox").TLiteral<"3mo">]>>; | ||
includePrePost: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
return: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"array">, import("@sinclair/typebox").TLiteral<"object">]>, import("@sinclair/typebox").TLiteral<"array">]>>; | ||
}>; | ||
declare const ChartOptionsWithReturnObjectSchema: import("@sinclair/typebox").TObject<{ | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>]>>; | ||
useYfid: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1m">, import("@sinclair/typebox").TLiteral<"2m">, import("@sinclair/typebox").TLiteral<"5m">, import("@sinclair/typebox").TLiteral<"15m">, import("@sinclair/typebox").TLiteral<"30m">, import("@sinclair/typebox").TLiteral<"60m">, import("@sinclair/typebox").TLiteral<"90m">, import("@sinclair/typebox").TLiteral<"1h">, import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"5d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">, import("@sinclair/typebox").TLiteral<"3mo">]>>; | ||
includePrePost: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
return: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"array">, import("@sinclair/typebox").TLiteral<"object">]>, import("@sinclair/typebox").TLiteral<"object">]>; | ||
}>; | ||
type ChartOptions = Static<typeof ChartOptionsSchema>; | ||
type ChartOptionsWithReturnObject = Static<typeof ChartOptionsWithReturnObjectSchema>; | ||
type ChartResultObject = Static<typeof ChartResultObjectSchema>; | ||
type ChartOptionsWithReturnArray = Static<typeof ChartOptionsWithReturnArraySchema>; | ||
type ChartResultArray = Static<typeof ChartResultArraySchema>; | ||
export declare const _chart: typeof chart; | ||
@@ -129,1 +356,2 @@ export default function chart(this: ModuleThis, symbol: string, queryOptionsOverrides: ChartOptionsWithReturnObject, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<ChartResultObject>; | ||
export default function chart(this: ModuleThis, symbol: string, queryOptionsOverrides: ChartOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
// Co-authored by @gadicc, @PythonCreator27 and @huned. | ||
import { Type } from "@sinclair/typebox"; | ||
import { YahooFinanceDate, YahooNumber } from "../lib/yahooFinanceTypes.js"; | ||
const ChartMetaTradingPeriod = Type.Object({ | ||
timezone: Type.String(), // "EST", | ||
start: YahooFinanceDate, // new Date(1637355600 * 1000), | ||
end: YahooFinanceDate, // new Date(1637370000 * 10000), | ||
gmtoffset: YahooNumber, // -18000 | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "ChartMetaTradingPeriod", | ||
}); | ||
const ChartMetaTradingPeriods = Type.Object({ | ||
pre: Type.Optional(Type.Array(Type.Array(ChartMetaTradingPeriod))), | ||
post: Type.Optional(Type.Array(Type.Array(ChartMetaTradingPeriod))), | ||
regular: Type.Optional(Type.Array(Type.Array(ChartMetaTradingPeriod))), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "ChartMetaTradingPeriods", | ||
}); | ||
const ChartResultArrayQuote = Type.Object({ | ||
date: YahooFinanceDate, | ||
high: Type.Union([YahooNumber, Type.Null()]), | ||
low: Type.Union([YahooNumber, Type.Null()]), | ||
open: Type.Union([YahooNumber, Type.Null()]), | ||
close: Type.Union([YahooNumber, Type.Null()]), | ||
volume: Type.Union([YahooNumber, Type.Null()]), | ||
adjclose: Type.Optional(Type.Union([YahooNumber, Type.Null()])), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "ChartResultArrayQuote", | ||
}); | ||
const ChartEventDividend = Type.Object({ | ||
amount: YahooNumber, | ||
date: YahooFinanceDate, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "ChartEventDividend", | ||
}); | ||
const ChartEventDividends = Type.Object({}, { | ||
additionalProperties: ChartEventDividend, | ||
title: "ChartEventDividends", | ||
}); | ||
const ChartEventSplit = Type.Object({ | ||
date: YahooFinanceDate, // new Date(1598880600 * 1000) | ||
numerator: YahooNumber, // 4 | ||
denominator: YahooNumber, // 1 | ||
splitRatio: Type.String(), // "4:1" | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}); | ||
const ChartEventsArray = Type.Object({ | ||
dividends: Type.Optional(Type.Array(ChartEventDividend)), | ||
splits: Type.Optional(Type.Array(ChartEventSplit)), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "ChartEventsArray", | ||
}); | ||
const ChartMeta = Type.Object({ | ||
currency: Type.String(), // "USD" | ||
symbol: Type.String(), // "AAPL", | ||
exchangeName: Type.String(), // "NMS", | ||
instrumentType: Type.String(), // "EQUITY", | ||
firstTradeDate: Type.Union([YahooFinanceDate, Type.Null()]), // new Date(345479400 * 1000); null in e.g. "APS.AX" | ||
regularMarketTime: YahooFinanceDate, // new Date(1637355602 * 1000), | ||
gmtoffset: YahooNumber, // -18000, | ||
timezone: Type.String(), /// "EST", | ||
exchangeTimezoneName: Type.String(), // "America/New_York", | ||
regularMarketPrice: YahooNumber, // 160.55, | ||
chartPreviousClose: Type.Optional(YahooNumber), // 79.75; missing in e.g. "APS.AX" | ||
previousClose: Type.Optional(YahooNumber), // 1137.06 | ||
scale: Type.Optional(YahooNumber), // 3, | ||
priceHint: YahooNumber, // 2, | ||
currentTradingPeriod: Type.Object({ | ||
pre: ChartMetaTradingPeriod, | ||
regular: ChartMetaTradingPeriod, | ||
post: ChartMetaTradingPeriod, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}), | ||
tradingPeriods: Type.Optional(ChartMetaTradingPeriods), | ||
dataGranularity: Type.String(), // "1d", | ||
range: Type.String(), // "" | ||
validRanges: Type.Array(Type.String()), // ["1d", "5d", "1mo", "3mo", "6mo", "1y", "2y", "5y", "10y", "ytd", "max"] | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "ChartMeta", | ||
}); | ||
const ChartResultArraySchema = Type.Object({ | ||
meta: ChartMeta, | ||
events: Type.Optional(ChartEventsArray), | ||
quotes: Type.Array(ChartResultArrayQuote), | ||
}, { title: "ChartResultArray" }); | ||
const ChartEventSplits = Type.Object({}, { | ||
additionalProperties: ChartEventSplit, | ||
title: "ChartEventSplits", | ||
}); | ||
const ChartIndicatorQuote = Type.Object({ | ||
high: Type.Array(Type.Union([YahooNumber, Type.Null()])), | ||
low: Type.Array(Type.Union([YahooNumber, Type.Null()])), | ||
open: Type.Array(Type.Union([YahooNumber, Type.Null()])), | ||
close: Type.Array(Type.Union([YahooNumber, Type.Null()])), | ||
volume: Type.Array(Type.Union([YahooNumber, Type.Null()])), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "ChartIndicatorQuote", | ||
}); | ||
const ChartIndicatorAdjclose = Type.Object({ | ||
adjclose: Type.Optional(Type.Array(Type.Union([YahooNumber, Type.Null()]))), // Missing in e.g. "APS.AX" | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "ChartIndicatorAdjClose", | ||
}); | ||
const ChartEventsObject = Type.Object({ | ||
dividends: Type.Optional(ChartEventDividends), | ||
splits: Type.Optional(ChartEventSplits), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}); | ||
const ChartIndicatorsObject = Type.Object({ | ||
quote: Type.Array(ChartIndicatorQuote), | ||
adjclose: Type.Optional(Type.Array(ChartIndicatorAdjclose)), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "ChartIndicatorObject", | ||
}); | ||
const ChartResultObjectSchema = Type.Object({ | ||
meta: ChartMeta, | ||
timestamp: Type.Optional(Type.Array(YahooNumber)), | ||
events: Type.Optional(ChartEventsObject), | ||
indicators: ChartIndicatorsObject, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "ChartResultObject", | ||
}); | ||
export const ChartOptionsSchema = Type.Object({ | ||
period1: Type.Union([Type.Date(), Type.String(), YahooNumber]), | ||
period2: Type.Optional(Type.Union([Type.Date(), Type.String(), YahooNumber])), | ||
useYfid: Type.Optional(Type.Boolean()), // true | ||
interval: Type.Optional(Type.Union([ | ||
Type.Literal("1m"), | ||
Type.Literal("2m"), | ||
Type.Literal("5m"), | ||
Type.Literal("15m"), | ||
Type.Literal("30m"), | ||
Type.Literal("60m"), | ||
Type.Literal("90m"), | ||
Type.Literal("1h"), | ||
Type.Literal("1d"), | ||
Type.Literal("5d"), | ||
Type.Literal("1wk"), | ||
Type.Literal("1mo"), | ||
Type.Literal("3mo"), | ||
])), | ||
includePrePost: Type.Optional(Type.Boolean()), // true | ||
events: Type.Optional(Type.String()), // 'history', | ||
lang: Type.Optional(Type.String()), // "en-US" | ||
return: Type.Optional(Type.Union([Type.Literal("array"), Type.Literal("object")])), | ||
}, { | ||
title: "ChartOptions", | ||
}); | ||
const ChartOptionsWithReturnArraySchema = Type.Composite([ | ||
ChartOptionsSchema, | ||
Type.Object({ | ||
return: Type.Optional(Type.Literal("array")), | ||
}), | ||
], { | ||
title: "ChartOptionsWithReturnArray", | ||
}); | ||
const ChartOptionsWithReturnObjectSchema = Type.Composite([ | ||
ChartOptionsSchema, | ||
Type.Object({ | ||
return: Type.Literal("object"), | ||
}), | ||
], { | ||
title: "ChartOptionsWithReturnObject", | ||
}); | ||
const queryOptionsDefaults = { | ||
@@ -21,3 +197,3 @@ useYfid: true, | ||
url: "https://${YF_QUERY_HOST}/v8/finance/chart/" + symbol, | ||
schemaKey: "#/definitions/ChartOptions", | ||
schema: ChartOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
@@ -31,7 +207,15 @@ overrides: queryOptionsOverrides, | ||
const value = queryOptions[fieldName]; | ||
if (value instanceof Date) | ||
if (value instanceof Date) { | ||
queryOptions[fieldName] = Math.floor(value.getTime() / 1000); | ||
else | ||
typeof value === "string"; | ||
queryOptions[fieldName] = Math.floor(new Date(value).getTime() / 1000); | ||
} | ||
else if (typeof value === "string") { | ||
const timestamp = new Date(value).getTime(); | ||
if (isNaN(timestamp)) | ||
throw new Error("yahooFinance.chart() option '" + | ||
fieldName + | ||
"' invalid date provided: '" + | ||
value + | ||
"'"); | ||
queryOptions[fieldName] = Math.floor(timestamp / 1000); | ||
} | ||
} | ||
@@ -48,3 +232,3 @@ if (queryOptions.period1 === queryOptions.period2) { | ||
result: { | ||
schemaKey: "#/definitions/ChartResultObject", | ||
schema: ChartResultObjectSchema, | ||
transformWith(result) { | ||
@@ -106,2 +290,3 @@ if (!result.chart) | ||
result2.quotes[i] = { | ||
// @ts-expect-error (eatkinson): clean this up with type in followup | ||
date: new Date(timestamp[i] * 1000), | ||
@@ -120,3 +305,5 @@ high: result.indicators.quote[0].high[i], | ||
for (const event of ["dividends", "splits"]) { | ||
// @ts-expect-error (eatkinson): Fix up type in follow up | ||
if (result.events[event]) | ||
// @ts-expect-error (eatkinson): Fix up type in follow up | ||
result2.events[event] = Object.values(result.events[event]); | ||
@@ -123,0 +310,0 @@ } |
@@ -0,131 +1,272 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export interface DailyGainersResult { | ||
id: string; | ||
title: string; | ||
description: string; | ||
canonicalName: string; | ||
criteriaMeta: DailyGainersCriteriaMeta; | ||
rawCriteria: string; | ||
start: number; | ||
count: number; | ||
total: number; | ||
quotes: DailyGainersQuote[]; | ||
useRecords: boolean; | ||
predefinedScr: boolean; | ||
versionId: number; | ||
creationDate: number; | ||
lastUpdated: number; | ||
isPremium: boolean; | ||
iconUrl: string; | ||
} | ||
export interface DailyGainersCriteriaMeta { | ||
size: number; | ||
offset: number; | ||
sortField: string; | ||
sortType: string; | ||
quoteType: string; | ||
criteria: DailyGainersCriterum[]; | ||
topOperator: string; | ||
} | ||
export interface DailyGainersCriterum { | ||
field: string; | ||
operators: string[]; | ||
values: number[]; | ||
labelsSelected: number[]; | ||
dependentValues: any[]; | ||
} | ||
export interface DailyGainersQuote { | ||
language: string; | ||
region: string; | ||
quoteType: string; | ||
typeDisp: string; | ||
quoteSourceName: string; | ||
triggerable: boolean; | ||
customPriceAlertConfidence: string; | ||
lastCloseTevEbitLtm?: number; | ||
lastClosePriceToNNWCPerShare?: number; | ||
firstTradeDateMilliseconds: number; | ||
priceHint: number; | ||
postMarketChangePercent?: number; | ||
postMarketTime?: number; | ||
postMarketPrice?: number; | ||
postMarketChange?: number; | ||
regularMarketChange: number; | ||
regularMarketTime: number; | ||
regularMarketPrice: number; | ||
regularMarketDayHigh: number; | ||
regularMarketDayRange: string; | ||
currency: string; | ||
regularMarketDayLow: number; | ||
regularMarketVolume: number; | ||
regularMarketPreviousClose: number; | ||
bid?: number; | ||
ask?: number; | ||
bidSize?: number; | ||
askSize?: number; | ||
market: string; | ||
messageBoardId: string; | ||
fullExchangeName: string; | ||
longName: string; | ||
financialCurrency?: string; | ||
regularMarketOpen: number; | ||
averageDailyVolume3Month: number; | ||
averageDailyVolume10Day: number; | ||
fiftyTwoWeekLowChange: number; | ||
fiftyTwoWeekLowChangePercent: number; | ||
fiftyTwoWeekRange: string; | ||
fiftyTwoWeekHighChange: number; | ||
fiftyTwoWeekHighChangePercent: number; | ||
fiftyTwoWeekChangePercent: number; | ||
earningsTimestamp?: number; | ||
earningsTimestampStart?: number; | ||
earningsTimestampEnd?: number; | ||
trailingAnnualDividendRate: number; | ||
trailingAnnualDividendYield: number; | ||
marketState: string; | ||
epsTrailingTwelveMonths?: number; | ||
epsForward?: number; | ||
epsCurrentYear?: number; | ||
priceEpsCurrentYear?: number; | ||
sharesOutstanding: number; | ||
bookValue?: number; | ||
fiftyDayAverage: number; | ||
fiftyDayAverageChange: number; | ||
fiftyDayAverageChangePercent: number; | ||
twoHundredDayAverage: number; | ||
twoHundredDayAverageChange: number; | ||
twoHundredDayAverageChangePercent: number; | ||
marketCap: number; | ||
forwardPE?: number; | ||
priceToBook?: number; | ||
sourceInterval: number; | ||
exchangeDataDelayedBy: number; | ||
exchangeTimezoneName: string; | ||
exchangeTimezoneShortName: string; | ||
gmtOffSetMilliseconds: number; | ||
esgPopulated: boolean; | ||
tradeable: boolean; | ||
cryptoTradeable: boolean; | ||
exchange: string; | ||
fiftyTwoWeekLow: number; | ||
fiftyTwoWeekHigh: number; | ||
shortName: string; | ||
averageAnalystRating?: string; | ||
regularMarketChangePercent: number; | ||
symbol: string; | ||
dividendDate?: number; | ||
displayName?: string; | ||
trailingPE?: number; | ||
prevName?: string; | ||
nameChangeDate?: number; | ||
ipoExpectedDate?: number; | ||
dividendYield?: number; | ||
dividendRate?: number; | ||
} | ||
export interface DailyGainersOptions { | ||
lang?: string; | ||
region?: string; | ||
count?: number; | ||
} | ||
declare const DailyGainersOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
region: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>; | ||
declare const DailyGainersResultSchema: import("@sinclair/typebox").TObject<{ | ||
id: import("@sinclair/typebox").TString; | ||
title: import("@sinclair/typebox").TString; | ||
description: import("@sinclair/typebox").TString; | ||
canonicalName: import("@sinclair/typebox").TString; | ||
criteriaMeta: import("@sinclair/typebox").TObject<{ | ||
size: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
offset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sortField: import("@sinclair/typebox").TString; | ||
sortType: import("@sinclair/typebox").TString; | ||
quoteType: import("@sinclair/typebox").TString; | ||
criteria: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
field: import("@sinclair/typebox").TString; | ||
operators: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>; | ||
values: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
labelsSelected: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dependentValues: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>; | ||
}>>; | ||
topOperator: import("@sinclair/typebox").TString; | ||
}>; | ||
rawCriteria: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
count: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
total: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
quotes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
language: import("@sinclair/typebox").TString; | ||
region: import("@sinclair/typebox").TString; | ||
quoteType: import("@sinclair/typebox").TString; | ||
typeDisp: import("@sinclair/typebox").TString; | ||
quoteSourceName: import("@sinclair/typebox").TString; | ||
triggerable: import("@sinclair/typebox").TBoolean; | ||
customPriceAlertConfidence: import("@sinclair/typebox").TString; | ||
lastCloseTevEbitLtm: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
lastClosePriceToNNWCPerShare: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
firstTradeDateMilliseconds: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
priceHint: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
postMarketChangePercent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
postMarketTime: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
postMarketPrice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
postMarketChange: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
regularMarketChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketTime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketPrice: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketDayHigh: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketDayRange: import("@sinclair/typebox").TString; | ||
currency: import("@sinclair/typebox").TString; | ||
regularMarketDayLow: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketVolume: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketPreviousClose: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
bid: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
ask: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
bidSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
askSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
market: import("@sinclair/typebox").TString; | ||
messageBoardId: import("@sinclair/typebox").TString; | ||
fullExchangeName: import("@sinclair/typebox").TString; | ||
longName: import("@sinclair/typebox").TString; | ||
financialCurrency: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
regularMarketOpen: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
averageDailyVolume3Month: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
averageDailyVolume10Day: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekLowChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekLowChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekRange: import("@sinclair/typebox").TString; | ||
fiftyTwoWeekHighChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekHighChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
earningsTimestamp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
earningsTimestampStart: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
earningsTimestampEnd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
trailingAnnualDividendRate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
trailingAnnualDividendYield: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
marketState: import("@sinclair/typebox").TString; | ||
epsTrailingTwelveMonths: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
epsForward: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
epsCurrentYear: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
priceEpsCurrentYear: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sharesOutstanding: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
bookValue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
fiftyDayAverage: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyDayAverageChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyDayAverageChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
twoHundredDayAverage: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
twoHundredDayAverageChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
twoHundredDayAverageChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
marketCap: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
forwardPE: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
priceToBook: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sourceInterval: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
exchangeDataDelayedBy: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
exchangeTimezoneName: import("@sinclair/typebox").TString; | ||
exchangeTimezoneShortName: import("@sinclair/typebox").TString; | ||
gmtOffSetMilliseconds: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
esgPopulated: import("@sinclair/typebox").TBoolean; | ||
tradeable: import("@sinclair/typebox").TBoolean; | ||
cryptoTradeable: import("@sinclair/typebox").TBoolean; | ||
exchange: import("@sinclair/typebox").TString; | ||
fiftyTwoWeekLow: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekHigh: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
shortName: import("@sinclair/typebox").TString; | ||
averageAnalystRating: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
regularMarketChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
symbol: import("@sinclair/typebox").TString; | ||
dividendDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
displayName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
trailingPE: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
ipoExpectedDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dividendYield: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dividendRate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>>; | ||
useRecords: import("@sinclair/typebox").TBoolean; | ||
predefinedScr: import("@sinclair/typebox").TBoolean; | ||
versionId: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
creationDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
lastUpdated: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
isPremium: import("@sinclair/typebox").TBoolean; | ||
iconUrl: import("@sinclair/typebox").TString; | ||
}>; | ||
type DailyGainersResult = Static<typeof DailyGainersResultSchema>; | ||
type DailyGainersOptions = Static<typeof DailyGainersOptionsSchema>; | ||
export default function dailyGainers(this: ModuleThis, queryOptionsOverrides?: DailyGainersOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<DailyGainersResult>; | ||
export default function dailyGainers(this: ModuleThis, queryOptionsOverrides?: DailyGainersOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
@@ -0,1 +1,131 @@ | ||
import { Type } from "@sinclair/typebox"; | ||
import { YahooNumber } from "../lib/yahooFinanceTypes.js"; | ||
const DailyGainersCriterum = Type.Object({ | ||
field: Type.String(), | ||
operators: Type.Array(Type.String()), | ||
values: Type.Array(YahooNumber), | ||
labelsSelected: Type.Array(YahooNumber), | ||
dependentValues: Type.Array(Type.Any()), | ||
}, { title: "DailyGainersCriterium" }); | ||
const DailyGainersQuote = Type.Object({ | ||
language: Type.String(), | ||
region: Type.String(), | ||
quoteType: Type.String(), | ||
typeDisp: Type.String(), | ||
quoteSourceName: Type.String(), | ||
triggerable: Type.Boolean(), | ||
customPriceAlertConfidence: Type.String(), | ||
lastCloseTevEbitLtm: Type.Optional(YahooNumber), | ||
lastClosePriceToNNWCPerShare: Type.Optional(YahooNumber), | ||
firstTradeDateMilliseconds: YahooNumber, | ||
priceHint: YahooNumber, | ||
postMarketChangePercent: Type.Optional(YahooNumber), | ||
postMarketTime: Type.Optional(YahooNumber), | ||
postMarketPrice: Type.Optional(YahooNumber), | ||
postMarketChange: Type.Optional(YahooNumber), | ||
regularMarketChange: YahooNumber, | ||
regularMarketTime: YahooNumber, | ||
regularMarketPrice: YahooNumber, | ||
regularMarketDayHigh: YahooNumber, | ||
regularMarketDayRange: Type.String(), | ||
currency: Type.String(), | ||
regularMarketDayLow: YahooNumber, | ||
regularMarketVolume: YahooNumber, | ||
regularMarketPreviousClose: YahooNumber, | ||
bid: Type.Optional(YahooNumber), | ||
ask: Type.Optional(YahooNumber), | ||
bidSize: Type.Optional(YahooNumber), | ||
askSize: Type.Optional(YahooNumber), | ||
market: Type.String(), | ||
messageBoardId: Type.String(), | ||
fullExchangeName: Type.String(), | ||
longName: Type.String(), | ||
financialCurrency: Type.Optional(Type.String()), | ||
regularMarketOpen: YahooNumber, | ||
averageDailyVolume3Month: YahooNumber, | ||
averageDailyVolume10Day: YahooNumber, | ||
fiftyTwoWeekLowChange: YahooNumber, | ||
fiftyTwoWeekLowChangePercent: YahooNumber, | ||
fiftyTwoWeekRange: Type.String(), | ||
fiftyTwoWeekHighChange: YahooNumber, | ||
fiftyTwoWeekHighChangePercent: YahooNumber, | ||
fiftyTwoWeekChangePercent: YahooNumber, | ||
earningsTimestamp: Type.Optional(YahooNumber), | ||
earningsTimestampStart: Type.Optional(YahooNumber), | ||
earningsTimestampEnd: Type.Optional(YahooNumber), | ||
trailingAnnualDividendRate: YahooNumber, | ||
trailingAnnualDividendYield: YahooNumber, | ||
marketState: Type.String(), | ||
epsTrailingTwelveMonths: Type.Optional(YahooNumber), | ||
epsForward: Type.Optional(YahooNumber), | ||
epsCurrentYear: Type.Optional(YahooNumber), | ||
priceEpsCurrentYear: Type.Optional(YahooNumber), | ||
sharesOutstanding: YahooNumber, | ||
bookValue: Type.Optional(YahooNumber), | ||
fiftyDayAverage: YahooNumber, | ||
fiftyDayAverageChange: YahooNumber, | ||
fiftyDayAverageChangePercent: YahooNumber, | ||
twoHundredDayAverage: YahooNumber, | ||
twoHundredDayAverageChange: YahooNumber, | ||
twoHundredDayAverageChangePercent: YahooNumber, | ||
marketCap: YahooNumber, | ||
forwardPE: Type.Optional(YahooNumber), | ||
priceToBook: Type.Optional(YahooNumber), | ||
sourceInterval: YahooNumber, | ||
exchangeDataDelayedBy: YahooNumber, | ||
exchangeTimezoneName: Type.String(), | ||
exchangeTimezoneShortName: Type.String(), | ||
gmtOffSetMilliseconds: YahooNumber, | ||
esgPopulated: Type.Boolean(), | ||
tradeable: Type.Boolean(), | ||
cryptoTradeable: Type.Boolean(), | ||
exchange: Type.String(), | ||
fiftyTwoWeekLow: YahooNumber, | ||
fiftyTwoWeekHigh: YahooNumber, | ||
shortName: Type.String(), | ||
averageAnalystRating: Type.Optional(Type.String()), | ||
regularMarketChangePercent: YahooNumber, | ||
symbol: Type.String(), | ||
dividendDate: Type.Optional(YahooNumber), | ||
displayName: Type.Optional(Type.String()), | ||
trailingPE: Type.Optional(YahooNumber), | ||
prevName: Type.Optional(Type.String()), | ||
nameChangeDate: Type.Optional(YahooNumber), | ||
ipoExpectedDate: Type.Optional(YahooNumber), | ||
dividendYield: Type.Optional(YahooNumber), | ||
dividendRate: Type.Optional(YahooNumber), | ||
}, { title: "DailyGainersQuote" }); | ||
const DailyGainersOptionsSchema = Type.Object({ | ||
lang: Type.Optional(Type.String()), | ||
region: Type.Optional(Type.String()), | ||
count: Type.Optional(YahooNumber), | ||
}, { title: "DailyGainersOptions" }); | ||
const DailyGainersCriteriaMeta = Type.Object({ | ||
size: YahooNumber, | ||
offset: YahooNumber, | ||
sortField: Type.String(), | ||
sortType: Type.String(), | ||
quoteType: Type.String(), | ||
criteria: Type.Array(DailyGainersCriterum), | ||
topOperator: Type.String(), | ||
}, { title: "DailyGainersCriteriaMeta" }); | ||
const DailyGainersResultSchema = Type.Object({ | ||
id: Type.String(), | ||
title: Type.String(), | ||
description: Type.String(), | ||
canonicalName: Type.String(), | ||
criteriaMeta: DailyGainersCriteriaMeta, | ||
rawCriteria: Type.String(), | ||
start: YahooNumber, | ||
count: YahooNumber, | ||
total: YahooNumber, | ||
quotes: Type.Array(DailyGainersQuote), | ||
useRecords: Type.Boolean(), | ||
predefinedScr: Type.Boolean(), | ||
versionId: YahooNumber, | ||
creationDate: YahooNumber, | ||
lastUpdated: YahooNumber, | ||
isPremium: Type.Boolean(), | ||
iconUrl: Type.String(), | ||
}, { title: "DailyGainersResult" }); | ||
const queryOptionsDefaults = { | ||
@@ -12,3 +142,3 @@ lang: "en-US", | ||
url: "https://${YF_QUERY_HOST}/v1/finance/screener/predefined/saved", | ||
schemaKey: "#/definitions/DailyGainersOptions", | ||
schema: DailyGainersOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
@@ -19,5 +149,4 @@ overrides: queryOptionsOverrides, | ||
result: { | ||
schemaKey: "#/definitions/DailyGainersResult", | ||
schema: DailyGainersResultSchema, | ||
transformWith(result) { | ||
// console.log(result); | ||
if (!result.finance) | ||
@@ -24,0 +153,0 @@ throw new Error("Unexpected result: " + JSON.stringify(result)); |
@@ -0,19 +1,28 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export declare const FundamentalsTimeSeries_Types: string[]; | ||
export declare const FundamentalsTimeSeries_Modules: string[]; | ||
export type FundamentalsTimeSeriesResults = Array<FundamentalsTimeSeriesResult>; | ||
export interface FundamentalsTimeSeriesResult { | ||
[key: string]: unknown; | ||
date: Date; | ||
} | ||
export interface FundamentalsTimeSeriesOptions { | ||
period1: Date | number | string; | ||
period2?: Date | number | string; | ||
type?: string; | ||
merge?: boolean; | ||
padTimeSeries?: boolean; | ||
lang?: string; | ||
region?: string; | ||
module: string; | ||
} | ||
declare const FundamentalsTimeSeriesResultSchema: import("@sinclair/typebox").TObject<{ | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
}>; | ||
declare const FundamentalsTimeSeriesOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TString]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>, import("@sinclair/typebox").TString]>>; | ||
type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
merge: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
padTimeSeries: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
region: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
module: import("@sinclair/typebox").TString; | ||
}>; | ||
type FundamentalsTimeSeriesOptions = Static<typeof FundamentalsTimeSeriesOptionsSchema>; | ||
type FundamentalsTimeSeriesResult = Static<typeof FundamentalsTimeSeriesResultSchema>; | ||
export default function fundamentalsTimeSeries(this: ModuleThis, symbol: string, queryOptionsOverrides: FundamentalsTimeSeriesOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<FundamentalsTimeSeriesResult>; | ||
@@ -41,1 +50,2 @@ export default function fundamentalsTimeSeries(this: ModuleThis, symbol: string, queryOptionsOverrides: FundamentalsTimeSeriesOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export declare const processResponse: (response: any) => any; | ||
export {}; |
@@ -1,4 +0,8 @@ | ||
import Timeseries_Keys from "../lib/timeseries.json.js"; | ||
export const FundamentalsTimeSeries_Types = ["quarterly", "annual", "trailing"]; | ||
export const FundamentalsTimeSeries_Modules = [ | ||
import { Type } from "@sinclair/typebox"; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore: we have to ignore this for csm output. | ||
import Timeseries_Keys from "../lib/timeseries.json" assert { type: "json" }; | ||
import { YahooFinanceDate, YahooNumber } from "../lib/yahooFinanceTypes.js"; | ||
const FundamentalsTimeSeries_Types = ["quarterly", "annual", "trailing"]; | ||
const FundamentalsTimeSeries_Modules = [ | ||
"financials", | ||
@@ -9,2 +13,21 @@ "balance-sheet", | ||
]; | ||
const FundamentalsTimeSeriesResultSchema = Type.Object({ | ||
date: YahooFinanceDate, | ||
}, { | ||
additionalProperties: Type.Unknown(), | ||
title: "FundamentalsTimeSeriesResult", | ||
}); | ||
const FundamentalsTimeSeriesOptionsSchema = Type.Object({ | ||
period1: Type.Union([YahooFinanceDate, YahooNumber, Type.String()]), | ||
period2: Type.Optional(Type.Union([YahooFinanceDate, YahooNumber, Type.String()])), | ||
type: Type.Optional(Type.String()), | ||
merge: Type.Optional(Type.Boolean()), // This returns a completely different format that will break the transformer | ||
padTimeSeries: Type.Optional(Type.Boolean()), // Not exactly sure what this does, assume it pads p1 and p2??? | ||
lang: Type.Optional(Type.String()), | ||
region: Type.Optional(Type.String()), | ||
module: Type.String(), | ||
}, { | ||
title: "FundamentalsTimeSeriesOptions", | ||
}); | ||
const FundamentalsTimeSeriesResultsSchema = Type.Array(FundamentalsTimeSeriesResultSchema); | ||
const queryOptionsDefaults = { | ||
@@ -24,3 +47,3 @@ merge: false, | ||
needsCrumb: false, | ||
schemaKey: "#/definitions/FundamentalsTimeSeriesOptions", | ||
schema: FundamentalsTimeSeriesOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
@@ -31,3 +54,3 @@ overrides: queryOptionsOverrides, | ||
result: { | ||
schemaKey: "#/definitions/FundamentalsTimeSeriesResults", | ||
schema: FundamentalsTimeSeriesResultsSchema, | ||
transformWith(response) { | ||
@@ -34,0 +57,0 @@ if (!response || !response.timeseries) |
@@ -0,40 +1,75 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export type HistoricalHistoryResult = Array<HistoricalRowHistory>; | ||
export type HistoricalDividendsResult = Array<HistoricalRowDividend>; | ||
export type HistoricalStockSplitsResult = Array<HistoricalRowStockSplit>; | ||
export type HistoricalResult = HistoricalHistoryResult | HistoricalDividendsResult | HistoricalStockSplitsResult; | ||
export interface HistoricalRowHistory { | ||
[key: string]: any; | ||
date: Date; | ||
open: number; | ||
high: number; | ||
low: number; | ||
close: number; | ||
adjClose?: number; | ||
volume: number; | ||
} | ||
export interface HistoricalRowDividend { | ||
date: Date; | ||
dividends: number; | ||
} | ||
export interface HistoricalRowStockSplit { | ||
date: Date; | ||
stockSplits: string; | ||
} | ||
export interface HistoricalOptions { | ||
period1: Date | string | number; | ||
period2?: Date | string | number; | ||
interval?: "1d" | "1wk" | "1mo"; | ||
events?: string; | ||
includeAdjustedClose?: boolean; | ||
} | ||
export interface HistoricalOptionsEventsHistory extends HistoricalOptions { | ||
events?: "history"; | ||
} | ||
export interface HistoricalOptionsEventsDividends extends HistoricalOptions { | ||
events: "dividends"; | ||
} | ||
export interface HistoricalOptionsEventsSplit extends HistoricalOptions { | ||
events: "split"; | ||
} | ||
declare const HistoricalOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">]>>; | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"history">, import("@sinclair/typebox").TLiteral<"dividends">, import("@sinclair/typebox").TLiteral<"split">]>>; | ||
includeAdjustedClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>; | ||
declare const HistoricalOptionsEventsHistorySchema: import("@sinclair/typebox").TObject<{ | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"history">, import("@sinclair/typebox").TLiteral<"dividends">, import("@sinclair/typebox").TLiteral<"split">]>, import("@sinclair/typebox").TLiteral<"history">]>>; | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">]>>; | ||
includeAdjustedClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>; | ||
declare const HistoricalOptionsEventsDividendsSchema: import("@sinclair/typebox").TObject<{ | ||
events: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"history">, import("@sinclair/typebox").TLiteral<"dividends">, import("@sinclair/typebox").TLiteral<"split">]>, import("@sinclair/typebox").TLiteral<"dividends">]>; | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">]>>; | ||
includeAdjustedClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>; | ||
declare const HistoricalOptionsEventsSplitSchema: import("@sinclair/typebox").TObject<{ | ||
events: import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"history">, import("@sinclair/typebox").TLiteral<"dividends">, import("@sinclair/typebox").TLiteral<"split">]>, import("@sinclair/typebox").TLiteral<"split">]>; | ||
period1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>; | ||
period2: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>>; | ||
interval: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"1d">, import("@sinclair/typebox").TLiteral<"1wk">, import("@sinclair/typebox").TLiteral<"1mo">]>>; | ||
includeAdjustedClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>; | ||
declare const HistoricalHistoryResultSchema: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
open: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
high: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
low: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
close: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
adjClose: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
volume: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>; | ||
declare const HistoricalDividendsResultSchema: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
dividends: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>>; | ||
declare const HistoricalStockSplitsResultSchema: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
stockSplits: import("@sinclair/typebox").TString; | ||
}>>; | ||
type HistoricalOptions = Static<typeof HistoricalOptionsSchema>; | ||
type HistoricalOptionsEventsHistory = Static<typeof HistoricalOptionsEventsHistorySchema>; | ||
type HistoricalHistoryResult = Static<typeof HistoricalHistoryResultSchema>; | ||
type HistoricalDividendsResult = Static<typeof HistoricalDividendsResultSchema>; | ||
type HistoricalOptionsEventsDividends = Static<typeof HistoricalOptionsEventsDividendsSchema>; | ||
type HistoricalOptionsEventsSplit = Static<typeof HistoricalOptionsEventsSplitSchema>; | ||
type HistoricalStockSplitsResult = Static<typeof HistoricalStockSplitsResultSchema>; | ||
export default function historical(this: ModuleThis, symbol: string, queryOptionsOverrides: HistoricalOptionsEventsHistory, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<HistoricalHistoryResult>; | ||
@@ -44,1 +79,2 @@ export default function historical(this: ModuleThis, symbol: string, queryOptionsOverrides: HistoricalOptionsEventsDividends, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<HistoricalDividendsResult>; | ||
export default function historical(this: ModuleThis, symbol: string, queryOptionsOverrides: HistoricalOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
@@ -0,1 +1,70 @@ | ||
import { Type } from "@sinclair/typebox"; | ||
import { Value } from "@sinclair/typebox/value"; | ||
import { YahooFinanceDate, YahooNumber } from "../lib/yahooFinanceTypes.js"; | ||
import { ChartOptionsSchema } from "./chart.js"; | ||
import validateAndCoerceTypebox from "../lib/validateAndCoerceTypes.js"; | ||
import { showNotice } from "../lib/notices.js"; | ||
const HistoricalRowHistory = Type.Object({ | ||
date: YahooFinanceDate, | ||
open: YahooNumber, | ||
high: YahooNumber, | ||
low: YahooNumber, | ||
close: YahooNumber, | ||
adjClose: Type.Optional(YahooNumber), | ||
volume: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "HistoricalRowHistory", | ||
}); | ||
const HistoricalRowDividend = Type.Object({ | ||
date: YahooFinanceDate, | ||
dividends: YahooNumber, | ||
}, { title: "HistoricalRowDividend" }); | ||
const HistoricalRowStockSplit = Type.Object({ | ||
date: YahooFinanceDate, | ||
stockSplits: Type.String(), | ||
}, { title: "HistoricalRowStockSplit" }); | ||
const HistoricalOptionsSchema = Type.Object({ | ||
period1: Type.Union([Type.Date(), Type.String(), Type.Number()]), | ||
period2: Type.Optional(Type.Union([Type.Date(), Type.String(), Type.Number()])), | ||
interval: Type.Optional(Type.Union([ | ||
Type.Literal("1d"), | ||
Type.Literal("1wk"), | ||
Type.Literal("1mo"), | ||
])), | ||
// events: Type.Optional(Type.String()), | ||
events: Type.Optional(Type.Union([ | ||
Type.Literal("history"), | ||
Type.Literal("dividends"), | ||
Type.Literal("split"), | ||
])), | ||
includeAdjustedClose: Type.Optional(Type.Boolean()), | ||
}, { title: "HistoricalOptions" }); | ||
const HistoricalOptionsEventsHistorySchema = Type.Composite([ | ||
HistoricalOptionsSchema, | ||
Type.Object({ | ||
events: Type.Optional(Type.Literal("history")), | ||
}), | ||
], { title: "HistoricalOptionsEventsHistory" }); | ||
const HistoricalOptionsEventsDividendsSchema = Type.Composite([ | ||
HistoricalOptionsSchema, | ||
Type.Object({ | ||
events: Type.Literal("dividends"), | ||
}), | ||
], { title: "HistoricalOptionsEventsDividends" }); | ||
const HistoricalOptionsEventsSplitSchema = Type.Composite([ | ||
HistoricalOptionsSchema, | ||
Type.Object({ | ||
events: Type.Literal("split"), | ||
}), | ||
], { title: "HistoricalOptionsEventsSplit" }); | ||
const HistoricalHistoryResultSchema = Type.Array(HistoricalRowHistory, { | ||
title: "HistoricalHistoryResult", | ||
}); | ||
const HistoricalDividendsResultSchema = Type.Array(HistoricalRowDividend, { | ||
title: "HistoricalDividendsResult", | ||
}); | ||
const HistoricalStockSplitsResultSchema = Type.Array(HistoricalRowStockSplit, { | ||
title: "HistoricalRowStockSplit", | ||
}); | ||
const queryOptionsDefaults = { | ||
@@ -6,91 +75,177 @@ interval: "1d", | ||
}; | ||
export default function historical(symbol, queryOptionsOverrides, moduleOptions) { | ||
let schemaKey; | ||
export default async function historical(symbol, queryOptionsOverrides, moduleOptions) { | ||
var _a, _b, _c, _d; | ||
showNotice("ripHistorical"); | ||
validateAndCoerceTypebox({ | ||
type: "options", | ||
data: queryOptionsOverrides !== null && queryOptionsOverrides !== void 0 ? queryOptionsOverrides : {}, | ||
schema: HistoricalOptionsSchema, | ||
options: this._opts.validation, | ||
}); | ||
let schema; | ||
if (!queryOptionsOverrides.events || | ||
queryOptionsOverrides.events === "history") | ||
schemaKey = "#/definitions/HistoricalHistoryResult"; | ||
schema = HistoricalHistoryResultSchema; | ||
else if (queryOptionsOverrides.events === "dividends") | ||
schemaKey = "#/definitions/HistoricalDividendsResult"; | ||
schema = HistoricalDividendsResultSchema; | ||
else if (queryOptionsOverrides.events === "split") | ||
schemaKey = "#/definitions/HistoricalStockSplitsResult"; | ||
schema = HistoricalStockSplitsResultSchema; | ||
else | ||
throw new Error("No such event type:" + queryOptionsOverrides.events); | ||
const queryOpts = { ...queryOptionsDefaults, ...queryOptionsOverrides }; | ||
if (!Value.Check(HistoricalOptionsSchema, queryOpts)) | ||
throw new Error("Internal error, please report. Overrides validated but not defaults?"); | ||
// Don't forget that queryOpts are already validated and safe-safe. | ||
const eventsMap = { history: "", dividends: "div", split: "split" }; | ||
const chartQueryOpts = { | ||
period1: queryOpts.period1, | ||
period2: queryOpts.period2, | ||
interval: queryOpts.interval, | ||
events: eventsMap[queryOpts.events || "history"], | ||
}; | ||
if (!Value.Check(ChartOptionsSchema, chartQueryOpts)) | ||
throw new Error("Internal error, please report. historical() provided invalid chart() query options."); | ||
// TODO: do we even care? | ||
if (queryOpts.includeAdjustedClose === false) { | ||
/* */ | ||
} | ||
const result = await this.chart(symbol, chartQueryOpts, { | ||
...moduleOptions, | ||
validateResult: true, | ||
}); | ||
let out; | ||
if (queryOpts.events === "dividends") { | ||
out = ((_b = (_a = result.events) === null || _a === void 0 ? void 0 : _a.dividends) !== null && _b !== void 0 ? _b : []).map((d) => ({ | ||
date: d.date, | ||
dividends: d.amount, | ||
})); | ||
} | ||
else if (queryOpts.events === "split") { | ||
out = ((_d = (_c = result.events) === null || _c === void 0 ? void 0 : _c.splits) !== null && _d !== void 0 ? _d : []).map((s) => ({ | ||
date: s.date, | ||
stockSplits: s.splitRatio, | ||
})); | ||
} | ||
else { | ||
out = result.quotes; | ||
} | ||
const validateResult = !moduleOptions || | ||
moduleOptions.validateResult === undefined || | ||
moduleOptions.validateResult === true; | ||
const validationOpts = { | ||
...this._opts.validation, | ||
// Set logErrors=false if validateResult=false | ||
logErrors: validateResult ? this._opts.validation.logErrors : false, | ||
}; | ||
try { | ||
validateAndCoerceTypebox({ | ||
type: "result", | ||
data: out, | ||
schema, | ||
options: validationOpts, | ||
}); | ||
} | ||
catch (error) { | ||
if (validateResult) | ||
throw error; | ||
} | ||
return out; | ||
/* | ||
// Original historical() retrieval code when Yahoo API still existed. | ||
return this._moduleExec({ | ||
moduleName: "historical", | ||
query: { | ||
assertSymbol: symbol, | ||
url: "https://${YF_QUERY_HOST}/v7/finance/download/" + symbol, | ||
schemaKey: "#/definitions/HistoricalOptions", | ||
defaults: queryOptionsDefaults, | ||
overrides: queryOptionsOverrides, | ||
fetchType: "csv", | ||
transformWith(queryOptions) { | ||
if (!queryOptions.period2) | ||
queryOptions.period2 = new Date(); | ||
const dates = ["period1", "period2"]; | ||
for (const fieldName of dates) { | ||
const value = queryOptions[fieldName]; | ||
if (value instanceof Date) | ||
queryOptions[fieldName] = Math.floor(value.getTime() / 1000); | ||
else if (typeof value === "string") { | ||
const timestamp = new Date(value).getTime(); | ||
if (isNaN(timestamp)) | ||
throw new Error("yahooFinance.historical() option '" + | ||
fieldName + | ||
"' invalid date provided: '" + | ||
value + | ||
"'"); | ||
queryOptions[fieldName] = Math.floor(timestamp / 1000); | ||
} | ||
} | ||
if (queryOptions.period1 === queryOptions.period2) { | ||
throw new Error("yahooFinance.historical() options `period1` and `period2` " + | ||
"cannot share the same value."); | ||
} | ||
return queryOptions; | ||
}, | ||
moduleName: "historical", | ||
query: { | ||
assertSymbol: symbol, | ||
url: "https://${YF_QUERY_HOST}/v7/finance/download/" + symbol, | ||
schema: HistoricalOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
overrides: queryOptionsOverrides, | ||
fetchType: "csv", | ||
transformWith(queryOptions: HistoricalOptions) { | ||
if (!queryOptions.period2) queryOptions.period2 = new Date(); | ||
const dates = ["period1", "period2"] as const; | ||
for (const fieldName of dates) { | ||
const value = queryOptions[fieldName]; | ||
if (value instanceof Date) | ||
queryOptions[fieldName] = Math.floor(value.getTime() / 1000); | ||
else if (typeof value === "string") { | ||
const timestamp = new Date(value as string).getTime(); | ||
if (isNaN(timestamp)) | ||
throw new Error( | ||
"yahooFinance.historical() option '" + | ||
fieldName + | ||
"' invalid date provided: '" + | ||
value + | ||
"'", | ||
); | ||
queryOptions[fieldName] = Math.floor(timestamp / 1000); | ||
} | ||
} | ||
if (queryOptions.period1 === queryOptions.period2) { | ||
throw new Error( | ||
"yahooFinance.historical() options `period1` and `period2` " + | ||
"cannot share the same value.", | ||
); | ||
} | ||
return queryOptions; | ||
}, | ||
result: { | ||
schemaKey, | ||
transformWith(result) { | ||
if (result.length === 0) | ||
return result; | ||
const filteredResults = []; | ||
const fieldCount = Object.keys(result[0]).length; | ||
// Count number of null values in object (1-level deep) | ||
function nullFieldCount(object) { | ||
let nullCount = 0; | ||
for (const val of Object.values(object)) | ||
if (val === null) | ||
nullCount++; | ||
return nullCount; | ||
} | ||
for (const row of result) { | ||
const nullCount = nullFieldCount(row); | ||
if (nullCount === 0) { | ||
// No nulls is a legit (regular) result | ||
filteredResults.push(row); | ||
} | ||
else if (nullCount !== fieldCount - 1 /* skip "date" */) { | ||
// Unhandled case: some but not all values are null. | ||
// Note: no need to check for null "date", validation does it for us | ||
console.error(nullCount, row); | ||
throw new Error("Historical returned a result with SOME (but not " + | ||
"all) null values. Please report this, and provide the " + | ||
"query that caused it."); | ||
} | ||
else { | ||
// All fields (except "date") are null: silently skip (no-op) | ||
} | ||
} | ||
/* | ||
* We may consider, for future optimization, to count rows and create | ||
* new array in advance, and skip consecutive blocks of null results. | ||
* Of doubtful utility. | ||
*/ | ||
return filteredResults; | ||
}, | ||
}, | ||
moduleOptions, | ||
}); | ||
}, | ||
result: { | ||
schema, | ||
transformWith(result: any) { | ||
if (result.length === 0) return result; | ||
const filteredResults = []; | ||
const fieldCount = Object.keys(result[0]).length; | ||
// Count number of null values in object (1-level deep) | ||
function nullFieldCount(object: unknown) { | ||
if (object == null) { | ||
return; | ||
} | ||
let nullCount = 0; | ||
for (const val of Object.values(object)) | ||
if (val === null) nullCount++; | ||
return nullCount; | ||
} | ||
for (const row of result) { | ||
const nullCount = nullFieldCount(row); | ||
if (nullCount === 0) { | ||
// No nulls is a legit (regular) result | ||
filteredResults.push(row); | ||
} else if (nullCount !== fieldCount - 1 /* skip "date" */ /*) { | ||
// Unhandled case: some but not all values are null. | ||
// Note: no need to check for null "date", validation does it for us | ||
console.error(nullCount, row); | ||
throw new Error( | ||
"Historical returned a result with SOME (but not " + | ||
"all) null values. Please report this, and provide the " + | ||
"query that caused it.", | ||
); | ||
} else { | ||
// All fields (except "date") are null: silently skip (no-op) | ||
} | ||
} | ||
/* | ||
* We may consider, for future optimization, to count rows and create | ||
* new array in advance, and skip consecutive blocks of null results. | ||
* Of doubtful utility. | ||
*/ /* | ||
return filteredResults; | ||
}, | ||
}, | ||
moduleOptions, | ||
}); | ||
*/ | ||
} |
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
import type { DateInMs } from "../lib/commonTypes.js"; | ||
export interface InsightsResult { | ||
[key: string]: any; | ||
symbol: string; | ||
instrumentInfo?: InsightsInstrumentInfo; | ||
companySnapshot?: InsightsCompanySnapshot; | ||
recommendation?: { | ||
targetPrice?: number; | ||
provider: string; | ||
rating: "BUY" | "SELL" | "HOLD"; | ||
}; | ||
events?: InsightsEvent[]; | ||
reports?: InsightsReport[]; | ||
sigDevs: InsightsSigDev[]; | ||
upsell?: InsightsUpsell; | ||
upsellSearchDD?: { | ||
researchReports: InsightsResearchReport; | ||
}; | ||
secReports?: InsightsSecReport[]; | ||
} | ||
export interface InsightsSigDev { | ||
[key: string]: any; | ||
headline: string; | ||
date: Date; | ||
} | ||
export interface InsightsReport { | ||
[key: string]: any; | ||
id: string; | ||
headHtml: string; | ||
provider: string; | ||
reportDate: Date; | ||
reportTitle: string; | ||
reportType: string; | ||
targetPrice?: number; | ||
targetPriceStatus?: "Increased" | "Maintained" | "Decreased" | "-"; | ||
investmentRating?: "Bullish" | "Neutral" | "Bearish"; | ||
tickers?: string[]; | ||
} | ||
export interface InsightsResearchReport { | ||
reportId: string; | ||
provider: string; | ||
title: string; | ||
reportDate: Date; | ||
summary: string; | ||
investmentRating?: "Bullish" | "Neutral" | "Bearish"; | ||
} | ||
export interface InsightsSecReport { | ||
id: string; | ||
type: string; | ||
title: string; | ||
description: string; | ||
filingDate: DateInMs; | ||
snapshotUrl: string; | ||
formType: string; | ||
} | ||
export interface InsightsEvent { | ||
[key: string]: any; | ||
eventType: string; | ||
pricePeriod: string; | ||
tradingHorizon: string; | ||
tradeType: string; | ||
imageUrl: string; | ||
startDate: Date; | ||
endDate: Date; | ||
} | ||
import { Static } from "@sinclair/typebox"; | ||
declare const InsightsOutlookSchema: import("@sinclair/typebox").TObject<{ | ||
stateDescription: import("@sinclair/typebox").TString; | ||
direction: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
scoreDescription: import("@sinclair/typebox").TString; | ||
sectorDirection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>>; | ||
sectorScore: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sectorScoreDescription: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
indexDirection: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
indexScore: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
indexScoreDescription: import("@sinclair/typebox").TString; | ||
}>; | ||
declare const InsightsResultSchema: import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
instrumentInfo: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
keyTechnicals: import("@sinclair/typebox").TObject<{ | ||
provider: import("@sinclair/typebox").TString; | ||
support: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
resistance: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
stopLoss: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>; | ||
technicalEvents: import("@sinclair/typebox").TObject<{ | ||
provider: import("@sinclair/typebox").TString; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortTermOutlook: import("@sinclair/typebox").TObject<{ | ||
stateDescription: import("@sinclair/typebox").TString; | ||
direction: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
scoreDescription: import("@sinclair/typebox").TString; | ||
sectorDirection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>>; | ||
sectorScore: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sectorScoreDescription: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
indexDirection: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
indexScore: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
indexScoreDescription: import("@sinclair/typebox").TString; | ||
}>; | ||
intermediateTermOutlook: import("@sinclair/typebox").TObject<{ | ||
stateDescription: import("@sinclair/typebox").TString; | ||
direction: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
scoreDescription: import("@sinclair/typebox").TString; | ||
sectorDirection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>>; | ||
sectorScore: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sectorScoreDescription: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
indexDirection: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
indexScore: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
indexScoreDescription: import("@sinclair/typebox").TString; | ||
}>; | ||
longTermOutlook: import("@sinclair/typebox").TObject<{ | ||
stateDescription: import("@sinclair/typebox").TString; | ||
direction: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
scoreDescription: import("@sinclair/typebox").TString; | ||
sectorDirection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>>; | ||
sectorScore: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sectorScoreDescription: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
indexDirection: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bearish">, import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">]>; | ||
indexScore: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
indexScoreDescription: import("@sinclair/typebox").TString; | ||
}>; | ||
}>; | ||
valuation: import("@sinclair/typebox").TObject<{ | ||
color: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
discount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
provider: import("@sinclair/typebox").TString; | ||
relativeValue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
}>; | ||
}>>; | ||
companySnapshot: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
sectorInfo: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
company: import("@sinclair/typebox").TObject<{ | ||
innovativeness: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
hiring: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sustainability: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
insiderSentiments: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
earningsReports: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dividends: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>; | ||
sector: import("@sinclair/typebox").TObject<{ | ||
innovativeness: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
hiring: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sustainability: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
insiderSentiments: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
earningsReports: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dividends: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
}>>; | ||
recommendation: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
targetPrice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
provider: import("@sinclair/typebox").TString; | ||
rating: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"BUY">, import("@sinclair/typebox").TLiteral<"SELL">, import("@sinclair/typebox").TLiteral<"HOLD">]>; | ||
}>>; | ||
events: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
eventType: import("@sinclair/typebox").TString; | ||
pricePeriod: import("@sinclair/typebox").TString; | ||
tradingHorizon: import("@sinclair/typebox").TString; | ||
tradeType: import("@sinclair/typebox").TString; | ||
imageUrl: import("@sinclair/typebox").TString; | ||
startDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
endDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
}>>>; | ||
reports: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
id: import("@sinclair/typebox").TString; | ||
headHtml: import("@sinclair/typebox").TString; | ||
provider: import("@sinclair/typebox").TString; | ||
reportDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
reportTitle: import("@sinclair/typebox").TString; | ||
reportType: import("@sinclair/typebox").TString; | ||
targetPrice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
targetPriceStatus: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Increased">, import("@sinclair/typebox").TLiteral<"Maintained">, import("@sinclair/typebox").TLiteral<"Decreased">, import("@sinclair/typebox").TLiteral<"-">]>>; | ||
investmentRating: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">, import("@sinclair/typebox").TLiteral<"Bearish">]>>; | ||
tickers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>; | ||
}>>>; | ||
sigDevs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
headline: import("@sinclair/typebox").TString; | ||
date: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
}>>>; | ||
upsell: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
msBullishSummary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>; | ||
msBearishSummary: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>; | ||
msBullishBearishSummariesPublishDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>>; | ||
companyName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
upsellReportType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
}>>; | ||
upsellSearchDD: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
researchReports: import("@sinclair/typebox").TObject<{ | ||
reportId: import("@sinclair/typebox").TString; | ||
provider: import("@sinclair/typebox").TString; | ||
title: import("@sinclair/typebox").TString; | ||
reportDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
summary: import("@sinclair/typebox").TString; | ||
investmentRating: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Bullish">, import("@sinclair/typebox").TLiteral<"Neutral">, import("@sinclair/typebox").TLiteral<"Bearish">]>>; | ||
}>; | ||
}>>; | ||
secReports: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
id: import("@sinclair/typebox").TString; | ||
type: import("@sinclair/typebox").TString; | ||
title: import("@sinclair/typebox").TString; | ||
description: import("@sinclair/typebox").TString; | ||
filingDate: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
snapshotUrl: import("@sinclair/typebox").TString; | ||
formType: import("@sinclair/typebox").TString; | ||
}>>>; | ||
}>; | ||
type InsightsResult = Static<typeof InsightsResultSchema>; | ||
type InsightsOutlook = Static<typeof InsightsOutlookSchema>; | ||
export interface InsightsInstrumentInfo { | ||
@@ -115,30 +268,12 @@ [key: string]: any; | ||
} | ||
export type InsightsDirection = "Bearish" | "Bullish" | "Neutral"; | ||
export interface InsightsOutlook { | ||
[key: string]: any; | ||
stateDescription: string; | ||
direction: InsightsDirection; | ||
score: number; | ||
scoreDescription: string; | ||
sectorDirection?: InsightsDirection; | ||
sectorScore?: number; | ||
sectorScoreDescription?: string; | ||
indexDirection: InsightsDirection; | ||
indexScore: number; | ||
indexScoreDescription: string; | ||
} | ||
export interface InsightsUpsell { | ||
[key: string]: any; | ||
msBullishSummary?: Array<string>; | ||
msBearishSummary?: Array<string>; | ||
msBullishBearishSummariesPublishDate?: DateInMs; | ||
companyName?: string; | ||
upsellReportType?: string; | ||
} | ||
export interface InsightsOptions { | ||
lang?: string; | ||
region?: string; | ||
reportsCount?: number; | ||
} | ||
declare const InsightsOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
region: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
reportsCount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>; | ||
type InsightsOptions = Static<typeof InsightsOptionsSchema>; | ||
export default function trendingSymbols(this: ModuleThis, symbol: string, queryOptionsOverrides?: InsightsOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<InsightsResult>; | ||
export default function trendingSymbols(this: ModuleThis, symbol: string, queryOptionsOverrides?: InsightsOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
@@ -0,1 +1,168 @@ | ||
import { Type } from "@sinclair/typebox"; | ||
import { YahooDateInMs, YahooFinanceDate, YahooNumber, } from "../lib/yahooFinanceTypes.js"; | ||
const InsightsDirection = Type.Union([Type.Literal("Bearish"), Type.Literal("Bullish"), Type.Literal("Neutral")], { title: "InsightsDirection" }); | ||
const InsightsOutlookSchema = Type.Object({ | ||
stateDescription: Type.String(), | ||
direction: InsightsDirection, | ||
score: YahooNumber, | ||
scoreDescription: Type.String(), | ||
sectorDirection: Type.Optional(InsightsDirection), | ||
sectorScore: Type.Optional(YahooNumber), | ||
sectorScoreDescription: Type.Optional(Type.String()), | ||
indexDirection: InsightsDirection, | ||
indexScore: YahooNumber, | ||
indexScoreDescription: Type.String(), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "InsightsOutlook", | ||
}); | ||
const InsightsInstrumentInfo = Type.Object({ | ||
keyTechnicals: Type.Object({ | ||
provider: Type.String(), | ||
support: Type.Optional(YahooNumber), | ||
resistance: Type.Optional(YahooNumber), | ||
stopLoss: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}), | ||
technicalEvents: Type.Object({ | ||
provider: Type.String(), | ||
sector: Type.Optional(Type.String()), | ||
shortTermOutlook: InsightsOutlookSchema, | ||
intermediateTermOutlook: InsightsOutlookSchema, | ||
longTermOutlook: InsightsOutlookSchema, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}), | ||
valuation: Type.Object({ | ||
color: Type.Optional(YahooNumber), | ||
description: Type.Optional(Type.String()), | ||
discount: Type.Optional(Type.String()), | ||
provider: Type.String(), | ||
relativeValue: Type.Optional(Type.String()), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "InsightsInstrumentInfo", | ||
}); | ||
const InsightsCompanySnapshot = Type.Object({ | ||
sectorInfo: Type.Optional(Type.String()), | ||
company: Type.Object({ | ||
innovativeness: Type.Optional(YahooNumber), | ||
hiring: Type.Optional(YahooNumber), | ||
sustainability: Type.Optional(YahooNumber), | ||
insiderSentiments: Type.Optional(YahooNumber), | ||
earningsReports: Type.Optional(YahooNumber), | ||
dividends: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}), | ||
sector: Type.Object({ | ||
innovativeness: YahooNumber, | ||
hiring: YahooNumber, | ||
sustainability: Type.Optional(YahooNumber), | ||
insiderSentiments: YahooNumber, | ||
earningsReports: Type.Optional(YahooNumber), | ||
dividends: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}), | ||
}, { title: "InsightsCompanySnapshot", additionalProperties: Type.Any() }); | ||
const InsightsEventSchema = Type.Object({ | ||
eventType: Type.String(), | ||
pricePeriod: Type.String(), | ||
tradingHorizon: Type.String(), | ||
tradeType: Type.String(), | ||
imageUrl: Type.String(), | ||
startDate: YahooFinanceDate, | ||
endDate: YahooFinanceDate, | ||
}, { title: "InsightsEvent", additionalProperties: Type.Any() }); | ||
const InsightsReport = Type.Object({ | ||
id: Type.String(), | ||
headHtml: Type.String(), | ||
provider: Type.String(), | ||
reportDate: YahooFinanceDate, | ||
reportTitle: Type.String(), | ||
reportType: Type.String(), | ||
targetPrice: Type.Optional(YahooNumber), | ||
targetPriceStatus: Type.Optional(Type.Union([ | ||
Type.Literal("Increased"), | ||
Type.Literal("Maintained"), | ||
Type.Literal("Decreased"), | ||
Type.Literal("-"), | ||
])), | ||
investmentRating: Type.Optional(Type.Union([ | ||
Type.Literal("Bullish"), | ||
Type.Literal("Neutral"), | ||
Type.Literal("Bearish"), | ||
])), | ||
tickers: Type.Optional(Type.Array(Type.String())), | ||
}, { title: "InsightsReport", additionalProperties: Type.Any() }); | ||
const InsightsSigDev = Type.Object({ | ||
headline: Type.String(), | ||
date: YahooFinanceDate, | ||
}, { title: "InsightsSigDev", additionalProperties: Type.Any() }); | ||
const InsightsUpsell = Type.Object({ | ||
msBullishSummary: Type.Optional(Type.Array(Type.String())), | ||
msBearishSummary: Type.Optional(Type.Array(Type.String())), | ||
msBullishBearishSummariesPublishDate: Type.Optional(YahooDateInMs), | ||
companyName: Type.Optional(Type.String()), | ||
upsellReportType: Type.Optional(Type.String()), | ||
}, { title: "InsightsUpsell", additionalProperties: Type.Any() }); | ||
const InsightsResearchReport = Type.Object({ | ||
reportId: Type.String(), | ||
provider: Type.String(), | ||
title: Type.String(), | ||
reportDate: YahooFinanceDate, | ||
summary: Type.String(), | ||
investmentRating: Type.Optional(Type.Union([ | ||
Type.Literal("Bullish"), | ||
Type.Literal("Neutral"), | ||
Type.Literal("Bearish"), | ||
])), | ||
}, { title: "InsightsResearchReport" }); | ||
const InsightsSecReport = Type.Object({ | ||
id: Type.String(), | ||
type: Type.String(), | ||
title: Type.String(), | ||
description: Type.String(), | ||
filingDate: YahooDateInMs, | ||
snapshotUrl: Type.String(), | ||
formType: Type.String(), | ||
}, { | ||
title: "InsightsSecReport", | ||
additionalProperties: Type.Any(), | ||
}); | ||
const InsightsResultSchema = Type.Object({ | ||
symbol: Type.String(), | ||
instrumentInfo: Type.Optional(InsightsInstrumentInfo), | ||
companySnapshot: Type.Optional(InsightsCompanySnapshot), | ||
recommendation: Type.Optional(Type.Object({ | ||
targetPrice: Type.Optional(YahooNumber), | ||
provider: Type.String(), | ||
rating: Type.Union([ | ||
Type.Literal("BUY"), | ||
Type.Literal("SELL"), | ||
Type.Literal("HOLD"), | ||
]), | ||
})), | ||
events: Type.Optional(Type.Array(InsightsEventSchema)), | ||
reports: Type.Optional(Type.Array(InsightsReport)), | ||
sigDevs: Type.Optional(Type.Array(InsightsSigDev)), | ||
upsell: Type.Optional(InsightsUpsell), | ||
upsellSearchDD: Type.Optional(Type.Object({ | ||
researchReports: InsightsResearchReport, | ||
})), | ||
secReports: Type.Optional(Type.Array(InsightsSecReport)), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "InsightsResult", | ||
}); | ||
const InsightsOptionsSchema = Type.Object({ | ||
lang: Type.Optional(Type.String()), | ||
region: Type.Optional(Type.String()), | ||
reportsCount: Type.Optional(YahooNumber), | ||
}, { title: "InsightsOptions" }); | ||
const queryOptionsDefaults = { | ||
@@ -13,3 +180,3 @@ lang: "en-US", | ||
url: "https://${YF_QUERY_HOST}/ws/insights/v2/finance/insights", | ||
schemaKey: "#/definitions/InsightsOptions", | ||
schema: InsightsOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
@@ -20,3 +187,3 @@ overrides: queryOptionsOverrides, | ||
result: { | ||
schemaKey: "#/definitions/InsightsResult", | ||
schema: InsightsResultSchema, | ||
transformWith(result) { | ||
@@ -23,0 +190,0 @@ if (!result.finance) |
@@ -0,1 +1,157 @@ | ||
import { Type } from "@sinclair/typebox"; | ||
import { YahooFinanceDate, YahooNumber } from "../lib/yahooFinanceTypes.js"; | ||
import { QuoteBase } from "./quote.js"; | ||
import { Value } from "@sinclair/typebox/value"; | ||
/* | ||
* [TODO] Fields seen in a query but not in this module yet: | ||
* | ||
* - extendedMarketChange | ||
* - extendedMarketChangePercent | ||
* - extendedMarketPrice | ||
* - extendedMarketTime | ||
* - dayHigh (separate to regularMarketDayHigh, etc) | ||
* - dayLow (separate to regularMarketDayLow, etc) | ||
* - volume (separate to regularMarketVolume, etc) | ||
* | ||
* i.e. on yahoo site, with ?fields=dayHigh,dayLow,etc. | ||
*/ | ||
/* | ||
* Guaranteed fields, even we don't ask for them | ||
*/ | ||
const QuoteCryptoCurrency = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("CRYPTOCURRENCY"), | ||
circulatingSupply: YahooNumber, | ||
fromCurrency: Type.String(), // 'BTC' | ||
toCurrency: Type.String(), // 'USD=X' | ||
lastMarket: Type.String(), // 'CoinMarketCap' | ||
coinImageUrl: Type.Optional(Type.String()), // 'https://s.yimg.com/uc/fin/img/reports-thumbnails/1.png' | ||
volume24Hr: Type.Optional(YahooNumber), // 62631043072 | ||
volumeAllCurrencies: Type.Optional(YahooNumber), // 62631043072 | ||
startDate: Type.Optional(YahooFinanceDate), // new Date(1367103600 * 1000) | ||
}), | ||
], { title: "QuoteCryptoCurrency" }); | ||
const QuoteCurrency = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("CURRENCY"), | ||
}), | ||
], { title: "QuoteCurrency" }); | ||
const QuoteEtf = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("ETF"), | ||
}), | ||
]); | ||
const QuoteEquity = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("EQUITY"), | ||
dividendRate: Type.Optional(Type.Number()), | ||
dividendYield: Type.Optional(Type.Number()), | ||
}), | ||
], { title: "QuoteEquity" }); | ||
const QuoteFuture = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("FUTURE"), | ||
headSymbolAsString: Type.String(), | ||
contractSymbol: Type.Boolean(), | ||
underlyingExchangeSymbol: Type.String(), | ||
expireDate: YahooFinanceDate, | ||
expireIsoDate: YahooFinanceDate, | ||
}), | ||
], { | ||
title: "QuoteFuture", | ||
}); | ||
const QuoteIndex = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("INDEX"), | ||
}), | ||
], { | ||
title: "QuoteIndex", | ||
}); | ||
const QuoteOption = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("OPTION"), | ||
strike: YahooNumber, | ||
openInterest: YahooNumber, | ||
expireDate: YahooNumber, | ||
expireIsoDate: YahooNumber, | ||
underlyingSymbol: Type.String(), | ||
}), | ||
], { | ||
title: "QuoteOption", | ||
}); | ||
const QuoteMutualfund = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("MUTUALFUND"), | ||
}), | ||
], { | ||
title: "QuoteMutualFund", | ||
}); | ||
const QuoteSchema = Type.Union([ | ||
QuoteCryptoCurrency, | ||
QuoteCurrency, | ||
QuoteEtf, | ||
QuoteEquity, | ||
QuoteFuture, | ||
QuoteIndex, | ||
QuoteMutualfund, | ||
QuoteOption, | ||
], { | ||
title: "Quote", | ||
}); | ||
const CallOrPut = Type.Object({ | ||
contractSymbol: Type.String(), | ||
strike: YahooNumber, | ||
currency: Type.Optional(Type.String()), | ||
lastPrice: YahooNumber, | ||
change: YahooNumber, | ||
percentChange: Type.Optional(YahooNumber), | ||
volume: Type.Optional(YahooNumber), | ||
openInterest: Type.Optional(YahooNumber), | ||
bid: Type.Optional(YahooNumber), | ||
ask: Type.Optional(YahooNumber), | ||
contractSize: Type.Literal("REGULAR"), | ||
expiration: YahooFinanceDate, | ||
lastTradeDate: YahooFinanceDate, | ||
impliedVolatility: YahooNumber, | ||
inTheMoney: Type.Boolean(), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "CallOrPut", | ||
}); | ||
const Option = Type.Object({ | ||
expirationDate: YahooFinanceDate, | ||
hasMiniOptions: Type.Boolean(), | ||
calls: Type.Array(CallOrPut), | ||
puts: Type.Array(CallOrPut), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "Option", | ||
}); | ||
const OptionsResultSchema = Type.Object({ | ||
underlyingSymbol: Type.String(), | ||
expirationDates: Type.Array(YahooFinanceDate), | ||
strikes: Type.Array(YahooNumber), | ||
hasMiniOptions: Type.Boolean(), | ||
quote: QuoteSchema, | ||
options: Type.Array(Option), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "OptionsResult", | ||
}); | ||
const OptionsOptionsSchema = Type.Object({ | ||
formatted: Type.Optional(Type.Boolean()), | ||
lang: Type.Optional(Type.String()), | ||
region: Type.Optional(Type.String()), | ||
date: Type.Optional(YahooFinanceDate), | ||
}, { | ||
title: "OptionsOptions", | ||
}); | ||
const queryOptionsDefaults = { | ||
@@ -13,17 +169,10 @@ formatted: false, | ||
needsCrumb: true, | ||
schemaKey: "#/definitions/OptionsOptions", | ||
schema: OptionsOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
overrides: queryOptionsOverrides, | ||
transformWith(queryOptions) { | ||
const date = queryOptions.date; | ||
if (date) { | ||
// yfDate will convert valid number/string to Date. | ||
if (date instanceof Date) { | ||
// now we convert back to unix epoch in seconds for query | ||
queryOptions.date = Math.floor(date.getTime() / 1000); | ||
} | ||
else { | ||
// yfDate didn't recognize it as a date. | ||
throw new Error("Unsupported date type: " + date); | ||
} | ||
// This is honestly the easiest way to coerce the date properly | ||
const parsed = Value.Decode(OptionsOptionsSchema, queryOptions); | ||
if (parsed.date) { | ||
queryOptions.date = Math.floor(parsed.date.getTime() / 1000); | ||
} | ||
@@ -34,3 +183,3 @@ return queryOptions; | ||
result: { | ||
schemaKey: "#/definitions/OptionsResult", | ||
schema: OptionsResultSchema, | ||
transformWith(result) { | ||
@@ -37,0 +186,0 @@ if (!result.optionChain) |
@@ -0,1 +1,234 @@ | ||
import { Type } from "@sinclair/typebox"; | ||
import { YahooDateInMs, YahooFinanceDate, YahooNumber, YahooTwoNumberRange, } from "../lib/yahooFinanceTypes.js"; | ||
export const QuoteBase = Type.Object({ | ||
language: Type.String(), // "en-US", | ||
region: Type.String(), // "US", | ||
quoteType: Type.String(), // "EQUITY" | "ETF" | "MUTUALFUND"; | ||
typeDisp: Type.Optional(Type.String()), // "Equity", not always present. | ||
quoteSourceName: Type.Optional(Type.String()), // "Delayed Quote", | ||
triggerable: Type.Boolean(), // true, | ||
currency: Type.Optional(Type.String()), // "USD", | ||
// Seems to appear / disappear based not on symbol but network load (#445) | ||
customPriceAlertConfidence: Type.Optional(Type.String()), // "HIGH" | "LOW"; TODO: anything else? | ||
marketState: Type.Union([ | ||
Type.Literal("REGULAR"), | ||
Type.Literal("CLOSED"), | ||
Type.Literal("PRE"), | ||
Type.Literal("PREPRE"), | ||
Type.Literal("POST"), | ||
Type.Literal("POSTPOST"), | ||
]), | ||
tradeable: Type.Boolean(), // false, | ||
cryptoTradeable: Type.Optional(Type.Boolean()), // false | ||
exchange: Type.String(), // "NMS", | ||
shortName: Type.Optional(Type.String()), // "NVIDIA Corporation", | ||
longName: Type.Optional(Type.String()), // "NVIDIA Corporation", | ||
messageBoardId: Type.Optional(Type.String()), // "finmb_32307", | ||
exchangeTimezoneName: Type.String(), // "America/New_York", | ||
exchangeTimezoneShortName: Type.String(), // "EST", | ||
gmtOffSetMilliseconds: YahooNumber, // -18000000, | ||
market: Type.String(), // "us_market", | ||
esgPopulated: Type.Boolean(), // false, | ||
fiftyTwoWeekLowChange: Type.Optional(YahooNumber), // 362.96002, | ||
fiftyTwoWeekLowChangePercent: Type.Optional(YahooNumber), // 2.0088556, | ||
fiftyTwoWeekRange: Type.Optional(YahooTwoNumberRange), // "180.68 - 589.07" -> { low, high } | ||
fiftyTwoWeekHighChange: Type.Optional(YahooNumber), // -45.429993, | ||
fiftyTwoWeekHighChangePercent: Type.Optional(YahooNumber), // -0.07712155, | ||
fiftyTwoWeekLow: Type.Optional(YahooNumber), // 180.68, | ||
fiftyTwoWeekHigh: Type.Optional(YahooNumber), // 589.07, | ||
fiftyTwoWeekChangePercent: Type.Optional(YahooNumber), // 22.604025 | ||
dividendDate: Type.Optional(YahooFinanceDate), // 1609200000, | ||
// maybe always present on EQUITY? | ||
earningsTimestamp: Type.Optional(YahooFinanceDate), // 1614200400, | ||
earningsTimestampStart: Type.Optional(YahooFinanceDate), // 1614200400, | ||
earningsTimestampEnd: Type.Optional(YahooFinanceDate), // 1614200400, | ||
trailingAnnualDividendRate: Type.Optional(YahooNumber), // 0.64, | ||
trailingPE: Type.Optional(YahooNumber), // 88.873634, | ||
trailingAnnualDividendYield: Type.Optional(YahooNumber), // 0.0011709387, | ||
epsTrailingTwelveMonths: Type.Optional(YahooNumber), // 6.117, | ||
epsForward: Type.Optional(YahooNumber), // 11.68, | ||
epsCurrentYear: Type.Optional(YahooNumber), // 9.72, | ||
priceEpsCurrentYear: Type.Optional(YahooNumber), // 55.930042, | ||
sharesOutstanding: Type.Optional(YahooNumber), // 619000000, | ||
bookValue: Type.Optional(YahooNumber), // 24.772, | ||
fiftyDayAverage: Type.Optional(YahooNumber), // 530.8828, | ||
fiftyDayAverageChange: Type.Optional(YahooNumber), // 12.757202, | ||
fiftyDayAverageChangePercent: Type.Optional(YahooNumber), // 0.024030166, | ||
twoHundredDayAverage: Type.Optional(YahooNumber), // 515.8518, | ||
twoHundredDayAverageChange: Type.Optional(YahooNumber), // 27.788208, | ||
twoHundredDayAverageChangePercent: Type.Optional(YahooNumber), // 0.053868588, | ||
marketCap: Type.Optional(YahooNumber), // 336513171456, | ||
forwardPE: Type.Optional(YahooNumber), // 46.54452, | ||
priceToBook: Type.Optional(YahooNumber), // 21.945745, | ||
sourceInterval: YahooNumber, // 15, | ||
exchangeDataDelayedBy: YahooNumber, // 0, | ||
firstTradeDateMilliseconds: Type.Optional(YahooDateInMs), // 917015400000 -> Date | ||
priceHint: YahooNumber, // 2, | ||
postMarketChangePercent: Type.Optional(YahooNumber), // 0.093813874, | ||
postMarketTime: Type.Optional(YahooFinanceDate), // 1612573179 -> new Date() | ||
postMarketPrice: Type.Optional(YahooNumber), // 544.15, | ||
postMarketChange: Type.Optional(YahooNumber), // 0.51000977, | ||
regularMarketChange: Type.Optional(YahooNumber), // -2.9299927, | ||
regularMarketChangePercent: Type.Optional(YahooNumber), // -0.53606904, | ||
regularMarketTime: Type.Optional(YahooFinanceDate), // 1612558802 -> new Date() | ||
regularMarketPrice: Type.Optional(YahooNumber), // 543.64, | ||
regularMarketDayHigh: Type.Optional(YahooNumber), // 549.19, | ||
regularMarketDayRange: Type.Optional(YahooTwoNumberRange), // "541.867 - 549.19" -> { low, high } | ||
regularMarketDayLow: Type.Optional(YahooNumber), // 541.867, | ||
regularMarketVolume: Type.Optional(YahooNumber), // 4228841, | ||
regularMarketPreviousClose: Type.Optional(YahooNumber), // 546.57, | ||
preMarketChange: Type.Optional(YahooNumber), // -2.9299927, | ||
preMarketChangePercent: Type.Optional(YahooNumber), // -0.53606904, | ||
preMarketTime: Type.Optional(YahooFinanceDate), // 1612558802 -> new Date() | ||
preMarketPrice: Type.Optional(YahooNumber), // 543.64, | ||
bid: Type.Optional(YahooNumber), // 543.84, | ||
ask: Type.Optional(YahooNumber), // 544.15, | ||
bidSize: Type.Optional(YahooNumber), // 18, | ||
askSize: Type.Optional(YahooNumber), // 8, | ||
fullExchangeName: Type.String(), // "NasdaqGS", | ||
financialCurrency: Type.Optional(Type.String()), // "USD", | ||
regularMarketOpen: Type.Optional(YahooNumber), // 549.0, | ||
averageDailyVolume3Month: Type.Optional(YahooNumber), // 7475022, | ||
averageDailyVolume10Day: Type.Optional(YahooNumber), // 5546385, | ||
displayName: Type.Optional(Type.String()), // "NVIDIA", | ||
symbol: Type.String(), // "NVDA" | ||
underlyingSymbol: Type.Optional(Type.String()), // "LD.MI" (for LDO.MI, #363) | ||
// only on ETF? not on EQUITY? | ||
ytdReturn: Type.Optional(YahooNumber), // 0.31 | ||
trailingThreeMonthReturns: Type.Optional(YahooNumber), // 16.98 | ||
trailingThreeMonthNavReturns: Type.Optional(YahooNumber), // 17.08 | ||
ipoExpectedDate: Type.Optional(YahooFinanceDate), // "2020-08-13", | ||
newListingDate: Type.Optional(YahooFinanceDate), // "2021-02-16", | ||
nameChangeDate: Type.Optional(YahooFinanceDate), | ||
prevName: Type.Optional(Type.String()), | ||
averageAnalystRating: Type.Optional(Type.String()), | ||
pageViewGrowthWeekly: Type.Optional(YahooNumber), // Since 2021-11-11 (#326) | ||
openInterest: Type.Optional(YahooNumber), // SOHO (#248) | ||
beta: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}); | ||
/* | ||
* [TODO] Fields seen in a query but not in this module yet: | ||
* | ||
* - extendedMarketChange | ||
* - extendedMarketChangePercent | ||
* - extendedMarketPrice | ||
* - extendedMarketTime | ||
* - dayHigh (separate to regularMarketDayHigh, etc) | ||
* - dayLow (separate to regularMarketDayLow, etc) | ||
* - volume (separaet to regularMarketVolume, etc) | ||
* | ||
* i.e. on yahoo site, with ?fields=dayHigh,dayLow,etc. | ||
*/ | ||
/* | ||
* Guaranteed fields, even we don't ask for them | ||
*/ | ||
const QuoteCryptoCurrency = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("CRYPTOCURRENCY"), | ||
circulatingSupply: YahooNumber, | ||
fromCurrency: Type.String(), // 'BTC' | ||
toCurrency: Type.String(), // 'USD=X' | ||
lastMarket: Type.String(), // 'CoinMarketCap' | ||
coinImageUrl: Type.Optional(Type.String()), // 'https://s.yimg.com/uc/fin/img/reports-thumbnails/1.png' | ||
volume24Hr: Type.Optional(YahooNumber), // 62631043072 | ||
volumeAllCurrencies: Type.Optional(YahooNumber), // 62631043072 | ||
startDate: Type.Optional(YahooFinanceDate), // new Date(1367103600 * 1000) | ||
}), | ||
]); | ||
const QuoteCurrency = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("CURRENCY"), | ||
}), | ||
]); | ||
const QuoteEtf = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("ETF"), | ||
}), | ||
]); | ||
const QuoteEquity = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("EQUITY"), | ||
dividendRate: Type.Optional(Type.Number()), | ||
dividendYield: Type.Optional(Type.Number()), | ||
}), | ||
]); | ||
const QuoteFuture = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("FUTURE"), | ||
headSymbolAsString: Type.String(), | ||
contractSymbol: Type.Boolean(), | ||
underlyingExchangeSymbol: Type.String(), | ||
expireDate: YahooFinanceDate, | ||
expireIsoDate: YahooFinanceDate, | ||
}), | ||
]); | ||
const QuoteIndex = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("INDEX"), | ||
}), | ||
]); | ||
const QuoteOption = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("OPTION"), | ||
strike: YahooNumber, | ||
openInterest: YahooNumber, | ||
expireDate: YahooNumber, | ||
expireIsoDate: YahooNumber, | ||
underlyingSymbol: Type.String(), | ||
}), | ||
]); | ||
const QuoteMutualfund = Type.Composite([ | ||
QuoteBase, | ||
Type.Object({ | ||
quoteType: Type.Literal("MUTUALFUND"), | ||
}), | ||
]); | ||
const QuoteSchema = Type.Union([ | ||
QuoteCryptoCurrency, | ||
QuoteCurrency, | ||
QuoteEtf, | ||
QuoteEquity, | ||
QuoteFuture, | ||
QuoteIndex, | ||
QuoteMutualfund, | ||
QuoteOption, | ||
]); | ||
const QuoteField = Type.KeyOf(QuoteSchema); | ||
const ResultType = Type.Union([ | ||
Type.Literal("array"), | ||
Type.Literal("object"), | ||
Type.Literal("map"), | ||
]); | ||
const QuoteResponseArraySchema = Type.Array(QuoteSchema); | ||
export const QuoteOptionsSchema = Type.Object({ | ||
fields: Type.Optional(Type.Array(QuoteField)), | ||
return: Type.Optional(ResultType), | ||
}); | ||
const QuoteOptionsWithReturnArraySchema = Type.Composite([ | ||
QuoteOptionsSchema, | ||
Type.Object({ | ||
return: Type.Optional(Type.Literal("array")), | ||
}), | ||
]); | ||
const QuoteOptionsWithReturnMapSchema = Type.Composite([ | ||
QuoteOptionsSchema, | ||
Type.Object({ | ||
return: Type.Literal("map"), | ||
}), | ||
]); | ||
const QuoteOptionsWithReturnObjectSchema = Type.Composite([ | ||
QuoteOptionsSchema, | ||
Type.Object({ | ||
return: Type.Literal("object"), | ||
}), | ||
]); | ||
const queryOptionsDefaults = {}; | ||
@@ -10,3 +243,3 @@ export default async function quote(query, queryOptionsOverrides, moduleOptions) { | ||
needsCrumb: true, | ||
schemaKey: "#/definitions/QuoteOptions", | ||
schema: QuoteOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
@@ -25,5 +258,6 @@ runtime: { symbols }, | ||
result: { | ||
schemaKey: "#/definitions/QuoteResponseArray", | ||
schema: QuoteResponseArraySchema, | ||
transformWith(rawResult) { | ||
var _a; | ||
// console.log({ rawResult: JSON.stringify(rawResult, null, 2) }); | ||
let results = (_a = rawResult === null || rawResult === void 0 ? void 0 : rawResult.quoteResponse) === null || _a === void 0 ? void 0 : _a.result; | ||
@@ -44,12 +278,14 @@ if (!results || !Array.isArray(results)) | ||
return results; | ||
case "object": | ||
case "object": { | ||
const object = {}; | ||
for (let result of results) | ||
for (const result of results) | ||
object[result.symbol] = result; | ||
return object; // TODO: type | ||
case "map": | ||
} | ||
case "map": { | ||
const map = new Map(); | ||
for (let result of results) | ||
for (const result of results) | ||
map.set(result.symbol, result); | ||
return map; // TODO: type | ||
} | ||
} | ||
@@ -56,0 +292,0 @@ } |
@@ -0,5 +1,8 @@ | ||
import { Type } from "@sinclair/typebox"; | ||
import { NullableYahooFinanceDate, NullableYahooNumber, YahooFinanceDate, YahooNumber, } from "../lib/yahooFinanceTypes.js"; | ||
/* | ||
* To generate the initial file, we took the output of all submodules for | ||
* 'AAPL', 'OCDO.L', '0700.HK' and '^IXIC' and ran the results through | ||
* the awesome https://app.quicktype.io/. | ||
* the awesome https://app.quicktype.io/ | ||
* and then the smashing https://sinclairzx81.github.io/typebox-workbench | ||
* | ||
@@ -11,25 +14,67 @@ * Manual cleanup afterwards: | ||
* 3) Alphabeticalize QuoteSummaryResult | ||
* 4) RawNumberObj type to Date|number for coersion | ||
*/ | ||
export var Relation; | ||
(function (Relation) { | ||
Relation["ChairmanOfTheBoard"] = "Chairman of the Board"; | ||
Relation["ChiefExecutiveOfficer"] = "Chief Executive Officer"; | ||
Relation["ChiefFinancialOfficer"] = "Chief Financial Officer"; | ||
Relation["ChiefOperatingOfficer"] = "Chief Operating Officer"; | ||
Relation["ChiefTechnologyOfficer"] = "Chief Technology Officer"; | ||
Relation["Director"] = "Director"; | ||
Relation["DirectorIndependent"] = "Director (Independent)"; | ||
Relation["Empty"] = ""; | ||
Relation["GeneralCounsel"] = "General Counsel"; | ||
Relation["IndependentNonExecutiveDirector"] = "Independent Non-Executive Director"; | ||
Relation["Officer"] = "Officer"; | ||
Relation["President"] = "President"; | ||
})(Relation || (Relation = {})); | ||
export var OwnershipEnum; | ||
(function (OwnershipEnum) { | ||
OwnershipEnum["D"] = "D"; | ||
OwnershipEnum["I"] = "I"; | ||
})(OwnershipEnum || (OwnershipEnum = {})); | ||
export var Action; | ||
var EnumGrade; | ||
(function (EnumGrade) { | ||
EnumGrade["Accumulate"] = "Accumulate"; | ||
EnumGrade["Add"] = "Add"; | ||
EnumGrade["Average"] = "Average"; | ||
EnumGrade["BelowAverage"] = "Below Average"; | ||
EnumGrade["Buy"] = "Buy"; | ||
EnumGrade["ConvictionBuy"] = "Conviction Buy"; | ||
EnumGrade["Empty"] = ""; | ||
EnumGrade["EqualWeight"] = "Equal-Weight"; | ||
EnumGrade["FairValue"] = "Fair Value"; | ||
EnumGrade["GradeEqualWeight"] = "Equal-weight"; | ||
EnumGrade["GradeLongTermBuy"] = "Long-term Buy"; | ||
EnumGrade["Hold"] = "Hold"; | ||
EnumGrade["LongTermBuy"] = "Long-Term Buy"; | ||
EnumGrade["MarketOutperform"] = "Market Outperform"; | ||
EnumGrade["MarketPerform"] = "Market Perform"; | ||
EnumGrade["Mixed"] = "Mixed"; | ||
EnumGrade["Negative"] = "Negative"; | ||
EnumGrade["Neutral"] = "Neutral"; | ||
EnumGrade["InLine"] = "In-Line"; | ||
EnumGrade["Outperform"] = "Outperform"; | ||
EnumGrade["Overweight"] = "Overweight"; | ||
EnumGrade["PeerPerform"] = "Peer Perform"; | ||
EnumGrade["Perform"] = "Perform"; | ||
EnumGrade["Positive"] = "Positive"; | ||
EnumGrade["Reduce"] = "Reduce"; | ||
EnumGrade["SectorOutperform"] = "Sector Outperform"; | ||
EnumGrade["SectorPerform"] = "Sector Perform"; | ||
EnumGrade["SectorWeight"] = "Sector Weight"; | ||
EnumGrade["Sell"] = "Sell"; | ||
EnumGrade["StrongBuy"] = "Strong Buy"; | ||
EnumGrade["TopPick"] = "Top Pick"; | ||
EnumGrade["Underperform"] = "Underperform"; | ||
EnumGrade["Underperformer"] = "Underperformer"; | ||
EnumGrade["Underweight"] = "Underweight"; | ||
EnumGrade["Trim"] = "Trim"; | ||
EnumGrade["AboveAverage"] = "Above Average"; | ||
EnumGrade["Inline"] = "In-line"; | ||
EnumGrade["Outperformer"] = "Outperformer"; | ||
EnumGrade["OVerweight"] = "OVerweight"; | ||
EnumGrade["Cautious"] = "Cautious"; | ||
EnumGrade["MarketWeight"] = "Market Weight"; | ||
EnumGrade["SectorUnderperform"] = "Sector Underperform"; | ||
EnumGrade["MarketUnderperform"] = "Market Underperform"; | ||
EnumGrade["Peerperform"] = "Peer perform"; | ||
EnumGrade["GraduallyAccumulate"] = "Gradually Accumulate"; | ||
EnumGrade["ActionListBuy"] = "Action List Buy"; | ||
EnumGrade["Performer"] = "Performer"; | ||
EnumGrade["SectorPerformer"] = "Sector Performer"; | ||
EnumGrade["SpeculativeBuy"] = "Speculative Buy"; | ||
EnumGrade["StrongSell"] = "Strong Sell"; | ||
EnumGrade["SpeculativeHold"] = "Speculative Hold"; | ||
EnumGrade["NotRated"] = "Not Rated"; | ||
EnumGrade["HoldNeutral"] = "Hold Neutral"; | ||
EnumGrade["Developing"] = "Developing"; | ||
EnumGrade["buy"] = "buy"; | ||
EnumGrade["HOld"] = "HOld"; | ||
EnumGrade["TradingSell"] = "Trading Sell"; | ||
EnumGrade["Tender"] = "Tender"; | ||
EnumGrade["marketperform"] = "market perform"; | ||
EnumGrade["BUy"] = "BUy"; | ||
})(EnumGrade || (EnumGrade = {})); | ||
var Action; | ||
(function (Action) { | ||
@@ -42,64 +87,1056 @@ Action["Down"] = "down"; | ||
})(Action || (Action = {})); | ||
export var Grade; | ||
(function (Grade) { | ||
Grade["Accumulate"] = "Accumulate"; | ||
Grade["Add"] = "Add"; | ||
Grade["Average"] = "Average"; | ||
Grade["BelowAverage"] = "Below Average"; | ||
Grade["Buy"] = "Buy"; | ||
Grade["ConvictionBuy"] = "Conviction Buy"; | ||
Grade["Empty"] = ""; | ||
Grade["EqualWeight"] = "Equal-Weight"; | ||
Grade["FairValue"] = "Fair Value"; | ||
Grade["GradeEqualWeight"] = "Equal-weight"; | ||
Grade["GradeLongTermBuy"] = "Long-term Buy"; | ||
Grade["Hold"] = "Hold"; | ||
Grade["LongTermBuy"] = "Long-Term Buy"; | ||
Grade["MarketOutperform"] = "Market Outperform"; | ||
Grade["MarketPerform"] = "Market Perform"; | ||
Grade["Mixed"] = "Mixed"; | ||
Grade["Negative"] = "Negative"; | ||
Grade["Neutral"] = "Neutral"; | ||
Grade["InLine"] = "In-Line"; | ||
Grade["Outperform"] = "Outperform"; | ||
Grade["Overweight"] = "Overweight"; | ||
Grade["PeerPerform"] = "Peer Perform"; | ||
Grade["Perform"] = "Perform"; | ||
Grade["Positive"] = "Positive"; | ||
Grade["Reduce"] = "Reduce"; | ||
Grade["SectorOutperform"] = "Sector Outperform"; | ||
Grade["SectorPerform"] = "Sector Perform"; | ||
Grade["SectorWeight"] = "Sector Weight"; | ||
Grade["Sell"] = "Sell"; | ||
Grade["StrongBuy"] = "Strong Buy"; | ||
Grade["TopPick"] = "Top Pick"; | ||
Grade["Underperform"] = "Underperform"; | ||
Grade["Underperformer"] = "Underperformer"; | ||
Grade["Underweight"] = "Underweight"; | ||
Grade["Trim"] = "Trim"; | ||
Grade["AboveAverage"] = "Above Average"; | ||
Grade["Inline"] = "In-line"; | ||
Grade["Outperformer"] = "Outperformer"; | ||
Grade["OVerweight"] = "OVerweight"; | ||
Grade["Cautious"] = "Cautious"; | ||
Grade["MarketWeight"] = "Market Weight"; | ||
Grade["SectorUnderperform"] = "Sector Underperform"; | ||
Grade["MarketUnderperform"] = "Market Underperform"; | ||
Grade["Peerperform"] = "Peer perform"; | ||
Grade["GraduallyAccumulate"] = "Gradually Accumulate"; | ||
Grade["ActionListBuy"] = "Action List Buy"; | ||
Grade["Performer"] = "Performer"; | ||
Grade["SectorPerformer"] = "Sector Performer"; | ||
Grade["SpeculativeBuy"] = "Speculative Buy"; | ||
Grade["StrongSell"] = "Strong Sell"; | ||
Grade["SpeculativeHold"] = "Speculative Hold"; | ||
Grade["NotRated"] = "Not Rated"; | ||
Grade["HoldNeutral"] = "Hold Neutral"; | ||
Grade["Developing"] = "Developing"; | ||
Grade["buy"] = "buy"; | ||
Grade["HOld"] = "HOld"; | ||
Grade["TradingSell"] = "Trading Sell"; | ||
Grade["Tender"] = "Tender"; | ||
Grade["marketperform"] = "market perform"; | ||
Grade["BUy"] = "BUy"; | ||
})(Grade || (Grade = {})); | ||
const Grade = Type.Enum(EnumGrade, { title: "QuoteSummaryEnumGrade" }); | ||
const ActionSchema = Type.Enum(Action, { title: "QuoteSummaryAction" }); | ||
const UpgradeDowngradeHistoryHistory = Type.Object({ | ||
epochGradeDate: YahooFinanceDate, | ||
firm: Type.String(), | ||
toGrade: Grade, | ||
fromGrade: Type.Optional(Grade), | ||
action: ActionSchema, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryUpgradeDowngradeHistoryHistory", | ||
}); | ||
const UpgradeDowngradeHistory = Type.Object({ | ||
history: Type.Array(UpgradeDowngradeHistoryHistory), | ||
maxAge: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryUpgradeDowngradeHistory", | ||
}); | ||
const TopHoldingsSectorWeighting = Type.Object({ | ||
realestate: Type.Optional(YahooNumber), | ||
consumer_cyclical: Type.Optional(YahooNumber), | ||
basic_materials: Type.Optional(YahooNumber), | ||
consumer_defensive: Type.Optional(YahooNumber), | ||
technology: Type.Optional(YahooNumber), | ||
communication_services: Type.Optional(YahooNumber), | ||
financial_services: Type.Optional(YahooNumber), | ||
utilities: Type.Optional(YahooNumber), | ||
industrials: Type.Optional(YahooNumber), | ||
energy: Type.Optional(YahooNumber), | ||
healthcare: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryTopHoldingsSectorWeighting", | ||
}); | ||
const TopHoldingsBondRating = Type.Object({ | ||
a: Type.Optional(YahooNumber), | ||
aa: Type.Optional(YahooNumber), | ||
aaa: Type.Optional(YahooNumber), | ||
other: Type.Optional(YahooNumber), | ||
b: Type.Optional(YahooNumber), | ||
bb: Type.Optional(YahooNumber), | ||
bbb: Type.Optional(YahooNumber), | ||
below_b: Type.Optional(YahooNumber), | ||
us_government: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryTopHoldingsBondRating", | ||
}); | ||
const TopHoldingsEquityHoldings = Type.Object({ | ||
medianMarketCap: Type.Optional(YahooNumber), | ||
medianMarketCapCat: Type.Optional(YahooNumber), | ||
priceToBook: YahooNumber, | ||
priceToBookCat: Type.Optional(YahooNumber), | ||
priceToCashflow: YahooNumber, | ||
priceToCashflowCat: Type.Optional(YahooNumber), | ||
priceToEarnings: YahooNumber, | ||
priceToEarningsCat: Type.Optional(YahooNumber), | ||
priceToSales: YahooNumber, | ||
priceToSalesCat: Type.Optional(YahooNumber), | ||
threeYearEarningsGrowth: Type.Optional(YahooNumber), | ||
threeYearEarningsGrowthCat: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryTopHoldingsEquityHoldings", | ||
}); | ||
const TopHoldingsHolding = Type.Object({ | ||
symbol: Type.String(), | ||
holdingName: Type.String(), | ||
holdingPercent: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryTopHoldingsHolding", | ||
}); | ||
const TopHoldings = Type.Object({ | ||
maxAge: YahooNumber, | ||
stockPosition: Type.Optional(YahooNumber), | ||
bondPosition: Type.Optional(YahooNumber), | ||
holdings: Type.Array(TopHoldingsHolding), | ||
equityHoldings: TopHoldingsEquityHoldings, | ||
bondHoldings: Type.Object({}), | ||
bondRatings: Type.Array(TopHoldingsBondRating), | ||
sectorWeightings: Type.Array(TopHoldingsSectorWeighting), | ||
cashPosition: Type.Optional(YahooNumber), | ||
otherPosition: Type.Optional(YahooNumber), | ||
preferredPosition: Type.Optional(YahooNumber), | ||
convertiblePosition: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryTopHoldings", | ||
}); | ||
const SummaryProfile = Type.Object({ | ||
address1: Type.Optional(Type.String()), | ||
address2: Type.Optional(Type.String()), | ||
address3: Type.Optional(Type.String()), | ||
city: Type.Optional(Type.String()), | ||
state: Type.Optional(Type.String()), | ||
zip: Type.Optional(Type.String()), | ||
country: Type.Optional(Type.String()), | ||
phone: Type.Optional(Type.String()), | ||
fax: Type.Optional(Type.String()), | ||
website: Type.Optional(Type.String()), | ||
industry: Type.Optional(Type.String()), | ||
industryDisp: Type.Optional(Type.String()), | ||
sector: Type.Optional(Type.String()), | ||
sectorDisp: Type.Optional(Type.String()), | ||
longBusinessSummary: Type.Optional(Type.String()), | ||
fullTimeEmployees: Type.Optional(YahooNumber), | ||
companyOfficers: Type.Array(Type.Any()), | ||
maxAge: YahooNumber, | ||
twitter: Type.Optional(Type.String()), // in e.g. "ADA-USD" (#418) | ||
// seems like for cryptocurency only | ||
// TODO: how does this relate to Quote type. Common base? | ||
name: Type.Optional(Type.String()), // 'Bitcoin' | ||
startDate: Type.Optional(YahooFinanceDate), // new Date('2013-04-28') | ||
description: Type.Optional(Type.String()), // 'Bitcoin (BTC) is a cryptocurrency...' | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummarySummaryProfile", | ||
}); | ||
const SummaryDetail = Type.Object({ | ||
maxAge: YahooNumber, | ||
priceHint: YahooNumber, | ||
previousClose: Type.Optional(YahooNumber), // missing in e.g. "APS.AX" | ||
open: Type.Optional(YahooNumber), | ||
dayLow: Type.Optional(YahooNumber), | ||
dayHigh: Type.Optional(YahooNumber), | ||
regularMarketPreviousClose: Type.Optional(YahooNumber), // missing in e.g. "APS.AX" | ||
regularMarketOpen: Type.Optional(YahooNumber), | ||
regularMarketDayLow: Type.Optional(YahooNumber), | ||
regularMarketDayHigh: Type.Optional(YahooNumber), | ||
regularMarketVolume: Type.Optional(YahooNumber), | ||
dividendRate: Type.Optional(YahooNumber), | ||
dividendYield: Type.Optional(YahooNumber), | ||
exDividendDate: Type.Optional(YahooFinanceDate), | ||
payoutRatio: Type.Optional(YahooNumber), | ||
fiveYearAvgDividendYield: Type.Optional(YahooNumber), | ||
beta: Type.Optional(YahooNumber), | ||
trailingPE: Type.Optional(YahooNumber), | ||
forwardPE: Type.Optional(YahooNumber), | ||
volume: Type.Optional(YahooNumber), | ||
averageVolume: Type.Optional(YahooNumber), | ||
averageVolume10days: Type.Optional(YahooNumber), | ||
averageDailyVolume10Day: Type.Optional(YahooNumber), | ||
bid: Type.Optional(YahooNumber), | ||
ask: Type.Optional(YahooNumber), | ||
bidSize: Type.Optional(YahooNumber), | ||
askSize: Type.Optional(YahooNumber), | ||
marketCap: Type.Optional(YahooNumber), | ||
fiftyDayAverage: Type.Optional(YahooNumber), | ||
fiftyTwoWeekLow: Type.Optional(YahooNumber), | ||
fiftyTwoWeekHigh: Type.Optional(YahooNumber), | ||
twoHundredDayAverage: Type.Optional(YahooNumber), | ||
priceToSalesTrailing12Months: Type.Optional(YahooNumber), | ||
trailingAnnualDividendRate: Type.Optional(YahooNumber), | ||
trailingAnnualDividendYield: Type.Optional(YahooNumber), | ||
currency: Type.String(), | ||
algorithm: Type.Null(), | ||
tradeable: Type.Boolean(), | ||
yield: Type.Optional(YahooNumber), | ||
totalAssets: Type.Optional(YahooNumber), | ||
navPrice: Type.Optional(YahooNumber), | ||
ytdReturn: Type.Optional(YahooNumber), | ||
// crypto only (optional, or null in other types) | ||
// TODO: how does Price / SummaryDetail compare? common base? | ||
fromCurrency: Type.Union([Type.String(), Type.Null()]), // 'BTC' | ||
toCurrency: Type.Optional(Type.Union([Type.String(), Type.Null()])), // 'USD-X' | ||
lastMarket: Type.Union([Type.String(), Type.Null()]), // 'CoinMarketCap' | ||
volume24Hr: Type.Optional(YahooNumber), // 62650314752 | ||
volumeAllCurrencies: Type.Optional(YahooNumber), // 62650314752 | ||
circulatingSupply: Type.Optional(YahooNumber), // 18638932 | ||
startDate: Type.Optional(YahooFinanceDate), // new Date(1367107200 * 1000) | ||
coinMarketCapLink: Type.Optional(Type.Union([Type.String(), Type.Null()])), // "https://coinmarketcap.com/currencies/cardano" | ||
// futures | ||
expireDate: Type.Optional(YahooFinanceDate), // 1656374400, | ||
openInterest: Type.Optional(YahooNumber), // 444411, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummarySummaryDetail", | ||
}); | ||
// May consider switching this to string, as we keep finding more and more. | ||
const FilingType = Type.Union([ | ||
Type.Literal("10-K"), | ||
Type.Literal("10-Q"), | ||
Type.Literal("8-K"), | ||
Type.Literal("8-K/A"), | ||
Type.Literal("10-K/A"), | ||
Type.Literal("10-Q/A"), | ||
Type.Literal("SD"), | ||
Type.Literal("PX14A6G"), | ||
Type.Literal("SC 13G/A"), | ||
Type.Literal("DEFA14A"), | ||
Type.Literal("25-NSE"), | ||
Type.Literal("S-8 POS"), | ||
Type.Literal("6-K"), | ||
Type.Literal("F-3ASR"), | ||
Type.Literal("SC 13D/A"), | ||
Type.Literal("20-F"), | ||
Type.Literal("425"), | ||
Type.Literal("SC14D9C"), | ||
Type.Literal("SC 13G"), | ||
Type.Literal("S-8"), | ||
Type.Literal("DEF 14A"), | ||
Type.Literal("F-10"), | ||
], { | ||
title: "QuoteSummaryFilingType", | ||
}); | ||
const Filing = Type.Object({ | ||
date: Type.String(), | ||
epochDate: YahooFinanceDate, | ||
type: FilingType, | ||
title: Type.String(), | ||
edgarUrl: Type.String(), | ||
maxAge: YahooNumber, | ||
url: Type.Optional(Type.String()), | ||
exhibits: Type.Optional(Type.Array(Type.Object({ | ||
type: Type.String(), | ||
url: Type.String(), | ||
downloadUrl: Type.Optional(Type.String()), | ||
}))), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFiling", | ||
}); | ||
const SECFilings = Type.Object({ | ||
filings: Type.Array(Filing), | ||
maxAge: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummarySECFilings", | ||
}); | ||
const RecommendationTrendTrend = Type.Object({ | ||
period: Type.String(), | ||
strongBuy: YahooNumber, | ||
buy: YahooNumber, | ||
hold: YahooNumber, | ||
sell: YahooNumber, | ||
strongSell: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryRecommendationTrendTrend", | ||
}); | ||
const RecommendationTrend = Type.Object({ | ||
trend: Type.Array(RecommendationTrendTrend), | ||
maxAge: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryRecommendationTrend", | ||
}); | ||
const QuoteType = Type.Object({ | ||
exchange: Type.String(), | ||
quoteType: Type.String(), | ||
symbol: Type.String(), | ||
underlyingSymbol: Type.String(), | ||
shortName: Type.Union([Type.Null(), Type.String()]), | ||
longName: Type.Union([Type.Null(), Type.String()]), | ||
firstTradeDateEpochUtc: NullableYahooFinanceDate, | ||
timeZoneFullName: Type.String(), | ||
timeZoneShortName: Type.String(), | ||
uuid: Type.String(), | ||
messageBoardId: Type.Optional(Type.Union([Type.Null(), Type.String()])), | ||
gmtOffSetMilliseconds: YahooNumber, | ||
maxAge: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryQuoteType", | ||
}); | ||
const Price = Type.Object({ | ||
averageDailyVolume10Day: Type.Optional(YahooNumber), | ||
averageDailyVolume3Month: Type.Optional(YahooNumber), | ||
exchange: Type.Optional(Type.String()), | ||
exchangeName: Type.Optional(Type.String()), | ||
exchangeDataDelayedBy: Type.Optional(YahooNumber), | ||
maxAge: YahooNumber, | ||
postMarketChangePercent: Type.Optional(YahooNumber), | ||
postMarketChange: Type.Optional(YahooNumber), | ||
postMarketTime: Type.Optional(YahooFinanceDate), | ||
postMarketPrice: Type.Optional(YahooNumber), | ||
postMarketSource: Type.Optional(Type.String()), | ||
preMarketChangePercent: Type.Optional(YahooNumber), | ||
preMarketChange: Type.Optional(YahooNumber), | ||
preMarketTime: Type.Optional(YahooFinanceDate), | ||
preMarketPrice: Type.Optional(YahooNumber), | ||
preMarketSource: Type.Optional(Type.String()), | ||
priceHint: YahooNumber, | ||
regularMarketChangePercent: Type.Optional(YahooNumber), | ||
regularMarketChange: Type.Optional(YahooNumber), | ||
regularMarketTime: Type.Optional(YahooFinanceDate), | ||
regularMarketPrice: Type.Optional(YahooNumber), | ||
regularMarketDayHigh: Type.Optional(YahooNumber), | ||
regularMarketDayLow: Type.Optional(YahooNumber), | ||
regularMarketVolume: Type.Optional(YahooNumber), | ||
regularMarketPreviousClose: Type.Optional(YahooNumber), | ||
regularMarketSource: Type.Optional(Type.String()), | ||
regularMarketOpen: Type.Optional(YahooNumber), | ||
quoteSourceName: Type.Optional(Type.String()), | ||
quoteType: Type.String(), | ||
symbol: Type.String(), | ||
underlyingSymbol: Type.Union([Type.Null(), Type.String()]), | ||
shortName: Type.Union([Type.Null(), Type.String()]), | ||
longName: Type.Union([Type.Null(), Type.String()]), | ||
lastMarket: Type.Union([Type.Null(), Type.String()]), | ||
marketState: Type.Optional(Type.String()), | ||
marketCap: Type.Optional(YahooNumber), | ||
currency: Type.Optional(Type.String()), | ||
currencySymbol: Type.Optional(Type.String()), | ||
fromCurrency: Type.Union([Type.String(), Type.Null()]), | ||
toCurrency: Type.Optional(Type.Union([Type.String(), Type.Null()])), | ||
volume24Hr: Type.Optional(YahooNumber), | ||
volumeAllCurrencies: Type.Optional(YahooNumber), | ||
circulatingSupply: Type.Optional(YahooNumber), | ||
expireDate: Type.Optional(YahooFinanceDate), | ||
openInterest: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryPrice", | ||
}); | ||
const NetSharePurchaseActivity = Type.Object({ | ||
maxAge: YahooNumber, | ||
period: Type.String(), | ||
buyInfoCount: YahooNumber, | ||
buyInfoShares: YahooNumber, | ||
buyPercentInsiderShares: Type.Optional(YahooNumber), | ||
sellInfoCount: YahooNumber, | ||
sellInfoShares: Type.Optional(YahooNumber), | ||
sellPercentInsiderShares: Type.Optional(YahooNumber), | ||
netInfoCount: YahooNumber, | ||
netInfoShares: YahooNumber, | ||
netPercentInsiderShares: Type.Optional(YahooNumber), | ||
totalInsiderShares: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryNetSharePurchaseActivity", | ||
}); | ||
const MajorHoldersBreakdown = Type.Object({ | ||
maxAge: YahooNumber, | ||
insidersPercentHeld: Type.Optional(YahooNumber), | ||
institutionsPercentHeld: Type.Optional(YahooNumber), | ||
institutionsFloatPercentHeld: Type.Optional(YahooNumber), | ||
institutionsCount: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryMajorHoldersBreakdown", | ||
}); | ||
var EnumOwnership; | ||
(function (EnumOwnership) { | ||
EnumOwnership["D"] = "D"; | ||
EnumOwnership["I"] = "I"; | ||
})(EnumOwnership || (EnumOwnership = {})); | ||
var EnumRelation; | ||
(function (EnumRelation) { | ||
EnumRelation["ChairmanOfTheBoard"] = "Chairman of the Board"; | ||
EnumRelation["ChiefExecutiveOfficer"] = "Chief Executive Officer"; | ||
EnumRelation["ChiefFinancialOfficer"] = "Chief Financial Officer"; | ||
EnumRelation["ChiefOperatingOfficer"] = "Chief Operating Officer"; | ||
EnumRelation["ChiefTechnologyOfficer"] = "Chief Technology Officer"; | ||
EnumRelation["Director"] = "Director"; | ||
EnumRelation["DirectorIndependent"] = "Director (Independent)"; | ||
EnumRelation["Empty"] = ""; | ||
EnumRelation["GeneralCounsel"] = "General Counsel"; | ||
EnumRelation["IndependentNonExecutiveDirector"] = "Independent Non-Executive Director"; | ||
EnumRelation["Officer"] = "Officer"; | ||
EnumRelation["President"] = "President"; | ||
})(EnumRelation || (EnumRelation = {})); | ||
const Relation = Type.Enum(EnumRelation, { title: "QuoteSummaryRelation" }); | ||
const OwnershipSchema = Type.Enum(EnumOwnership, { | ||
title: "QuoteSummaryOwnership", | ||
}); | ||
const Transaction = Type.Object({ | ||
maxAge: YahooNumber, | ||
shares: YahooNumber, | ||
filerUrl: Type.String(), | ||
transactionText: Type.String(), | ||
filerName: Type.String(), | ||
filerRelation: Type.Union([Relation, Type.String()]), | ||
moneyText: Type.String(), | ||
startDate: YahooFinanceDate, | ||
ownership: Type.Union([OwnershipSchema, Type.String()]), | ||
value: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryTransaction", | ||
}); | ||
const InsiderTransactions = Type.Object({ | ||
transactions: Type.Array(Transaction), | ||
maxAge: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryInsiderTransactions", | ||
}); | ||
const Holder = Type.Object({ | ||
maxAge: YahooNumber, | ||
name: Type.String(), | ||
relation: Type.Union([Relation, Type.String()]), | ||
url: Type.String(), | ||
transactionDescription: Type.String(), | ||
latestTransDate: YahooFinanceDate, | ||
positionDirect: Type.Optional(YahooNumber), | ||
positionDirectDate: Type.Optional(YahooFinanceDate), | ||
positionIndirect: Type.Optional(YahooNumber), | ||
positionIndirectDate: Type.Optional(YahooFinanceDate), | ||
positionSummaryDate: Type.Optional(YahooFinanceDate), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryHolder", | ||
}); | ||
const Holders = Type.Object({ | ||
holders: Type.Array(Holder), | ||
maxAge: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryHolders", | ||
}); | ||
const Trend = Type.Object({ | ||
maxAge: YahooNumber, | ||
symbol: Type.Null(), | ||
estimates: Type.Array(Type.Any()), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryTrend", | ||
}); | ||
const Estimate = Type.Object({ | ||
period: Type.String(), | ||
growth: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryEstimate", | ||
}); | ||
const IndexTrend = Type.Object({ | ||
maxAge: YahooNumber, | ||
symbol: Type.String(), | ||
peRatio: YahooNumber, | ||
pegRatio: YahooNumber, | ||
estimates: Type.Array(Estimate), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryIndexTrend", | ||
}); | ||
const IncomeStatementHistoryElement = Type.Object({ | ||
maxAge: NullableYahooNumber, | ||
endDate: YahooFinanceDate, | ||
totalRevenue: NullableYahooNumber, | ||
costOfRevenue: NullableYahooNumber, | ||
grossProfit: NullableYahooNumber, | ||
researchDevelopment: NullableYahooNumber, | ||
sellingGeneralAdministrative: NullableYahooNumber, | ||
nonRecurring: NullableYahooNumber, | ||
otherOperatingExpenses: NullableYahooNumber, | ||
totalOperatingExpenses: NullableYahooNumber, | ||
operatingIncome: NullableYahooNumber, | ||
totalOtherIncomeExpenseNet: NullableYahooNumber, | ||
ebit: NullableYahooNumber, | ||
interestExpense: NullableYahooNumber, | ||
incomeBeforeTax: NullableYahooNumber, | ||
incomeTaxExpense: NullableYahooNumber, | ||
minorityInterest: NullableYahooNumber, | ||
netIncomeFromContinuingOps: NullableYahooNumber, | ||
discontinuedOperations: NullableYahooNumber, | ||
extraordinaryItems: NullableYahooNumber, | ||
effectOfAccountingCharges: NullableYahooNumber, | ||
otherItems: NullableYahooNumber, | ||
netIncome: NullableYahooNumber, | ||
netIncomeApplicableToCommonShares: NullableYahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryIncomeStatementHistoryElement", | ||
}); | ||
const IncomeStatementHistory = Type.Object({ | ||
incomeStatementHistory: Type.Array(IncomeStatementHistoryElement), | ||
maxAge: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryIncomeStatementHistory", | ||
}); | ||
const FundProfileBrokerage = Type.Object({}, { | ||
title: "QuoteSummaryFundProfileBrokerage", | ||
}); | ||
const FundProfileFeesExpensesInvestment = Type.Object({ | ||
annualHoldingsTurnover: Type.Optional(YahooNumber), | ||
annualReportExpenseRatio: Type.Optional(YahooNumber), | ||
grossExpRatio: Type.Optional(YahooNumber), | ||
netExpRatio: Type.Optional(YahooNumber), | ||
projectionValues: Type.Object({}), | ||
totalNetAssets: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFundProfileFeesExpensesInvestment", | ||
}); | ||
const FundProfileFeesExpensesInvestmentCat = Type.Composite([ | ||
Type.Omit(FundProfileFeesExpensesInvestment, ["projectionValues"]), | ||
Type.Object({ | ||
projectionValuesCat: Type.Object({}), | ||
}), | ||
], { | ||
title: "QuoteSummaryFundProfileFeesExpensesInvestmentCat", | ||
additionalProperties: Type.Any(), | ||
}); | ||
const FundProfileManagementInfo = Type.Object({ | ||
managerName: Type.Union([Type.Null(), Type.String()]), | ||
managerBio: Type.Union([Type.Null(), Type.String()]), | ||
startdate: Type.Optional(YahooFinanceDate), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFundProfileManagementInfo", | ||
}); | ||
const FundProfile = Type.Object({ | ||
maxAge: YahooNumber, | ||
styleBoxUrl: Type.Optional(Type.Union([Type.Null(), Type.String()])), | ||
family: Type.Union([Type.Null(), Type.String()]), | ||
categoryName: Type.Union([Type.Null(), Type.String()]), | ||
legalType: Type.Union([Type.Null(), Type.String()]), | ||
managementInfo: Type.Optional(FundProfileManagementInfo), | ||
feesExpensesInvestment: Type.Optional(FundProfileFeesExpensesInvestment), | ||
feesExpensesInvestmentCat: Type.Optional(FundProfileFeesExpensesInvestmentCat), | ||
brokerages: Type.Optional(Type.Array(FundProfileBrokerage)), | ||
initInvestment: Type.Optional(YahooNumber), | ||
initIraInvestment: Type.Optional(YahooNumber), | ||
initAipInvestment: Type.Optional(YahooNumber), | ||
subseqInvestment: Type.Optional(YahooNumber), | ||
subseqIraInvestment: Type.Optional(YahooNumber), | ||
subseqAipInvestment: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFundProfile", | ||
}); | ||
const FundPerformanceRiskOverviewStatsRow = Type.Object({ | ||
year: Type.String(), // "5y" | "3y" | "10y" | anything else? | ||
alpha: YahooNumber, // 7.76 | ||
beta: YahooNumber, // 1.04 | ||
meanAnnualReturn: YahooNumber, // 2.05 | ||
rSquared: YahooNumber, // 84.03 | ||
stdDev: Type.Optional(YahooNumber), // 17.12 | ||
sharpeRatio: YahooNumber, // 1.37 | ||
treynorRatio: YahooNumber, // 23.61 | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFundPerformanceRiskOverviewStatsRow", | ||
}); | ||
const FundPerformanceRiskOverviewStatsCat = Type.Object({ | ||
riskStatisticsCat: Type.Array(FundPerformanceRiskOverviewStatsRow), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFundPerformanceRiskOverviewStatsCat", | ||
}); | ||
const FundPerformanceRiskOverviewStats = Type.Object({ | ||
riskStatistics: Type.Array(FundPerformanceRiskOverviewStatsRow), | ||
riskRating: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFundPerformanceRiskOverviewStats", | ||
}); | ||
const FundPerformanceReturnsRow = Type.Object({ | ||
year: YahooFinanceDate, | ||
annualValue: Type.Optional(YahooNumber), | ||
q1: Type.Optional(YahooNumber), | ||
q2: Type.Optional(YahooNumber), | ||
q3: Type.Optional(YahooNumber), | ||
q4: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFundPerformanceReturnsRow", | ||
}); | ||
const FundPerformanceReturns = Type.Object({ | ||
returns: Type.Array(FundPerformanceReturnsRow), | ||
returnsCat: Type.Optional(Type.Array(FundPerformanceReturnsRow)), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFundPerformanceReturns", | ||
}); | ||
const FundPerformancePerformanceOverviewCat = Type.Object({ | ||
ytdReturnPct: Type.Optional(YahooNumber), | ||
fiveYrAvgReturnPct: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFundPerformancePerformanceOverviewCat", | ||
}); | ||
const FundPerformancePerformanceOverview = Type.Object({ | ||
asOfDate: Type.Optional(YahooFinanceDate), | ||
ytdReturnPct: Type.Optional(YahooNumber), | ||
oneYearTotalReturn: Type.Optional(YahooNumber), | ||
threeYearTotalReturn: Type.Optional(YahooNumber), | ||
fiveYrAvgReturnPct: Type.Optional(YahooNumber), | ||
morningStarReturnRating: Type.Optional(YahooNumber), | ||
numYearsUp: Type.Optional(YahooNumber), | ||
numYearsDown: Type.Optional(YahooNumber), | ||
bestOneYrTotalReturn: Type.Optional(YahooNumber), | ||
worstOneYrTotalReturn: Type.Optional(YahooNumber), | ||
bestThreeYrTotalReturn: Type.Optional(YahooNumber), | ||
worstThreeYrTotalReturn: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFundPerformancePerformanceOverview", | ||
}); | ||
const PeriodRange = Type.Object({ | ||
asOfDate: Type.Optional(YahooFinanceDate), | ||
ytd: Type.Optional(YahooNumber), | ||
oneMonth: Type.Optional(YahooNumber), | ||
threeMonth: Type.Optional(YahooNumber), | ||
oneYear: Type.Optional(YahooNumber), | ||
threeYear: Type.Optional(YahooNumber), | ||
fiveYear: Type.Optional(YahooNumber), | ||
tenYear: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryPeriodRange", | ||
}); | ||
const FundPerformanceTrailingReturns = Type.Composite([ | ||
PeriodRange, | ||
Type.Object({ | ||
lastBullMkt: Type.Optional(YahooNumber), | ||
lastBearMkt: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}), | ||
], { | ||
title: "QuoteSummaryFundPerformanceTrailingReturns", | ||
}); | ||
const FundPerformance = Type.Object({ | ||
maxAge: YahooNumber, | ||
loadAdjustedReturns: Type.Optional(PeriodRange), | ||
rankInCategory: Type.Optional(PeriodRange), | ||
performanceOverview: FundPerformancePerformanceOverview, | ||
performanceOverviewCat: FundPerformancePerformanceOverviewCat, | ||
trailingReturns: FundPerformanceTrailingReturns, | ||
trailingReturnsNav: FundPerformanceTrailingReturns, | ||
trailingReturnsCat: FundPerformanceTrailingReturns, | ||
annualTotalReturns: FundPerformanceReturns, | ||
pastQuarterlyReturns: FundPerformanceReturns, | ||
riskOverviewStatistics: FundPerformanceRiskOverviewStats, | ||
riskOverviewStatisticsCat: FundPerformanceRiskOverviewStatsCat, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFundPerformance", | ||
}); | ||
const OwnershipList = Type.Object({ | ||
maxAge: YahooNumber, | ||
reportDate: YahooFinanceDate, | ||
organization: Type.String(), | ||
pctHeld: YahooNumber, | ||
position: YahooNumber, | ||
value: YahooNumber, | ||
pctChange: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryOwnershipList", | ||
}); | ||
const Ownership = Type.Object({ | ||
maxAge: YahooNumber, | ||
ownershipList: Type.Array(OwnershipList), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryOwnership", | ||
}); | ||
const FinancialData = Type.Object({ | ||
maxAge: YahooNumber, | ||
currentPrice: Type.Optional(YahooNumber), | ||
targetHighPrice: Type.Optional(YahooNumber), | ||
targetLowPrice: Type.Optional(YahooNumber), | ||
targetMeanPrice: Type.Optional(YahooNumber), | ||
targetMedianPrice: Type.Optional(YahooNumber), | ||
recommendationMean: Type.Optional(YahooNumber), | ||
recommendationKey: Type.String(), | ||
numberOfAnalystOpinions: Type.Optional(YahooNumber), | ||
totalCash: Type.Optional(YahooNumber), | ||
totalCashPerShare: Type.Optional(YahooNumber), | ||
ebitda: Type.Optional(YahooNumber), | ||
totalDebt: Type.Optional(YahooNumber), | ||
quickRatio: Type.Optional(YahooNumber), | ||
currentRatio: Type.Optional(YahooNumber), | ||
totalRevenue: Type.Optional(YahooNumber), | ||
debtToEquity: Type.Optional(YahooNumber), | ||
revenuePerShare: Type.Optional(YahooNumber), | ||
returnOnAssets: Type.Optional(YahooNumber), | ||
returnOnEquity: Type.Optional(YahooNumber), | ||
grossProfits: Type.Optional(YahooNumber), | ||
freeCashflow: Type.Optional(YahooNumber), | ||
operatingCashflow: Type.Optional(YahooNumber), | ||
earningsGrowth: Type.Optional(YahooNumber), | ||
revenueGrowth: Type.Optional(YahooNumber), | ||
grossMargins: Type.Optional(YahooNumber), | ||
ebitdaMargins: Type.Optional(YahooNumber), | ||
operatingMargins: Type.Optional(YahooNumber), | ||
profitMargins: Type.Optional(YahooNumber), | ||
financialCurrency: Type.Union([Type.String(), Type.Null()]), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFinancialData", | ||
}); | ||
const RevenueEstimate = Type.Object({ | ||
avg: NullableYahooNumber, | ||
low: NullableYahooNumber, | ||
high: NullableYahooNumber, | ||
numberOfAnalysts: NullableYahooNumber, | ||
yearAgoRevenue: NullableYahooNumber, | ||
growth: NullableYahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryRevenueEstimate", | ||
}); | ||
const EpsTrend = Type.Object({ | ||
current: NullableYahooNumber, | ||
"7daysAgo": NullableYahooNumber, | ||
"30daysAgo": NullableYahooNumber, | ||
"60daysAgo": NullableYahooNumber, | ||
"90daysAgo": NullableYahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryEpsTrend", | ||
}); | ||
const EpsRevisions = Type.Object({ | ||
upLast7days: NullableYahooNumber, | ||
upLast30days: NullableYahooNumber, | ||
downLast30days: NullableYahooNumber, | ||
downLast90days: NullableYahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryEpsRevisions", | ||
}); | ||
const EarningsEstimate = Type.Object({ | ||
avg: NullableYahooNumber, | ||
low: NullableYahooNumber, | ||
high: NullableYahooNumber, | ||
yearAgoEps: NullableYahooNumber, | ||
numberOfAnalysts: NullableYahooNumber, | ||
growth: NullableYahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryEarningsEstimate", | ||
}); | ||
const EarningsTrendTrend = Type.Object({ | ||
maxAge: YahooNumber, | ||
period: Type.String(), | ||
endDate: NullableYahooFinanceDate, | ||
growth: NullableYahooNumber, | ||
earningsEstimate: EarningsEstimate, | ||
revenueEstimate: RevenueEstimate, | ||
epsTrend: EpsTrend, | ||
epsRevisions: EpsRevisions, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryEarningsTrendTrend", | ||
}); | ||
const EarningsTrend = Type.Object({ | ||
trend: Type.Array(EarningsTrendTrend), | ||
maxAge: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryEarningsTrend", | ||
}); | ||
const EarningsHistoryHistory = Type.Object({ | ||
maxAge: YahooNumber, | ||
epsActual: NullableYahooNumber, | ||
epsEstimate: NullableYahooNumber, | ||
epsDifference: NullableYahooNumber, | ||
surprisePercent: NullableYahooNumber, | ||
quarter: NullableYahooFinanceDate, | ||
period: Type.String(), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryEarningsHistoryHistory", | ||
}); | ||
const EarningsHistory = Type.Object({ | ||
history: Type.Array(EarningsHistoryHistory), | ||
maxAge: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryEarningsHistory", | ||
}); | ||
const Yearly = Type.Object({ | ||
date: YahooNumber, | ||
revenue: YahooNumber, | ||
earnings: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryYearly", | ||
}); | ||
const FinancialsChartQuarterly = Type.Object({ | ||
date: Type.String(), | ||
revenue: YahooNumber, | ||
earnings: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFinancialsChartQuarterly", | ||
}); | ||
const FinancialsChart = Type.Object({ | ||
yearly: Type.Array(Yearly), | ||
quarterly: Type.Array(FinancialsChartQuarterly), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryFinancialsChart", | ||
}); | ||
const EarningsChartQuarterly = Type.Object({ | ||
date: Type.String(), | ||
actual: YahooNumber, | ||
estimate: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryEarningsChartQuarterly", | ||
}); | ||
const EarningsChart = Type.Object({ | ||
quarterly: Type.Array(EarningsChartQuarterly), | ||
currentQuarterEstimate: Type.Optional(YahooNumber), | ||
currentQuarterEstimateDate: Type.Optional(Type.String()), | ||
currentQuarterEstimateYear: Type.Optional(YahooNumber), | ||
earningsDate: Type.Array(YahooFinanceDate), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryEarningsChart", | ||
}); | ||
const QuoteSummaryEarnings = Type.Object({ | ||
maxAge: YahooNumber, | ||
earningsChart: EarningsChart, | ||
financialsChart: FinancialsChart, | ||
financialCurrency: Type.Optional(Type.String()), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryEarnings", | ||
}); | ||
const DefaultKeyStatistics = Type.Object({ | ||
maxAge: YahooNumber, | ||
priceHint: YahooNumber, | ||
enterpriseValue: Type.Optional(YahooNumber), | ||
forwardPE: Type.Optional(YahooNumber), | ||
profitMargins: Type.Optional(YahooNumber), | ||
floatShares: Type.Optional(YahooNumber), | ||
sharesOutstanding: Type.Optional(YahooNumber), | ||
sharesShort: Type.Optional(YahooNumber), | ||
sharesShortPriorMonth: Type.Optional(YahooFinanceDate), | ||
sharesShortPreviousMonthDate: Type.Optional(YahooFinanceDate), | ||
dateShortInterest: Type.Optional(YahooNumber), | ||
sharesPercentSharesOut: Type.Optional(YahooNumber), | ||
heldPercentInsiders: Type.Optional(YahooNumber), | ||
heldPercentInstitutions: Type.Optional(YahooNumber), | ||
shortRatio: Type.Optional(YahooNumber), | ||
shortPercentOfFloat: Type.Optional(YahooNumber), | ||
beta: Type.Optional(YahooNumber), | ||
impliedSharesOutstanding: Type.Optional(YahooNumber), | ||
category: Type.Union([Type.Null(), Type.String()]), | ||
bookValue: Type.Optional(YahooNumber), | ||
priceToBook: Type.Optional(YahooNumber), | ||
fundFamily: Type.Union([Type.Null(), Type.String()]), | ||
legalType: Type.Union([Type.Null(), Type.String()]), | ||
lastFiscalYearEnd: Type.Optional(YahooFinanceDate), | ||
nextFiscalYearEnd: Type.Optional(YahooFinanceDate), | ||
mostRecentQuarter: Type.Optional(YahooFinanceDate), | ||
earningsQuarterlyGrowth: Type.Optional(YahooNumber), | ||
netIncomeToCommon: Type.Optional(YahooNumber), | ||
trailingEps: Type.Optional(YahooNumber), | ||
forwardEps: Type.Optional(YahooNumber), | ||
pegRatio: Type.Optional(YahooNumber), | ||
lastSplitFactor: Type.Union([Type.Null(), Type.String()]), | ||
lastSplitDate: Type.Optional(YahooNumber), | ||
enterpriseToRevenue: Type.Optional(YahooNumber), | ||
enterpriseToEbitda: Type.Optional(YahooNumber), | ||
"52WeekChange": Type.Optional(YahooNumber), | ||
SandP52WeekChange: Type.Optional(YahooNumber), | ||
lastDividendValue: Type.Optional(YahooNumber), | ||
lastDividendDate: Type.Optional(YahooFinanceDate), | ||
ytdReturn: Type.Optional(YahooNumber), | ||
beta3Year: Type.Optional(YahooNumber), | ||
totalAssets: Type.Optional(YahooNumber), | ||
yield: Type.Optional(YahooNumber), | ||
fundInceptionDate: Type.Optional(YahooFinanceDate), | ||
threeYearAverageReturn: Type.Optional(YahooNumber), | ||
fiveYearAverageReturn: Type.Optional(YahooNumber), | ||
morningStarOverallRating: Type.Optional(YahooNumber), | ||
morningStarRiskRating: Type.Optional(YahooNumber), | ||
annualReportExpenseRatio: Type.Optional(YahooNumber), | ||
lastCapGain: Type.Optional(YahooNumber), | ||
annualHoldingsTurnover: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryDefaultKeyStatistics", | ||
}); | ||
const CashflowStatement = Type.Object({ | ||
maxAge: YahooNumber, | ||
endDate: YahooFinanceDate, | ||
netIncome: YahooNumber, | ||
depreciation: Type.Optional(YahooNumber), | ||
changeToNetincome: Type.Optional(YahooNumber), | ||
changeToAccountReceivables: Type.Optional(YahooNumber), | ||
changeToLiabilities: Type.Optional(YahooNumber), | ||
changeToInventory: Type.Optional(YahooNumber), | ||
changeToOperatingActivities: Type.Optional(YahooNumber), | ||
totalCashFromOperatingActivities: Type.Optional(YahooNumber), | ||
capitalExpenditures: Type.Optional(YahooNumber), | ||
investments: Type.Optional(YahooNumber), | ||
otherCashflowsFromInvestingActivities: Type.Optional(YahooNumber), | ||
totalCashflowsFromInvestingActivities: Type.Optional(YahooNumber), | ||
dividendsPaid: Type.Optional(YahooNumber), | ||
netBorrowings: Type.Optional(YahooNumber), | ||
otherCashflowsFromFinancingActivities: Type.Optional(YahooNumber), | ||
totalCashFromFinancingActivities: Type.Optional(YahooNumber), | ||
changeInCash: Type.Optional(YahooNumber), | ||
repurchaseOfStock: Type.Optional(YahooNumber), | ||
issuanceOfStock: Type.Optional(YahooNumber), | ||
effectOfExchangeRate: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryCashflowStatement", | ||
}); | ||
const CashflowStatementHistory = Type.Object({ | ||
cashflowStatements: Type.Array(CashflowStatement), | ||
maxAge: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryCashflowStatementHistory", | ||
}); | ||
const CalendarEventsEarnings = Type.Object({ | ||
earningsDate: Type.Array(YahooFinanceDate), | ||
earningsAverage: Type.Optional(YahooNumber), | ||
earningsLow: Type.Optional(YahooNumber), | ||
earningsHigh: Type.Optional(YahooNumber), | ||
revenueAverage: Type.Optional(YahooNumber), | ||
revenueLow: Type.Optional(YahooNumber), | ||
revenueHigh: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSumamryCalendarEventsEarnings", | ||
}); | ||
const CalendarEvents = Type.Object({ | ||
maxAge: YahooNumber, | ||
earnings: CalendarEventsEarnings, | ||
exDividendDate: Type.Optional(YahooFinanceDate), | ||
dividendDate: Type.Optional(YahooFinanceDate), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryCalendarEvents", | ||
}); | ||
const BalanceSheetStatement = Type.Object({ | ||
maxAge: YahooNumber, | ||
endDate: YahooFinanceDate, | ||
cash: Type.Optional(YahooNumber), | ||
shortTermInvestments: Type.Optional(YahooNumber), | ||
netReceivables: Type.Optional(YahooNumber), | ||
inventory: Type.Optional(YahooNumber), | ||
otherCurrentAssets: Type.Optional(YahooNumber), | ||
totalCurrentAssets: Type.Optional(YahooNumber), | ||
longTermInvestments: Type.Optional(YahooNumber), | ||
propertyPlantEquipment: Type.Optional(YahooNumber), | ||
otherAssets: Type.Optional(YahooNumber), | ||
totalAssets: Type.Optional(YahooNumber), | ||
accountsPayable: Type.Optional(YahooNumber), | ||
shortLongTermDebt: Type.Optional(YahooNumber), | ||
otherCurrentLiab: Type.Optional(YahooNumber), | ||
longTermDebt: Type.Optional(YahooNumber), | ||
otherLiab: Type.Optional(YahooNumber), | ||
totalCurrentLiabilities: Type.Optional(YahooNumber), | ||
totalLiab: Type.Optional(YahooNumber), | ||
commonStock: Type.Optional(YahooNumber), | ||
retainedEarnings: Type.Optional(YahooNumber), | ||
treasuryStock: Type.Optional(YahooNumber), | ||
otherStockholderEquity: Type.Optional(YahooNumber), | ||
totalStockholderEquity: Type.Optional(YahooNumber), | ||
netTangibleAssets: Type.Optional(YahooNumber), | ||
goodWill: Type.Optional(YahooNumber), | ||
intangibleAssets: Type.Optional(YahooNumber), | ||
deferredLongTermAssetCharges: Type.Optional(YahooNumber), | ||
deferredLongTermLiab: Type.Optional(YahooNumber), | ||
minorityInterest: Type.Optional(NullableYahooNumber), | ||
capitalSurplus: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryBalanceSheetStatement", | ||
}); | ||
const BalanceSheetHistory = Type.Object({ | ||
balanceSheetStatements: Type.Array(BalanceSheetStatement), | ||
maxAge: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryBalanceSheetHistory", | ||
}); | ||
const CompanyOfficer = Type.Object({ | ||
maxAge: YahooNumber, | ||
name: Type.String(), | ||
age: Type.Optional(YahooNumber), | ||
title: Type.String(), | ||
yearBorn: Type.Optional(YahooNumber), | ||
fiscalYear: Type.Optional(YahooNumber), | ||
totalPay: Type.Optional(YahooNumber), | ||
exercisedValue: Type.Optional(YahooNumber), | ||
unexercisedValue: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryCompanyOfficer", | ||
}); | ||
const AssetProfile = Type.Object({ | ||
maxAge: YahooNumber, | ||
address1: Type.Optional(Type.String()), | ||
address2: Type.Optional(Type.String()), | ||
address3: Type.Optional(Type.String()), | ||
city: Type.Optional(Type.String()), | ||
state: Type.Optional(Type.String()), | ||
zip: Type.Optional(Type.String()), | ||
country: Type.Optional(Type.String()), | ||
phone: Type.Optional(Type.String()), | ||
fax: Type.Optional(Type.String()), | ||
website: Type.Optional(Type.String()), | ||
industry: Type.Optional(Type.String()), | ||
industryDisp: Type.Optional(Type.String()), | ||
industryKey: Type.Optional(Type.String()), | ||
industrySymbol: Type.Optional(Type.String()), | ||
sector: Type.Optional(Type.String()), | ||
sectorDisp: Type.Optional(Type.String()), | ||
sectorKey: Type.Optional(Type.String()), | ||
longBusinessSummary: Type.Optional(Type.String()), | ||
fullTimeEmployees: Type.Optional(YahooNumber), | ||
companyOfficers: Type.Array(CompanyOfficer), | ||
auditRisk: Type.Optional(YahooNumber), | ||
boardRisk: Type.Optional(YahooNumber), | ||
compensationRisk: Type.Optional(YahooNumber), | ||
shareHolderRightsRisk: Type.Optional(YahooNumber), | ||
overallRisk: Type.Optional(YahooNumber), | ||
governanceEpochDate: Type.Optional(YahooFinanceDate), | ||
compensationAsOfEpochDate: Type.Optional(YahooFinanceDate), | ||
name: Type.Optional(Type.String()), // 'Bitcoin'; | ||
startDate: Type.Optional(YahooFinanceDate), // new Date('2013-04-28') | ||
description: Type.Optional(Type.String()), // 'Bitcoin (BTC) is a cryptocurrency...' | ||
twitter: Type.Optional(Type.String()), // in e.g. "ADA-USD" (#418) | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryAssetProfile", | ||
}); | ||
export const QuoteSummaryResult = Type.Object({ | ||
assetProfile: Type.Optional(AssetProfile), | ||
balanceSheetHistory: Type.Optional(BalanceSheetHistory), | ||
balanceSheetHistoryQuarterly: Type.Optional(BalanceSheetHistory), | ||
calendarEvents: Type.Optional(CalendarEvents), | ||
cashflowStatementHistory: Type.Optional(CashflowStatementHistory), | ||
cashflowStatementHistoryQuarterly: Type.Optional(CashflowStatementHistory), | ||
defaultKeyStatistics: Type.Optional(DefaultKeyStatistics), | ||
earnings: Type.Optional(QuoteSummaryEarnings), | ||
earningsHistory: Type.Optional(EarningsHistory), | ||
earningsTrend: Type.Optional(EarningsTrend), | ||
financialData: Type.Optional(FinancialData), | ||
fundOwnership: Type.Optional(Ownership), | ||
fundPerformance: Type.Optional(FundPerformance), | ||
fundProfile: Type.Optional(FundProfile), | ||
institutionOwnership: Type.Optional(Ownership), | ||
majorDirectHolders: Type.Optional(Holders), | ||
majorHoldersBreakdown: Type.Optional(MajorHoldersBreakdown), | ||
netSharePurchaseActivity: Type.Optional(NetSharePurchaseActivity), | ||
price: Type.Optional(Price), | ||
quoteType: Type.Optional(QuoteType), | ||
recommendationTrend: Type.Optional(RecommendationTrend), | ||
secFilings: Type.Optional(SECFilings), | ||
sectorTrend: Type.Optional(Trend), | ||
summaryDetail: Type.Optional(SummaryDetail), | ||
summaryProfile: Type.Optional(SummaryProfile), | ||
topHoldings: Type.Optional(TopHoldings), | ||
upgradeDowngradeHistory: Type.Optional(UpgradeDowngradeHistory), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "QuoteSummaryResult", | ||
}); |
@@ -0,10 +1,12 @@ | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
import { Static } from "@sinclair/typebox"; | ||
import { QuoteSummaryResult } from "./quoteSummary-iface.js"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export declare const quoteSummary_modules: string[]; | ||
export type QuoteSummaryModules = "assetProfile" | "balanceSheetHistory" | "balanceSheetHistoryQuarterly" | "calendarEvents" | "cashflowStatementHistory" | "cashflowStatementHistoryQuarterly" | "defaultKeyStatistics" | "earnings" | "earningsHistory" | "earningsTrend" | "financialData" | "fundOwnership" | "fundPerformance" | "fundProfile" | "incomeStatementHistory" | "incomeStatementHistoryQuarterly" | "indexTrend" | "industryTrend" | "insiderHolders" | "insiderTransactions" | "institutionOwnership" | "majorDirectHolders" | "majorHoldersBreakdown" | "netSharePurchaseActivity" | "price" | "quoteType" | "recommendationTrend" | "secFilings" | "sectorTrend" | "summaryDetail" | "summaryProfile" | "topHoldings" | "upgradeDowngradeHistory"; | ||
export interface QuoteSummaryOptions { | ||
formatted?: boolean; | ||
modules?: Array<QuoteSummaryModules> | "all"; | ||
} | ||
type QuoteSummaryOptions = Static<typeof QuoteSummaryOptions>; | ||
type QuoteSummaryResult = Static<typeof QuoteSummaryResult>; | ||
declare const QuoteSummaryOptions: import("@sinclair/typebox").TObject<{ | ||
formatted: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
modules: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"assetProfile">, import("@sinclair/typebox").TLiteral<"balanceSheetHistory">, import("@sinclair/typebox").TLiteral<"balanceSheetHistoryQuarterly">, import("@sinclair/typebox").TLiteral<"calendarEvents">, import("@sinclair/typebox").TLiteral<"cashflowStatementHistory">, import("@sinclair/typebox").TLiteral<"cashflowStatementHistoryQuarterly">, import("@sinclair/typebox").TLiteral<"defaultKeyStatistics">, import("@sinclair/typebox").TLiteral<"earnings">, import("@sinclair/typebox").TLiteral<"earningsHistory">, import("@sinclair/typebox").TLiteral<"earningsTrend">, import("@sinclair/typebox").TLiteral<"financialData">, import("@sinclair/typebox").TLiteral<"fundOwnership">, import("@sinclair/typebox").TLiteral<"fundPerformance">, import("@sinclair/typebox").TLiteral<"fundProfile">, import("@sinclair/typebox").TLiteral<"incomeStatementHistory">, import("@sinclair/typebox").TLiteral<"incomeStatementHistoryQuarterly">, import("@sinclair/typebox").TLiteral<"indexTrend">, import("@sinclair/typebox").TLiteral<"industryTrend">, import("@sinclair/typebox").TLiteral<"insiderHolders">, import("@sinclair/typebox").TLiteral<"insiderTransactions">, import("@sinclair/typebox").TLiteral<"institutionOwnership">, import("@sinclair/typebox").TLiteral<"majorDirectHolders">, import("@sinclair/typebox").TLiteral<"majorHoldersBreakdown">, import("@sinclair/typebox").TLiteral<"netSharePurchaseActivity">, import("@sinclair/typebox").TLiteral<"price">, import("@sinclair/typebox").TLiteral<"quoteType">, import("@sinclair/typebox").TLiteral<"recommendationTrend">, import("@sinclair/typebox").TLiteral<"secFilings">, import("@sinclair/typebox").TLiteral<"sectorTrend">, import("@sinclair/typebox").TLiteral<"summaryDetail">, import("@sinclair/typebox").TLiteral<"summaryProfile">, import("@sinclair/typebox").TLiteral<"topHoldings">, import("@sinclair/typebox").TLiteral<"upgradeDowngradeHistory">]>>, import("@sinclair/typebox").TLiteral<"all">]>>; | ||
}>; | ||
export default function quoteSummary(this: ModuleThis, symbol: string, queryOptionsOverrides?: QuoteSummaryOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<QuoteSummaryResult>; | ||
export default function quoteSummary(this: ModuleThis, symbol: string, queryOptionsOverrides?: QuoteSummaryOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
@@ -1,2 +0,39 @@ | ||
export const quoteSummary_modules = [ | ||
import { Type } from "@sinclair/typebox"; | ||
import { QuoteSummaryResult } from "./quoteSummary-iface.js"; | ||
const QuoteSummaryModules = Type.Union([ | ||
Type.Literal("assetProfile"), | ||
Type.Literal("balanceSheetHistory"), | ||
Type.Literal("balanceSheetHistoryQuarterly"), | ||
Type.Literal("calendarEvents"), | ||
Type.Literal("cashflowStatementHistory"), | ||
Type.Literal("cashflowStatementHistoryQuarterly"), | ||
Type.Literal("defaultKeyStatistics"), | ||
Type.Literal("earnings"), | ||
Type.Literal("earningsHistory"), | ||
Type.Literal("earningsTrend"), | ||
Type.Literal("financialData"), | ||
Type.Literal("fundOwnership"), | ||
Type.Literal("fundPerformance"), | ||
Type.Literal("fundProfile"), | ||
Type.Literal("incomeStatementHistory"), | ||
Type.Literal("incomeStatementHistoryQuarterly"), | ||
Type.Literal("indexTrend"), | ||
Type.Literal("industryTrend"), | ||
Type.Literal("insiderHolders"), | ||
Type.Literal("insiderTransactions"), | ||
Type.Literal("institutionOwnership"), | ||
Type.Literal("majorDirectHolders"), | ||
Type.Literal("majorHoldersBreakdown"), | ||
Type.Literal("netSharePurchaseActivity"), | ||
Type.Literal("price"), | ||
Type.Literal("quoteType"), | ||
Type.Literal("recommendationTrend"), | ||
Type.Literal("secFilings"), | ||
Type.Literal("sectorTrend"), | ||
Type.Literal("summaryDetail"), | ||
Type.Literal("summaryProfile"), | ||
Type.Literal("topHoldings"), | ||
Type.Literal("upgradeDowngradeHistory"), | ||
]); | ||
const quoteSummaryModules = [ | ||
"assetProfile", | ||
@@ -36,2 +73,6 @@ "balanceSheetHistory", | ||
]; | ||
const QuoteSummaryOptions = Type.Object({ | ||
formatted: Type.Optional(Type.Boolean()), | ||
modules: Type.Optional(Type.Union([Type.Array(QuoteSummaryModules), Type.Literal("all")])), | ||
}); | ||
const queryOptionsDefaults = { | ||
@@ -48,8 +89,12 @@ formatted: false, | ||
needsCrumb: true, | ||
schemaKey: "#/definitions/QuoteSummaryOptions", | ||
schema: QuoteSummaryOptions, | ||
defaults: queryOptionsDefaults, | ||
overrides: queryOptionsOverrides, | ||
transformWith(options) { | ||
if (options.modules === "all") | ||
options.modules = quoteSummary_modules; | ||
if (typeof options === "object" && | ||
options != null && | ||
"modules" in options && | ||
options.modules === "all") | ||
options.modules = | ||
quoteSummaryModules; | ||
return options; | ||
@@ -59,3 +104,3 @@ }, | ||
result: { | ||
schemaKey: "#/definitions/QuoteSummaryResult", | ||
schema: QuoteSummaryResult, | ||
transformWith(result) { | ||
@@ -62,0 +107,0 @@ if (!result.quoteSummary) |
@@ -0,16 +1,28 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateFalse, ModuleOptionsWithValidateTrue, ModuleThis } from "../lib/moduleCommon.js"; | ||
export interface RecommendationsBySymbolResponse { | ||
[key: string]: any; | ||
recommendedSymbols: Array<{ | ||
[key: string]: any; | ||
score: number; | ||
symbol: string; | ||
}>; | ||
symbol: string; | ||
} | ||
export type RecommendationsBySymbolResponseArray = RecommendationsBySymbolResponse[]; | ||
export interface RecommendationsBySymbolOptions { | ||
} | ||
declare const RecommendationsBySymbolResponse: import("@sinclair/typebox").TObject<{ | ||
recommendedSymbols: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
symbol: import("@sinclair/typebox").TString; | ||
}>>; | ||
symbol: import("@sinclair/typebox").TString; | ||
}>; | ||
declare const RecommendationsBySymbolResponseArray: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
recommendedSymbols: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
symbol: import("@sinclair/typebox").TString; | ||
}>>; | ||
symbol: import("@sinclair/typebox").TString; | ||
}>>; | ||
declare const RecommendationsBySymbolOptions: import("@sinclair/typebox").TObject<{}>; | ||
type RecommendationsBySymbolResponse = Static<typeof RecommendationsBySymbolResponse>; | ||
type RecommendationsBySymbolOptions = Static<typeof RecommendationsBySymbolOptions>; | ||
type RecommendationsBySymbolResponseArray = Static<typeof RecommendationsBySymbolResponseArray>; | ||
export default function recommendationsBySymbol(this: ModuleThis, query: string, queryOptionsOverrides?: RecommendationsBySymbolOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<RecommendationsBySymbolResponse>; | ||
export default function recommendationsBySymbol(this: ModuleThis, query: string | string[], queryOptionsOverrides?: RecommendationsBySymbolOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<RecommendationsBySymbolResponseArray>; | ||
export default function recommendationsBySymbol(this: ModuleThis, query: string | string[], queryOptionsOverrides?: RecommendationsBySymbolOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
@@ -0,1 +1,16 @@ | ||
import { Type } from "@sinclair/typebox"; | ||
import { YahooNumber } from "../lib/yahooFinanceTypes.js"; | ||
const RecommendationsBySymbolResponse = Type.Object({ | ||
recommendedSymbols: Type.Array(Type.Object({ | ||
score: YahooNumber, // 0.1927 | ||
symbol: Type.String(), // "BMW.DE" | ||
}, { | ||
additionalProperties: Type.Any(), | ||
})), | ||
symbol: Type.String(), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}); | ||
const RecommendationsBySymbolResponseArray = Type.Array(RecommendationsBySymbolResponse); | ||
const RecommendationsBySymbolOptions = Type.Object({}); | ||
const queryOptionsDefaults = {}; | ||
@@ -9,3 +24,3 @@ export default function recommendationsBySymbol(query, queryOptionsOverrides, moduleOptions) { | ||
symbols, | ||
schemaKey: "#/definitions/RecommendationsBySymbolOptions", | ||
schema: RecommendationsBySymbolOptions, | ||
defaults: queryOptionsDefaults, | ||
@@ -15,3 +30,3 @@ overrides: queryOptionsOverrides, | ||
result: { | ||
schemaKey: "#/definitions/RecommendationsBySymbolResponseArray", | ||
schema: RecommendationsBySymbolResponseArray, | ||
transformWith(result) { | ||
@@ -18,0 +33,0 @@ if (!result.finance) |
@@ -0,141 +1,307 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export interface ScreenerResult { | ||
id: string; | ||
title: string; | ||
description: string; | ||
canonicalName: string; | ||
criteriaMeta: ScreenerCriteriaMeta; | ||
rawCriteria: string; | ||
start: number; | ||
count: number; | ||
total: number; | ||
quotes: ScreenerQuote[]; | ||
useRecords: boolean; | ||
predefinedScr: boolean; | ||
versionId: number; | ||
creationDate: number; | ||
lastUpdated: number; | ||
isPremium: boolean; | ||
iconUrl: string; | ||
} | ||
export interface ScreenerCriteriaMeta { | ||
size: number; | ||
offset: number; | ||
sortField: string; | ||
sortType: string; | ||
quoteType: string; | ||
criteria: ScreenerCriterum[]; | ||
topOperator: string; | ||
} | ||
export interface ScreenerCriterum { | ||
field: string; | ||
operators: string[]; | ||
values: number[]; | ||
labelsSelected: number[]; | ||
dependentValues: any[]; | ||
} | ||
export interface ScreenerQuote { | ||
language: string; | ||
region: string; | ||
quoteType: string; | ||
typeDisp: string; | ||
quoteSourceName: string; | ||
triggerable: boolean; | ||
customPriceAlertConfidence: string; | ||
lastCloseTevEbitLtm?: number; | ||
lastClosePriceToNNWCPerShare?: number; | ||
firstTradeDateMilliseconds: number; | ||
priceHint: number; | ||
postMarketChangePercent?: number; | ||
postMarketTime?: number; | ||
postMarketPrice?: number; | ||
postMarketChange?: number; | ||
regularMarketChange: number; | ||
regularMarketTime: number; | ||
regularMarketPrice: number; | ||
regularMarketDayHigh?: number; | ||
regularMarketDayRange?: string; | ||
currency: string; | ||
regularMarketDayLow?: number; | ||
regularMarketVolume?: number; | ||
regularMarketPreviousClose: number; | ||
bid?: number; | ||
ask?: number; | ||
bidSize?: number; | ||
askSize?: number; | ||
market: string; | ||
messageBoardId: string; | ||
fullExchangeName: string; | ||
longName: string; | ||
financialCurrency?: string; | ||
regularMarketOpen?: number; | ||
averageDailyVolume3Month: number; | ||
averageDailyVolume10Day: number; | ||
fiftyTwoWeekLowChange: number; | ||
fiftyTwoWeekLowChangePercent: number; | ||
fiftyTwoWeekRange: string; | ||
fiftyTwoWeekHighChange: number; | ||
fiftyTwoWeekHighChangePercent: number; | ||
fiftyTwoWeekChangePercent: number; | ||
earningsTimestamp?: number; | ||
earningsTimestampStart?: number; | ||
earningsTimestampEnd?: number; | ||
trailingAnnualDividendRate?: number; | ||
trailingAnnualDividendYield?: number; | ||
marketState: string; | ||
epsTrailingTwelveMonths?: number; | ||
epsForward?: number; | ||
epsCurrentYear?: number; | ||
priceEpsCurrentYear?: number; | ||
sharesOutstanding?: number; | ||
bookValue?: number; | ||
fiftyDayAverage: number; | ||
fiftyDayAverageChange: number; | ||
fiftyDayAverageChangePercent: number; | ||
twoHundredDayAverage: number; | ||
twoHundredDayAverageChange: number; | ||
twoHundredDayAverageChangePercent: number; | ||
marketCap?: number; | ||
forwardPE?: number; | ||
priceToBook?: number; | ||
sourceInterval: number; | ||
exchangeDataDelayedBy: number; | ||
exchangeTimezoneName: string; | ||
exchangeTimezoneShortName: string; | ||
gmtOffSetMilliseconds: number; | ||
esgPopulated: boolean; | ||
tradeable: boolean; | ||
cryptoTradeable: boolean; | ||
exchange: string; | ||
fiftyTwoWeekLow: number; | ||
fiftyTwoWeekHigh: number; | ||
shortName: string; | ||
averageAnalystRating?: string; | ||
regularMarketChangePercent: number; | ||
symbol: string; | ||
dividendDate?: number; | ||
displayName?: string; | ||
trailingPE?: number; | ||
prevName?: string; | ||
nameChangeDate?: number; | ||
ipoExpectedDate?: number; | ||
dividendYield?: number; | ||
dividendRate?: number; | ||
yieldTTM?: number; | ||
peTTM?: number; | ||
annualReturnNavY3?: number; | ||
annualReturnNavY5?: number; | ||
ytdReturn?: number; | ||
trailingThreeMonthReturns?: number; | ||
netAssets?: number; | ||
netExpenseRatio?: number; | ||
} | ||
export type PredefinedScreenerModules = "aggressive_small_caps" | "conservative_foreign_funds" | "day_gainers" | "day_losers" | "growth_technology_stocks" | "high_yield_bond" | "most_actives" | "most_shorted_stocks" | "portfolio_anchors" | "small_cap_gainers" | "solid_large_growth_funds" | "solid_midcap_growth_funds" | "top_mutual_funds" | "undervalued_growth_stocks" | "undervalued_large_caps"; | ||
export interface ScreenerOptions { | ||
lang?: string; | ||
region?: string; | ||
scrIds: PredefinedScreenerModules; | ||
count?: number; | ||
} | ||
declare const ScreenerResult: import("@sinclair/typebox").TObject<{ | ||
id: import("@sinclair/typebox").TString; | ||
title: import("@sinclair/typebox").TString; | ||
description: import("@sinclair/typebox").TString; | ||
canonicalName: import("@sinclair/typebox").TString; | ||
criteriaMeta: import("@sinclair/typebox").TObject<{ | ||
size: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
offset: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sortField: import("@sinclair/typebox").TString; | ||
sortType: import("@sinclair/typebox").TString; | ||
quoteType: import("@sinclair/typebox").TString; | ||
criteria: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
field: import("@sinclair/typebox").TString; | ||
operators: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>; | ||
values: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
labelsSelected: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dependentValues: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>; | ||
}>>; | ||
topOperator: import("@sinclair/typebox").TString; | ||
}>; | ||
rawCriteria: import("@sinclair/typebox").TString; | ||
start: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
count: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
total: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
quotes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
language: import("@sinclair/typebox").TString; | ||
region: import("@sinclair/typebox").TString; | ||
quoteType: import("@sinclair/typebox").TString; | ||
typeDisp: import("@sinclair/typebox").TString; | ||
quoteSourceName: import("@sinclair/typebox").TString; | ||
triggerable: import("@sinclair/typebox").TBoolean; | ||
customPriceAlertConfidence: import("@sinclair/typebox").TString; | ||
lastCloseTevEbitLtm: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
lastClosePriceToNNWCPerShare: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
firstTradeDateMilliseconds: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
priceHint: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
postMarketChangePercent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
postMarketTime: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
postMarketPrice: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
postMarketChange: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
regularMarketChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketTime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketPrice: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
regularMarketDayHigh: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
regularMarketDayRange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
low: import("@sinclair/typebox").TNumber; | ||
high: import("@sinclair/typebox").TNumber; | ||
}>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TRegExp, { | ||
low: number; | ||
high: number; | ||
}>]>; | ||
currency: import("@sinclair/typebox").TString; | ||
regularMarketDayLow: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
regularMarketVolume: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
regularMarketPreviousClose: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
bid: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
ask: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
bidSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
askSize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
market: import("@sinclair/typebox").TString; | ||
messageBoardId: import("@sinclair/typebox").TString; | ||
fullExchangeName: import("@sinclair/typebox").TString; | ||
longName: import("@sinclair/typebox").TString; | ||
financialCurrency: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
regularMarketOpen: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
averageDailyVolume3Month: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
averageDailyVolume10Day: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekLowChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekLowChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekRange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
low: import("@sinclair/typebox").TNumber; | ||
high: import("@sinclair/typebox").TNumber; | ||
}>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TRegExp, { | ||
low: number; | ||
high: number; | ||
}>]>; | ||
fiftyTwoWeekHighChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekHighChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
earningsTimestamp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
earningsTimestampStart: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
earningsTimestampEnd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
trailingAnnualDividendRate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
trailingAnnualDividendYield: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
marketState: import("@sinclair/typebox").TString; | ||
epsTrailingTwelveMonths: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
epsForward: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
epsCurrentYear: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
priceEpsCurrentYear: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sharesOutstanding: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
bookValue: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
fiftyDayAverage: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyDayAverageChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyDayAverageChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
twoHundredDayAverage: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
twoHundredDayAverageChange: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
twoHundredDayAverageChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
marketCap: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
forwardPE: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
priceToBook: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
sourceInterval: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
exchangeDataDelayedBy: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
exchangeTimezoneName: import("@sinclair/typebox").TString; | ||
exchangeTimezoneShortName: import("@sinclair/typebox").TString; | ||
gmtOffSetMilliseconds: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
esgPopulated: import("@sinclair/typebox").TBoolean; | ||
tradeable: import("@sinclair/typebox").TBoolean; | ||
cryptoTradeable: import("@sinclair/typebox").TBoolean; | ||
exchange: import("@sinclair/typebox").TString; | ||
fiftyTwoWeekLow: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
fiftyTwoWeekHigh: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
shortName: import("@sinclair/typebox").TString; | ||
averageAnalystRating: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
regularMarketChangePercent: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
symbol: import("@sinclair/typebox").TString; | ||
dividendDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
displayName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
trailingPE: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
ipoExpectedDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
dividendYield: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
dividendRate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
yieldTTM: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
peTTM: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
annualReturnNavY3: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
annualReturnNavY5: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
ytdReturn: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
trailingThreeMonthReturns: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
netAssets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
netExpenseRatio: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>>; | ||
useRecords: import("@sinclair/typebox").TBoolean; | ||
predefinedScr: import("@sinclair/typebox").TBoolean; | ||
versionId: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
creationDate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
lastUpdated: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
isPremium: import("@sinclair/typebox").TBoolean; | ||
iconUrl: import("@sinclair/typebox").TString; | ||
}>; | ||
type ScreenerResult = Static<typeof ScreenerResult>; | ||
type ScreenerOptions = Static<typeof ScreenerOptions>; | ||
declare const ScreenerOptions: import("@sinclair/typebox").TObject<{ | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
region: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
scrIds: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"aggressive_small_caps">, import("@sinclair/typebox").TLiteral<"conservative_foreign_funds">, import("@sinclair/typebox").TLiteral<"day_gainers">, import("@sinclair/typebox").TLiteral<"day_losers">, import("@sinclair/typebox").TLiteral<"growth_technology_stocks">, import("@sinclair/typebox").TLiteral<"high_yield_bond">, import("@sinclair/typebox").TLiteral<"most_actives">, import("@sinclair/typebox").TLiteral<"most_shorted_stocks">, import("@sinclair/typebox").TLiteral<"portfolio_anchors">, import("@sinclair/typebox").TLiteral<"small_cap_gainers">, import("@sinclair/typebox").TLiteral<"solid_large_growth_funds">, import("@sinclair/typebox").TLiteral<"solid_midcap_growth_funds">, import("@sinclair/typebox").TLiteral<"top_mutual_funds">, import("@sinclair/typebox").TLiteral<"undervalued_growth_stocks">, import("@sinclair/typebox").TLiteral<"undervalued_large_caps">]>; | ||
count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>; | ||
}>; | ||
export default function screener(this: ModuleThis, queryOptionsOverrides?: ScreenerOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<ScreenerResult>; | ||
export default function screener(this: ModuleThis, queryOptionsOverrides?: ScreenerOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
@@ -0,1 +1,161 @@ | ||
import { Type } from "@sinclair/typebox"; | ||
import { YahooFinanceDate, YahooNumber, YahooTwoNumberRange, } from "../lib/yahooFinanceTypes.js"; | ||
const ScreenerCriterum = Type.Object({ | ||
field: Type.String(), | ||
operators: Type.Array(Type.String()), | ||
values: Type.Array(YahooNumber), | ||
labelsSelected: Type.Array(YahooNumber), | ||
dependentValues: Type.Array(Type.Any()), | ||
}, { | ||
title: "ScreenerCriterum", | ||
}); | ||
const ScreenerCriteriaMeta = Type.Object({ | ||
size: YahooNumber, | ||
offset: YahooNumber, | ||
sortField: Type.String(), | ||
sortType: Type.String(), | ||
quoteType: Type.String(), | ||
criteria: Type.Array(ScreenerCriterum), | ||
topOperator: Type.String(), | ||
}, { | ||
title: "ScreenerCriteriaMeta", | ||
}); | ||
const ScreenerQuote = Type.Object({ | ||
language: Type.String(), | ||
region: Type.String(), | ||
quoteType: Type.String(), | ||
typeDisp: Type.String(), | ||
quoteSourceName: Type.String(), | ||
triggerable: Type.Boolean(), | ||
customPriceAlertConfidence: Type.String(), | ||
lastCloseTevEbitLtm: Type.Optional(YahooNumber), | ||
lastClosePriceToNNWCPerShare: Type.Optional(YahooNumber), | ||
firstTradeDateMilliseconds: YahooNumber, | ||
priceHint: YahooNumber, | ||
postMarketChangePercent: Type.Optional(YahooNumber), | ||
postMarketTime: Type.Optional(YahooNumber), | ||
postMarketPrice: Type.Optional(YahooNumber), | ||
postMarketChange: Type.Optional(YahooNumber), | ||
regularMarketChange: YahooNumber, | ||
regularMarketTime: YahooNumber, | ||
regularMarketPrice: YahooNumber, | ||
regularMarketDayHigh: Type.Optional(YahooNumber), | ||
regularMarketDayRange: YahooTwoNumberRange, | ||
currency: Type.String(), | ||
regularMarketDayLow: Type.Optional(YahooNumber), | ||
regularMarketVolume: Type.Optional(YahooNumber), | ||
regularMarketPreviousClose: YahooNumber, | ||
bid: Type.Optional(YahooNumber), | ||
ask: Type.Optional(YahooNumber), | ||
bidSize: Type.Optional(YahooNumber), | ||
askSize: Type.Optional(YahooNumber), | ||
market: Type.String(), | ||
messageBoardId: Type.String(), | ||
fullExchangeName: Type.String(), | ||
longName: Type.String(), | ||
financialCurrency: Type.Optional(Type.String()), | ||
regularMarketOpen: Type.Optional(YahooNumber), | ||
averageDailyVolume3Month: YahooNumber, | ||
averageDailyVolume10Day: YahooNumber, | ||
fiftyTwoWeekLowChange: YahooNumber, | ||
fiftyTwoWeekLowChangePercent: YahooNumber, | ||
fiftyTwoWeekRange: YahooTwoNumberRange, | ||
fiftyTwoWeekHighChange: YahooNumber, | ||
fiftyTwoWeekHighChangePercent: YahooNumber, | ||
fiftyTwoWeekChangePercent: YahooNumber, | ||
earningsTimestamp: Type.Optional(YahooNumber), | ||
earningsTimestampStart: Type.Optional(YahooNumber), | ||
earningsTimestampEnd: Type.Optional(YahooNumber), | ||
trailingAnnualDividendRate: Type.Optional(YahooNumber), | ||
trailingAnnualDividendYield: Type.Optional(YahooNumber), | ||
marketState: Type.String(), | ||
epsTrailingTwelveMonths: Type.Optional(YahooNumber), | ||
epsForward: Type.Optional(YahooNumber), | ||
epsCurrentYear: Type.Optional(YahooNumber), | ||
priceEpsCurrentYear: Type.Optional(YahooNumber), | ||
sharesOutstanding: Type.Optional(YahooNumber), | ||
bookValue: Type.Optional(YahooNumber), | ||
fiftyDayAverage: YahooNumber, | ||
fiftyDayAverageChange: YahooNumber, | ||
fiftyDayAverageChangePercent: YahooNumber, | ||
twoHundredDayAverage: YahooNumber, | ||
twoHundredDayAverageChange: YahooNumber, | ||
twoHundredDayAverageChangePercent: YahooNumber, | ||
marketCap: Type.Optional(YahooNumber), | ||
forwardPE: Type.Optional(YahooNumber), | ||
priceToBook: Type.Optional(YahooNumber), | ||
sourceInterval: YahooNumber, | ||
exchangeDataDelayedBy: YahooNumber, | ||
exchangeTimezoneName: Type.String(), | ||
exchangeTimezoneShortName: Type.String(), | ||
gmtOffSetMilliseconds: YahooNumber, | ||
esgPopulated: Type.Boolean(), | ||
tradeable: Type.Boolean(), | ||
cryptoTradeable: Type.Boolean(), | ||
exchange: Type.String(), | ||
fiftyTwoWeekLow: YahooNumber, | ||
fiftyTwoWeekHigh: YahooNumber, | ||
shortName: Type.String(), | ||
averageAnalystRating: Type.Optional(Type.String()), | ||
regularMarketChangePercent: YahooNumber, | ||
symbol: Type.String(), | ||
dividendDate: Type.Optional(YahooFinanceDate), | ||
displayName: Type.Optional(Type.String()), | ||
trailingPE: Type.Optional(YahooNumber), | ||
prevName: Type.Optional(Type.String()), | ||
nameChangeDate: Type.Optional(YahooFinanceDate), | ||
ipoExpectedDate: Type.Optional(YahooFinanceDate), | ||
dividendYield: Type.Optional(YahooNumber), | ||
dividendRate: Type.Optional(YahooNumber), | ||
yieldTTM: Type.Optional(YahooNumber), | ||
peTTM: Type.Optional(YahooNumber), | ||
annualReturnNavY3: Type.Optional(YahooNumber), | ||
annualReturnNavY5: Type.Optional(YahooNumber), | ||
ytdReturn: Type.Optional(YahooNumber), | ||
trailingThreeMonthReturns: Type.Optional(YahooNumber), | ||
netAssets: Type.Optional(YahooNumber), | ||
netExpenseRatio: Type.Optional(YahooNumber), | ||
}, { | ||
title: "ScreenerQuote", | ||
}); | ||
const ScreenerResult = Type.Object({ | ||
id: Type.String(), | ||
title: Type.String(), | ||
description: Type.String(), | ||
canonicalName: Type.String(), | ||
criteriaMeta: ScreenerCriteriaMeta, | ||
rawCriteria: Type.String(), | ||
start: YahooNumber, | ||
count: YahooNumber, | ||
total: YahooNumber, | ||
quotes: Type.Array(ScreenerQuote), | ||
useRecords: Type.Boolean(), | ||
predefinedScr: Type.Boolean(), | ||
versionId: YahooNumber, | ||
creationDate: YahooFinanceDate, | ||
lastUpdated: YahooFinanceDate, | ||
isPremium: Type.Boolean(), | ||
iconUrl: Type.String(), | ||
}, { | ||
title: "ScreenerResult", | ||
}); | ||
const PredefinedScreenerModules = Type.Union([ | ||
Type.Literal("aggressive_small_caps"), | ||
Type.Literal("conservative_foreign_funds"), | ||
Type.Literal("day_gainers"), | ||
Type.Literal("day_losers"), | ||
Type.Literal("growth_technology_stocks"), | ||
Type.Literal("high_yield_bond"), | ||
Type.Literal("most_actives"), | ||
Type.Literal("most_shorted_stocks"), | ||
Type.Literal("portfolio_anchors"), | ||
Type.Literal("small_cap_gainers"), | ||
Type.Literal("solid_large_growth_funds"), | ||
Type.Literal("solid_midcap_growth_funds"), | ||
Type.Literal("top_mutual_funds"), | ||
Type.Literal("undervalued_growth_stocks"), | ||
Type.Literal("undervalued_large_caps"), | ||
], { | ||
title: "ScreenerPredefinedScreenerModules", | ||
}); | ||
const queryOptionsDefaults = { | ||
@@ -7,2 +167,8 @@ lang: "en-US", | ||
}; | ||
const ScreenerOptions = Type.Object({ | ||
lang: Type.Optional(Type.String()), | ||
region: Type.Optional(Type.String()), | ||
scrIds: PredefinedScreenerModules, | ||
count: Type.Optional(Type.Number()), | ||
}); | ||
export default function screener(queryOptionsOverrides, moduleOptions) { | ||
@@ -13,3 +179,3 @@ return this._moduleExec({ | ||
url: "https://${YF_QUERY_HOST}/v1/finance/screener/predefined/saved", | ||
schemaKey: "#/definitions/ScreenerOptions", | ||
schema: ScreenerOptions, | ||
defaults: queryOptionsDefaults, | ||
@@ -20,3 +186,3 @@ overrides: queryOptionsOverrides, | ||
result: { | ||
schemaKey: "#/definitions/ScreenerResult", | ||
schema: ScreenerResult, | ||
transformWith(result) { | ||
@@ -32,16 +198,1 @@ // console.log(result); | ||
} | ||
// aggressive_small_caps | ||
// conservative_foreign_funds | ||
// day_gainers | ||
// day_losers | ||
// growth_technology_stocks | ||
// high_yield_bond | ||
// most_actives | ||
// most_shorted_stocks | ||
// portfolio_anchors | ||
// small_cap_gainers | ||
// solid_large_growth_funds | ||
// solid_midcap_growth_funds | ||
// top_mutual_funds | ||
// undervalued_growth_stocks | ||
// undervalued_large_caps |
@@ -0,113 +1,278 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export interface SearchQuoteYahoo { | ||
[key: string]: any; | ||
symbol: string; | ||
isYahooFinance: true; | ||
exchange: string; | ||
exchDisp?: string; | ||
shortname?: string; | ||
longname?: string; | ||
index: "quotes"; | ||
score: number; | ||
newListingDate?: Date; | ||
prevName?: string; | ||
nameChangeDate?: Date; | ||
sector?: string; | ||
industry?: string; | ||
dispSecIndFlag?: boolean; | ||
} | ||
export interface SearchQuoteYahooEquity extends SearchQuoteYahoo { | ||
quoteType: "EQUITY"; | ||
typeDisp: "Equity"; | ||
} | ||
export interface SearchQuoteYahooOption extends SearchQuoteYahoo { | ||
quoteType: "OPTION"; | ||
typeDisp: "Option"; | ||
} | ||
export interface SearchQuoteYahooETF extends SearchQuoteYahoo { | ||
quoteType: "ETF"; | ||
typeDisp: "ETF"; | ||
} | ||
export interface SearchQuoteYahooFund extends SearchQuoteYahoo { | ||
quoteType: "MUTUALFUND"; | ||
typeDisp: "Fund"; | ||
} | ||
export interface SearchQuoteYahooIndex extends SearchQuoteYahoo { | ||
quoteType: "INDEX"; | ||
typeDisp: "Index"; | ||
} | ||
export interface SearchQuoteYahooCurrency extends SearchQuoteYahoo { | ||
quoteType: "CURRENCY"; | ||
typeDisp: "Currency"; | ||
} | ||
export interface SearchQuoteYahooCryptocurrency extends SearchQuoteYahoo { | ||
quoteType: "CRYPTOCURRENCY"; | ||
typeDisp: "Cryptocurrency"; | ||
} | ||
export interface SearchQuoteYahooFuture extends SearchQuoteYahoo { | ||
quoteType: "FUTURE"; | ||
typeDisp: "Future" | "Futures"; | ||
} | ||
export interface SearchQuoteNonYahoo { | ||
[key: string]: any; | ||
index: string; | ||
name: string; | ||
permalink: string; | ||
isYahooFinance: false; | ||
} | ||
export interface SearchNews { | ||
[key: string]: any; | ||
uuid: string; | ||
title: string; | ||
publisher: string; | ||
link: string; | ||
providerPublishTime: Date; | ||
type: string; | ||
thumbnail?: { | ||
resolutions: SearchNewsThumbnailResolution[]; | ||
}; | ||
relatedTickers?: string[]; | ||
} | ||
export interface SearchNewsThumbnailResolution { | ||
url: string; | ||
width: number; | ||
height: number; | ||
tag: string; | ||
} | ||
export interface SearchResult { | ||
[key: string]: any; | ||
explains: Array<any>; | ||
count: number; | ||
quotes: Array<SearchQuoteYahooEquity | SearchQuoteYahooOption | SearchQuoteYahooETF | SearchQuoteYahooFund | SearchQuoteYahooIndex | SearchQuoteYahooCurrency | SearchQuoteYahooCryptocurrency | SearchQuoteNonYahoo | SearchQuoteYahooFuture>; | ||
news: Array<SearchNews>; | ||
nav: Array<any>; | ||
lists: Array<any>; | ||
researchReports: Array<any>; | ||
totalTime: number; | ||
screenerFieldResults?: Array<any>; | ||
culturalAssets?: Array<any>; | ||
timeTakenForQuotes: number; | ||
timeTakenForNews: number; | ||
timeTakenForAlgowatchlist: number; | ||
timeTakenForPredefinedScreener: number; | ||
timeTakenForCrunchbase: number; | ||
timeTakenForNav: number; | ||
timeTakenForResearchReports: number; | ||
timeTakenForScreenerField?: number; | ||
timeTakenForCulturalAssets?: number; | ||
} | ||
export interface SearchOptions { | ||
lang?: string; | ||
region?: string; | ||
quotesCount?: number; | ||
newsCount?: number; | ||
enableFuzzyQuery?: boolean; | ||
quotesQueryId?: string; | ||
multiQuoteQueryId?: string; | ||
newsQueryId?: string; | ||
enableCb?: boolean; | ||
enableNavLinks?: boolean; | ||
enableEnhancedTrivialQuery?: boolean; | ||
} | ||
type SearchResult = Static<typeof SearchResultSchema>; | ||
declare const SearchResultSchema: import("@sinclair/typebox").TObject<{ | ||
explains: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>; | ||
count: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
quotes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"EQUITY">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"Equity">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"OPTION">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"Option">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"ETF">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"ETF">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"MUTUALFUND">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"Fund">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"INDEX">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"Index">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"CURRENCY">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"Currency">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"CRYPTOCURRENCY">; | ||
typeDisp: import("@sinclair/typebox").TLiteral<"Cryptocurrency">; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
index: import("@sinclair/typebox").TString; | ||
name: import("@sinclair/typebox").TString; | ||
permalink: import("@sinclair/typebox").TString; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<false>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
exchange: import("@sinclair/typebox").TString; | ||
newListingDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
nameChangeDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>>; | ||
prevName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
score: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
sector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
industry: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
isYahooFinance: import("@sinclair/typebox").TLiteral<true>; | ||
exchDisp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
shortname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
longname: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
index: import("@sinclair/typebox").TLiteral<"quotes">; | ||
dispSecIndFlag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quoteType: import("@sinclair/typebox").TLiteral<"FUTURE">; | ||
typeDisp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"Future">, import("@sinclair/typebox").TLiteral<"Futures">]>; | ||
}>]>>; | ||
news: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
uuid: import("@sinclair/typebox").TString; | ||
title: import("@sinclair/typebox").TString; | ||
publisher: import("@sinclair/typebox").TString; | ||
link: import("@sinclair/typebox").TString; | ||
providerPublishTime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TNumber, Date>; | ||
}>, Date>, import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TString, import("@sinclair/typebox").TString]>, Date>]>; | ||
type: import("@sinclair/typebox").TString; | ||
thumbnail: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
resolutions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
url: import("@sinclair/typebox").TString; | ||
width: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
height: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
tag: import("@sinclair/typebox").TString; | ||
}>>; | ||
}>>; | ||
relatedTickers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>; | ||
}>>; | ||
nav: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>; | ||
lists: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>; | ||
researchReports: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>; | ||
totalTime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
screenerFieldResults: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>>; | ||
culturalAssets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>>; | ||
timeTakenForQuotes: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForNews: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForAlgowatchlist: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForPredefinedScreener: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForCrunchbase: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForNav: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForResearchReports: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
timeTakenForScreenerField: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
timeTakenForCulturalAssets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>; | ||
declare const SearchOptionsSchema: import("@sinclair/typebox").TObject<{ | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
region: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
quotesCount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
newsCount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
enableFuzzyQuery: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
quotesQueryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
multiQuoteQueryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
newsQueryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
enableCb: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
enableNavLinks: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
enableEnhancedTrivialQuery: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>; | ||
}>; | ||
type SearchOptions = Static<typeof SearchOptionsSchema>; | ||
export default function search(this: ModuleThis, query: string, queryOptionsOverrides?: SearchOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<SearchResult>; | ||
export default function search(this: ModuleThis, query: string, queryOptionsOverrides?: SearchOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
@@ -0,1 +1,185 @@ | ||
import { Type } from "@sinclair/typebox"; | ||
import { YahooFinanceDate, YahooNumber } from "../lib/yahooFinanceTypes.js"; | ||
const SearchQuoteYahoo = Type.Object({ | ||
symbol: Type.String(), // "BABA" | ||
isYahooFinance: Type.Literal(true), // true | ||
exchange: Type.String(), // "NYQ" | ||
exchDisp: Type.Optional(Type.String()), // "London", e.g. with BJ0CDD2 | ||
shortname: Type.Optional(Type.String()), // "Alibaba Group Holding Limited" | ||
longname: Type.Optional(Type.String()), // "Alibaba Group Holding Limited" | ||
index: Type.Literal("quotes"), // "quotes" | ||
score: YahooNumber, // 1111958.0 | ||
newListingDate: Type.Optional(YahooFinanceDate), // "2021-02-16" | ||
prevName: Type.Optional(Type.String()), | ||
nameChangeDate: Type.Optional(YahooFinanceDate), | ||
sector: Type.Optional(Type.String()), // "Industrials" | ||
industry: Type.Optional(Type.String()), // "Building Products & Equipment" | ||
dispSecIndFlag: Type.Optional(Type.Boolean()), // true | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}); | ||
const SearchQuoteYahooEquity = Type.Composite([ | ||
SearchQuoteYahoo, | ||
Type.Object({ | ||
quoteType: Type.Literal("EQUITY"), | ||
typeDisp: Type.Literal("Equity"), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooEntity", | ||
}); | ||
const SearchQuoteYahooOption = Type.Composite([ | ||
SearchQuoteYahoo, | ||
Type.Object({ | ||
quoteType: Type.Literal("OPTION"), | ||
typeDisp: Type.Literal("Option"), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooOption", | ||
}); | ||
const SearchQuoteYahooETF = Type.Composite([ | ||
SearchQuoteYahoo, | ||
Type.Object({ | ||
quoteType: Type.Literal("ETF"), | ||
typeDisp: Type.Literal("ETF"), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooETF", | ||
}); | ||
const SearchQuoteYahooFund = Type.Composite([ | ||
SearchQuoteYahoo, | ||
Type.Object({ | ||
quoteType: Type.Literal("MUTUALFUND"), | ||
typeDisp: Type.Literal("Fund"), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooFund", | ||
}); | ||
const SearchQuoteYahooIndex = Type.Composite([ | ||
SearchQuoteYahoo, | ||
Type.Object({ | ||
quoteType: Type.Literal("INDEX"), | ||
typeDisp: Type.Literal("Index"), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooIndex", | ||
}); | ||
const SearchQuoteYahooCurrency = Type.Composite([ | ||
SearchQuoteYahoo, | ||
Type.Object({ | ||
quoteType: Type.Literal("CURRENCY"), | ||
typeDisp: Type.Literal("Currency"), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooCurrency", | ||
}); | ||
const SearchQuoteYahooCryptocurrency = Type.Composite([ | ||
SearchQuoteYahoo, | ||
Type.Object({ | ||
quoteType: Type.Literal("CRYPTOCURRENCY"), | ||
typeDisp: Type.Literal("Cryptocurrency"), | ||
}), | ||
]); | ||
const SearchQuoteYahooFuture = Type.Composite([ | ||
SearchQuoteYahoo, | ||
Type.Object({ | ||
quoteType: Type.Literal("FUTURE"), | ||
typeDisp: Type.Union([Type.Literal("Future"), Type.Literal("Futures")]), | ||
}), | ||
], { | ||
title: "SearchQuoteYahooFuture", | ||
}); | ||
const SearchQuoteNonYahoo = Type.Object({ | ||
index: Type.String(), // '78ddc07626ff4bbcae663e88514c23a0' | ||
name: Type.String(), // 'AAPlasma' | ||
permalink: Type.String(), // 'aaplasma' | ||
isYahooFinance: Type.Literal(false), // false | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "SearchQuoteNonYahoo", | ||
}); | ||
const SearchNewsThumbnailResolution = Type.Object({ | ||
url: Type.String(), | ||
width: YahooNumber, | ||
height: YahooNumber, | ||
tag: Type.String(), | ||
}, { | ||
title: "SearchNewsThumbnailResolution", | ||
}); | ||
const SearchNews = Type.Object({ | ||
uuid: Type.String(), // "9aff624a-e84c-35f3-9c23-db39852006dc" | ||
title: Type.String(), // "Analyst Report: Alibaba Group Holding Limited" | ||
publisher: Type.String(), // "Morningstar Research" | ||
link: Type.String(), // "https://finance.yahoo.com/m/9aff624a-e84c-35f3-9c23-db39852006dc/analyst-report%3A-alibaba-group.html" | ||
providerPublishTime: YahooFinanceDate, // coerced to New Date(1611285342 * 1000) | ||
type: Type.String(), // "STORY" TODO "STORY" | ??? | ||
thumbnail: Type.Optional(Type.Object({ | ||
resolutions: Type.Array(SearchNewsThumbnailResolution), | ||
})), | ||
relatedTickers: Type.Optional(Type.Array(Type.String())), // [ "AAPL" ] | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "SearchNews", | ||
}); | ||
const SearchResultSchema = Type.Object({ | ||
explains: Type.Array(Type.Any()), | ||
count: YahooNumber, | ||
quotes: Type.Array(Type.Union([ | ||
SearchQuoteYahooEquity, | ||
SearchQuoteYahooOption, | ||
SearchQuoteYahooETF, | ||
SearchQuoteYahooFund, | ||
SearchQuoteYahooIndex, | ||
SearchQuoteYahooCurrency, | ||
SearchQuoteYahooCryptocurrency, | ||
SearchQuoteNonYahoo, | ||
SearchQuoteYahooFuture, | ||
])), | ||
news: Type.Array(SearchNews), | ||
nav: Type.Array(Type.Any()), | ||
lists: Type.Array(Type.Any()), | ||
researchReports: Type.Array(Type.Any()), | ||
totalTime: YahooNumber, | ||
// ALWAYS present, but TEMPORARILY marked optional ("?") since its | ||
// sudden appearance, let's make sure it doesn't get suddenly removed. | ||
// Array<any> until we can find some examples of what it actually looks | ||
// like (#255). | ||
screenerFieldResults: Type.Optional(Type.Array(Type.Any())), | ||
// ALWAYS present, but TEMPORARILY marked optional ("?") since its | ||
// sudden appearance, let's make sure it doesn't get suddenly removed. | ||
// Array<any> until we can find some examples of what it actually looks | ||
// like (#399). | ||
culturalAssets: Type.Optional(Type.Array(Type.Any())), | ||
timeTakenForQuotes: YahooNumber, // 26 | ||
timeTakenForNews: YahooNumber, // 419 | ||
timeTakenForAlgowatchlist: YahooNumber, // 700 | ||
timeTakenForPredefinedScreener: YahooNumber, // 400 | ||
timeTakenForCrunchbase: YahooNumber, // 400 | ||
timeTakenForNav: YahooNumber, // 400 | ||
timeTakenForResearchReports: YahooNumber, // 0 | ||
// ALWAYS present, but TEMPORARILY marked optional ("?") since its | ||
// sudden appearance, let's make sure it doesn't get suddenly removed. | ||
timeTakenForScreenerField: Type.Optional(YahooNumber), | ||
// ALWAYS present, but TEMPORARILY marked optional ("?") since its | ||
// sudden appearance, let's make sure it doesn't get suddenly removed. | ||
timeTakenForCulturalAssets: Type.Optional(YahooNumber), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "SearchResults", | ||
}); | ||
const SearchOptionsSchema = Type.Object({ | ||
lang: Type.Optional(Type.String()), | ||
region: Type.Optional(Type.String()), | ||
quotesCount: Type.Optional(YahooNumber), | ||
newsCount: Type.Optional(YahooNumber), | ||
enableFuzzyQuery: Type.Optional(Type.Boolean()), | ||
quotesQueryId: Type.Optional(Type.String()), | ||
multiQuoteQueryId: Type.Optional(Type.String()), | ||
newsQueryId: Type.Optional(Type.String()), | ||
enableCb: Type.Optional(Type.Boolean()), | ||
enableNavLinks: Type.Optional(Type.Boolean()), | ||
enableEnhancedTrivialQuery: Type.Optional(Type.Boolean()), | ||
}, { | ||
title: "SearchOptions", | ||
additionalProperties: false, | ||
}); | ||
const queryOptionsDefaults = { | ||
@@ -16,12 +200,13 @@ lang: "en-US", | ||
return this._moduleExec({ | ||
moduleName: "search", | ||
moduleName: "searchTypebox", | ||
query: { | ||
url: "https://${YF_QUERY_HOST}/v1/finance/search", | ||
schemaKey: "#/definitions/SearchOptions", | ||
schema: SearchOptionsSchema, | ||
defaults: queryOptionsDefaults, | ||
runtime: { q: query }, | ||
overrides: queryOptionsOverrides, | ||
needsCrumb: false, | ||
}, | ||
result: { | ||
schemaKey: "#/definitions/SearchResult", | ||
schema: SearchResultSchema, | ||
}, | ||
@@ -28,0 +213,0 @@ moduleOptions, |
@@ -0,19 +1,28 @@ | ||
import { Static } from "@sinclair/typebox"; | ||
import type { ModuleOptionsWithValidateTrue, ModuleOptionsWithValidateFalse, ModuleThis } from "../lib/moduleCommon.js"; | ||
export interface TrendingSymbol { | ||
[key: string]: any; | ||
symbol: string; | ||
} | ||
export interface TrendingSymbolsResult { | ||
[key: string]: any; | ||
count: number; | ||
quotes: TrendingSymbol[]; | ||
jobTimestamp: number; | ||
startInterval: number; | ||
} | ||
export interface TrendingSymbolsOptions { | ||
lang?: string; | ||
region?: string; | ||
count?: number; | ||
} | ||
declare const TrendingSymbolsResult: import("@sinclair/typebox").TObject<{ | ||
count: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
quotes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{ | ||
symbol: import("@sinclair/typebox").TString; | ||
}>>; | ||
jobTimestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
startInterval: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>; | ||
}>; | ||
declare const TrendingSymbolsOptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{ | ||
lang: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
region: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>; | ||
count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TObject<{ | ||
raw: import("@sinclair/typebox").TNumber; | ||
}>, number>, import("@sinclair/typebox").TNumber]>>; | ||
}>>; | ||
type TrendingSymbolsResult = Static<typeof TrendingSymbolsResult>; | ||
type TrendingSymbolsOptions = Static<typeof TrendingSymbolsOptions>; | ||
export default function trendingSymbols(this: ModuleThis, query: string, queryOptionsOverrides?: TrendingSymbolsOptions, moduleOptions?: ModuleOptionsWithValidateTrue): Promise<TrendingSymbolsResult>; | ||
export default function trendingSymbols(this: ModuleThis, query: string, queryOptionsOverrides?: TrendingSymbolsOptions, moduleOptions?: ModuleOptionsWithValidateFalse): Promise<any>; | ||
export {}; |
@@ -0,1 +1,24 @@ | ||
import { Type } from "@sinclair/typebox"; | ||
import { YahooNumber } from "../lib/yahooFinanceTypes.js"; | ||
const TrendingSymbol = Type.Object({ | ||
symbol: Type.String(), | ||
}, { | ||
additionalProperties: Type.Any(), | ||
}); | ||
const TrendingSymbolsResult = Type.Object({ | ||
count: YahooNumber, | ||
quotes: Type.Array(TrendingSymbol), | ||
jobTimestamp: YahooNumber, | ||
startInterval: YahooNumber, | ||
}, { | ||
additionalProperties: Type.Any(), | ||
title: "TrendingSymbolsResult", | ||
}); | ||
const TrendingSymbolsOptions = Type.Optional(Type.Object({ | ||
lang: Type.Optional(Type.String()), | ||
region: Type.Optional(Type.String()), | ||
count: Type.Optional(YahooNumber), | ||
}, { | ||
title: "TrendingSymbolsOptions", | ||
})); | ||
const queryOptionsDefaults = { | ||
@@ -10,3 +33,3 @@ lang: "en-US", | ||
url: "https://${YF_QUERY_HOST}/v1/finance/trending/" + query, | ||
schemaKey: "#/definitions/TrendingSymbolsOptions", | ||
schema: TrendingSymbolsOptions, | ||
defaults: queryOptionsDefaults, | ||
@@ -16,3 +39,3 @@ overrides: queryOptionsOverrides, | ||
result: { | ||
schemaKey: "#/definitions/TrendingSymbolsResult", | ||
schema: TrendingSymbolsResult, | ||
transformWith(result) { | ||
@@ -19,0 +42,0 @@ if (!result.finance) |
@@ -1,3 +0,3 @@ | ||
import quote from "../modules/quote.js"; | ||
import validateAndCoerceTypes from "../lib/validateAndCoerceTypes.js"; | ||
import { validateAndCoerceTypebox } from "../lib/validateAndCoerceTypes.js"; | ||
import quote, { QuoteOptionsSchema } from "../modules/quote.js"; | ||
const DEBOUNCE_TIME = 50; | ||
@@ -10,7 +10,6 @@ const slugMap = new Map(); | ||
JSON.stringify(symbol, null, 2)); | ||
validateAndCoerceTypes({ | ||
source: "quoteCombine", | ||
validateAndCoerceTypebox({ | ||
type: "options", | ||
object: queryOptionsOverrides, | ||
schemaKey: "#/definitions/QuoteOptions", | ||
data: queryOptionsOverrides, | ||
schema: QuoteOptionsSchema, | ||
options: this._opts.validation, | ||
@@ -46,4 +45,4 @@ }); | ||
.then((results) => { | ||
for (let result of results) { | ||
for (let promise of entry.symbols.get(result.symbol)) { | ||
for (const result of results) { | ||
for (const promise of entry.symbols.get(result.symbol)) { | ||
promise.resolve(result); | ||
@@ -54,5 +53,5 @@ promise.resolved = true; | ||
// Check for symbols we asked for and didn't get back, | ||
// e.g. non-existant symbols (#150) | ||
for (let [symbol, promises] of entry.symbols) { | ||
for (let promise of promises) { | ||
// e.g. non-existent symbols (#150) | ||
for (const [_, promises] of entry.symbols) { | ||
for (const promise of promises) { | ||
if (!promise.resolved) { | ||
@@ -65,4 +64,4 @@ promise.resolve(undefined); | ||
.catch((error) => { | ||
for (let symbolPromiseCallbacks of entry.symbols.values()) | ||
for (let promise of symbolPromiseCallbacks) | ||
for (const symbolPromiseCallbacks of entry.symbols.values()) | ||
for (const promise of symbolPromiseCallbacks) | ||
promise.reject(error); | ||
@@ -69,0 +68,0 @@ }); |
{ | ||
"name": "yahoo-finance2", | ||
"version": "2.11.3", | ||
"version": "2.12.0", | ||
"description": "JS API for Yahoo Finance", | ||
@@ -32,3 +32,3 @@ "type": "module", | ||
"engines": { | ||
"node": ">=16.0.0" | ||
"node": ">=18.0.0" | ||
}, | ||
@@ -41,11 +41,7 @@ "bin": { | ||
"lint": "eslint . --ext .js,.ts", | ||
"//schema": "ts-json-schema-generator -f tsconfig.json -p 'src/{modules/**/*.ts,lib/options.ts}' -t '*' | node bin/schema-tweak.js > schema.json", | ||
"schema": "node --loader ts-node/esm scripts/schema.js > schema.json", | ||
"timeseries": "node --loader ts-node/esm scripts/timeseries.js", | ||
"build": "yarn run build:esm && yarn run build:cjs && yarn run build:post", | ||
"build:esm": "tsc --module es2020 --target es2019 --outDir dist/esm", | ||
"build": "yarn run build:esm && yarn run build:cjs", | ||
"build:esm": "tsc --module esnext --target es2019 --outDir dist/esm", | ||
"build:cjs": "tsc --module commonjs --target es2015 --outDir dist/cjs && sed 's/\"type\": \"module\",/\"type:\": \"commonjs\",/' dist/cjs/package.json > dist/cjs/package-changed.json && mv dist/cjs/package-changed.json dist/cjs/package.json", | ||
"build:post": "scripts/json-transform.sh", | ||
"generateSchema": "yarn schema", | ||
"prepublishOnly": "yarn build && yarn generateSchema && yarn build:post", | ||
"prepublishOnly": "yarn build", | ||
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js", | ||
@@ -59,9 +55,7 @@ "test:ts": "tsc --noEmit", | ||
"files": [ | ||
"dist", | ||
"schema.json" | ||
"dist" | ||
], | ||
"dependencies": { | ||
"@sinclair/typebox": "^0.32.27", | ||
"@types/tough-cookie": "^4.0.2", | ||
"ajv": "8.10.0", | ||
"ajv-formats": "2.1.1", | ||
"node-fetch": "^2.6.1", | ||
@@ -78,2 +72,5 @@ "tough-cookie": "^4.1.2", | ||
"@semantic-release/release-notes-generator": "10.0.3", | ||
"@swc/core": "^1.7.26", | ||
"@swc/helpers": "^0.5.13", | ||
"@swc/jest": "^0.2.36", | ||
"@tsconfig/node12": "12.1.3", | ||
@@ -86,11 +83,8 @@ "@types/har-format": "^1.2.15", | ||
"eslint": "8.57.0", | ||
"eslint-config-prettier": "8.10.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"globby": "13.2.2", | ||
"jest": "29.7.0", | ||
"jest-tobetype": "1.2.3", | ||
"oas-schema-walker": "1.1.5", | ||
"prettier": "2.8.8", | ||
"prettier": "^3.3.3", | ||
"semantic-release": "19.0.5", | ||
"ts-jest": "29.1.2", | ||
"ts-json-schema-generator": "1.5.0", | ||
"ts-node": "10.9.2", | ||
@@ -97,0 +91,0 @@ "typescript": "5.4.3" |
@@ -9,3 +9,3 @@ # node-yahoo-finance2 | ||
Supports Node 16.10.0 and up (tests are run against 16.10.0), | ||
Supports Node 18.0.0 and up (tests are run against 18.0.0), | ||
e.g. all active LTS versions. | ||
@@ -18,8 +18,7 @@ | ||
[Live Demo on CodeSandbox](https://codesandbox.io/p/sandbox/yf2-node-xzdjrt?file=/index.js) | ||
[Live Demo on CodeSandbox](https://codesandbox.io/p/devbox/yahoo-finance2-nextjs-sy42pv) | ||
(Updated 2024-06-17; NextJS with both RSC and Hook-Relay examples) | ||
## Unofficial API | ||
***Update 2024-04-15*: Yahoo has disabled API-access to quotes data. Please see the discussion and our stance at https://github.com/gadicc/node-yahoo-finance2/issues/764#issuecomment-2056623851.** | ||
This project is neither created nor endorsed by Yahoo Inc. Yahoo does not | ||
@@ -74,3 +73,3 @@ provide any official API to developers, nor makes any guarantees regarding | ||
fundOwnership, fundPerformance, fundProfile, incomeStatementHistory, | ||
incomeStatementHistoryQuarterly, indexTrend, industryTrend, insiderHolders | ||
incomeStatementHistoryQuarterly, indexTrend, industryTrend, insiderHolders, | ||
insiderTransactions, institutionOwnership, majorDirectHolders, | ||
@@ -77,0 +76,0 @@ majorHoldersBreakdown, netSharePurchaseActivity, price, quoteType, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2189245
5
11
164
28063
167
23
+ Added@sinclair/typebox@^0.32.27
+ Added@sinclair/typebox@0.32.35(transitive)
- Removedajv@8.10.0
- Removedajv-formats@2.1.1
- Removedajv@8.10.0(transitive)
- Removedajv-formats@2.1.1(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedjson-schema-traverse@1.0.0(transitive)
- Removedrequire-from-string@2.0.2(transitive)
- Removeduri-js@4.4.1(transitive)