Documentation ¶
Index ¶
- func WrapError(err error) error
- type AssetClass
- type AssetType
- type BISTStockLiveData
- type Client
- func (c *Client) CreateCustomTheme(ctx context.Context, params CreateCustomThemeParams) (*primitive.ObjectID, error)
- func (c *Client) DeleteCustomTheme(ctx context.Context, id primitive.ObjectID) error
- func (c *Client) GetAllCollections(ctx context.Context, region Region, locale Locale) ([]Collection, error)
- func (c *Client) GetAllCustomThemes(ctx context.Context, locale Locale) ([]Collection, error)
- func (c *Client) GetAllIndustries(ctx context.Context, region Region, locale Locale) ([]Collection, error)
- func (c *Client) GetAllSectors(ctx context.Context, region Region, locale Locale) ([]Collection, error)
- func (c *Client) GetAllStocks(ctx context.Context, region Region) ([]Stock, error)
- func (c *Client) GetAllThemes(ctx context.Context, region Region, locale Locale) ([]Collection, error)
- func (c *Client) GetCollectionDetail(ctx context.Context, id string, region Region, locale Locale) (CollectionDetail, error)
- func (c *Client) GetCustomThemeDetail(ctx context.Context, id string, region Region, locale Locale, sortBy SortBy) (CollectionDetail, error)
- func (c *Client) GetFinancialRatioComparison(ctx context.Context, symbol string, region Region) ([]StockSectorFinancialRatioComparison, error)
- func (c *Client) GetHistoricalFinancialSheets(ctx context.Context, symbol string, from FinancialSheetDate, ...) (HistoricalFinancialSheets, error)
- func (c *Client) GetHistoricalPrices(ctx context.Context, symbols []string, region Region, ...) ([]StockPriceGraph, error)
- func (c *Client) GetHistoricalRatios(ctx context.Context, symbol string, keys []HistoricalRatiosKey, region Region) (StockHistoricalRatios, error)
- func (c *Client) GetHistoricalRatiosDescriptions(ctx context.Context, locale Locale, region Region) ([]StockHistoricalRatiosDescription, error)
- func (c *Client) GetIndustryDetail(ctx context.Context, id string, region Region, locale Locale) (CollectionDetail, error)
- func (c *Client) GetLivePriceForBIST(ctx context.Context, symbols []string) (data <-chan BISTStockLiveData, errors <-chan error, close func(), err error)
- func (c *Client) GetLivePriceForUS(ctx context.Context, symbols []string) (data <-chan USStockLiveData, errors <-chan error, close func(), err error)
- func (c *Client) GetSectorDetail(ctx context.Context, id string, region Region, locale Locale) (CollectionDetail, error)
- func (c *Client) GetStockDetailByID(ctx context.Context, id string, locale Locale) (StockDetail, error)
- func (c *Client) GetStockDetailBySymbol(ctx context.Context, symbol string, assetClass AssetClass, region Region, ...) (StockDetail, error)
- func (c *Client) GetStockDividends(ctx context.Context, symbol string, region Region) ([]StockDividend, error)
- func (c *Client) GetStockStats(ctx context.Context, symbols []string, keys []StockStatsKey, region Region) ([]StockStats, error)
- func (c *Client) GetThemeDetail(ctx context.Context, id string, region Region, locale Locale) (CollectionDetail, error)
- func (c *Client) GetTopMovers(ctx context.Context, region Region) ([]TopMover, error)
- func (c *Client) Search(ctx context.Context, query string, types []SearchType, region Region, ...) (*SearchResponse, error)
- func (c *Client) UpdateCustomTheme(ctx context.Context, id primitive.ObjectID, params UpdateCustomThemeParams) error
- type Collection
- type CollectionDetail
- type CollectionStatus
- type CollectionType
- type CreateCustomThemeParams
- type Currency
- type FinancialSheetDate
- type FinancialSheetPeriod
- type FinancialSheetType
- type HistoricalFinancialSheet
- type HistoricalFinancialSheetRow
- type HistoricalFinancialSheets
- type HistoricalPricePeriod
- type HistoricalRatiosKey
- type LaplaceError
- type LaplaceHTTPError
- type Locale
- type LocaleString
- type PaginationPageSize
- type PriceDataPoint
- type Region
- type SearchResponse
- type SearchResponseCollection
- type SearchResponseStock
- type SearchType
- type SortBy
- type Stock
- type StockDetail
- type StockDividend
- type StockHistoricalRatios
- type StockHistoricalRatiosData
- type StockHistoricalRatiosDescription
- type StockHistoricalRatiosFormatting
- type StockHistoricalRatiosValue
- type StockLiveData
- type StockPriceGraph
- type StockSectorFinancialRatioComparison
- type StockSectorFinancialRatioComparisonDetail
- type StockStats
- type StockStatsKey
- type TopMover
- type USStockLiveData
- type UpdateCustomThemeParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssetClass ¶
type AssetClass string
const ( AssetClassEquity AssetClass = "equity" AssetClassCrypto AssetClass = "crypto" )
type BISTStockLiveData ¶
type BISTStockLiveData struct { Symbol string `json:"s"` DailyPercentChange float64 `json:"ch"` ClosePrice float64 `json:"p"` StockLiveData }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient( cfg utilities.LaplaceConfiguration, logger *logrus.Logger, ) *Client
func (*Client) CreateCustomTheme ¶
func (*Client) DeleteCustomTheme ¶
func (*Client) GetAllCollections ¶
func (*Client) GetAllCustomThemes ¶
func (*Client) GetAllIndustries ¶
func (*Client) GetAllSectors ¶
func (*Client) GetAllStocks ¶
func (*Client) GetAllThemes ¶
func (*Client) GetCollectionDetail ¶
func (*Client) GetCustomThemeDetail ¶
func (*Client) GetFinancialRatioComparison ¶
func (*Client) GetHistoricalFinancialSheets ¶
func (c *Client) GetHistoricalFinancialSheets(ctx context.Context, symbol string, from FinancialSheetDate, to FinancialSheetDate, sheetType FinancialSheetType, period FinancialSheetPeriod, currency Currency, region Region) (HistoricalFinancialSheets, error)
func (*Client) GetHistoricalPrices ¶
func (c *Client) GetHistoricalPrices(ctx context.Context, symbols []string, region Region, keys []HistoricalPricePeriod) ([]StockPriceGraph, error)
func (*Client) GetHistoricalRatios ¶
func (c *Client) GetHistoricalRatios(ctx context.Context, symbol string, keys []HistoricalRatiosKey, region Region) (StockHistoricalRatios, error)
func (*Client) GetHistoricalRatiosDescriptions ¶
func (*Client) GetIndustryDetail ¶
func (*Client) GetLivePriceForBIST ¶
func (*Client) GetLivePriceForUS ¶
func (*Client) GetSectorDetail ¶
func (*Client) GetStockDetailByID ¶
func (*Client) GetStockDetailBySymbol ¶
func (c *Client) GetStockDetailBySymbol(ctx context.Context, symbol string, assetClass AssetClass, region Region, locale Locale) (StockDetail, error)
func (*Client) GetStockDividends ¶
func (*Client) GetStockStats ¶
func (c *Client) GetStockStats(ctx context.Context, symbols []string, keys []StockStatsKey, region Region) ([]StockStats, error)
func (*Client) GetThemeDetail ¶
func (*Client) GetTopMovers ¶
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, query string, types []SearchType, region Region, locale Locale, page int, pageSize PaginationPageSize) (*SearchResponse, error)
func (*Client) UpdateCustomTheme ¶
type Collection ¶
type Collection struct { ID primitive.ObjectID `json:"id"` Title string `json:"title"` Description string `json:"description"` Region []Region `json:"region"` AssetClass string `json:"assetClass"` ImageUrl string `json:"imageUrl"` AvatarUrl string `json:"avatarUrl"` NumStocks int `json:"numStocks"` Image string `json:"image"` Order int `json:"order"` Status CollectionStatus `json:"status,omitempty"` MetaData map[string]any `json:"metaData,omitempty"` }
type CollectionDetail ¶
type CollectionDetail struct { *Collection `json:",inline"` Stocks []Stock `json:"stocks"` }
type CollectionStatus ¶
type CollectionStatus string
const ( CollectionStatusActive CollectionStatus = "active" CollectionStatusInactive CollectionStatus = "inactive" )
type CollectionType ¶
type CollectionType string
const ( CollectionTypeSector CollectionType = "sector" CollectionTypeIndustry CollectionType = "industry" CollectionTypeTheme CollectionType = "theme" CollectionTypeCustomTheme CollectionType = "custom-theme" CollectionTypeCollection CollectionType = "collection" )
type CreateCustomThemeParams ¶
type CreateCustomThemeParams struct { Title LocaleString `json:"title,omitempty" bson:"title,omitempty" validate:"required"` Description LocaleString `json:"description,omitempty" bson:"description,omitempty"` Region []Region `json:"region,omitempty" bson:"region,omitempty"` ImageURL string `json:"image_url" bson:"image_url"` Image string `json:"image" bson:"image"` AvatarImageURL string `json:"avatar_url" bson:"avatar_image_url"` Stocks []primitive.ObjectID `json:"stocks" bson:"stocks" validate:"required"` Order int `json:"order" bson:"order"` Status CollectionStatus `json:"status" bson:"status" validate:"required,oneof=active inactive"` MetaData map[string]any `json:"meta_data,omitempty" bson:"meta_data,omitempty"` }
type FinancialSheetDate ¶
type FinancialSheetPeriod ¶
type FinancialSheetPeriod string
const ( FinancialSheetPeriodAnnual FinancialSheetPeriod = "annual" FinancialSheetPeriodQuarterly FinancialSheetPeriod = "quarterly" FinancialSheetPeriodCumulative FinancialSheetPeriod = "cumulative" )
type FinancialSheetType ¶
type FinancialSheetType string
const ( FinancialSheetIncomeStatement FinancialSheetType = "incomeStatement" FinancialSheetBalanceSheet FinancialSheetType = "balanceSheet" FinancialSheetCashFlow FinancialSheetType = "cashFlowStatement" )
type HistoricalFinancialSheet ¶
type HistoricalFinancialSheet struct { Period string `json:"period"` Rows []HistoricalFinancialSheetRow `json:"rows"` }
type HistoricalFinancialSheets ¶
type HistoricalFinancialSheets struct {
Sheets []HistoricalFinancialSheet `json:"sheets"`
}
type HistoricalPricePeriod ¶
type HistoricalPricePeriod string
const ( HistoricalPricePeriodOneDay HistoricalPricePeriod = "1D" HistoricalPricePeriodOneWeek HistoricalPricePeriod = "1W" HistoricalPricePeriodOneMonth HistoricalPricePeriod = "1M" HistoricalPricePeriodThreeMonth HistoricalPricePeriod = "3M" HistoricalPricePeriodOneYear HistoricalPricePeriod = "1Y" HistoricalPricePeriodTwoYear HistoricalPricePeriod = "2Y" HistoricalPricePeriodThreeYear HistoricalPricePeriod = "3Y" HistoricalPricePeriodFiveYear HistoricalPricePeriod = "5Y" )
type HistoricalRatiosKey ¶
type HistoricalRatiosKey string
const ( HistoricalRatiosKeyPriceToEarningsRatio HistoricalRatiosKey = "pe-ratio" HistoricalRatiosKeyReturnOnEquity HistoricalRatiosKey = "roe" HistoricalRatiosKeyReturnOnAssets HistoricalRatiosKey = "roa" HistoricalRatiosKeyReturnOnCapital HistoricalRatiosKey = "roic" )
type LaplaceError ¶
type LaplaceError error
var ( ErrYouDoNotHaveAccessToEndpoint LaplaceError = errors.New("you do not have access to this endpoint") ErrLimitExceeded LaplaceError = errors.New("limit exceeded") ErrEndpointIsNotActive LaplaceError = errors.New("endpoint is not active") ErrInvalidToken LaplaceError = errors.New("invalid token") ErrInvalidID LaplaceError = errors.New("invalid object id") )
type LaplaceHTTPError ¶
type LaplaceHTTPError struct { HTTPStatus int `json:"code"` Message string `json:"msg"` InternalError error `json:"-"` }
func HttpError ¶
func HttpError(httpStatus int, fmtString string, args ...interface{}) *LaplaceHTTPError
func (*LaplaceHTTPError) Cause ¶
func (e *LaplaceHTTPError) Cause() error
Cause returns the root cause error
func (*LaplaceHTTPError) Error ¶
func (e *LaplaceHTTPError) Error() string
func (*LaplaceHTTPError) Is ¶
func (e *LaplaceHTTPError) Is(target error) bool
func (*LaplaceHTTPError) Unwrap ¶
func (e *LaplaceHTTPError) Unwrap() error
func (*LaplaceHTTPError) WithInternalError ¶
func (e *LaplaceHTTPError) WithInternalError(err error) *LaplaceHTTPError
WithInternalError adds internal error information to the error
type LocaleString ¶
type PaginationPageSize ¶
type PaginationPageSize int
const ( PageSize10 PaginationPageSize = 10 PageSize20 PaginationPageSize = 20 PageSize50 PaginationPageSize = 50 )
type PriceDataPoint ¶
type SearchResponse ¶
type SearchResponse struct { Stocks []SearchResponseStock `json:"stocks"` Collections []SearchResponseCollection `json:"collections"` Sectors []SearchResponseCollection `json:"sectors"` Industries []SearchResponseCollection `json:"industries"` }
type SearchResponseStock ¶
type SearchType ¶
type SearchType string
const ( SearchTypeStock SearchType = "stock" SearchTypeCollection SearchType = "collection" SearchTypeSector SearchType = "sector" SearchTypeIndustry SearchType = "industry" )
type Stock ¶
type Stock struct { ID primitive.ObjectID `json:"id"` AssetType AssetType `json:"assetType"` Name string `json:"name"` Symbol string `json:"symbol"` SectorId primitive.ObjectID `json:"sectorId"` IndustryId primitive.ObjectID `json:"industryId"` UpdatedDate time.Time `json:"updatedDate"` DailyChange float64 `json:"dailyChange,omitempty"` }
type StockDetail ¶
type StockDetail struct { ID primitive.ObjectID `json:"id"` AssetType AssetType `json:"assetType"` AssetClass AssetClass `json:"assetClass"` Name string `json:"name"` Symbol string `json:"symbol"` Description string `json:"description"` LocalizedDescription LocaleString `json:"localized_description"` ShortDescription string `json:"shortDescription"` LocalizedShortDescription LocaleString `json:"localizedShortDescription"` Region string `json:"region"` SectorId primitive.ObjectID `json:"sectorId"` IndustryId primitive.ObjectID `json:"industryId"` UpdatedDate time.Time `json:"updatedDate"` }
type StockDividend ¶
type StockHistoricalRatios ¶
type StockHistoricalRatios struct { Symbol string `json:"symbol"` Data []StockHistoricalRatiosData `json:"data"` Formatting map[string]StockHistoricalRatiosFormatting `json:"formatting"` }
type StockHistoricalRatiosData ¶
type StockHistoricalRatiosData struct { FiscalYear int `json:"fiscalYear"` FiscalQuarter int `json:"fiscalQuarter"` Values map[string]StockHistoricalRatiosValue `json:"values"` }
type StockHistoricalRatiosDescription ¶
type StockHistoricalRatiosDescription struct { Slug string `json:"slug"` Name string `json:"name"` Suffix string `json:"suffix"` Prefix string `json:"prefix"` Display bool `json:"display"` Precision int `json:"precision"` Multiplier float64 `json:"multiplier"` Description string `json:"description"` Interval string `json:"interval"` }
type StockHistoricalRatiosFormatting ¶
type StockHistoricalRatiosFormatting struct { Name string `json:"name"` Slug string `json:"slug"` Precision int `json:"precision"` Multiplier float64 `json:"multiplier"` Suffix string `json:"suffix"` Prefix string `json:"prefix"` Interval string `json:"interval"` Description string `json:"description"` }
type StockLiveData ¶
type StockLiveData interface{}
type StockPriceGraph ¶
type StockPriceGraph struct { Symbol string `json:"symbol"` OneDay []PriceDataPoint `json:"1D"` OneWeek []PriceDataPoint `json:"1W"` OneMonth []PriceDataPoint `json:"1M"` ThreeMonth []PriceDataPoint `json:"3M"` OneYear []PriceDataPoint `json:"1Y"` TwoYear []PriceDataPoint `json:"2Y"` ThreeYear []PriceDataPoint `json:"3Y"` FiveYear []PriceDataPoint `json:"5Y"` }
type StockSectorFinancialRatioComparison ¶
type StockSectorFinancialRatioComparison struct { MetricName string `json:"metric_name"` NormalizedValue float64 `json:"normalizedValue"` Details []StockSectorFinancialRatioComparisonDetail `json:"details"` }
type StockStats ¶
type StockStats struct { PreviousClose float64 `json:"previousClose"` MarketCap float64 `json:"marketCap"` PeRatio float64 `json:"peRatio"` PbRatio float64 `json:"pbRatio"` YearLow float64 `json:"yearLow"` YearHigh float64 `json:"yearHigh"` WeeklyReturn float64 `json:"weeklyReturn"` MonthlyReturn float64 `json:"monthlyReturn"` ThreeMonthReturn float64 `json:"3MonthReturn"` YtdReturn float64 `json:"ytdReturn"` YearlyReturn float64 `json:"yearlyReturn"` ThreeYear float64 `json:"3YearReturn"` FiveYear float64 `json:"5YearReturn"` Symbol string `json:"symbol"` }
type StockStatsKey ¶
type StockStatsKey string
const ( StockStatsPreviousClose StockStatsKey = "previous_close" StockStatsMarketCap StockStatsKey = "market_cap" StockStatsFK StockStatsKey = "fk" StockStatsPDDD StockStatsKey = "pddd" StockStatsYearLow StockStatsKey = "year_low" StockStatsYearHigh StockStatsKey = "year_high" StockStatsWeeklyReturn StockStatsKey = "weekly_return" StockStatsMonthlyReturn StockStatsKey = "monthly_return" StockStats3MonthReturn StockStatsKey = "3_month_return" StockStatsYtdReturn StockStatsKey = "ytd_return" StockStatsYearlyReturn StockStatsKey = "yearly_return" StockStats3YearReturn StockStatsKey = "3_year_return" StockStats5YearReturn StockStatsKey = "5_year_return" StockStatsLatestPrice StockStatsKey = "latest_price" )
type USStockLiveData ¶
type USStockLiveData struct { Symbol string `json:"s"` BidPrice float64 `json:"bp"` AskPrice float64 `json:"ap"` StockLiveData }
type UpdateCustomThemeParams ¶
type UpdateCustomThemeParams struct { Title LocaleString `json:"title,omitempty" bson:"title,omitempty"` Description LocaleString `json:"description,omitempty" bson:"description,omitempty"` ImageURL string `json:"image_url" bson:"image_url"` Image string `json:"image" bson:"image"` AvatarImageURL string `json:"avatar_url" bson:"avatar_image_url"` Stocks []primitive.ObjectID `json:"stockIds" bson:"stockIds"` Status CollectionStatus `json:"status" bson:"status"` MetaData map[string]any `json:"meta_data,omitempty" bson:"meta_data,omitempty"` }
Click to show internal directories.
Click to hide internal directories.