Skip to content

Commit

Permalink
chore(docs): initial docs [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Feb 3, 2021
1 parent 08561c7 commit ee6a759
Show file tree
Hide file tree
Showing 6 changed files with 692 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 13 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -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)

<a name="common-options"></a>
## Common Options
59 changes: 59 additions & 0 deletions docs/modules/autoc.md
Original file line number Diff line number Diff line change
@@ -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" | |
57 changes: 57 additions & 0 deletions docs/modules/historical.md
Original file line number Diff line number Diff line change
@@ -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"`.
Loading

0 comments on commit ee6a759

Please sign in to comment.