googleFinance

package module
v0.0.0-...-09b3604 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2016 License: MIT Imports: 10 Imported by: 2

README

google_finance_api

Google Finance API wrapper written in Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct{}

API is the interface for the google finance resource

func (*API) GetStock

func (api *API) GetStock(code string) (*Stock, error)

GetStock gets stock struct from google API.

func (API) GetStocker

func (api API) GetStocker(code string) (plugin.Stocker, error)

GetStocker wraps the Stock into fugo Stocker interface

func (API) GetStockers

func (api API) GetStockers(codes []string) (plugin.Stockers, error)

GetStockers wraps the Stocks into fugo Stockers interface

func (API) GetStocks

func (api API) GetStocks(codes []string) (*Stocks, error)

GetStocks gets stocks struct from google API.

type Stock

type Stock struct {
	Code          string    `json:"t"` // Depending on the market (f.g. integer code for TYO, ticker for NASDAQ...etc)
	Name          string    `json:"name"`
	Price         float64   `json:"l_fix,string"`
	Change        float64   `json:"c_fix,string"`
	ChangePercent float64   `json:"cp_fix,string"`
	UpdatedAt     time.Time `json:"lt_dts,string"`
}

Stock stores stock data from Google Finance API.

func (*Stock) GetCode

func (stk *Stock) GetCode() string

GetCode is getter method for Stock's Code.

func (Stock) String

func (stk Stock) String() string

String defines what we get on printing Stock.

func (*Stock) ToStocks

func (stk *Stock) ToStocks(stks []Stock) Stocks

ToStocks takes Stock slices and parses it into a Stocks struct

type Stocks

type Stocks []Stock

Stocks is an array of Stock

func (Stocks) String

func (stks Stocks) String() string

String defines what we get on printing Stocks.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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