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
- Host: GitHub
- URL: https://github.com/huytd/yahoo-finance-graphql
- Owner: huytd
- Created: 2021-06-16T23:47:08.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-17T22:55:18.000Z (over 4 years ago)
- Last Synced: 2024-04-14T08:56:02.036Z (over 1 year ago)
- Topics: apollo, apollo-server, graphql, graphql-api, graphql-server, yahoo-finance, yahoo-finance-api
- Language: TypeScript
- Homepage: https://yahoo-finance-graphql.herokuapp.com/
- Size: 66.4 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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."
},
...
]
}
}
```