Skip to content

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:

CLI Quick Start Guide

  • Install the yf command-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:

Library Getting Started Guide

  • 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

git clone https://codeberg.org/jailop/yfnim.git
cd yfnim
nimble build -d:ssl
nimble install

What's Next?