Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Jun 1, 2021
1 parent 6aee241 commit 43b62e3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions docs/modules/quote.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,14 @@ const result = await yahooFinance.quote('AAPL');
symbol: 'AAPL'
}

// Multiple symbols
const results = await yahooFinance.quote(['AAPL','GOOGL']);
const result = { AAPL: result[0], GOOGL: result[1] };
// Multiple symbols, with default { return: "array" }. Missing symbols skipped.
const results = await yahooFinance.quote(['AAPL', 'NO_SUCH_SYMBOL', 'GOOGL']);
const result = { AAPL: result[0], GOOGL: result[1] /* not result[2]! */ };

// Other return types, where it's easier to deal with missing symbols, e.g.
// here map.get("NO_SUCH_SYMBOL") === object.NO_SUCH_SYMBOL === undefined.
const map = await yahooFinance.quote([...], { return: "map" });
const object = await yahooFinance.quote([...], { return: "object" });
```

## API
Expand All @@ -111,6 +116,7 @@ an array of symbols, and you'll receive an array of results back.
| Name | Type | Default | Description |
| ------------- | ----------| ---------- | --------------------------------- |
| `fields` | string[] | (all) | Which fields to return in query
| `return` | string | "array" | Return as "array" | "map" | "object"

```js
// Don't return all fields, only return these two + other essentials.
Expand Down

0 comments on commit 43b62e3

Please sign in to comment.