go-yfinance v1.0.0 Update

Released go-yfinance v1.0.0.

Author Avatar

wonjoon

  ยท  4 min read

ranaroussi/yfinance v1.0.0 Update #

On December 23rd (KST), ranaroussi/yfinance was updated to v1.0.0.


image


The update introduces Calendars, a new feature for querying market-wide events, and Lookup, which expands ticker search capabilities. Additionally, Sector, Industry, and Market features have been added, enabling analysis by sector, industry, and market.

v1.0.0 Major Changes #

ChangeDescription
Calendars Module (New)Query market-wide calendar events
Config Module (New)Global configuration management (yf.config)
Network RetryAutomatic retry on network errors

Feature Comparison: go-yfinance vs. ranaroussi/yfinance v1.0.0 #

FeaturePython v1.0.0GoNote
Ticker (Basic)โœ…โœ…Identical
History (Price Data)โœ…โœ…Identical
Info (Company Info)โœ…โœ…Identical
Financialsโœ…โœ…Identical
Optionsโœ…โœ…Identical
Holdersโœ…โœ…Identical
Analysisโœ…โœ…Identical
Calendar (Per Ticker)โœ…โœ…Identical
Newsโœ…โœ…Identical
WebSocket (Real-time)โœ…โœ…Identical
Searchโœ…โœ…Identical
Screenerโœ…โœ…Identical
Multi/Downloadโœ…โœ…Identical
Lookupโœ…โŒNot Implemented
Sector/Industry/Marketโœ…โŒNot Implemented
Calendars (Global)โœ…โŒNew in v1.0.0
Config (Global)โœ…๐Ÿ”ถPartially Implemented
  • All existing features are identical; however, four features from v1.0.0 were missing in go-yfinance.

Analysis of Unimplemented Modules #

Lookup #

API Analysis

ItemDetails
EndpointGET /v1/finance/lookup
go-yfinanceLookupURL already defined โœ…
Python Implyfinance/lookup.py (221 lines)

Usage (Python)

yf.Lookup(query="AAPL")  # Search ticker by ISIN, CUSIP, etc.

Request Parameters

  • query: Search term (Required)
  • type: all, equity, mutualfund, etf, index, future, currency, cryptocurrency
  • count: Number of results (Default 25)
  • start: Pagination
  • formatted: false
  • fetchPricingData: true
  • lang: en-US
  • region: US

Response Structure

{
  "finance": {
    "result": [{
      "documents": [
        {"symbol": "AAPL", "name": "Apple Inc.", "exchange": "NMS", ...}
      ]
    }]
  }
}

Implementation Plan

  • Model Definition: pkg/models/lookup.go
  • Implementation: pkg/lookup/lookup.go
  • Testing: pkg/lookup/lookup_test.go
  • Estimated Workload: ~300 lines

Calendars #

API Analysis

ItemDetails
EndpointPOST /v1/finance/visualization
go-yfinanceDefinition Needed โŒ
Python Implyfinance/calendars.py (547 lines)
  • go-yfinance’s Calendar() only supports calendars for individual Tickers.
  • Python’s Calendars supports querying market-wide calendar events.

Usage (Python)

calendars = yf.Calendars(start="2025-01-01", end="2025-01-07")
calendars.get_earnings_calendar()        # Earnings schedule
calendars.get_ipo_info_calendar()        # IPO schedule
calendars.get_economic_events_calendar() # Economic events
calendars.get_splits_calendar()          # Stock splits schedule

Request Structure (POST Body)

{
  "sortType": "DESC",
  "entityIdType": "sp_earnings|ipo_info|economic_event|splits",
  "sortField": "intradaymarketcap|startdatetime",
  "includeFields": ["ticker", "companyshortname", ...],
  "size": 100,
  "offset": 0,
  "query": {
    "operator": "AND",
    "operands": [
      {"operator": "eq", "operands": ["region", "us"]},
      {"operator": "gte", "operands": ["startdatetime", "2025-01-01"]}
    ]
  }
}

Supported Calendar Types

TypeDescriptionFields
sp_earningsEarningsticker, companyshortname, epsestimate, epsactual, …
ipo_infoIPO Infoticker, filingdate, pricefrom, priceto, shares, …
economic_eventEconomic Eventsecon_release, country_code, consensus_estimate, …
splitsSplitsticker, startdatetime, old_share_worth, share_worth

Implementation Plan

  • Model Definition: pkg/models/calendar_market.go
  • Query Builder: pkg/calendars/query.go
  • Implementation: pkg/calendars/calendars.go
  • Testing: pkg/calendars/calendars_test.go
  • Estimated Workload: ~700 lines

Domain (Sector/Industry/Market) #

Usage (Python)

yf.Sector("technology")   # Sector info
yf.Industry("software")   # Industry info
yf.Market("us_market")    # Market info

Sector

ItemDetails
EndpointGET /v1/finance/sectors/{key}
go-yfinanceDefinition Needed โŒ
Python Implyfinance/domain/sector.py (153 lines)

Provided Data:

  • name, symbol, overview (market cap, company count, industry count, etc.)
  • top_companies
  • top_etfs, top_mutual_funds
  • industries (list of included industries)
  • research_reports

Industry

ItemDetails
EndpointGET /v1/finance/industries/{key}
go-yfinanceDefinition Needed โŒ
Python Implyfinance/domain/industry.py (154 lines)

Provided Data:

  • name, symbol, overview
  • sector_key, sector_name (Parent Sector)
  • top_companies, top_performing_companies, top_growth_companies
  • research_reports

Market

ItemDetails
EndpointGET /v6/finance/quote/marketSummary, GET /v6/finance/markettime
go-yfinanceMarketSummaryURL defined โœ…
Python Implyfinance/domain/market.py (108 lines)

Provided Data:

  • status (market state, open/close times, timezone)
  • summary (price and change rate by major index)

Implementation Plan

  • Models: pkg/models/domain.go
  • Common Interface: pkg/domain/domain.go
  • Sector: pkg/domain/sector.go
  • Industry: pkg/domain/industry.go
  • Market: pkg/domain/market.go
  • Testing: pkg/domain/*_test.go
  • Estimated Workload: ~920 lines

Config #

go-yfinance already implements a richer Config than Python v1.0.0.

SettingPython v1.0.0go-yfinance
Proxyโœ…โœ…
Retriesโœ…โœ…
Debug/Loggingโœ…โœ…
TimeoutโŒโœ…
UserAgentโŒโœ…
JA3 FingerprintโŒโœ…
Retry DelayโŒโœ…
Max ConcurrentโŒโœ…
Cache TTLโŒโœ…

Due to language characteristics, Python uses a nested style (config.network.proxy), while Go uses a method chain style (SetProxy()) in its API. However, since Config is set once at application startup and only read thereafter, I determined that there is no practical performance difference, so no changes are necessary.

Performance Comparison

ItemNested StyleMethod Chain
MemorySlightly moreEfficient
Runtime OverheadDynamic lookupDirect call
Compile-time CheckโŒ Impossibleโœ… Possible

Issues Resolved #

Calendars Earnings API 500 Error

  • Cause: Query structure issue - date queries were wrapped in a nested AND.
  • Resolution: Added buildDateQueries() to pass GTE/LTE as individual operands.
// Before (Error)
Operands: []interface{}{
    query{Operator: "EQ", ...},
    query{Operator: "AND", Operands: [GTE, LTE]},  // Nested AND
}

// After (Success)
Operands: []interface{}{
    query{Operator: "EQ", ...},
    gteQuery,  // Included directly
    lteQuery,  // Included directly
}

SplitEvent Type Conflict

  • Cause: SplitEvent was already defined in pkg/models/response.go.
  • Resolution: Renamed to CalendarSplitEvent.

Post Method Signature Mismatch

  • Cause: client.Post accepted map[string]string, but Calendars required map[string]interface{}.
  • Resolution: Used client.PostJSON + json.Marshal for body serialization.

Result #

go-yfinance v1.0.0 Release Note