Skip to content

Commit

Permalink
chore(docs): quote docs, readme example, links to common-options
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Feb 8, 2021
1 parent a6afde6 commit 1cbc17a
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 4 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const results = await yahooFInance.search('AAPL', { someOption: true, etc });
Available modules:
[`autoc`](./docs/modules/autoc.md),
[`historical`](./docs/modules/historical.md),
[`quote`](./docs/modules/quote.md),
[`quoteSummary`](./docs/modules/quoteSummary.md) (submodules:
assetProfile, balanceSheetHistory, balanceSheetHistoryQuarterly,
calendarEvents, cashflowStatementHistory, cashflowStatementHistoryQuarterly,
Expand All @@ -67,6 +68,13 @@ symbol, topHoldings, upgradeDowngradeHistory),

See the [Full Documentation](./docs/README.md).

## Even Quicker Start - Stock Price

```js
const quote = await yahooFinance.quote('AAPL');
const { regularMarketPrice as price, currency } = quote;
```

## (Optional) TypeScript Love

Working with `yahoo-finance2` is a joy if you're using TypeScript (but you
Expand Down
6 changes: 5 additions & 1 deletion docs/modules/autoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ See also: [search](./search.md).
## API

```js
await yahooFinance.autoc(query, queryOptions, fetchOptions);
await yahooFinance.autoc(query, queryOptions, moduleOptions);
```

### Query term
Expand All @@ -57,3 +57,7 @@ Symbol, company name, SEDOL, etc.
| ------------- | ----------| ---------- | --------------------------------- |
| `region` | number | 1 | |
| `lang` | string | "en" | |

### Module Options

