From ee6a75981a55d7e688fef276483a27a52d22c373 Mon Sep 17 00:00:00 2001 From: Gadi Cohen Date: Wed, 3 Feb 2021 09:19:01 +0200 Subject: [PATCH] chore(docs): initial docs [skip ci] --- README.md | 2 +- docs/README.md | 13 + docs/modules/autoc.md | 59 +++++ docs/modules/historical.md | 57 +++++ docs/modules/quoteSummary.md | 478 +++++++++++++++++++++++++++++++++++ docs/modules/search.md | 84 ++++++ 6 files changed, 692 insertions(+), 1 deletion(-) create mode 100644 docs/README.md create mode 100644 docs/modules/autoc.md create mode 100644 docs/modules/historical.md create mode 100644 docs/modules/quoteSummary.md create mode 100644 docs/modules/search.md diff --git a/README.md b/README.md index 2a9f8718..b3687f2b 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ recommendationTrend, secFilings, sectorTrend, summaryDetail, summaryProfile, symbol, topHoldings, upgradeDowngradeHistory), `search`, with more [coming soon](https://github.com/gadicc/node-yahoo-finance2/issues/8). -[Documentation](./docs/docs.md) coming soon. +[Documentation](./docs/README.md) coming soon. ## (Optional) TypeScript Love diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..c3da3bac --- /dev/null +++ b/docs/README.md @@ -0,0 +1,13 @@ +# yahoo-finance docs + +## Table of Contents + +1. [Common Options](#common-options) +1. Modules +1.1. [autoc](./modules/autoc.md) +1.1. [historical](./modules/historical.md) +1.1. [quoteSummary](./modules/quoteSummary.md) +1.1. [search](./modules/search.md) + + +## Common Options diff --git a/docs/modules/autoc.md b/docs/modules/autoc.md new file mode 100644 index 00000000..b801f5f9 --- /dev/null +++ b/docs/modules/autoc.md @@ -0,0 +1,59 @@ +# autoc (auto complete) + +## Usage: + +```js +import yahooFinance from 'yahoo-finance2'; + +const query = 'GOO'; +const result = await yahooFinance.autoc(query, /* queryOptions */); + +{ + Query: 'GOO', + Result: [ + { + symbol: 'GDRX', + name: 'GoodRx Holdings, Inc.', + exch: 'NMS', + type: 'S', + exchDisp: 'NASDAQ', + typeDisp: 'Equity' + }, + { + symbol: 'GOOG', + name: 'Alphabet Inc.', + exch: 'NMS', + type: 'S', + exchDisp: 'NASDAQ', + typeDisp: 'Equity' + }, + { + symbol: 'GOOGL', + name: 'Alphabet Inc.', + exch: 'NAS', + type: 'S', + exchDisp: 'NASDAQ', + typeDisp: 'Equity' + }, + // .... +} +``` + +See also: [search](./search.md). + +## API + +```js +await yahooFinance.autoc(query, queryOptions, fetchOptions); +``` + +### Query term + +Symbol, company name, SEDOL, etc. + +### Query Options + +| Name | Type | Default | Description | +| ------------- | ----------| ---------- | --------------------------------- | +| `region` | number | 1 | | +| `lang` | string | "en" | | diff --git a/docs/modules/historical.md b/docs/modules/historical.md new file mode 100644 index 00000000..eb317aac --- /dev/null +++ b/docs/modules/historical.md @@ -0,0 +1,57 @@ +# historical + +## Usage: + +```js +import yahooFinance from 'yahoo-finance2'; + +const query = 'TSLA'; +const queryOptions = { period1: '2021-02-01', /* ... */ }; +const result = await yahooFinance.search(query, queryOptions); + +[ + { + date: new Date("2021-02-01T00:00:00.000Z"), + open: 814.289978, + high: 842, + low: 795.559998, + close: 839.809998, + adjClose: 839.809998, + volume: 25391400 + }, + { + date: new Date("2021-02-02T00:00:00.000Z"), + open: 844.679993, + high: 880.5, + low: 842.200623, + close: 872.789978, + adjClose: 872.789978, + volume: 24346213 + } +] +``` + +## API + +```js +await yahooFinance.historical(query, queryOptions, fetchOptions); +``` + +### Query term + +Symbol, company name, SEDOL, etc. + +### Query Options + +| Name | Type | Default | Description | +| ------------- | ----------| ---------- | --------------------------------- | +| `period1` | Date* | *required* | Starting period +| `period2` | Date* | (today) | Ending period +| `interval` | "1d", "1wk", "1mo" | "1d" | Interval (day, week, month) +| `events` | string | "history" +| `includeAdjustedClose` | boolean | true + +Dates* can be: + +* A **Date** instance, e.g. `new Date(something)` +* A **string** that can be parsed by `Date()`, e.g. `"2020-01-01"`. diff --git a/docs/modules/quoteSummary.md b/docs/modules/quoteSummary.md new file mode 100644 index 00000000..a2a7ccf6 --- /dev/null +++ b/docs/modules/quoteSummary.md @@ -0,0 +1,478 @@ +# quoteSummary + +## Usage: + +```js +import yahooFinance from 'yahoo-finance2'; + +const symbol = 'OCDO.L'; +const queryOptions = { modules: ['price', 'summaryDetail'] }; // defaults +const result = await yahooFinance.quoteSummary(symbol, queryOptions); + +{ + summaryDetail: { + maxAge: 1, + priceHint: 2, + previousClose: 2828, + open: 2843, + dayLow: 2776, + dayHigh: 2853, + regularMarketPreviousClose: 2828, + regularMarketOpen: 2843, + regularMarketDayLow: 2776, + regularMarketDayHigh: 2853, + payoutRatio: 0, + beta: 0.693054, + volume: 1004034, + regularMarketVolume: 1004034, + averageVolume: 1831257, + averageVolume10days: 2115356, + averageDailyVolume10Day: 2115356, + bid: 2788, + ask: 2790, + bidSize: 0, + askSize: 0, + marketCap: 20966455296, + fiftyTwoWeekLow: 994.012, + fiftyTwoWeekHigh: 2914, + priceToSalesTrailing12Months: 10.691171, + fiftyDayAverage: 2477.3635, + twoHundredDayAverage: 2397.2805, + currency: 'GBp', + fromCurrency: null, + toCurrency: null, + lastMarket: null, + algorithm: null, + tradeable: false + }, + price: { + maxAge: 1, + regularMarketChangePercent: -0.00990099, + regularMarketChange: -28, + regularMarketTime: new Date("2021-02-02T16:35:44.000Z"), + priceHint: 2, + regularMarketPrice: 2800, + regularMarketDayHigh: 2853, + regularMarketDayLow: 2776, + regularMarketVolume: 1004034, + averageDailyVolume10Day: 2115356, + averageDailyVolume3Month: 1831257, + regularMarketPreviousClose: 2828, + regularMarketSource: 'DELAYED', + regularMarketOpen: 2843, + exchange: 'LSE', + exchangeName: 'LSE', + exchangeDataDelayedBy: 20, + marketState: 'PREPRE', + quoteType: 'EQUITY', + symbol: 'OCDO.L', + underlyingSymbol: null, + shortName: 'OCADO GROUP PLC ORD 2P', + longName: 'Ocado Group plc', + currency: 'GBp', + quoteSourceName: 'Delayed Quote', + currencySymbol: '£', + fromCurrency: null, + toCurrency: null, + lastMarket: null, + marketCap: 20966455296 + } +} +``` + +## API + +```js +await yahooFinance.quoteSummary(symbol, queryOptions, fetchOptions); +``` + +### Symbol + +Symbol name as used by Yahoo (often the stock ticker). You can find it +using [autoc](./auto.md) or [search](./search.md). + +### Query Options + +| Name | Type | Default | Description | +| ------------- | ----------| ---------- | --------------------------------- | +| `modules` | `Array` | `["price","summaryDetail"]` | List of modules to query + + +The full list of submodules and their output: + +* [assetProfile](#assetProfile) +* [balanceSheetHistory](#balanceSheetHistory) +* [balanceSheetHistoryQuarterly](#balanceSheetHistoryQuarterly) +* [calendarEvents](#calendarEvents) +* [cashflowStatementHistory](#cashflowStatementHistory) +* [cashflowStatementHistoryQuarterly](#cashflowStatementHistoryQuarterly) +* [defaultKeyStatistics](#defaultKeyStatistics) +* [earnings](#earnings) +* [earningsHistory](#earningsHistory) +* [earningsTrend](#earningsTrend) +* [financialData](#financialData) +* [fundOwnership](#fundOwnership) +* [fundPerformance](#fundPerformance) +* [fundProfile](#fundProfile) +* [incomeStatementHistory](#incomeStatementHistory) +* [incomeStatementHistoryQuarterly](#incomeStatementHistoryQuarterly) +* [indexTrend](#indexTrend) +* [industryTrend](#industryTrend) +* [insiderHolders](#insiderHolders) +* [insiderTransactions](#insiderTransactions) +* [institutionOwnership](#institutionOwnership) +* [majorDirectHolders](#majorDirectHolders) +* [majorHoldersBreakdown](#majorHoldersBreakdown) +* [netSharePurchaseActivity](#netSharePurchaseActivity) +* [price](#price) +* [quoteType](#quoteType) +* [recommendationTrend](#recommendationTrend) +* [secFilings](#secFilings) +* [sectorTrend](#sectorTrend) +* [summaryDetail](#summaryDetail) +* [summaryProfile](#summaryProfile) +* [symbol](#symbol) +* [topHoldings](#topHoldings) +* [upgradeDowngradeHistory](#upgradeDowngradeHistory) + + +### assetProfile + +```js +await yahooFinance.quoteSummary('AAPL', { modules: [ "assetProfile" ] }); + +{ + assetProfile: { + address1: 'One Apple Park Way', + city: 'Cupertino', + state: 'CA', + zip: '95014', + country: 'United States', + phone: '408-996-1010', + website: 'http://www.apple.com', + industry: 'Consumer Electronics', + sector: 'Technology', + longBusinessSummary: 'Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables, and accessories worldwide. It also sells various related services. The company offers iPhone, a line of smartphones; Mac, a line of personal computers; iPad, a line of multi-purpose tablets; and wearables, home, and accessories comprising AirPods, Apple TV, Apple Watch, Beats products, HomePod, iPod touch, and other Apple-branded and third-party accessories. It also provides AppleCare support services; cloud services store services; and operates various platforms, including the App Store, that allow customers to discover and download applications and digital content, such as books, music, video, games, and podcasts. In addition, the company offers various services, such as Apple Arcade, a game subscription service; Apple Music, which offers users a curated listening experience with on-demand radio stations; Apple News+, a subscription news and magazine service; Apple TV+, which offers exclusive original content; Apple Card, a co-branded credit card; and Apple Pay, a cashless payment service, as well as licenses its intellectual property. The company serves consumers, and small and mid-sized businesses; and the education, enterprise, and government markets. It sells and delivers third-party applications for its products through the App Store. The company also sells its products through its retail and online stores, and direct sales force; and third-party cellular network carriers, wholesalers, retailers, and resellers. Apple Inc. was founded in 1977 and is headquartered in Cupertino, California.', + fullTimeEmployees: 147000, + companyOfficers: [ + { + maxAge: 1, + name: 'Mr. Timothy D. Cook', + age: 59, + title: 'CEO & Director', + yearBorn: 1961, + fiscalYear: 2020, + totalPay: 14769259, + exercisedValue: 0, + unexercisedValue: 0 + }, + /* ... */ + ], + auditRisk: 1, + boardRisk: 1, + compensationRisk: 3, + shareHolderRightsRisk: 1, + overallRisk: 1, + governanceEpochDate: new Date("2021-01-22T00:00:00.000Z"), + compensationAsOfEpochDate: new Date("2020-12-31T00:00:00.000Z"), + maxAge: 86400 + } +} +``` + + +### balanceSheetHistory + +```js +await yahooFinance.quoteSummary('', { modules: [ "balanceSheetHistory" ] }); + + +``` + + +### balanceSheetHistoryQuarterly + +```js +await yahooFinance.quoteSummary('', { modules: [ "balanceSheetHistoryQuarterly" ] }); + + +``` + + +### calendarEvents + +```js +await yahooFinance.quoteSummary('', { modules: [ "calendarEvents" ] }); + + +``` + + +### cashflowStatementHistory + +```js +await yahooFinance.quoteSummary('', { modules: [ "cashflowStatementHistory" ] }); + + +``` + + +### cashflowStatementHistoryQuarterly + +```js +await yahooFinance.quoteSummary('', { modules: [ "cashflowStatementHistoryQuarterly" ] }); + + +``` + + +### defaultKeyStatistics + +```js +await yahooFinance.quoteSummary('', { modules: [ "defaultKeyStatistics" ] }); + + +``` + + +### earnings + +```js +await yahooFinance.quoteSummary('', { modules: [ "earnings" ] }); + + +``` + + +### earningsHistory + +```js +await yahooFinance.quoteSummary('', { modules: [ "earningsHistory" ] }); + + +``` + + +### earningsTrend + +```js +await yahooFinance.quoteSummary('', { modules: [ "earningsTrend" ] }); + + +``` + + +### financialData + +```js +await yahooFinance.quoteSummary('', { modules: [ "financialData" ] }); + + +``` + + +### fundOwnership + +```js +await yahooFinance.quoteSummary('', { modules: [ "fundOwnership" ] }); + + +``` + + +### fundPerformance + +```js +await yahooFinance.quoteSummary('', { modules: [ "fundPerformance" ] }); + + +``` + + +### fundProfile + +```js +await yahooFinance.quoteSummary('', { modules: [ "fundProfile" ] }); + + +``` + + +### incomeStatementHistory + +```js +await yahooFinance.quoteSummary('', { modules: [ "incomeStatementHistory" ] }); + + +``` + + +### incomeStatementHistoryQuarterly + +```js +await yahooFinance.quoteSummary('', { modules: [ "incomeStatementHistoryQuarterly" ] }); + + +``` + + +### indexTrend + +```js +await yahooFinance.quoteSummary('', { modules: [ "indexTrend" ] }); + + +``` + + +### industryTrend + +```js +await yahooFinance.quoteSummary('', { modules: [ "industryTrend" ] }); + + +``` + + +### insiderHolders + +```js +await yahooFinance.quoteSummary('', { modules: [ "insiderHolders" ] }); + + +``` + + +### insiderTransactions + +```js +await yahooFinance.quoteSummary('', { modules: [ "insiderTransactions" ] }); + + +``` + + +### institutionOwnership + +```js +await yahooFinance.quoteSummary('', { modules: [ "institutionOwnership" ] }); + + +``` + + +### majorDirectHolders + +```js +await yahooFinance.quoteSummary('', { modules: [ "majorDirectHolders" ] }); + + +``` + + +### majorHoldersBreakdown + +```js +await yahooFinance.quoteSummary('', { modules: [ "majorHoldersBreakdown" ] }); + + +``` + + +### netSharePurchaseActivity + +```js +await yahooFinance.quoteSummary('', { modules: [ "netSharePurchaseActivity" ] }); + + +``` + + +### price + +```js +await yahooFinance.quoteSummary('', { modules: [ "price" ] }); + + +``` + + +### quoteType + +```js +await yahooFinance.quoteSummary('', { modules: [ "quoteType" ] }); + + +``` + + +### recommendationTrend + +```js +await yahooFinance.quoteSummary('', { modules: [ "recommendationTrend" ] }); + + +``` + + +### secFilings + +```js +await yahooFinance.quoteSummary('', { modules: [ "secFilings" ] }); + + +``` + + +### sectorTrend + +```js +await yahooFinance.quoteSummary('', { modules: [ "sectorTrend" ] }); + + +``` + + +### summaryDetail + +```js +await yahooFinance.quoteSummary('', { modules: [ "summaryDetail" ] }); + + +``` + + +### summaryProfile + +```js +await yahooFinance.quoteSummary('', { modules: [ "summaryProfile" ] }); + + +``` + + +### symbol + +```js +await yahooFinance.quoteSummary('', { modules: [ "symbol" ] }); + + +``` + + +### topHoldings + +```js +await yahooFinance.quoteSummary('', { modules: [ "topHoldings" ] }); + + +``` + + +### upgradeDowngradeHistory + +```js +await yahooFinance.quoteSummary('', { modules: [ "upgradeDowngradeHistory" ] }); + + +``` diff --git a/docs/modules/search.md b/docs/modules/search.md new file mode 100644 index 00000000..40937a8e --- /dev/null +++ b/docs/modules/search.md @@ -0,0 +1,84 @@ +# search + +## Usage: + +```js +import yahooFinance from 'yahoo-finance2'; + +const query = 'GOO'; +const result = await yahooFinance.search(query, /* queryOptions */); + +{ + explains: [], + count: 3, + quotes: [ + { + exchange: 'NMS', + shortname: 'Alphabet Inc.', + quoteType: 'EQUITY', + symbol: 'GOOG', + index: 'quotes', + score: 597831, + typeDisp: 'Equity', + longname: 'Alphabet Inc.', + isYahooFinance: true + }, + { + index: '5167b830a941ed08d275f74473d13e91', + name: 'Google for Startups', + permalink: 'google-for-entrepreneurs', + isYahooFinance: false + }, + { + index: '26e6817312a98f234d2fcf80fa1abc1c', + name: 'Google Cloud Platform', + permalink: 'google-cloud-platform', + isYahooFinance: false + } + ], + news: [], + nav: [], + lists: [], + researchReports: [], + totalTime: 20, + timeTakenForQuotes: 414, + timeTakenForNews: 0, + timeTakenForAlgowatchlist: 400, + timeTakenForPredefinedScreener: 400, + timeTakenForCrunchbase: 400, + timeTakenForNav: 400, + timeTakenForResearchReports: 0 +} +``` + +See also: [autoc](./autoc.md) (auto complete). + +## API + +```js +await yahooFinance.search(query, queryOptions, fetchOptions); +``` + +### Query term + +Anything you'd put in the search box at the top of https://finance.yahoo.com/. +The text there is "Search for news, symbols, companies". + + +Useful things we've found include: listing SEDOL. + +### Query Options + +| Name | Type | Default | Description | +| ------------- | ----------| ---------- | --------------------------------- | +| `lang` | string | "en-US" +| `region` | string | "US" +| `quotesCount` | number | 6 | Max no. of quotes to return +| `newsCount` | number | 4 | Max no. of news items to return +| `enableFuzzyQuery` | boolean | false +| `quotesQueryId` | string | "tss_match_phrase_query" +| `multiQuoteQueryId` | string | "multi_quote_single_token_query" +| `newsQueryId` | string | "news_cie_vespa" +| `enableCb` | boolean | true, +| `enableNavLinks` | boolean | true, +| `enableEnhancedTrivialQuery` | boolean | true