historical

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IntradayChartURI represents the URI for retrieving intraday historical chart data.
	IntradayChartURI string = "/historical-chart"
	// DailyChartEODURI represents the URI for retrieving end-of-day historical price data.
	DailyChartEODURI string = "/historical-price-full"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DailyChartEOD

type DailyChartEOD struct {
	Symbol     string           `json:"symbol"`
	Historical []historicalData `json:"historical"`
}

DailyChartEOD represents end-of-day daily chart data for a specific symbol.

type Historical

type Historical interface {
	IntradayChart | DailyChartEOD
}

Historical is an interface that represents historical data. Date represents the timestamp of the data point. Open represents the opening price of the asset at the given timestamp. Low represents the lowest price of the asset during the time interval. High represents the highest price of the asset during the time interval. Close represents the closing price of the asset at the given timestamp. Volume represents the trading volume of the asset at the given timestamp.

type IntradayChart

type IntradayChart []struct {
	Date   string  `json:"date"`
	Open   float64 `json:"open"`
	Low    float64 `json:"low"`
	High   float64 `json:"high"`
	Close  float64 `json:"close"`
	Volume uint64  `json:"volume"`
}

IntradayChart represents the response structure of intraday chart data. @see https://site.financialmodelingprep.com/developer/docs/historical-stock-data-free-api

type PathParameter

type PathParameter struct {
	URI       string
	Timeframe string
	Symbol    string
}

PathParameter represents a path object used for TechnicalIndicator interface.

func (*PathParameter) GetURLWithPath

func (parameters *PathParameter) GetURLWithPath() string

GetURLWithPath constructs the URL for a historical data based on the provided uri, timeframe and symbol.

type Query

type Query struct {
	From      string
	To        string
	SerieType string
	APIKey    string
}

Query represents a query object used for TechnicalIndicator interface.

func (*Query) GetURL

func (query *Query) GetURL(pathParameters PathParameter) string

GetURL constructs the URL for the company search based on the provided URI and query parameters.

type Repository

type Repository struct {
	HTTPClient api.ClientInterface
}

Repository represents a repository for interacting with API Stock Historical price endpoints

func (*Repository) GetDailyChartEOD

func (repository *Repository) GetDailyChartEOD(pathParameter PathParameter, query Query) (*DailyChartEOD, error)

GetDailyChartEOD retrieves Daily Chart EOD data based on the provided path parameter and query.

func (*Repository) GetIntradayChart

func (repository *Repository) GetIntradayChart(pathParameter PathParameter, query Query) (*IntradayChart, error)

GetIntradayChart retrieves Intraday Historical data based on the provided path parameter and query.

Jump to

Keyboard shortcuts

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