Documentation ¶
Index ¶
Constants ¶
View Source
const ( // URL of Yahoo quotes for stock quotes. YURL = "http://finance.yahoo.com/d/quotes.csv?s=%s&f=%s" // Base data formating. // s - symbol // n - name // b - bid // a - ask // o - open // p - previous price // l1 - last price without time // d1 - last trade date BaseFormat = "snbaopl1d1" // Historical data URL with params: // s - symbol // a - from month (zero based) // b - from day // c - from year // d - to month (zero based) // e - to day // f - to year // g - period frequence (d - daily, w - weekly, m - monthly, y -yearly) YURL_H = "http://ichart.yahoo.com/table.csv?s=%s&a=%d&b=%d&c=%d&d=%d&e=%d&f=%d&g=%s&ignore=.csv" )
View Source
const ( Symbol = "s" Name = "n" Bid = "b" Ask = "a" Open = "o" Previous = "p" Last = "l1" LastDate = "d1" )
Formatting constants.
View Source
const ( Daily = "d" Weekly = "w" Monthly = "m" Yearly = "y" )
Constance of frequesncy for historical data requests.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Price ¶
type Price struct { Bid float64 `json:"bid,omitempty"` Ask float64 `json:"ask,omitempty"` Open float64 `json:"open,omitempty"` PreviousClose float64 `json:"previousClose,omitempty"` Last float64 `json:"last,omitempty"` Date time.Time `json:"date,omitempty"` }
Price struct represents price in single point in time.
type PriceH ¶
type PriceH struct { Date time.Time `json:"date,omitempty"` Open float64 `json:"open,omitempty"` High float64 `json:"high,omitempty"` Low float64 `json:"low,omitempty"` Close float64 `json:"close,omitempty"` Volume float64 `json:"volume,omitempty"` AdjClose float64 `json:"adjClose,omitempty"` }
Price type that is used for historical price data.
func GetDailyHistory ¶
Get historical prices for the stock.
func GetPriceForDate ¶
Get single stock price for certain date.
type Stock ¶
type Stock struct { // Symbol of stock that should meet requirements of Yahoo. Otherwise, // there will be no possibility to find stock. Symbol string `json:"symbol,omitempty"` // Name of the company will be filled from request of stock data. Name string `json:"name,omitempty"` // Information about last price of stock. Price *Price `json:"price,omitempty"` // Contains historical price information. If client asks information // for recent price, this field will be omited. History []PriceH `json:"history,omitempty"` }
Stock is used as container for stock price data.
Click to show internal directories.
Click to hide internal directories.