See [Common Options](../README.md#common-options).
6 changes: 5 additions & 1 deletion docs/modules/historical.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const result = await yahooFinance.search(query, queryOptions);
## API

```js
await yahooFinance.historical(query, queryOptions, fetchOptions);
await yahooFinance.historical(query, queryOptions, moduleOptions);
```

### Query term
Expand All @@ -55,3 +55,7 @@ Dates* can be:

* A **Date** instance, e.g. `new Date(something)`
* A **string** that can be parsed by `Date()`, e.g. `"2020-01-01"`.

### Module Options

See [Common Options](../README.md#common-options).
115 changes: 115 additions & 0 deletions docs/modules/quote.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# quote

Note: in the original `node-yahoo-finance`, we had a module called "`quote`"
that actually called the [quoteSummary](./quoteSummary.md) API. See that
module for further details.

## Usage:

```js
import yahooFinance from 'yahoo-finance2';

// Single symbol
const result = await yahooFinance.quote('AAPL');

{
language: 'en-US',
region: 'US',
quoteType: 'EQUITY',
quoteSourceName: 'Nasdaq Real Time Price',
triggerable: true,
currency: 'USD',
exchange: 'NMS',
shortName: 'Apple Inc.',
longName: 'Apple Inc.',
messageBoardId: 'finmb_24937',
exchangeTimezoneName: 'America/New_York',
exchangeTimezoneShortName: 'EST',
gmtOffSetMilliseconds: -18000000,
market: 'us_market',
esgPopulated: false,
epsCurrentYear: 4.45,
priceEpsCurrentYear: 30.732584,
sharesOutstanding: 16788100096,
bookValue: 3.936,
fiftyDayAverage: 133.31032,
fiftyDayAverageChange: 3.4496765,
fiftyDayAverageChangePercent: 0.02587704,
twoHundredDayAverage: 119.94297,
twoHundredDayAverageChange: 16.817024,
twoHundredDayAverageChangePercent: 0.1402085,
marketCap: 2295940513792,
forwardPE: 29.34764,
priceToBook: 34.745934,
sourceInterval: 15,
exchangeDataDelayedBy: 0,
tradeable: false,
firstTradeDateMilliseconds: new Date("1980-12-12T14:30:00.000Z"),
priceHint: 2,
marketState: 'PREPRE',
postMarketChangePercent: -0.058498,
postMarketTime: new Date("2021-02-06T00:59:58.000Z"),
postMarketPrice: 136.68,
postMarketChange: -0.0800018,
regularMarketChange: -0.42500305,
regularMarketChangePercent: -0.30980286,
regularMarketTime: 1612558802,
regularMarketPrice: 136.76,
regularMarketDayHigh: 137.41,
regularMarketDayRange: { low: 135.86, high: 137.41 },
regularMarketDayLow: 135.86,
regularMarketVolume: 75693830,
regularMarketPreviousClose: 137.185,
bid: 0,
ask: 0,
bidSize: 29,
askSize: 11,
fullExchangeName: 'NasdaqGS',
financialCurrency: 'USD',
regularMarketOpen: 137.35,
averageDailyVolume3Month: 106825349,
averageDailyVolume10Day: 108468300,
fiftyTwoWeekLowChange: 83.6075,
fiftyTwoWeekLowChangePercent: 1.572974,
fiftyTwoWeekRange: { low: 53.1525, high: 145.09 },
fiftyTwoWeekHighChange: -8.330002,
fiftyTwoWeekHighChangePercent: -0.057412654,
fiftyTwoWeekLow: 53.1525,
fiftyTwoWeekHigh: 145.09,
dividendDate: new Date("2021-02-11T00:00:00.000Z"),
earningsTimestamp: new Date("2021-01-27T16:30:00.000Z"),
earningsTimestampStart: new Date("2021-04-28T10:59:00.000Z"),
earningsTimestampEnd: new Date("2021-05-03T12:00:00.000Z"),
trailingAnnualDividendRate: 0.807,
trailingPE: 37.092484,
trailingAnnualDividendYield: 0.0058825673,
epsTrailingTwelveMonths: 3.687,
epsForward: 4.66,
displayName: 'Apple',
symbol: 'AAPL'
}

// Multiple symbols
const results = await yahooFinance.quote(['AAPL','GOOGL']);
const result = { AAPL: result[0], GOOGL: result[1] };
```

## API

```js
await yahooFinance.quote(symbol, queryOptions, moduleOptions);
```

### Symbol

Symbol name as used by Yahoo (often the stock ticker). You can find it
using [autoc](./auto.md) or [search](./search.md). You can also provide
an array of symbols, and you'll receive an array of results back.

### Query Options

The `quote` module doesn't have any options. Find some? Let us know!

### Module Options

See [Common Options](../README.md#common-options).
10 changes: 9 additions & 1 deletion docs/modules/quoteSummary.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# quoteSummary

Note: in the original `node-yahoo-finance`, we incorrectly called this
"`quote`". See the [quote](./quote.md) docs, for this similar but
different module.

## Usage:

```js
Expand Down Expand Up @@ -83,14 +87,18 @@ const result = await yahooFinance.quoteSummary(symbol, queryOptions);
## API

```js
await yahooFinance.quoteSummary(symbol, queryOptions, fetchOptions);
await yahooFinance.quoteSummary(symbol, queryOptions, moduleOptions);
```

### Symbol

Symbol name as used by Yahoo (often the stock ticker). You can find it
using [autoc](./auto.md) or [search](./search.md).

### Module Options

See [Common Options](../README.md#common-options).

### Query Options

| Name | Type | Default | Description |
Expand Down
6 changes: 5 additions & 1 deletion docs/modules/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ See also: [autoc](./autoc.md) (auto complete).
## API

```js
await yahooFinance.search(query, queryOptions, fetchOptions);
await yahooFinance.search(query, queryOptions, moduleOptions);
```

### Query term
Expand All @@ -82,3 +82,7 @@ Useful things we've found include: listing SEDOL.
| `enableCb` | boolean | true,
| `enableNavLinks` | boolean | true,
| `enableEnhancedTrivialQuery` | boolean | true

### Module Options

See [Common Options](../README.md#common-options).

0 comments on commit 1cbc17a

Please sign in to comment.