An open API service indexing awesome lists of open source software.

https://github.com/huytd/yahoo-finance-graphql

GraphQL server for Yahoo Finance
https://github.com/huytd/yahoo-finance-graphql

apollo apollo-server graphql graphql-api graphql-server yahoo-finance yahoo-finance-api

Last synced: 2 months ago
JSON representation

GraphQL server for Yahoo Finance

Awesome Lists containing this project

README

          

# Yahoo Finance GraphQL API

A GraphQL API for fetching data from Yahoo Finance, thanks to [node-yahoo-finance2](https://github.com/gadicc/node-yahoo-finance2/).

Online Demo: https://yahoo-finance-graphql.herokuapp.com/

Available APIs:

- [quote](https://github.com/gadicc/node-yahoo-finance2/blob/devel/docs/modules/quote.md)
- [autoc](https://github.com/gadicc/node-yahoo-finance2/blob/devel/docs/modules/autoc.md)
- [trendingSymbols](https://github.com/gadicc/node-yahoo-finance2/blob/devel/docs/modules/trendingSymbols.md)
- [historical](https://github.com/gadicc/node-yahoo-finance2/blob/devel/docs/modules/historical.md)

## How to use

Run the GraphQL server with the following command:

```
$ yarn install

$ yarn start
```

## Examples

**Get historical data since 01/01/2021:**

QueryResponse

```
query {
historicalData(
symbol: "IBM"
from: "2021-01-01"
to: ""
interval: "1d"
) {
open
close
high
low
}
}
```

```
{

"data": {
"historicalData": [
{
"open": 125.849998,
"close": 123.940002,
"high": 125.919998,
"low": 123.040001
},
{
"open": 125.010002,
"close": 126.139999,
"high": 126.68,
"low": 124.610001
},
...
]
}
}
```

**Get top 10 trending symbols with quote:**

QueryResponse

```
query {
trendingSymbols(count: 3) {
symbol,
quote {
displayName,
regularMarketPrice,
regularMarketChange,
regularMarketChangePercent
}
}
}
```

```
{
"data": {
"trendingSymbols": [
{
"symbol": "ORPH",
"quote": {
"displayName": null,
"regularMarketPrice": 16.21,
"regularMarketChange": 6.159999,
"regularMarketChangePercent": 61.293518
}
},
{
"symbol": "CVAC",
"quote": {
"displayName": "CureVac",
"regularMarketPrice": 94.79,
"regularMarketChange": -3.409996,
"regularMarketChangePercent": -3.472501
}
},
{
"symbol": "VINO",
"quote": {
"displayName": "Gaucho",
"regularMarketPrice": 7.98,
"regularMarketChange": 3.8899999,
"regularMarketChangePercent": 95.110016
}
}
]
}
}
```

**Auto complete stock's symbol:**

QueryResponse

```
query {
autoComplete(query: "IB") {
symbol
name
}
}
```

```
{
"data": {
"autoComplete": [
{
"symbol": "IBBQ",
"name": "Invesco Nasdaq Biotechnology ETF"
},
{
"symbol": "IBM",
"name": "International Business Machines Corporation"
},
{
"symbol": "IBIO",
"name": "iBio, Inc."
},
...
]
}
}
```