Socket
Book a DemoInstallSign in
Socket

github.com/oscarli916/yahoo-finance-api

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/oscarli916/yahoo-finance-api

Source
Go
Version
v0.1.2
Version published
Created
Source

yahoo-finance-api

Motivation

  • I used to write Python programs and use Yahoo Finance data. The yfinance library is an awesome library which I enjoyed a lot.
  • Could not find similar packages in Go.
  • Learn Go
  • Able to use this package on my other Go projects

Installation

go get github.com/oscarli916/yahoo-finance-api

Example

package main

import (
	"fmt"

	yfa "github.com/oscarli916/yahoo-finance-api"
)

func main() {
	t := yfa.NewTicker("AAPL")

	// get the latest PriceData
	quote, err := t.Quote()
	if err != nil {
		fmt.Println("Error fetching quote:", err)
		return
	}
	fmt.Println(quote.Close)

	// history data
	history, err := t.History(yfa.HistoryQuery{Range: "1d", Interval: "1m"})
	if err != nil {
		fmt.Println("Error fetching history:", err)
		return
	}
	fmt.Println(history)

	// option chain
	e := t.ExpirationDates()
	oc := t.OptionChainByExpiration(e[2])
	fmt.Println(oc)
}

Contributing

  • Fork the repository
  • Create your feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add some amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

FAQs

Package last updated on 25 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.