https://github.com/stephanakkerman/ticker-price-data
Efficiently get price data for a given ticker
https://github.com/stephanakkerman/ticker-price-data
Last synced: 8 days ago
JSON representation
Efficiently get price data for a given ticker
- Host: GitHub
- URL: https://github.com/stephanakkerman/ticker-price-data
- Owner: StephanAkkerman
- License: mit
- Created: 2026-06-17T17:33:45.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-06-17T18:59:42.000Z (about 2 months ago)
- Last Synced: 2026-06-17T20:27:19.372Z (about 2 months ago)
- Language: Python
- Size: 47.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# ticker-price-data
Unified ticker price data from **Yahoo Finance** (stocks/indices/forex/futures),
**CoinGecko** (crypto), and **TradingView** (universal fallback).
One normalized quote shape for every asset, with sensible fallbacks and built-in
caching.
## Key Features 🔑
- `get_price(ticker, asset_type)` — single entry point; `asset_type="auto"` uses
[ticker-classifier](https://github.com/StephanAkkerman/ticker-classifier) to decide
stock vs crypto vs forex automatically.
- `get_ticker(ticker)` — everything known about a symbol in one call: classification
metadata (sector, industry, market cap, company profile, ...) **plus** the live quote,
classifying only once.
- `get_stock_info(ticker)` — Yahoo Finance, with a TradingView fallback.
- `get_crypto_info(ticker)` — CoinGecko via the website `search_v2` endpoint (avoids the
public API's free-tier rate limits), with Yahoo → TradingView fallbacks.
- `get_tradingview_quote(symbol, asset_hint)` — realtime websocket pool + scraper fallback.
- In-memory caching, stale/negative caching, and concurrency limits built in.
- Pre-market and after-hours data where available.
All helpers return `Optional[dict]`:
```python
{
"price": float,
"change_percent": float,
"volume": float,
"website": str,
"source": str, # "yahoo" | "coingecko" | "tradingview"
# stocks only:
"last_close": float | None, # previous day's regular-session close
"session": str, # "regular" | "pre-market" | "after-hours" | "closed"
"extended_price": float, # pre/after-hours price (omitted when session == "regular")
"extended_change_percent": float, # (extended_price − price) / price × 100 (omitted when session == "regular")
}
```
`extended_price` and `extended_change_percent` persist from the end of after-hours (8 pm ET) through weekends and holidays until pre-market opens (4 am ET) on the next trading day.
## Installation ⚙️
```bash
pip install ticker-price-data
```
or, for local development:
```bash
pip install -e .
```
## Usage ⌨️
```python
import asyncio
from ticker_price_data import get_price, get_ticker, get_stock_info, get_crypto_info
async def main():
print(await get_stock_info("AAPL")) # Yahoo
print(await get_crypto_info("BTC")) # CoinGecko
print(await get_price("BTC", "auto")) # classified automatically
print(await get_ticker("AAPL")) # metadata (sector, industry, ...) + quote
asyncio.run(main())
```
## License 📜
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.