Getting Started with yfnim¶
yfnim provides both a library and CLI tool for accessing Yahoo Finance data. Choose your path:
For Command-Line Users (CLI Tool)¶
If you want to access market data from the terminal:
- Install the
yfcommand-line tool - Learn basic commands with abbreviations
- Export data to CSV/JSON
- Screen stocks and analyze trends
- Use piped input for batch processing
# Get current quotes
yf quote AAPL MSFT GOOGL
# Get historical data
yf history --symbol=AAPL --lookback=30d
# Screen stocks
yf screen AAPL MSFT --criteria=value
# Use command abbreviations
yf q AAPL # quote
yf h --symbol=AAPL # history
# Pipe symbols from file
cat symbols.txt | yf quote --read-stdin
For Developers (Library)¶
If you want to integrate Yahoo Finance data into your Nim applications:
- Learn how to install and use the yfnim library
- Fetch historical OHLCV data
- Get real-time quotes
- Type-safe API with minimal dependencies
import yfnim
import std/times
let endTime = getTime().toUnix()
let startTime = endTime - (7 * 86400)
let history = getHistory("AAPL", Int1d, startTime, endTime)
echo "Retrieved ", history.data.len, " records"
Installation¶
What's Next?¶
- Library Users: Start with Library Getting Started
- CLI Users: Start with CLI Installation then CLI Quick Start
- Everyone: Check out the API Reference