All Projects → Finnhub-Stock-API → finnhub-go

Finnhub-Stock-API / finnhub-go

Licence: Apache-2.0 license
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

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to finnhub-go

finnhub-js
Finnhub Javascript 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
Stars: ✭ 35 (-33.96%)
Mutual labels:  stock, finnhub
STOCK-RETURN-PREDICTION-USING-KNN-SVM-GUASSIAN-PROCESS-ADABOOST-TREE-REGRESSION-AND-QDA
Forecast stock prices using machine learning approach. A time series analysis. Employ the Use of Predictive Modeling in Machine Learning to Forecast Stock Return. Approach Used by Hedge Funds to Select Tradeable Stocks
Stars: ✭ 94 (+77.36%)
Mutual labels:  stock
Sphinx Quant
一个基于vnpy,支持多账户,多策略,实盘交易,数据分析,分布式在线回测,风险管理,多交易节点的量化交易系统;支持CTP期货,股票,期权,数字货币等金融产品
Stars: ✭ 217 (+309.43%)
Mutual labels:  stock
Chase
Automatic trading bot (WIP)
Stars: ✭ 73 (+37.74%)
Mutual labels:  stock
Laravel Stock
Keep stock for Eloquent models
Stars: ✭ 229 (+332.08%)
Mutual labels:  stock
bsedata
Python library for extracting real-time data from Bombay Stock Exchange (India)
Stars: ✭ 67 (+26.42%)
Mutual labels:  stock
Dolibarr
Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). It is open source software (written in PHP) and designed for small and medium businesses, foundations and freelancers. You can freely install, use and distribute it as a standalon…
Stars: ✭ 2,877 (+5328.3%)
Mutual labels:  stock
AlphaVantageRB
A Gem for AlphaVantage
Stars: ✭ 68 (+28.3%)
Mutual labels:  stock
StockPricePredictor
An S&P500 Stock Index Movement Predictor built with Machine Learning models
Stars: ✭ 29 (-45.28%)
Mutual labels:  stock
Acgn Stock
PTT ACGN股票交易市場
Stars: ✭ 252 (+375.47%)
Mutual labels:  stock
Trading Backtest
A stock backtesting engine written in modern Java. And a pairs trading (cointegration) strategy implementation using a bayesian kalman filter model
Stars: ✭ 247 (+366.04%)
Mutual labels:  stock
Deep Rl Trading
playing idealized trading games with deep reinforcement learning
Stars: ✭ 228 (+330.19%)
Mutual labels:  stock
PyTse
TseTmc Crawler
Stars: ✭ 40 (-24.53%)
Mutual labels:  stock
Deeptrade keras
Stars: ✭ 228 (+330.19%)
Mutual labels:  stock
markets
A stock, currency and cryptocurrency tracker
Stars: ✭ 103 (+94.34%)
Mutual labels:  stock
Stocksensation
基于情感字典和机器学习的股市舆情情感分类可视化Web
Stars: ✭ 215 (+305.66%)
Mutual labels:  stock
qluacpp
C++ interface for Quik trading terminal via lua bindings
Stars: ✭ 44 (-16.98%)
Mutual labels:  stock
MyTT
MyTT将通达信,同花顺,文华麦语言等指标公式,最简移植到Python中,核心库单个文件,仅百行代码,十几个核心函数,神奇的实现所有常见技术指标算法(不依赖talib库)的纯python实现和转换通达信MACD,RSI,BOLL,ATR,KDJ,CCI,PSY等公式,全部基于pandas函数计算方法封装,简洁且高性能,能非常方便的应用在股票指标公式,股市期货量化框架分析,自动程序化交易,数字货币量化等领域,它是您最精练的股市量化工具。Python library with most stock market indicators.
Stars: ✭ 888 (+1575.47%)
Mutual labels:  stock
Finance Python
python tools for Finance with the functionality of indicator calculation, business day calculation and so on.
Stars: ✭ 238 (+349.06%)
Mutual labels:  stock
markets-react
📈 Check the stock market, from your phone!
Stars: ✭ 47 (-11.32%)
Mutual labels:  stock

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()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", filings)

    // International filings
    internationalFilings, _, err := finnhubClient.InternationalFilings(context.Background()).Symbol("RY.TO").Execute()
    fmt.Printf("%+v\n", internationalFilings)

    // Filings Sentiment
    filingsSentiment, _, err := finnhubClient.FilingsSentiment(context.Background()).AccessNumber("0000320193-20-000052").Execute()
    fmt.Printf("%+v\n", filingsSentiment)

    // Similarity Index
    similarityIndex, _, err := finnhubClient.SimilarityIndex(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", similarityIndex)

    // Financials
    financials, _, err := finnhubClient.Financials(context.Background()).Symbol("AAPL").Statement("bs").Freq("annual").Execute()
    fmt.Printf("%+v\n", financials)

    // Financials Reported
    financialsReported, _, err := finnhubClient.FinancialsReported(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", financialsReported)

    // Forex candles
    forexCandles, _, err := finnhubClient.ForexCandles(context.Background()).Symbol("OANDA:EUR_USD").Resolution("D").From(1590988249).To(1591852249).Execute()
    fmt.Printf("%+v\n", forexCandles)

    // Forex exchanges
    forexExchanges, _, err := finnhubClient.ForexExchanges(context.Background()).Execute()
    fmt.Printf("%+v\n", forexExchanges)

    // Forex rates
    forexRates, _, err := finnhubClient.ForexRates(context.Background()).Base("USD").Execute()
    fmt.Printf("%+v\n", forexRates)

    // Forex symbols
    forexSymbols, _, err := finnhubClient.ForexSymbols(context.Background()).Exchange("OANDA").Execute()
    fmt.Printf("%+v\n", forexSymbols)

    // Fund ownership
    fundOwnership, _, err := finnhubClient.FundOwnership(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", fundOwnership)

    // General news
    generalNews, _, err := finnhubClient.MarketNews(context.Background()).Category("general").Execute()
    fmt.Printf("%+v\n", generalNews)

    // Ipo calendar
    ipoCalendar, _, err := finnhubClient.IpoCalendar(context.Background()).From("2021-01-01").To("2021-06-30").Execute()
    fmt.Printf("%+v\n", ipoCalendar)

    // Press Releases
    majorDevelopment, _, err := finnhubClient.PressReleases(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", majorDevelopment)

    // News sentiment
    newsSentiment, _, err := finnhubClient.NewsSentiment(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", newsSentiment)

    // Pattern recognition
    patterns, _, err := finnhubClient.PatternRecognition(context.Background()).Symbol("AAPL").Resolution("D").Execute()
    fmt.Printf("%+v\n", patterns)

    // Price target
    priceTarget, _, err := finnhubClient.PriceTarget(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", priceTarget)

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

    // Recommendation trends
    recommendationTrend, _, err := finnhubClient.RecommendationTrends(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", recommendationTrend)

    // Stock dividends
    dividends, _, err := finnhubClient.StockDividends(context.Background()).Symbol("KO").From("2019-01-01").To("2021-01-01").Execute()
    fmt.Printf("%+v\n", dividends)

    // Splits
    splits, _, err := finnhubClient.StockSplits(context.Background()).Symbol("AAPL").From("2000-01-01").To("2020-06-15").Execute()
    fmt.Printf("%+v\n", splits)

    // Stock symbols
    stockSymbols, _, err := finnhubClient.StockSymbols(context.Background()).Exchange("US").Execute()
    fmt.Printf("%+v\n", stockSymbols[0:5])

    // Support resistance
    supportResitance, _, err := finnhubClient.SupportResistance(context.Background()).Symbol("AAPL").Resolution("D").Execute()
    fmt.Printf("%+v\n", supportResitance)

    // Technical indicator
    technicalIndicator, _, err := finnhubClient.TechnicalIndicator(context.Background()).Symbol("AAPL").Resolution("D").From(1583098857).To(1584308457).Indicator("sma").IndicatorFields(map[string]interface{}{"timeperiod": 3}).Execute()
    fmt.Printf("%+v\n", technicalIndicator)

    // Transcripts
    transcripts, _, err := finnhubClient.Transcripts(context.Background()).Id("AAPL_162777").Execute()
    fmt.Printf("%+v\n", transcripts)

    // Transcripts list
    transcriptsList, _, err := finnhubClient.TranscriptsList(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", transcriptsList)

    // Upgrade/downgrade
    upgradeDowngrade, _, err := finnhubClient.UpgradeDowngrade(context.Background()).Symbol("BYND").Execute()
    fmt.Printf("%+v\n", upgradeDowngrade)

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

    // Indices Constituents
    indicesConstData, _, err := finnhubClient.IndicesConstituents(context.Background()).Symbol("^GSPC").Execute()
    fmt.Printf("%+v\n", indicesConstData)

    // Indices Historical Constituents
    indicesHistoricalConstData, _, err := finnhubClient.IndicesHistoricalConstituents(context.Background()).Symbol("^GSPC").Execute()
    fmt.Printf("%+v\n", indicesHistoricalConstData)

    // ETFs Profile
    etfsProfileData, _, err := finnhubClient.EtfsProfile(context.Background()).Symbol("SPY").Execute()
    fmt.Printf("%+v\n", etfsProfileData)

    // ETFs Holdings
    etfsHoldingsData, _, err := finnhubClient.EtfsHoldings(context.Background()).Symbol("SPY").Execute()
    fmt.Printf("%+v\n", etfsHoldingsData)

    // ETFs Industry Exposure
    etfsIndustryExposureData, _, err := finnhubClient.EtfsSectorExposure(context.Background()).Symbol("SPY").Execute()
    fmt.Printf("%+v\n", etfsIndustryExposureData)

    // ETFs Country Exposure
    etfsCountryExposureData, _, err := finnhubClient.EtfsCountryExposure(context.Background()).Symbol("SPY").Execute()
    fmt.Printf("%+v\n", etfsCountryExposureData)

    // Mutual Funds Profile
    mfProfileData, _, err := finnhubClient.MutualFundProfile(context.Background()).Symbol("VTSAX").Execute()
    fmt.Printf("%+v\n", mfProfileData)

    // Mutual Funds Holdings
    mfHoldingsData, _, err := finnhubClient.MutualFundHoldings(context.Background()).Symbol("VTSAX").Execute()
    fmt.Printf("%+v\n", mfHoldingsData)

    // Mutual Funds Industry Exposure
    mfIndustryExposureData, _, err := finnhubClient.MutualFundSectorExposure(context.Background()).Symbol("VTSAX").Execute()
    fmt.Printf("%+v\n", mfIndustryExposureData)

    // Mutual Funds Country Exposure
    mfCountryExposureData, _, err := finnhubClient.MutualFundCountryExposure(context.Background()).Symbol("VTSAX").Execute()
    fmt.Printf("%+v\n", mfCountryExposureData)

    // Insider Transactions
    insiderTransactions, _, err := finnhubClient.InsiderTransactions(context.Background()).Symbol("AAPL").From("2021-01-01").To("2021-07-30").Execute()
    fmt.Printf("%+v\n", insiderTransactions)

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

    // Social Sentiment
    socialSentiment, _, err := finnhubClient.SocialSentiment(context.Background()).Symbol("GME").Execute()
    fmt.Printf("%+v\n", socialSentiment)

    // Investment theme
    investmentTheme, _, err := finnhubClient.InvestmentThemes(context.Background()).Theme("financialExchangesData").Execute()
    fmt.Printf("%+v\n", investmentTheme)

    // Supply chain
    supplyChain, _, err := finnhubClient.SupplyChainRelationships(context.Background()).Symbol("AAPL").Execute()
    fmt.Printf("%+v\n", supplyChain)

    //Symbol lookup
    searchResult, _, err := finnhubClient.SymbolSearch(context.Background()).Q("AAPL").Execute()
    fmt.Printf("%+v\n", searchResult)
    
    // Company ESG
    companyESGScore, _, err := finnhubClient.CompanyEsgScore(context.Background()).Symbol("AAPL").Execute()
	fmt.Printf("%+v\n", companyESGScore)
    
    // Company Earnings Quality Score
    earningsQualityScore, _, err := finnhubClient.CompanyEarningsQualityScore(context.Background()).Symbol("AAPL").Freq("quarterly").Execute()
    if err != nil {
		panic(err)
	}
    fmt.Printf("%+v\n", earningsQualityScore)   
    
    // Crypto Profile
    cryptoProfile, _, err := finnhubClient.CryptoProfile(context.Background()).Symbol("BTC").Execute()
	if err != nil {
		panic(err)
	}
	fmt.Println(objectString(cryptoProfile))

    // EBITDA Estimates
    ebitdaEstimates, _, err := finnhubClient.CompanyEbitdaEstimates(context.Background()).Symbol("AAPL").Freq("annual").Execute()
    if err != nil {
        panic(err)
    }
    fmt.Printf("%+v\n", ebitdaEstimates)
    
    // EBIT Estimates
    ebitEstimates, _, err := finnhubClient.CompanyEbitEstimates(context.Background()).Symbol("AAPL").Freq("annual").Execute()
    if err != nil {
        panic(err)
    }
    fmt.Printf("%+v\n", ebitEstimates)

    // USPTO Patent
    uspto, _, err := finnhubClient.StockUsptoPatent(context.Background()).Symbol("NVDA").From("2021-01-01").To("2021-12-31").Execute()
    if err != nil {
        panic(err)
    }
    fmt.Printf("%+v\n", uspto)

    // Visa Application
    visa, _, err := finnhubClient.StockVisaApplication(context.Background()).Symbol("AAPL").From("2021-01-01").To("2021-12-31").Execute()
    if err != nil {
        panic(err)
    }
    fmt.Printf("%+v\n", visa)
    
    sectorMetric, _, err := finnhubClient.SectorMetric(context.Background()).Region("NA").Execute()
    if err != nil {
        panic(err)
    }
    fmt.Printf("%+v\n", sectorMetric)
    
}

License

Apache License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].