Documentation ¶
Overview ¶
Package quote is free quote downloader library and cli
Downloads daily/weekly/monthly historical price quotes from Yahoo and daily/intraday data from Google/Tiingo/Bittrex/Binance
Copyright 2019 Mark Chenoweth Licensed under terms of MIT license (see LICENSE)
Index ¶
- Constants
- Variables
- func NewEtfFile(filename string) error
- func NewEtfList() ([]string, error)
- func NewMarketFile(market, filename string) error
- func NewMarketList(market string) ([]string, error)
- func NewSymbolsFromFile(filename string) ([]string, error)
- func ParseDateString(dt string) time.Time
- func ValidMarket(market string) bool
- type Period
- type Quote
- func NewQuote(symbol string, bars int) Quote
- func NewQuoteFromBinance(symbol string, startDate, endDate string, period Period) (Quote, error)
- func NewQuoteFromBittrex(symbol string, period Period) (Quote, error)
- func NewQuoteFromCSV(symbol, csv string) (Quote, error)
- func NewQuoteFromCSVDateFormat(symbol, csv string, format string) (Quote, error)
- func NewQuoteFromCSVFile(symbol, filename string) (Quote, error)
- func NewQuoteFromCSVFileDateFormat(symbol, filename string, format string) (Quote, error)
- func NewQuoteFromCoinbase(symbol, startDate, endDate string, period Period) (Quote, error)
- func NewQuoteFromGoogle(symbol, startDate, endDate string, period Period) (Quote, error)
- func NewQuoteFromJSON(jsn string) (Quote, error)
- func NewQuoteFromJSONFile(filename string) (Quote, error)
- func NewQuoteFromTiingo(symbol, startDate, endDate string, token string) (Quote, error)
- func NewQuoteFromTiingoCrypto(symbol, startDate, endDate string, period Period, token string) (Quote, error)
- func NewQuoteFromYahoo(symbol, startDate, endDate string, period Period, adjustQuote bool) (Quote, error)
- func (q Quote) Amibroker() string
- func (q Quote) CSV() string
- func (q Quote) Highstock() string
- func (q Quote) JSON(indent bool) string
- func (q Quote) WriteAmibroker(filename string) error
- func (q Quote) WriteCSV(filename string) error
- func (q Quote) WriteHighstock(filename string) error
- func (q Quote) WriteJSON(filename string, indent bool) error
- type Quotes
- func NewQuotesFromBinance(filename string, startDate, endDate string, period Period) (Quotes, error)
- func NewQuotesFromBinanceSyms(symbols []string, startDate, endDate string, period Period) (Quotes, error)
- func NewQuotesFromBittrex(filename string, period Period) (Quotes, error)
- func NewQuotesFromBittrexSyms(symbols []string, period Period) (Quotes, error)
- func NewQuotesFromCSV(csv string) (Quotes, error)
- func NewQuotesFromCSVFile(filename string) (Quotes, error)
- func NewQuotesFromCoinbase(filename, startDate, endDate string, period Period) (Quotes, error)
- func NewQuotesFromCoinbaseSyms(symbols []string, startDate, endDate string, period Period) (Quotes, error)
- func NewQuotesFromGoogle(filename, startDate, endDate string, period Period) (Quotes, error)
- func NewQuotesFromGoogleSyms(symbols []string, startDate, endDate string, period Period) (Quotes, error)
- func NewQuotesFromJSON(jsn string) (Quotes, error)
- func NewQuotesFromJSONFile(filename string) (Quotes, error)
- func NewQuotesFromTiingoCryptoSyms(symbols []string, startDate, endDate string, period Period, token string) (Quotes, error)
- func NewQuotesFromTiingoSyms(symbols []string, startDate, endDate string, token string) (Quotes, error)
- func NewQuotesFromYahoo(filename, startDate, endDate string, period Period, adjustQuote bool) (Quotes, error)
- func NewQuotesFromYahooSyms(symbols []string, startDate, endDate string, period Period, adjustQuote bool) (Quotes, error)
- func (q Quotes) Amibroker() string
- func (q Quotes) CSV() string
- func (q Quotes) Highstock() string
- func (q Quotes) JSON(indent bool) string
- func (q Quotes) WriteAmibroker(filename string) error
- func (q Quotes) WriteCSV(filename string) error
- func (q Quotes) WriteHighstock(filename string) error
- func (q Quotes) WriteJSON(filename string, indent bool) error
Constants ¶
const ClientTimeout = 10 * time.Second
ClientTimeout - connect/read timeout for client requests
Variables ¶
var Delay time.Duration
Delay - time delay in milliseconds between quote requests (default=100) Be nice, don't get blocked
var Log *log.Logger
Log - standard logger, disabled by default
var ValidMarkets = [...]string{"etf",
"nasdaq",
"nyse",
"amex",
"megacap",
"largecap",
"midcap",
"smallcap",
"microcap",
"nanocap",
"basicindustries",
"capitalgoods",
"consumerdurables",
"consumernondurable",
"consumerservices",
"energy",
"finance",
"healthcare",
"miscellaneous",
"utilities",
"technology",
"transportation",
"bittrex-btc",
"bittrex-eth",
"bittrex-usdt",
"binance-bnb",
"binance-btc",
"binance-eth",
"binance-usdt",
"tiingo-btc",
"tiingo-eth",
"tiingo-usd",
"coinbase",
}
ValidMarkets list of markets that can be downloaded
Functions ¶
func NewEtfFile ¶
NewEtfFile - download a list of etf symbols to a file
func NewEtfList ¶
NewEtfList - download a list of etf symbols to an array of strings
func NewMarketFile ¶
NewMarketFile - download a list of market symbols to a file
func NewMarketList ¶
NewMarketList - download a list of market symbols to an array of strings
func NewSymbolsFromFile ¶
NewSymbolsFromFile - read symbols from a file
func ParseDateString ¶
ParseDateString - parse a potentially partial date string to Time
Types ¶
type Period ¶
type Period string
Period - for quote history
const ( // Min1 - 1 Minute time period Min1 Period = "60" // Min3 - 3 Minute time period Min3 Period = "3m" // Min5 - 5 Minute time period Min5 Period = "300" // Min15 - 15 Minute time period Min15 Period = "900" // Min30 - 30 Minute time period Min30 Period = "1800" // Min60 - 60 Minute time period Min60 Period = "3600" // Hour2 - 2 hour time period Hour2 Period = "2h" // Hour4 - 4 hour time period Hour4 Period = "4h" // Hour6 - 6 hour time period Hour6 Period = "6h" // Hour8 - 8 hour time period Hour8 Period = "8h" // Hour12 - 12 hour time period Hour12 Period = "12h" // Daily time period Daily Period = "d" // Day3 - 3 day time period Day3 Period = "3d" // Weekly time period Weekly Period = "w" // Monthly time period Monthly Period = "m" )
type Quote ¶
type Quote struct { Symbol string `json:"symbol"` Precision int64 `json:"-"` Date []time.Time `json:"date"` Open []float64 `json:"open"` High []float64 `json:"high"` Low []float64 `json:"low"` Close []float64 `json:"close"` Volume []float64 `json:"volume"` }
Quote - stucture for historical price data
func NewQuoteFromBinance ¶
NewQuoteFromBinance - Binance historical prices for a symbol
func NewQuoteFromBittrex ¶
NewQuoteFromBittrex - Biitrex historical prices for a symbol
func NewQuoteFromCSV ¶
NewQuoteFromCSV - parse csv quote string into Quote structure
func NewQuoteFromCSVDateFormat ¶
NewQuoteFromCSVDateFormat - parse csv quote string into Quote structure with specified DateTime format
func NewQuoteFromCSVFile ¶
NewQuoteFromCSVFile - parse csv quote file into Quote structure
func NewQuoteFromCSVFileDateFormat ¶
NewQuoteFromCSVFileDateFormat - parse csv quote file into Quote structure with specified DateTime format
func NewQuoteFromCoinbase ¶
NewQuoteFromCoinbase - Coinbase Pro historical prices for a symbol
func NewQuoteFromGoogle ¶
NewQuoteFromGoogle - Google daily/intraday historical prices for a symbol
func NewQuoteFromJSON ¶
NewQuoteFromJSON - parse json quote string into Quote structure
func NewQuoteFromJSONFile ¶
NewQuoteFromJSONFile - parse json quote string into Quote structure
func NewQuoteFromTiingo ¶
NewQuoteFromTiingo - Tiingo daily historical prices for a symbol
func NewQuoteFromTiingoCrypto ¶
func NewQuoteFromTiingoCrypto(symbol, startDate, endDate string, period Period, token string) (Quote, error)
NewQuoteFromTiingoCrypto - Tiingo crypto historical prices for a symbol
func NewQuoteFromYahoo ¶
func NewQuoteFromYahoo(symbol, startDate, endDate string, period Period, adjustQuote bool) (Quote, error)
NewQuoteFromYahoo - Yahoo historical prices for a symbol
func (Quote) WriteAmibroker ¶
WriteAmibroker - write Quote struct to csv file
func (Quote) WriteHighstock ¶
WriteHighstock - write Quote struct to Highstock json format
type Quotes ¶
type Quotes []Quote
Quotes - an array of historical price data
func NewQuotesFromBinance ¶
func NewQuotesFromBinance(filename string, startDate, endDate string, period Period) (Quotes, error)
NewQuotesFromBinance - create a list of prices from symbols in file
func NewQuotesFromBinanceSyms ¶
func NewQuotesFromBinanceSyms(symbols []string, startDate, endDate string, period Period) (Quotes, error)
NewQuotesFromBinanceSyms - create a list of prices from symbols in string array
func NewQuotesFromBittrex ¶
NewQuotesFromBittrex - create a list of prices from symbols in file
func NewQuotesFromBittrexSyms ¶
NewQuotesFromBittrexSyms - create a list of prices from symbols in string array
func NewQuotesFromCSV ¶
NewQuotesFromCSV - parse csv quote string into Quotes array
func NewQuotesFromCSVFile ¶
NewQuotesFromCSVFile - parse csv quote file into Quotes array
func NewQuotesFromCoinbase ¶
NewQuotesFromCoinbase - create a list of prices from symbols in file
func NewQuotesFromCoinbaseSyms ¶
func NewQuotesFromCoinbaseSyms(symbols []string, startDate, endDate string, period Period) (Quotes, error)
NewQuotesFromCoinbaseSyms - create a list of prices from symbols in string array
func NewQuotesFromGoogle ¶
NewQuotesFromGoogle - create a list of prices from symbols in file
func NewQuotesFromGoogleSyms ¶
func NewQuotesFromGoogleSyms(symbols []string, startDate, endDate string, period Period) (Quotes, error)
NewQuotesFromGoogleSyms - create a list of prices from symbols in string array
func NewQuotesFromJSON ¶
NewQuotesFromJSON - parse json quote string into Quote structure
func NewQuotesFromJSONFile ¶
NewQuotesFromJSONFile - parse json quote string into Quote structure
func NewQuotesFromTiingoCryptoSyms ¶
func NewQuotesFromTiingoCryptoSyms(symbols []string, startDate, endDate string, period Period, token string) (Quotes, error)
NewQuotesFromTiingoCryptoSyms - create a list of prices from symbols in string array
func NewQuotesFromTiingoSyms ¶
func NewQuotesFromTiingoSyms(symbols []string, startDate, endDate string, token string) (Quotes, error)
NewQuotesFromTiingoSyms - create a list of prices from symbols in string array
func NewQuotesFromYahoo ¶
func NewQuotesFromYahoo(filename, startDate, endDate string, period Period, adjustQuote bool) (Quotes, error)
NewQuotesFromYahoo - create a list of prices from symbols in file
func NewQuotesFromYahooSyms ¶
func NewQuotesFromYahooSyms(symbols []string, startDate, endDate string, period Period, adjustQuote bool) (Quotes, error)
NewQuotesFromYahooSyms - create a list of prices from symbols in string array
func (Quotes) WriteAmibroker ¶
WriteAmibroker - write Quotes structure to file
func (Quotes) WriteHighstock ¶
WriteHighstock - write Quote struct to json file in Highstock format