yahoofinance

package module
Version: v0.0.0-...-071cc11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2017 License: MIT Imports: 7 Imported by: 0

README

Yahoo Finance Quotes

A small Go library to retrieve stock quotes from Yahoo Finance.

There is also a command line program that uses the library

Build

go get github.com/scottjbarr/yahoofinance/cmd/yahoofinance

Usage

Command line program example.

yahoofinance GE MO AAPL C MSFT USDAUD=X GS

{AAPL Apple Inc. 124.08 3/26/2015 10:45am}
{C Citigroup, Inc. Common Stock 50.88 3/26/2015 10:45am}
{GE General Electric Company Common 24.81 3/26/2015 10:45am}
{GS Goldman Sachs Group, Inc. (The) 186.375 3/26/2015 10:45am}
{MO Altria Group, Inc. 50.5 3/26/2015 10:45am}
{MSFT Microsoft Corporation 41.14 3/26/2015 10:45am}
{USDAUD=X USD/AUD 1.2762 3/26/2015 2:59pm}

Testing

go test

... or alternatively

goconvey

References

Licence

The MIT License (MIT)

Copyright (c) 2015 Scott Barr

See LICENSE.md

Documentation

Overview

Package yahoofinance provides a way to fetch quotes for equities and currencies from Yahoo Finance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL    string
	HTTPClient *http.Client
}

Client provides access to the Quotes service.

func NewClient

func NewClient() *Client

NewClient returns a new default Client

func (*Client) GetQuotes

func (client *Client) GetQuotes(symbols []string) ([]Quote, error)

GetQuotes return Quotes for the given symbols

type Quote

type Quote struct {
	Symbol        string  `json:"symbol"`
	Name          string  `json:"name"`
	PreviousClose float64 `json:"previous_close"`
	Open          float64 `json:"open"`
	Price         float64 `json:"price"`
	Change        float64 `json:"change"`
	ChangePct     float64 `json:"change_pct"`
	DayLow        float64 `json:"day_low"`
	DayHigh       float64 `json:"day_high"`
	LastTradeDate string  `json:"last_trade_date"`
	LastTradeTime string  `json:"last_trade_time"`
	LastTrade     float64 `json:"last_trade"`
}

Quote data

Source Files

Directories

Path Synopsis
cmd
yahoofinance
Command line interface to fetch quotes for equities and currencies from Yahoo Finance.
Command line interface to fetch quotes for equities and currencies from Yahoo Finance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL