datafetch

package
v0.2.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 20 Imported by: 1

Documentation

Overview

file: insyra/datafetch/yfinance_errors.go

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRateLimited   = errors.New("yfinance: rate limited")
	ErrTimeout       = errors.New("yfinance: timeout")
	ErrInvalidSymbol = errors.New("yfinance: invalid symbol")
)

Functions

func GoogleMapsStores

func GoogleMapsStores() *googleMapsStoreCrawler

GoogleMapsStores returns a crawler for Google Maps store data. Returns nil if failed to initialize.

func YFinance added in v0.2.13

func YFinance(cfg YFinanceConfig) (*yahooFinance, error)

YFinance creates a YahooFinance fetcher using a config struct (no WithXxx in public API).

Types

type GoogleMapsStoreData added in v0.1.3

type GoogleMapsStoreData struct {
	ID   string
	Name string
}

type GoogleMapsStoreReview added in v0.1.1

type GoogleMapsStoreReview struct {
	Reviewer      string `json:"reviewer"`
	ReviewerID    string `json:"reviewer_id"`
	ReviewerState string `json:"reviewer_state"`
	ReviewerLevel int    `json:"reviewer_level"`
	ReviewTime    string `json:"review_time"`
	ReviewDate    string `json:"review_date"`
	Content       string `json:"content"`
	Rating        int    `json:"rating"`
}

GoogleMapsStoreReview is a struct for Google Maps store reviews.

type GoogleMapsStoreReviewSortBy added in v0.1.1

type GoogleMapsStoreReviewSortBy uint8
const (
	// SortByRelevance 按相關性排序
	SortByRelevance GoogleMapsStoreReviewSortBy = 1
	// SortByNewest 按最新排序
	SortByNewest GoogleMapsStoreReviewSortBy = 2
	// SortByRating 按評分排序
	SortByHighestRating GoogleMapsStoreReviewSortBy = 3
	// SortByLowestRating 按最低評分排序
	SortByLowestRating GoogleMapsStoreReviewSortBy = 4
)

type GoogleMapsStoreReviews added in v0.1.2

type GoogleMapsStoreReviews []GoogleMapsStoreReview

GoogleMapsStoreReviews is a slice of GoogleMapsStoreReview.

func (GoogleMapsStoreReviews) ToDataTable added in v0.1.2

func (reviews GoogleMapsStoreReviews) ToDataTable() *insyra.DataTable

ToDataTable converts the reviews to a DataTable.

type GoogleMapsStoreReviewsFetchingOptions added in v0.1.1

type GoogleMapsStoreReviewsFetchingOptions struct {
	SortBy GoogleMapsStoreReviewSortBy
	// MaxWaitingInterval_Milliseconds is the maximum waiting interval in milliseconds between requests.
	MaxWaitingInterval_Milliseconds uint
}

GoogleMapsStoreReviewsFetchingOptions is a struct for options when fetching reviews.

type YFFinancialStatementTables added in v0.2.13

type YFFinancialStatementTables struct {
	Values *insyra.DataTable
	Items  *insyra.DataTable
	Meta   *insyra.DataTable
}

YFFinancialStatementTables provides multiple views of a statement.

type YFHistoryParams added in v0.2.13

type YFHistoryParams = models.HistoryParams

type YFOptionChainTables added in v0.2.13

type YFOptionChainTables struct {
	Calls      *insyra.DataTable
	Puts       *insyra.DataTable
	Underlying *insyra.DataTable
	Expiration time.Time
}

YFOptionChainTables splits option chains into separate tables.

type YFPeriod added in v0.2.13

type YFPeriod string

YFPeriod represents frequency values used for financial statements. Accepted values: YFPeriodAnnual, YFPeriodYearly, YFPeriodQuarterly. When empty or unrecognized, it defaults to YFPeriodAnnual.

const (
	YFPeriodAnnual    YFPeriod = "annual"
	YFPeriodYearly    YFPeriod = "yearly"
	YFPeriodQuarterly YFPeriod = "quarterly"
)

type YFinanceConfig added in v0.2.13

type YFinanceConfig struct {
	// Timeout: 單次請求最多等待多久(避免卡死)
	Timeout time.Duration

	// Interval: 每次請求之間最少要隔多久(節流)
	// 0 表示不節流
	Interval time.Duration

	// UserAgent: HTTP User-Agent
	UserAgent string

	// Retries: 失敗時重試次數(0 表示不重試)
	Retries int

	// RetryBackoff: 每次重試前等待多久(0 表示用預設)
	RetryBackoff time.Duration

	// Concurrency: 多 ticker 並行抓取時的最大並行數(0 表示用預設)
	Concurrency int
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL