Apache License 2.0

项目介绍

Finnhub-Stock-API/finnhub-go 是一个托管在 GitHub 上的开源项目,主要使用 Go 编写,采用 Apache License 2.0 许可证,目前获得 91 个 Star、12 次 Fork。

仓库全名
Finnhub-Stock-API/finnhub-go
开源许可证
Apache License 2.0
Star 数
91
Fork 数
12
未关闭 Issue
8

README 摘要

Go API client for finnhub.io Overview API documentation: https://finnhub.io/docs/api API version: 1.0.0 Package version: 2.0.25 Installation Using Go Modules Make sure your project is using Go Modules (it will have a go.mod file in its root if it already is): Then, reference finnhub-go in a Go program with import: Run any of the normal go commands (build/install/test). The Go toolchain will resolve and fetch the…

完整内容见 GitHub 原始 README 或本页 。

常见问题

finnhub-go 用什么语言开发?

主要使用 Go 编写,采用 Apache License 2.0 许可证,目前有 91 个 Star。

finnhub-go 可以免费商用吗?

仓库采用 Apache License 2.0 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 finnhub-go 的源码?

可以直接克隆仓库:git clone https://github.com/Finnhub-Stock-API/finnhub-go.git,默认分支为 master;安装与运行步骤见仓库 README。

finnhub-go 最近还在维护吗?

仓库最近一次更新为 5 天前,当前有 8 个未关闭 Issue;Star 数为 91,可作为社区活跃度的参考。

关于

Finnhub Go API client. Finnhub API provides institutional-grade financial data to investors, fintech startups and investment firms. We support real-time stock price, global fundamentals and alternative data. https://finnhub.io/docs/api

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
119
价值分
58
活跃状态
活跃

README

Go API client for finnhub.io

Overview

Installation

Using Go Modules

Make sure your project is using Go Modules (it will have a go.mod file in its root if it already is):

go mod init

Then, reference finnhub-go in a Go program with import:

import (
    finnhub "github.com/Finnhub-Stock-API/finnhub-go/v2"
)

Run any of the normal go commands (build/install/test). The Go toolchain will resolve and fetch the finnhub-go module automatically.

Alternatively, you can also explicitly go get the package into a project:

$ go get -u github.com/Finnhub-Stock-API/finnhub-go/v2

Using go get

If you don’t want to use Go Modules, you can choose to get the library directly:

$ go get -u github.com/Finnhub-Stock-API/finnhub-go

Then, reference finnhub-go in a Go program with import (Note that no /v2 at the end):

import (
    finnhub "github.com/Finnhub-Stock-API/finnhub-go"
)

Examples

Example (check out other methods documentation here):

package main

import (
	"context"
	"fmt"
	finnhub "github.com/Finnhub-Stock-API/finnhub-go/v2"
)

func main() {
    cfg := finnhub.NewConfiguration()
    cfg.AddDefaultHeader("X-Finnhub-Token", "<API_key>")
    finnhubClient := finnhub.NewAPIClient(cfg).DefaultApi
	
    //Earnings calendar
    earningsCalendar, _, err := finnhubClient.EarningsCalendar(context.Background()).From("2021-07-01").To("2021-07-25").Execute()
    fmt.Printf("%+v\n", earningsCalendar)

    // NBBO
    bboData, _, err := finnhubClient.StockNbbo(context.Background()).Symbol("AAPL").Date("2021-07-23").Limit(50).Skip(0).Execute()
    fmt.Printf("%+v\n", bboData)

    // Bid ask
    lastBidAsk, _, err := finnhubClient.StockBidask(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", lastBidAsk)

    // Stock dividends 2
    dividends2, _, err := finnhubClient.StockBasicDividends(context.Background()).Symbol("KO").Execute()
    fmt.Printf("%+v\n", dividends2)

    //Stock candles
    stockCandles, _, err := finnhubClient.StockCandles(context.Background()).Symbol("AAPL").Resolution("D").From(1590988249).To(1591852249).Execute()
    fmt.Printf("%+v\n", stockCandles)

    // Example with required parameters
    news, _, err := finnhubClient.CompanyNews(context.Background()).Symbol("AAPL").From("2020-05-01").To("2020-05-01").Execute()
    if err != nil {
        fmt.Println(err)
    }
    fmt.Printf("%+v\n", news)

    // Example with required and optional parameters
    ownerships, _, err := finnhubClient.Ownership(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", ownerships)

    // Aggregate Indicator
    aggregateIndicator, _, err := finnhubClient.AggregateIndicator(context.Background()).Symbol("AAPL").Resolution("D").Execute()
    fmt.Printf("%+v\n", aggregateIndicator)

    // Basic financials
    basicFinancials, _, err := finnhubClient.CompanyBasicFinancials(context.Background()).Symbol("MSFT").Metric("all").Execute()
    fmt.Printf("%+v\n", basicFinancials)

    // Company earnings
    earningsSurprises, _, err := finnhubClient.CompanyEarnings(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", earningsSurprises)

    // Company EPS estimates
    epsEstimate, _, err := finnhubClient.CompanyEpsEstimates(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", epsEstimate)

    // Company executive
    executive, _, err := finnhubClient.CompanyExecutive(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", executive)

    // Company peers
    peers, _, err := finnhubClient.CompanyPeers(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", peers)

    // Company profile
    profile, _, err := finnhubClient.CompanyProfile(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", profile)

    profileISIN, _, err := finnhubClient.CompanyProfile(context.Background()).Isin("US0378331005").Execute()
    fmt.Printf("%+v\n", profileISIN)

    profileCusip, _, err := finnhubClient.CompanyProfile(context.Background()).Cusip("037833100").Execute()
    fmt.Printf("%+v\n", profileCusip)

    // Company profile2
    profile2, _, err := finnhubClient.CompanyProfile2(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", profile2)

    // Revenue Estimates
    revenueEstimates, _, err := finnhubClient.CompanyRevenueEstimates(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", revenueEstimates)

    // List country
    countries, _, err := finnhubClient.Country(context.Background()).Execute()
    fmt.Printf("%+v\n", countries)

    // Covid-19
    covid19, _, err := finnhubClient.Covid19(context.Background()).Execute()
    fmt.Printf("%+v\n", covid19)

    // FDA Calendar
    fdaCalendar, _, err := finnhubClient.FdaCommitteeMeetingCalendar(context.Background()).Execute()
    fmt.Printf("%+v\n", fdaCalendar)

    // Crypto candles
    cryptoCandles, _, err := finnhubClient.CryptoCandles(context.Background()).Symbol("BINANCE:BTCUSDT").Resolution("D").From(1590988249).To(1591852249).Execute()
    fmt.Printf("%+v\n", cryptoCandles)

    // Crypto exchanges
    cryptoExchange, _, err := finnhubClient.CryptoExchanges(context.Background()).Execute()
    fmt.Printf("%+v\n", cryptoExchange)

    // Crypto symbols
    cryptoSymbol, _, err := finnhubClient.CryptoSymbols(context.Background()).Exchange("BINANCE").Execute()
    fmt.Printf("%+v\n", cryptoSymbol[0:5])

    // Economic Calendar
    economicCalendar, _, err := finnhubClient.EconomicCalendar(context.Background()).Execute()
    fmt.Printf("%+v\n", economicCalendar)

    // Economic code
    economicCode, _, err := finnhubClient.EconomicCode(context.Background()).Execute()
    fmt.Printf("%+v\n", economicCode)

    // Economic data
    economicData, _, err := finnhubClient.EconomicData(context.Background()).Code("MA-USA-656880").Execute()
    fmt.Printf("%+v\n", economicData)

    // Filings
    filings, _, err := finnhubClient.Filings(context.Background()

提示:代码过长已自动截断

License

Apache License

评论

暂无评论