百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

go-quote

> DevOps
开源

Yahoo finance/Google finance/Coinbase/Bittrex/Binance/Tiingo 历史报价下载库和基于 Golang 编写的 CLI

346 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Yahoo finance/Google finance/Coinbase/Bittrex/Binance/Tiingo 历史报价下载库和基于 Golang 编写的 CLI

go-quote

A free quote downloader library and cli

Downloads daily historical price quotes from Tiingo and daily/intraday data from various api's. Written in pure Go. No external dependencies. Now downloads crypto coin historical data from various exchanges.

  • Update: 08/19/2026 - Added Binance symbol lists: binance-usdt, binance-usdc, binance-btc, binance-eth. market.go is now a table rather than a switch plus a dispatch chain, so market lists are testable and a market can no longer be listed as valid without a way to fetch it. ValidMarkets is deprecated in favor of Markets()

  • Update: 08/19/2026 - Added Binance support (-source=binance), restoring the source removed in 2024. Uses data-api.binance.vision, which needs no API key and is not geo-restricted; api.binance.com returns 451 outside eligible regions. Supports every period the package defines, including 3d, which no other source offers

  • Update: 08/19/2026 - Modernization: added Client (context, retries, shared HTTP client) and a Provider registry; split the library into topic files; requires Go 1.24+. Fixes: EUR/GBP-quoted Coinbase pairs were rounded to 2 decimals and lost their price data, all timestamps are now UTC, -markets=etf works from the library API, multi-symbol CSV parsing no longer scrambles symbols, and CSV round-trips no longer append a phantom zero bar. Existing API is unchanged; older entry points still work and are marked deprecated

  • Update: 09/04/2025 - added Tiingo CSV update mode (-update) with 10-day backfill, optional full re-download on corporate actions, and -concurrency for faster updates

  • Update: 04/01/2025 - added markets flag, wildcard input files, multiple inputs

  • Update: 03/02/2025 - Removed obsolete Yahoo support

  • Update: 02/15/2024 - Major update: updated to Go 1.22, removed bittrex/binance support, fixed nasdaq/tiingo markets

  • Update: 11/15/2021 - Removed obsolete markets, converted to go modules

  • Update: 7/18/2021 - Removed obsolete Google support

  • Update: 6/26/2019 - updated GDAX to Coinbase, added coinbase market

  • Update: 4/26/2018 - Added preliminary tiingo CRYPTO support. Use -source=tiingo-crypto -token= You can also set env variable TIINGO_API_TOKEN. To get symbol lists, use market: tiingo-btc, tiingo-eth or tiingo-usd

  • Update: 12/21/2017 - Added Amibroker format option (creates csv file with separate date and time). Use -format=ami

  • Update: 12/20/2017 - Added Binance exchange support. Use -source=binance

  • Update: 12/18/2017 - Added Bittrex exchange support. Use -source=bittrex

  • Update: 10/21/2017 - Added Coinbase GDAX exchange support. Use -source=gdax All times are in UTC. Automatically rate limited.

  • Update: 7/19/2017 - Added preliminary tiingo support. Use -source=tiingo -token= You can also set env variable TIINGO_API_TOKEN

  • Update: 5/24/2017 - Now works with the new Yahoo download format. Beware - Yahoo data quality is now questionable and the free Yahoo quotes are likely to permanently go away in the near future. Use with caution!

Still very much in alpha mode. Expect bugs and API changes. Comments/suggestions/pull requests welcome!

Copyright 2025 Mark Chenoweth

Install CLI utility (quote) with:

bash
go install github.com/markcheno/go-quote/quote@latest
…

CLI Examples

…

Update mode rate limiting

  • -delay=0: no global throttle; workers issue requests immediately.
  • -delay>0: a single global limiter spaces requests across all workers by ~delay ms. Use higher -concurrency to overlap work while keeping polite pacing.

Tiingo rate limit guidance

  • Start conservatively: -delay=100..250 and -concurrency=2..4.
  • Increase gradually and watch for 429 Too Many Requests responses.
  • Leave -delay > 0 to be polite; set -delay=0 only if your plan allows higher throughput.

Install library

Requires Go 1.24 or later. Install the package with:

bash
go get github.com/markcheno/go-quote@latest

Library example

go
package main

import (
	"fmt"
	"github.com/markcheno/go-quote"
	"github.com/markcheno/go-talib"
)

func main() {
	spy, _ := quote.NewQuoteFromTiingo("spy", "2016-01-01", "2016-04-01", quote.Daily, "your-tiingo-token")
	fmt.Print(spy.CSV())
	rsi2 := talib.Rsi(spy.Close, 2)
	fmt.Println(rsi2)
}

Using a Client

The package-level functions above still work, but new code should prefer a Client. It takes a context.Context, so requests can be cancelled or given a deadline, and it lets you set the request delay, retry policy, and HTTP client per caller instead of through package globals:

…

Fetch many symbols with Client.FetchSymbols, which paces requests by Client.Delay and skips symbols that fail:

go
quotes, err := c.FetchSymbols(ctx, p, []string{"spy", "qqq", "dia"}, quote.Request{
	From:   quote.ParseDateString("2024-01-01"),
	To:     quote.ParseDateString("2024-12-31"),
	Period: quote.Daily,
})
if err != nil {
	panic(err)
}
err = quotes.WriteFile("indexes.csv", quote.FormatCSV)

Client.Provider reports the valid sources and Provider.Periods the periods each one supports, so an unsupported combination is an error rather than a silent fallback to daily bars.

Notes

Timestamps are UTC. Every source returns UTC, so a Coinbase file and a Tiingo file label the same instant identically. The CSV format carries no timezone, so this also means a file written and read back keeps its instants.

Decimal places come from the data source: 2 for equities, 8 for cryptocurrencies, recorded in Quote.Precision. CSV parsing infers it from the decimals present in the file, so reading a file and writing it out again does not round it.

Adding a data source means implementing quote.Provider and calling quote.RegisterProvider. That is enough for -source dispatch and period validation, which are registry-driven. A source added to the package itself also needs a base-URL seam so it can be tested, Quote.Precision stamped, UTC timestamps, and updates to three tests that know the set of sources - docs/adding-a-provider.md is the full checklist.

Upgrading

Three changes need attention if you have existing data or scripts:

  • EUR/GBP-quoted Coinbase pairs (DOGE-EUR, ADA-GBP, and ~48 others) were written with 2 decimal places, which rounded sub-euro prices away entirely - a full day of DOGE-EUR came out as 0.08,0.08,0.08,0.08. The data in those files is gone and needs refetching, not reformatting.
  • Coinbase timestamps were written in local time and are now UTC. If you are not in UTC they will shift by your offset, so refetch whole ranges rather than diffing old files against new ones. Tiingo files are unaffected - they were already UTC.
  • ValidMarkets grew from 26 to 30 entries. It is an array, so its type changed from [26]string to [30]string. Ranging over it, indexing it, and len all still compile; only an explicit var m [26]string = quote.ValidMarkets breaks. Use the new Markets() []string instead, which is a slice and will not change type when markets are added.
  • The CLI now exits 1 on a bad flag instead of 0. A script written as quote -source=bogus && next-step will now stop where it used to continue.

License

MIT License - see LICENSE for more details

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Gobinancebinance-apibitcoinbittrex

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理