A simple server that fetches stock data from Yahoo Finance and returns it in JSON format using the yfinance library.
docker pull yarhrn/yfinance-server:latest
docker run -p 8000:8000 -d --name yfinance-server yarhrn/yfinance-server:latest
pip install -r requirements.txt
fastapi dev main.py
Open https://localhost:8000/docs in your browser to see the API documentation and try out the endpoints.
The server is a wrapper around the yfinance library that essentially exposes yfinance methods as API endpoints. So the protocol is rpc like.
To execute request do POST request on the endpoint /api/invoke/ticker with the following body:
{
"symbol": "AAPL",
"method": "history",
"params": {
"period": "1d",
"interval": "1m"
}
}
The server will try to init yt.Ticker(symbol) and call method with params on it. The response will be returned as JSON. More examples can be found by visiting the OpenAPI /docs endpoint.
I will try to release a new version of the server every time a new version of the yfinance library is released.
To check which version of yfinance is used in the server, you can visit the /api/version endpoint or check the CHANGELOG.md file.
I will try to follow the Semantic Versioning guidelines when releasing new versions but I can't guarantee that I will always follow them.
This software is provided as is and I am not responsible for any damages that may occur from using it. Use at your own risk.
Content type
Image
Digest
sha256:5ed8352fc…
Size
109.4 MB
Last updated
over 2 years ago
docker pull yarhrn/yfinance-server