laplace

package module
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 23 Imported by: 0

README

Laplace Go SDK

Go Version License Go Report Card

The official Go SDK for the Laplace stock data platform. Get easy access to stock data, collections, financials, funds, and AI-powered insights.

Features

  • 🚀 Easy to use: Simple, intuitive API with Go idioms
  • 📊 Comprehensive data: Stocks, collections, financials, funds, and AI insights
  • 🔧 Well-typed: Full Go type safety with comprehensive structs
  • 🧪 Well-tested: Comprehensive test coverage with real API integration
  • 🌍 Multi-region: Support for US and Turkish markets
  • ⚡ Fast: Built on Go's high-performance HTTP client
  • 📚 Well-documented: Complete GoDoc documentation for all public methods

Installation

go get github.com/Laplace-Analytics/laplace-api-golang/v2

Upgrading from an earlier v2 tag? As of v2.7.0 the module path is github.com/Laplace-Analytics/laplace-api-golang/v2. Change your import to laplace "github.com/Laplace-Analytics/laplace-api-golang/v2" and run the go get above. Tags v2.0.0 to v2.6.0 keep the old module path and do not resolve under /v2.

Quick Start

package main

import (
	"context"
	"fmt"
	"log"

	laplace "github.com/Laplace-Analytics/laplace-api-golang/v2"
)

func main() {
	// Initialize the client
	client := laplace.NewClient(laplace.LaplaceConfiguration{
		APIKey:  "your-api-key-here",
	})

	// Create a context
	ctx := context.Background()

	// Get stock details
	stock, err := client.GetStockDetailBySymbol(ctx, "AAPL", laplace.AssetClassEquity, laplace.RegionUs, laplace.LocaleEn)
	if err != nil {
		log.Fatal("Error fetching stock:", err)
	}
	fmt.Printf("%s: %s\n", stock.Name, stock.Description)

	// Get all stocks in a region
	stocks, err := client.GetAllStocks(ctx, laplace.RegionUs, 1, 10)
	if err != nil {
		log.Fatal("Error fetching stocks:", err)
	}
	for _, stock := range stocks {
		fmt.Printf("%s: %s\n", stock.Symbol, stock.Name)
	}

	// Get collections
	collections, err := client.GetAllCollections(ctx, laplace.RegionTr, laplace.LocaleEn)
	if err != nil {
		log.Fatal("Error fetching collections:", err)
	}
	for _, collection := range collections {
		fmt.Printf("%s: %d stocks\n", collection.Title, collection.NumStocks)
	}

	// Get collection details
	collectionDetail, err := client.GetCollectionDetail(ctx, "620f455a0187ade00bb0d55f", laplace.RegionTr, laplace.LocaleEn)
	if err != nil {
		log.Fatal("Error fetching collection detail:", err)
	}
	fmt.Printf("Stocks in %s:\n", collectionDetail.Title)
	for _, stock := range collectionDetail.Stocks {
		fmt.Printf("  %s: %s\n", stock.Symbol, stock.Name)
	}
}

API Reference

Stocks Client
// Get all stocks with pagination
stocks, err := client.GetAllStocks(ctx, laplace.RegionUs, 1, 10)

// Get stock detail by symbol
stock, err := client.GetStockDetailBySymbol(ctx, "AAPL", laplace.AssetClassEquity, laplace.RegionUs, laplace.LocaleEn)

// Get stock detail by ID
stock, err := client.GetStockDetailByID(ctx, "stock-id", laplace.LocaleEn)

// Get historical prices
prices, err := client.GetHistoricalPrices(ctx, []string{"AAPL", "GOOGL"}, laplace.RegionUs, []laplace.HistoricalPricePeriod{laplace.HistoricalPricePeriodOneDay, laplace.HistoricalPricePeriodOneWeek})

// Get historical prices with custom interval
prices, err := client.GetCustomHistoricalPrices(ctx, "AAPL", laplace.RegionUs, "2024-01-01", "2024-01-31", laplace.HistoricalPriceIntervalOneMinute, true)

// Get tick rules (Turkey only)
rules, err := client.GetTickRules(ctx, "THYAO", laplace.RegionTr)

// Get restrictions (Turkey only)
restrictions, err := client.GetStockRestrictions(ctx, "THYAO", laplace.RegionTr)
Collections Client
// Get all collections
collections, err := client.GetAllCollections(ctx, laplace.RegionTr, laplace.LocaleEn)

// Get collection detail
detail, err := client.GetCollectionDetail(ctx, "collection-id", laplace.RegionTr, laplace.LocaleEn)

// Get themes
themes, err := client.GetAllThemes(ctx, laplace.RegionTr, laplace.LocaleEn)

// Get theme detail
themeDetail, err := client.GetThemeDetail(ctx, "theme-id", laplace.RegionTr, laplace.LocaleEn)

// Get industries
industries, err := client.GetAllIndustries(ctx, laplace.RegionTr, laplace.LocaleEn)

// Get industry detail
industryDetail, err := client.GetIndustryDetail(ctx, "industry-id", laplace.RegionTr, laplace.LocaleEn)

// Get sectors
sectors, err := client.GetAllSectors(ctx, laplace.RegionTr, laplace.LocaleEn)

// Get sector detail
sectorDetail, err := client.GetSectorDetail(ctx, "sector-id", laplace.RegionTr, laplace.LocaleEn)
Funds Client
// Get all funds
funds, err := client.GetFunds(ctx, laplace.RegionTr, 1, 10)

// Get fund statistics
stats, err := client.GetFundStats(ctx, "fund-symbol", laplace.RegionTr)

// Get fund distribution
distribution, err := client.GetFundDistribution(ctx, "fund-symbol", laplace.RegionTr)

// Get historical fund prices
prices, err := client.GetHistoricalFundPrices(ctx, "fund-symbol", laplace.RegionTr, laplace.HistoricalFundPricePeriodOneYear)
Financial Data Client
// Get financial ratios
ratios, err := client.GetHistoricalRatios(ctx, "AAPL", []laplace.HistoricalRatiosKey{laplace.HistoricalRatiosKeyPERatio}, laplace.RegionUs)

// Get financial ratio comparisons
comparisons, err := client.GetFinancialRatioComparison(ctx, "AAPL", laplace.RegionUs, laplace.PeerTypeSector)

// Get financial statements
statements, err := client.GetHistoricalFinancialSheets(ctx, "AAPL", laplace.FinancialSheetDate{Year: 2024, Month: 1, Day: 1}, laplace.FinancialSheetDate{Year: 2024, Month: 12, Day: 31}, laplace.FinancialSheetIncomeStatement, laplace.FinancialSheetPeriodAnnual, laplace.CurrencyUSD, laplace.RegionUs)

// Get stock dividends
dividends, err := client.GetStockDividends(ctx, "AAPL", laplace.RegionUs)

// Get stock statistics
stats, err := client.GetStockStats(ctx, []string{"AAPL", "GOOGL"}, laplace.RegionUs)

// Get top movers
movers, err := client.GetTopMovers(ctx, laplace.TopMoversDirectionGainers, laplace.AssetClassEquity, laplace.AssetTypeStock, 1, 10, laplace.RegionUs)
Live Price Client

Every event on the price feeds is a LiveMessageV2 envelope. Check Type before reading Data:

  • laplace.MessageTypePrice ("pr"): a price tick, Data is populated.
  • laplace.MessageTypeHeartbeat ("heartbeat"): sent every 10 seconds, Data is empty.
  • laplace.MessageTypeStateChange ("state_change"): a BIST market or stock changed state. Market-level events reach every subscriber regardless of the symbol filter. Data is empty; the state payload is not decoded yet.

The channel returned by Receive() is closed when you call Close(), when the context passed to the stream is cancelled, or when the server ends the stream.

// Live prices for BIST stocks (BISTStockLiveData payload)
stream, err := client.CreateLivePriceStreamForBIST(ctx, []string{"THYAO", "GARAN"})
if err != nil {
	log.Fatal(err)
}
defer stream.Close()

for msg := range stream.Receive() {
	if msg.Error != nil {
		log.Println(msg.Error)
		continue
	}
	if msg.Data.Type != laplace.MessageTypePrice {
		continue
	}
	tick := msg.Data.Data
	fmt.Printf("%s %.2f (%.2f%%)\n", tick.Symbol, tick.ClosePrice, tick.DailyPercentChange)
}
// Live prices for US stocks (same envelope, USStockLiveData payload)
stream, err := client.CreateLivePriceStreamForUS(ctx, []string{"AAPL", "GOOGL"})
if err != nil {
	log.Fatal(err)
}
defer stream.Close()

for msg := range stream.Receive() {
	if msg.Error != nil {
		log.Println(msg.Error)
		continue
	}
	if msg.Data.Type != laplace.MessageTypePrice {
		continue
	}
	tick := msg.Data.Data
	fmt.Printf("%s %.2f (%+.2f / %.2f%%)\n", tick.Symbol, tick.Price, tick.AmountChange, tick.PercentChange)
}
Brokers Client
// Get all brokers
brokers, err := client.GetBrokers(ctx, laplace.RegionTr, 1, 10)

// Get market stocks with broker statistics
marketStocks, err := client.GetMarketStocks(ctx, laplace.RegionTr, laplace.BrokerSortNetAmount, laplace.SortDirectionDesc, "2024-01-01", "2024-01-31", 1, 10)

// Get brokers by stock
brokersByStock, err := client.GetBrokersByStock(ctx, "THYAO", laplace.RegionTr, laplace.BrokerSortNetAmount, laplace.SortDirectionDesc, "2024-01-01", "2024-01-31", 1, 10)
Search Client
// Search across stocks, collections, sectors, and industries
results, err := client.Search(ctx, "technology", []laplace.SearchType{laplace.SearchTypeStock, laplace.SearchTypeCollection}, laplace.RegionUs, laplace.LocaleEn, 1, laplace.PageSize20)
WebSocket Client
// Get WebSocket URL for real-time data
url, err := client.GetWebSocketUrl(ctx, "user-id", []laplace.FeedType{laplace.FeedTypeLivePriceTR})
Capital Increase Client
// Get all capital increases
increases, err := client.GetAllCapitalIncreases(ctx, 1, 10, laplace.RegionTr)

// Get capital increases for a specific instrument
instrumentIncreases, err := client.GetCapitalIncreasesForInstrument(ctx, "THYAO", 1, 10, laplace.RegionTr)

// Get active rights for an instrument
rights, err := client.GetActiveRightsForInstrument(ctx, "THYAO", "2024-01-15")
Custom Themes Client
// Get all custom themes
themes, err := client.GetAllCustomThemes(ctx, laplace.LocaleEn)

// Get custom theme detail
themeDetail, err := client.GetCustomThemeDetail(ctx, "theme-id", laplace.LocaleEn, laplace.SortByPriceChange)

// Create a custom theme
id, err := client.CreateCustomTheme(ctx, laplace.CreateCustomThemeParams{
	Title:       laplace.LocaleString{"en": "My Tech Portfolio"},
	Description: laplace.LocaleString{"en": "Technology stocks portfolio"},
	Region:      []laplace.Region{laplace.RegionUs},
	Stocks:      []primitive.ObjectID{/* stock IDs */},
	Status:      laplace.CollectionStatusActive,
})

// Update a custom theme
err = client.UpdateCustomTheme(ctx, *id, laplace.UpdateCustomThemeParams{
	Title: laplace.LocaleString{"en": "Updated Tech Portfolio"},
	Stocks: []primitive.ObjectID{/* updated stock IDs */},
})

// Delete a custom theme
err = client.DeleteCustomTheme(ctx, *id)
Key Insights Client
// Get key insights for a stock
insights, err := client.GetKeyInsights(ctx, "AAPL", laplace.RegionUs)

Supported Regions

  • US: United States stock market
  • TR: Turkey stock market (Borsa Istanbul)

Error Handling

import (
	"fmt"
	laplace "github.com/Laplace-Analytics/laplace-api-golang/v2"
)

client := laplace.NewClient(laplace.LaplaceConfiguration{
	APIKey:  "your-api-key",
})

ctx := context.Background()

stock, err := client.GetStockDetailBySymbol(ctx, "INVALID", laplace.AssetClassEquity, laplace.RegionUs, laplace.LocaleEn)
if err != nil {
	if laplaceErr, ok := err.(*laplace.LaplaceHTTPError); ok {
		fmt.Printf("API Error: %s\n", laplaceErr.Message)
		fmt.Printf("Status Code: %d\n", laplaceErr.HTTPStatus)
	} else {
		fmt.Printf("Error: %v\n", err)
	}
	return
}

Authentication

Get your API key from the Laplace platform and initialize the client:

client := laplace.NewClient(laplace.LaplaceConfiguration{
	APIKey:  "your-api-key-here",
})

Configuration

You can also load configuration from environment variables:

config, err := laplace.LoadGlobal("")
if err != nil {
	log.Fatal("Error loading config:", err)
}

client := laplace.NewClient(*config)

Environment variables:

  • LAPLACE_API_KEY: Your API key
  • LAPLACE_BASE_URL: API base URL

Development

Setup
git clone https://github.com/Laplace-Analytics/laplace-api-golang.git
cd laplace-api-golang
go mod download
Running Tests
# Run all tests
go test ./...

# Run with coverage
go test -cover ./...

# Run integration tests (requires API key)
LAPLACE_API_KEY=your-key go test -tags=integration ./...

Requirements

  • Go 1.21+
  • Standard library only (no external dependencies)

Documentation

Full API documentation is available at laplace.finfree.co/en/docs

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

Index

Constants

View Source
const (
	BaseURL = "https://api.finfree.app"
)

Variables

This section is empty.

Functions

func WithLogger

func WithLogger(logger *logrus.Logger) clientOption

WithLogger configures the client to use a custom logger instead of the default one.

Types

type AggregatePricePeriod

type AggregatePricePeriod string
const (
	AggregatePricePeriodOneDay     AggregatePricePeriod = "1G"
	AggregatePricePeriodOneWeek    AggregatePricePeriod = "1H"
	AggregatePricePeriodOneMonth   AggregatePricePeriod = "1A"
	AggregatePricePeriodThreeMonth AggregatePricePeriod = "3A"
	AggregatePricePeriodOneYear    AggregatePricePeriod = "1Y"
	AggregatePricePeriodTwoYear    AggregatePricePeriod = "2Y"
	AggregatePricePeriodThreeYear  AggregatePricePeriod = "3Y"
	AggregatePricePeriodFiveYear   AggregatePricePeriod = "5Y"
)

type AssetClass

type AssetClass string
const (
	AssetClassEquity AssetClass = "equity"
	AssetClassCrypto AssetClass = "crypto"
	AssetClassADR    AssetClass = "adr"
	AssetClassETN    AssetClass = "etn"
	AssetClassAll    AssetClass = "all"
)

type AssetType

type AssetType string
const (
	AssetTypeStock       AssetType = "stock"
	AssetTypeForex       AssetType = "forex"
	AssetTypeIndex       AssetType = "index"
	AssetTypeEtf         AssetType = "etf"
	AssetTypeCommodity   AssetType = "commodity"
	AssetTypeStockRights AssetType = "stock_rights"
	AssetTypeFund        AssetType = "fund"
	AssetTypeAll         AssetType = "all"
)

type BISTBidAskLiveData

type BISTBidAskLiveData struct {
	Symbol string  `json:"s"`
	Ask    float64 `json:"ask"`
	Bid    float64 `json:"bid"`
	Date   int64   `json:"d"`
}

type BISTBidAskResponse

type BISTBidAskResponse = LiveMessageV2[BISTBidAskLiveData]

BISTBidAskResponse is the envelope of the bid/ask feed. It is the same LiveMessageV2 envelope as the other price feeds; the alias is kept so the bid/ask wire format cannot drift from the shared one again.

type BISTStockLiveData

type BISTStockLiveData struct {
	Symbol             string  `json:"s"`
	DailyPercentChange float64 `json:"ch"`
	ClosePrice         float64 `json:"p"`
	Date               int64   `json:"d"`
}

type BISTStockOrderBookData

type BISTStockOrderBookData struct {
	Updated []OrderbookLevel        `json:"updated"`
	Deleted []OrderbookDeletedLevel `json:"deleted"`
	Symbol  string                  `json:"symbol"`
}

BISTStockOrderBookData represents BIST stock order book data. Unlike the price feeds the order book stream is not wrapped in an envelope and carries the symbol under "symbol".

type Broker

type Broker struct {
	ID                    int          `json:"id"`
	Symbol                string       `json:"symbol"`
	Name                  string       `json:"name"`
	LongName              string       `json:"longName"`
	SupportedAssetClasses []AssetClass `json:"supportedAssetClasses,omitempty"`
}

type BrokerListResponse

type BrokerListResponse struct {
	PaginatedResponse[*BrokerResponseItem]
	TotalStats BrokerStats `json:"totalStats"`
}

type BrokerResponseItem

type BrokerResponseItem struct {
	BrokerStats
	Broker *Broker      `json:"broker,omitempty"`
	Stock  *BrokerStock `json:"stock,omitempty"`
}

type BrokerSort

type BrokerSort string
const (
	BrokerSortNetAmount       BrokerSort = "netAmount"
	BrokerSortTotalAmount     BrokerSort = "totalAmount"
	BrokerSortTotalVolume     BrokerSort = "totalVolume"
	BrokerSortTotalBuyAmount  BrokerSort = "totalBuyAmount"
	BrokerSortTotalBuyVolume  BrokerSort = "totalBuyVolume"
	BrokerSortTotalSellAmount BrokerSort = "totalSellAmount"
	BrokerSortTotalSellVolume BrokerSort = "totalSellVolume"
)

type BrokerStats

type BrokerStats struct {
	TotalBuyAmount  float64 `json:"totalBuyAmount"`
	TotalSellAmount float64 `json:"totalSellAmount"`
	NetAmount       float64 `json:"netAmount"`
	TotalBuyVolume  float64 `json:"totalBuyVolume"`
	TotalSellVolume float64 `json:"totalSellVolume"`
	TotalVolume     float64 `json:"totalVolume"`
	TotalAmount     float64 `json:"totalAmount"`
	AverageCost     float64 `json:"averageCost,omitempty"`
}

type BrokerStock

type BrokerStock struct {
	Symbol     string     `json:"symbol"`
	Name       string     `json:"name"`
	AssetId    string     `json:"id"`
	AssetType  AssetType  `json:"assetType"`
	AssetClass AssetClass `json:"assetClass"`
	LogoUrl    string     `json:"logoUrl,omitempty"`
	Exchange   string     `json:"exchange,omitempty"`
}

type CapitalIncrease

type CapitalIncrease struct {
	ID                            int        `json:"id"`
	BoardDecisionDate             *time.Time `json:"boardDecisionDate"`
	RegisteredCapitalCeiling      string     `json:"registeredCapitalCeiling"`
	CurrentCapital                string     `json:"currentCapital"`
	TargetCapital                 string     `json:"targetCapital"`
	Types                         []string   `json:"types"`
	SpkApplicationResult          *string    `json:"spkApplicationResult"`
	SpkApplicationDate            *time.Time `json:"spkApplicationDate"`
	SpkApprovalDate               *time.Time `json:"spkApprovalDate"`
	PaymentDate                   *time.Time `json:"paymentDate"`
	RegistrationDate              *time.Time `json:"registrationDate"`
	SpecifiedCurrency             string     `json:"specifiedCurrency"`
	Symbol                        string     `json:"symbol"`
	RelatedDisclosureIDs          []int      `json:"relatedDisclosureIds"`
	RightsRate                    string     `json:"rightsRate"`
	RightsPrice                   string     `json:"rightsPrice"`
	RightsTotalAmount             string     `json:"rightsTotalAmount"`
	RightsStartDate               *time.Time `json:"rightsStartDate"`
	RightsEndDate                 *time.Time `json:"rightsEndDate"`
	RightsLastSellDate            *time.Time `json:"rightsLastSellDate"`
	BonusRate                     string     `json:"bonusRate"`
	BonusTotalAmount              string     `json:"bonusTotalAmount"`
	BonusStartDate                *time.Time `json:"bonusStartDate"`
	BonusDividendRate             string     `json:"bonusDividendRate"`
	BonusDividendTotalAmount      string     `json:"bonusDividendTotalAmount"`
	ExternalCapitalIncreaseAmount string     `json:"externalCapitalIncreaseAmount"`
	ExternalCapitalIncreaseRate   string     `json:"externalCapitalIncreaseRate"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(
	cfg LaplaceConfiguration,
	opts ...clientOption,
) (*Client, error)

NewClient creates a new Laplace API client with the provided configuration and optional settings.

func (*Client) CreateCustomTheme

func (c *Client) CreateCustomTheme(ctx context.Context, params CreateCustomThemeParams) (*primitive.ObjectID, error)

CreateCustomTheme creates a new custom investment theme with the specified parameters and returns the theme ID.

func (*Client) CreateDelayedPriceStreamForBIST

func (c *Client) CreateDelayedPriceStreamForBIST(ctx context.Context, symbols []string) (*LivePriceStream[LiveMessageV2[BISTStockLiveData]], error)

CreateDelayedPriceStreamForBIST creates and subscribes to delayed price stream for BIST

func (*Client) CreateLiveBidAskStreamForBIST

func (c *Client) CreateLiveBidAskStreamForBIST(ctx context.Context, symbols []string) (*LivePriceStream[BISTBidAskResponse], error)

CreateLiveBidAskStreamForBIST creates and subscribes to bid/ask price stream for BIST.

func (*Client) CreateLiveOrderBookStreamForBIST

func (c *Client) CreateLiveOrderBookStreamForBIST(ctx context.Context, symbols []string) (*LivePriceStream[BISTStockOrderBookData], error)

CreateLiveOrderBookStreamForBIST creates and subscribes to order book stream for BIST

func (*Client) CreateLivePriceStreamForBIST

func (c *Client) CreateLivePriceStreamForBIST(ctx context.Context, symbols []string) (*LivePriceStream[LiveMessageV2[BISTStockLiveData]], error)

CreateLivePriceStreamForBIST creates and subscribes to live price stream for BIST

func (*Client) CreateLivePriceStreamForUS

func (c *Client) CreateLivePriceStreamForUS(ctx context.Context, symbols []string) (*LivePriceStream[LiveMessageV2[USStockLiveData]], error)

CreateLivePriceStreamForUS creates and subscribes to live price stream for US stocks

func (*Client) CreateNewsStream

func (c *Client) CreateNewsStream(ctx context.Context, params StreamNewsParams) (*NewsStream, error)

CreateNewsStream creates and subscribes to a news stream.

func (*Client) DeleteCustomTheme

func (c *Client) DeleteCustomTheme(ctx context.Context, id primitive.ObjectID) error

DeleteCustomTheme permanently removes a custom theme from the system.

func (*Client) GetActiveRightsForInstrument

func (c *Client) GetActiveRightsForInstrument(ctx context.Context, symbol string, date string) ([]CapitalIncrease, error)

GetActiveRightsForInstrument retrieves active rights offerings for a specific stock on a given date.

func (*Client) GetAggregateGraph

func (c *Client) GetAggregateGraph(ctx context.Context, period AggregatePricePeriod, region Region, sectorId, industryId, collectionId string) (CollectionPriceGraph, error)

GetAggregateGraph retrieves the aggregate price graph for a sector, industry, or collection.

func (*Client) GetAllCapitalIncreases

func (c *Client) GetAllCapitalIncreases(ctx context.Context, page int, pageSize int, region Region) (*PaginatedResponse[CapitalIncrease], error)

GetAllCapitalIncreases retrieves all capital increase announcements and events with pagination.

func (*Client) GetAllCollections

func (c *Client) GetAllCollections(ctx context.Context, region Region, locale Locale) ([]Collection, error)

GetAllCollections retrieves all collections available for the specified region and locale.

func (*Client) GetAllCustomThemes

func (c *Client) GetAllCustomThemes(ctx context.Context, region Region, locale Locale) ([]Collection, error)

GetAllCustomThemes retrieves all custom investment themes available for the specified locale.

func (*Client) GetAllIndustries

func (c *Client) GetAllIndustries(ctx context.Context, region Region, locale Locale) ([]Industry, error)

GetAllIndustries retrieves all industries available for the specified region and locale.

func (*Client) GetAllPoliticians

func (c *Client) GetAllPoliticians(ctx context.Context) ([]Politician, error)

func (*Client) GetAllRestrictions

func (c *Client) GetAllRestrictions(ctx context.Context) ([]StockRestriction, error)

GetAllRestrictions retrieves all trading restrictions and limitations.

func (*Client) GetAllSectors

func (c *Client) GetAllSectors(ctx context.Context, region Region, locale Locale) ([]Sector, error)

GetAllSectors retrieves all sectors available for the specified region and locale.

func (*Client) GetAllStocks

func (c *Client) GetAllStocks(ctx context.Context, region Region, page int, pageSize int) ([]Stock, error)

GetAllStocks retrieves a paginated list of all stocks for the specified region.

func (*Client) GetAllThemes

func (c *Client) GetAllThemes(ctx context.Context, region Region, locale Locale) ([]Collection, error)

GetAllThemes retrieves all investment themes available for the specified region and locale.

func (*Client) GetAllTopHoldings

func (c *Client) GetAllTopHoldings(ctx context.Context) ([]TopHolding, error)

func (*Client) GetBrokers

func (c *Client) GetBrokers(ctx context.Context, region Region, page, size int, assetClass ...AssetClass) (PaginatedResponse[*Broker], error)

GetBrokers retrieves a paginated list of brokers for the specified region.

func (*Client) GetBrokersByStock

func (c *Client) GetBrokersByStock(ctx context.Context, symbol string, region Region, sortBy BrokerSort, sortDirection SortDirection, fromDate, toDate string, page, size int) (BrokerListResponse, error)

GetBrokersByStock retrieves brokers that have traded a specific stock with their trading statistics and sorting options.

func (*Client) GetCapitalIncreasesForInstrument

func (c *Client) GetCapitalIncreasesForInstrument(ctx context.Context, symbol string, page int, pageSize int, region Region) (*PaginatedResponse[CapitalIncrease], error)

GetCapitalIncreasesForInstrument fetches capital increase events for a specific stock symbol.

func (*Client) GetCollectionDetail

func (c *Client) GetCollectionDetail(ctx context.Context, id string, region Region, locale Locale, sortBy ...SortBy) (CollectionDetail, error)

GetCollectionDetail fetches detailed information about a specific collection including its constituent stocks. An optional sortBy parameter can be provided to sort stocks (e.g. SortByPriceChange).

func (*Client) GetCustomHistoricalPrices

func (c *Client) GetCustomHistoricalPrices(ctx context.Context, symbol string, region Region, fromDate string, toDate string, interval HistoricalPriceInterval, detail bool, numIntervals ...int) ([]PriceDataPoint, error)

GetCustomHistoricalPrices retrieves custom historical price data for a stock within a specific date range and interval.

func (*Client) GetCustomThemeDetail

func (c *Client) GetCustomThemeDetail(ctx context.Context, id string, locale Locale, sortBy SortBy) (CollectionDetail, error)

GetCustomThemeDetail fetches detailed information about a specific custom theme including its constituent stocks.

func (*Client) GetDelayedPriceStreamForBIST

func (c *Client) GetDelayedPriceStreamForBIST() *LivePriceStream[LiveMessageV2[BISTStockLiveData]]

GetDelayedPriceStreamForBIST creates a new delayed price stream for BIST stocks. Call Subscribe(ctx, symbols) on the returned stream to start receiving data.

func (*Client) GetEarningsTranscriptList

func (c *Client) GetEarningsTranscriptList(ctx context.Context, region Region, symbol string) ([]EarningsTranscriptListItem, error)

GetEarningsTranscriptList retrieves the list of available earnings transcripts for a stock.

func (*Client) GetEarningsTranscriptWithSummary

func (c *Client) GetEarningsTranscriptWithSummary(ctx context.Context, symbol string, year, quarter int) (*EarningsTranscriptWithSummary, error)

GetEarningsTranscriptWithSummary retrieves the earnings transcript with an AI-generated summary for a specific quarter.

func (*Client) GetFinancialRatioComparison

func (c *Client) GetFinancialRatioComparison(ctx context.Context, symbol string, region Region, peerType PeerType) ([]StockPeerFinancialRatioComparison, error)

GetFinancialRatioComparison retrieves financial ratio comparisons for a stock against its sector or industry peers.

func (*Client) GetFundDistribution

func (c *Client) GetFundDistribution(ctx context.Context, symbol string, region Region) (*FundDistribution, error)

GetFundDistribution retrieves detailed asset allocation and distribution information for a specific fund.

func (*Client) GetFundStats

func (c *Client) GetFundStats(ctx context.Context, symbol string, region Region) (*FundStats, error)

GetFundStats fetches comprehensive statistical data for a specific fund including returns, risk metrics, and performance indicators.

func (*Client) GetFunds

func (c *Client) GetFunds(ctx context.Context, region Region, page int, pageSize int) ([]Fund, error)

GetFunds retrieves a paginated list of investment funds for the specified region with basic fund information.

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)

GetHistoricalFinancialSheets fetches historical financial statements (income statement, balance sheet, cash flow) for a stock.

func (*Client) GetHistoricalFundPrices

func (c *Client) GetHistoricalFundPrices(ctx context.Context, symbol string, region Region, period HistoricalFundPricePeriod) ([]FundHistoricalPrice, error)

GetHistoricalFundPrices retrieves historical price data for a fund over the specified time period.

func (*Client) GetHistoricalPrices

func (c *Client) GetHistoricalPrices(ctx context.Context, symbols []string, region Region, keys []HistoricalPricePeriod) ([]StockPriceGraph, error)

GetHistoricalPrices retrieves historical price data for multiple stocks over specified time periods.

func (*Client) GetHistoricalRatios

func (c *Client) GetHistoricalRatios(ctx context.Context, symbol string, keys []HistoricalRatiosKey, region Region, locale ...Locale) ([]StockHistoricalRatios, error)

GetHistoricalRatios fetches historical financial ratios for a stock over time with sector comparisons.

func (*Client) GetHistoricalRatiosDescriptions

func (c *Client) GetHistoricalRatiosDescriptions(ctx context.Context, locale Locale, region Region) ([]StockHistoricalRatiosDescription, error)

GetHistoricalRatiosDescriptions retrieves metadata and descriptions for available historical financial ratios.

func (*Client) GetIndustryDetail

func (c *Client) GetIndustryDetail(ctx context.Context, id string, region Region, locale Locale) (CollectionDetail, error)

GetIndustryDetail fetches detailed information about a specific industry including its constituent stocks.

func (*Client) GetKeyInsights

func (c *Client) GetKeyInsights(ctx context.Context, symbol string, region Region) (*KeyInsight, error)

GetKeyInsights fetches key insights and analysis for a specific stock symbol.

func (*Client) GetLiveBidAskStreamForBIST

func (c *Client) GetLiveBidAskStreamForBIST() *LivePriceStream[BISTBidAskResponse]

GetLiveBidAskStreamForBIST creates a new bid/ask price stream for BIST stocks. Call Subscribe(ctx, symbols) on the returned stream to start receiving data. Passing no symbols to Subscribe means all BIST stocks will be streamed.

func (*Client) GetLiveOrderBookStreamForBIST

func (c *Client) GetLiveOrderBookStreamForBIST() *LivePriceStream[BISTStockOrderBookData]

GetLiveOrderBookStreamForBIST creates a new order book stream for BIST stocks. Call Subscribe(ctx, symbols) on the returned stream to start receiving data.

func (*Client) GetLivePriceStreamForBIST

func (c *Client) GetLivePriceStreamForBIST() *LivePriceStream[LiveMessageV2[BISTStockLiveData]]

GetLivePriceStreamForBIST creates a new live price stream for BIST stocks. Call Subscribe(ctx, symbols) on the returned stream to start receiving data.

func (*Client) GetLivePriceStreamForUS

func (c *Client) GetLivePriceStreamForUS() *LivePriceStream[LiveMessageV2[USStockLiveData]]

GetLivePriceStreamForUS creates a new live price stream for US stocks. Call Subscribe(ctx, symbols) on the returned stream to start receiving data.

func (*Client) GetMarketBrokers

func (c *Client) GetMarketBrokers(ctx context.Context, region Region, sortBy BrokerSort, sortDirection SortDirection, fromDate, toDate string, page, size int) (BrokerListResponse, error)

GetMarketBrokers fetches market brokers with trading statistics, including total volumes and amounts with sorting options.

func (*Client) GetMarketStocks

func (c *Client) GetMarketStocks(ctx context.Context, region Region, sortBy BrokerSort, sortDirection SortDirection, fromDate, toDate string, page, size int) (BrokerListResponse, error)

GetMarketStocks fetches market stocks with broker trading statistics, including buy/sell volumes and amounts with sorting options.

func (*Client) GetNews

func (c *Client) GetNews(ctx context.Context, params GetNewsParams) (*PaginatedResponse[News], error)

GetNews retrieves a paginated list of news articles with optional filtering, ordering, and pagination.

func (*Client) GetNewsApiSourceNames

func (c *Client) GetNewsApiSourceNames(ctx context.Context, params GetNewsApiSourceNamesParams) ([]NewsApiSource, error)

GetNewsApiSourceNames returns the configured news sources (id + name), suitable for populating a source filter. The returned IDs feed the `apiSource` parameter of the News and Live News Stream endpoints.

func (*Client) GetNewsCategories

func (c *Client) GetNewsCategories(ctx context.Context, locale Locale) ([]NewsCategory, error)

GetNewsCategories returns the full canonical news category list with localized names for the given locale. All categories are always returned regardless of whether they currently have tagged news, making the result suitable for populating dropdowns and filter UIs.

func (*Client) GetNewsHighlights

func (c *Client) GetNewsHighlights(ctx context.Context, params GetNewsHighlightsParams) (*PaginatedResponse[NewsHighlight], error)

GetNewsHighlights retrieves paginated, sector-categorized US news highlights, newest first.

func (*Client) GetNewsLanes

func (c *Client) GetNewsLanes(ctx context.Context, params GetNewsLanesParams) ([]NewsLaneInfo, error)

GetNewsLanes returns the fixed list of news lanes (id + label) suitable for building a lane filter UI. The returned IDs feed the `lane` parameter of the News and Live News Stream endpoints.

func (*Client) GetNewsStream

func (c *Client) GetNewsStream(params StreamNewsParams) *NewsStream

GetNewsStream creates a new news stream. Call Subscribe(ctx) on the returned stream to start receiving data.

func (*Client) GetNewsV2

func (c *Client) GetNewsV2(ctx context.Context, params GetNewsParams) (*PaginatedResponse[NewsV2], error)

GetNewsV2 retrieves a paginated list of news articles from the v2 endpoint, excluding related tickers.

func (*Client) GetPoliticianDetail

func (c *Client) GetPoliticianDetail(ctx context.Context, id int) (PoliticianDetail, error)

func (*Client) GetPoliticianHoldingsBySymbol

func (c *Client) GetPoliticianHoldingsBySymbol(ctx context.Context, symbol string) ([]Holding, error)

func (*Client) GetSectorDetail

func (c *Client) GetSectorDetail(ctx context.Context, id string, region Region, locale Locale) (CollectionDetail, error)

GetSectorDetail fetches detailed information about a specific sector including its constituent stocks.

func (*Client) GetStateForMarket

func (c *Client) GetStateForMarket(ctx context.Context, symbol string) (MarketState, error)

GetStateForMarket returns the current state of a specific market.

func (*Client) GetStateForStock

func (c *Client) GetStateForStock(ctx context.Context, symbol string) (MarketState, error)

GetStateForStock returns the current state of a specific stock.

func (*Client) GetStateOfAllMarkets

func (c *Client) GetStateOfAllMarkets(ctx context.Context, region Region, page, size int) (PaginatedResponse[*MarketState], error)

GetStateOfAllMarkets returns the state of all markets for a given region.

func (*Client) GetStateOfAllStocks

func (c *Client) GetStateOfAllStocks(ctx context.Context, region Region, page, size int) (PaginatedResponse[*MarketState], error)

GetStateOfAllStocks returns the state of all stocks for a given region.

func (*Client) GetStockChartImage

func (c *Client) GetStockChartImage(ctx context.Context, params GenerateChartImageRequest) ([]byte, error)

GetStockChartImage generates a chart image for a stock and returns the raw image bytes.

func (*Client) GetStockDetailByID

func (c *Client) GetStockDetailByID(ctx context.Context, id string, locale Locale) (StockDetail, error)

GetStockDetailByID fetches detailed information about a stock using its unique ID.

func (*Client) GetStockDetailBySymbol

func (c *Client) GetStockDetailBySymbol(ctx context.Context, symbol string, assetClass AssetClass, region Region, locale Locale) (StockDetail, error)

GetStockDetailBySymbol fetches detailed information about a stock using its symbol, asset class, region, and locale.

func (*Client) GetStockDividends

func (c *Client) GetStockDividends(ctx context.Context, symbol string, region Region) ([]StockDividend, error)

GetStockDividends retrieves dividend history and information for a specific stock.

func (*Client) GetStockRestrictions

func (c *Client) GetStockRestrictions(ctx context.Context, symbol string, region Region) ([]StockRestriction, error)

GetStockRestrictions fetches trading restrictions and limitations for a specific stock in the given region.

func (*Client) GetStockStats

func (c *Client) GetStockStats(ctx context.Context, symbols []string, region Region) ([]StockStats, error)

GetStockStats fetches comprehensive statistics for multiple stocks including market cap, P/E ratios, returns, and price data.

func (*Client) GetStocksByBroker

func (c *Client) GetStocksByBroker(ctx context.Context, symbol string, region Region, sortBy BrokerSort, sortDirection SortDirection, fromDate, toDate string, page, size int) (BrokerListResponse, error)

GetStocksByBroker retrieves stocks that have been traded by a specific broker with trading statistics and sorting options.

func (*Client) GetThemeDetail

func (c *Client) GetThemeDetail(ctx context.Context, id string, region Region, locale Locale) (CollectionDetail, error)

GetThemeDetail fetches detailed information about a specific investment theme including its constituent stocks.

func (*Client) GetTickRules

func (c *Client) GetTickRules(ctx context.Context, symbol string, region Region) (TickRule, error)

GetTickRules retrieves tick size rules and price limits for a stock in the specified region.

func (*Client) GetTopMovers

func (c *Client) GetTopMovers(ctx context.Context, direction TopMoversDirection, assetClass AssetClass, assetType AssetType, page int, pageSize int, region Region) ([]TopMover, error)

GetTopMovers retrieves the top gaining or losing stocks for the specified asset class and type with pagination.

func (*Client) GetWebSocketUrl

func (c *Client) GetWebSocketUrl(ctx context.Context, externalUserId string, feeds []FeedType) (string, error)

GetWebSocketUrl generates a WebSocket URL for accessing real-time market data feeds including live prices and depth data.

func (*Client) GetWebsocketUsageForMonth

func (c *Client) GetWebsocketUsageForMonth(ctx context.Context, month int, year int, feedType FeedType) ([]WebSocketMonthlyUsageData, error)

GetWebsocketUsageForMonth retrieves WebSocket usage statistics for a specific month.

func (*Client) RevokeWebSocketConnection

func (c *Client) RevokeWebSocketConnection(ctx context.Context, id string) error

RevokeWebSocketConnection revokes an active WebSocket connection by its ID (the UUID segment from the WebSocket URL).

func (*Client) Screener

func (c *Client) Screener(ctx context.Context, region Region, params ScreenerRequest) (ScreenerResponse, error)

Screener returns a filtered and sorted list of stocks for the given region. Region defaults to "tr" if empty. US is not currently supported.

func (*Client) Search

func (c *Client) Search(ctx context.Context, query string, types []SearchType, region Region, locale Locale, page int, pageSize PaginationPageSize) (*SearchResponse, error)

Search performs a comprehensive search across stocks, collections, sectors, and industries with filtering and pagination.

func (*Client) SendWebsocketEvent

func (c *Client) SendWebsocketEvent(ctx context.Context, params SendWebsocketEventRequest) error

SendWebsocketEvent sends a custom event through the WebSocket connection.

func (*Client) UpdateCustomTheme

func (c *Client) UpdateCustomTheme(ctx context.Context, id primitive.ObjectID, params UpdateCustomThemeParams) error

UpdateCustomTheme updates an existing custom theme with new parameters and settings.

type ClientTestSuite

type ClientTestSuite struct {
	suite.Suite
	Config LaplaceConfiguration
}

func NewClientTestSuite

func NewClientTestSuite() *ClientTestSuite

func (*ClientTestSuite) SetupTest

func (s *ClientTestSuite) SetupTest()

type Collection

type Collection struct {
	ID          primitive.ObjectID `json:"id"`
	Title       string             `json:"title"`
	Region      []Region           `json:"region"`
	Locale      Locale             `json:"locale,omitempty"`
	ImageUrl    string             `json:"imageUrl"`
	AvatarUrl   string             `json:"avatarUrl"`
	NumStocks   int                `json:"numStocks"`
	AssetClass  AssetClass         `json:"assetClass,omitempty"`
	Description string             `json:"description,omitempty"`
	Image       string             `json:"image,omitempty"`
	Order       *int               `json:"order,omitempty"`
	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 CollectionPriceGraph

type CollectionPriceGraph struct {
	PreviousClose float64          `json:"previous_close"`
	Graph         []PriceDataPoint `json:"graph"`
}

type CollectionStatus

type CollectionStatus string
const (
	CollectionStatusActive   CollectionStatus = "active"
	CollectionStatusInactive CollectionStatus = "inactive"
)

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 CreateCustomThemeResponse

type CreateCustomThemeResponse struct {
	ID string `json:"id"`
}

type Currency

type Currency string
const (
	CurrencyUSD Currency = "USD"
	CurrencyTRY Currency = "TRY"
	CurrencyEUR Currency = "EUR"
)

type EarningsTranscriptListItem

type EarningsTranscriptListItem struct {
	Symbol     string       `json:"symbol"`
	Year       int          `json:"year"`
	Quarter    int          `json:"quarter"`
	Date       FlexibleTime `json:"date"`
	FiscalYear int          `json:"fiscal_year"`
}

type EarningsTranscriptWithSummary

type EarningsTranscriptWithSummary struct {
	Symbol     string       `json:"symbol"`
	Year       int          `json:"year"`
	Quarter    int          `json:"quarter"`
	Date       FlexibleTime `json:"date"`
	Content    string       `json:"content"`
	Summary    string       `json:"summary,omitempty"`
	HasSummary bool         `json:"has_summary"`
}

type FeedType

type FeedType string
const (
	FeedTypeLivePriceTR       FeedType = "live_price_tr"
	FeedTypeDelayedPriceTR    FeedType = "delayed_price_tr"
	FeedTypeLivePriceUS       FeedType = "live_price_us"
	FeedTypeDelayedPriceUS    FeedType = "delayed_price_us"
	FeedTypeDepthTR           FeedType = "depth_tr"
	FeedTypeStateUS           FeedType = "state_us"
	FeedTypeLiveAskBidPriceTR FeedType = "live_ask_bid_price_tr"
	FeedTypeCustom            FeedType = "custom"
)

type FinancialSheetDate

type FinancialSheetDate struct {
	Day   int `json:"day"`
	Month int `json:"month"`
	Year  int `json:"year"`
}

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 FlexibleTime

type FlexibleTime struct {
	time.Time
}

FlexibleTime handles date fields that may arrive in different formats from the API (e.g. "2024-01-15", "2024-01-15T10:30:00Z", unix timestamp as number).

func (FlexibleTime) MarshalJSON

func (ft FlexibleTime) MarshalJSON() ([]byte, error)

func (*FlexibleTime) UnmarshalJSON

func (ft *FlexibleTime) UnmarshalJSON(data []byte) error

type Fund

type Fund struct {
	AssetType     AssetType `json:"assetType"`
	Name          string    `json:"name"`
	Symbol        string    `json:"symbol"`
	Active        bool      `json:"active"`
	ManagementFee float64   `json:"managementFee"`
	RiskLevel     int       `json:"riskLevel"`
	FundType      FundType  `json:"fundType"`
	OwnerSymbol   string    `json:"ownerSymbol"`
}

type FundAsset

type FundAsset struct {
	Type               FundContentType `json:"type"`
	Symbol             string          `json:"symbol"`
	WholePercentage    float64         `json:"wholePercentage"`
	CategoryPercentage float64         `json:"categoryPercentage"`
}

type FundAssetCategory

type FundAssetCategory string
const (
	FundAssetCategoryOther                                  FundAssetCategory = "OTHER"
	FundAssetCategoryEquity                                 FundAssetCategory = "EQUITY"
	FundAssetCategoryLiquidDeposit                          FundAssetCategory = "LIQUID_DEPOSIT"
	FundAssetCategoryFuturesCashCollateral                  FundAssetCategory = "FUTURES_CASH_COLLATERAL"
	FundAssetCategoryInvestmentFunds                        FundAssetCategory = "INVESTMENT_FUNDS"
	FundAssetCategoryParticipationAccount                   FundAssetCategory = "PARTICIPATION_ACCOUNT"
	FundAssetCategoryPreciousMetals                         FundAssetCategory = "PRECIOUS_METALS"
	FundAssetCategoryCorporateBond                          FundAssetCategory = "CORPORATE_BOND"
	FundAssetCategoryCurrency                               FundAssetCategory = "CURRENCY"
	FundAssetCategoryPublicExternalDebtSecurities           FundAssetCategory = "PUBLIC_EXTERNAL_DEBT_SECURITIES"
	FundAssetCategoryPrivateSectorExternalDebtSecurities    FundAssetCategory = "PRIVATE_SECTOR_EXTERNAL_DEBT_SECURITIES"
	FundAssetCategoryPublicLeaseCertificates                FundAssetCategory = "PUBLIC_LEASE_CERTIFICATES"
	FundAssetCategoryPrivateSectorLeaseCertificates         FundAssetCategory = "PRIVATE_SECTOR_LEASE_CERTIFICATES"
	FundAssetCategoryForeignExchangeTradedFunds             FundAssetCategory = "FOREIGN_EXCHANGE_TRADED_FUNDS"
	FundAssetCategoryPublicLeaseCertificatesCurrency        FundAssetCategory = "PUBLIC_LEASE_CERTIFICATES_CURRENCY"
	FundAssetCategoryGovernmentBond                         FundAssetCategory = "GOVERNMENT_BOND"
	FundAssetCategoryPrivateSectorLeaseCertificatesCurrency FundAssetCategory = "PRIVATE_SECTOR_LEASE_CERTIFICATES_CURRENCY"
	FundAssetCategoryUnknown                                FundAssetCategory = "UNKNOWN"
)

type FundContentType

type FundContentType string
const (
	FundContentTypeBistStock  FundContentType = "BIST_STOCK"
	FundContentTypeOtherStock FundContentType = "OTHER_STOCK"
	FundContentTypeUnknown    FundContentType = "UNKNOWN"
)

type FundDistribution

type FundDistribution struct {
	Categories []FundDistributionCategory `json:"categories"`
}

type FundDistributionCategory

type FundDistributionCategory struct {
	Category   FundAssetCategory `json:"category"`
	Percentage float64           `json:"percentage"`
	Assets     []FundAsset       `json:"assets,omitempty"`
}

type FundHistoricalPrice

type FundHistoricalPrice struct {
	Aum           float64   `json:"aum"`
	Date          time.Time `json:"date"`
	Price         float64   `json:"price"`
	ShareCount    float64   `json:"shareCount"`
	InvestorCount int       `json:"investorCount"`
}

type FundStats

type FundStats struct {
	YearBeta         float64 `json:"yearBeta"`
	YearStdev        float64 `json:"yearStdev"`
	YtdReturn        float64 `json:"ytdReturn"`
	YearMomentum     float64 `json:"yearMomentum"`
	YearlyReturn     float64 `json:"yearlyReturn"`
	MonthlyReturn    float64 `json:"monthlyReturn"`
	FiveYearReturn   float64 `json:"fiveYearReturn"`
	SixMonthReturn   float64 `json:"sixMonthReturn"`
	ThreeYearReturn  float64 `json:"threeYearReturn"`
	ThreeMonthReturn float64 `json:"threeMonthReturn"`
}

type FundType

type FundType string
const (
	FundTypeStockUmbrella           FundType = "STOCK_UMBRELLA_FUND"
	FundTypeVariableUmbrella        FundType = "VARIABLE_UMBRELLA_FUND"
	FundTypeParticipationUmbrella   FundType = "PARTICIPATION_UMBRELLA_FUND"
	FundTypeFlexibleUmbrella        FundType = "FLEXIBLE_UMBRELLA_FUND"
	FundTypeFundBasketUmbrella      FundType = "FUND_BASKET_UMBRELLA_FUND"
	FundTypeMoneyMarketUmbrella     FundType = "MONEY_MARKET_UMBRELLA_FUND"
	FundTypePreciousMetalsUmbrella  FundType = "PRECIOUS_METALS_UMBRELLA_FUND"
	FundTypeDebtInstrumentsUmbrella FundType = "DEBT_INSTRUMENTS_UMBRELLA_FUND"
	FundTypeMixedUmbrella           FundType = "MIXED_UMBRELLA_FUND"
	FundTypeUnknown                 FundType = "UNKNOWN_FUND_TYPE"
)

type GenerateChartImageRequest

type GenerateChartImageRequest struct {
	Symbol     string
	Period     HistoricalPricePeriod
	Region     Region
	Resolution HistoricalPriceInterval
	Indicators []string
	ChartType  *int
}

type GetNewsApiSourceNamesParams

type GetNewsApiSourceNamesParams struct {
	Region   Region
	Language Locale
}

GetNewsApiSourceNamesParams holds the optional parameters for the news api-source-names endpoint.

type GetNewsHighlightsParams

type GetNewsHighlightsParams struct {
	Region Region
	Locale Locale
	From   string
	To     string
	Skip   *int
	Top    *int
}

GetNewsHighlightsParams holds the parameters for the news highlights endpoint. Region (which must be RegionUs) and Locale are required. From/To (YYYY-MM-DD) narrow the result to highlights created in that window; Skip/Top page the result, where Top is the page size (1-20).

type GetNewsLanesParams

type GetNewsLanesParams struct {
	// Region, when set (RegionTr or RegionUs), restricts the result to lanes valid for that region.
	Region Region
}

GetNewsLanesParams holds the optional parameters for the news lanes endpoint.

type GetNewsParams

type GetNewsParams struct {
	Region           Region
	Locale           Locale
	NewsType         NewsType
	Lane             NewsLane
	Page             *int
	Size             *int
	OrderBy          NewsOrderBy
	OrderByDirection SortDirection
	Symbols          string
	CategoryIds      string
	SectorIds        string
	IndustryIds      string
	ApiSource        string
	QualityScoreMin  *int
	QualityScoreMax  *int
	TimestampFrom    string
	TimestampTo      string
}

type HistoricalFinancialSheet

type HistoricalFinancialSheet struct {
	Period string      `json:"period"`
	Items  []SheetItem `json:"items"`
}

type HistoricalFinancialSheetRow

type HistoricalFinancialSheetRow struct {
	Description             string  `json:"description"`
	Value                   float64 `json:"value"`
	LineCodeId              int     `json:"lineCodeId"`
	IndentLevel             int     `json:"indentLevel"`
	FirstAncestorLineCodeId int     `json:"firstAncestorLineCodeId"`
	SectionLineCodeId       int     `json:"sectionLineCodeId"`
}

type HistoricalFinancialSheets

type HistoricalFinancialSheets struct {
	Sheets []HistoricalFinancialSheet `json:"sheets"`
}

type HistoricalFundPricePeriod

type HistoricalFundPricePeriod string
const (
	HistoricalFundPricePeriodOneWeek    HistoricalFundPricePeriod = "1H"
	HistoricalFundPricePeriodOneMonth   HistoricalFundPricePeriod = "1A"
	HistoricalFundPricePeriodThreeMonth HistoricalFundPricePeriod = "3A"
	HistoricalFundPricePeriodOneYear    HistoricalFundPricePeriod = "1Y"
	HistoricalFundPricePeriodThreeYear  HistoricalFundPricePeriod = "3Y"
	HistoricalFundPricePeriodFiveYear   HistoricalFundPricePeriod = "5Y"
)

type HistoricalPriceDate

type HistoricalPriceDate struct {
	Year   int
	Month  int
	Day    int
	Hour   int
	Minute int
	Second int
}

type HistoricalPriceInterval

type HistoricalPriceInterval string
const (
	HistoricalPriceIntervalOneMinute     HistoricalPriceInterval = "1m"
	HistoricalPriceIntervalThreeMinute   HistoricalPriceInterval = "3m"
	HistoricalPriceIntervalFiveMinute    HistoricalPriceInterval = "5m"
	HistoricalPriceIntervalFifteenMinute HistoricalPriceInterval = "15m"
	HistoricalPriceIntervalThirtyMinute  HistoricalPriceInterval = "30m"
	HistoricalPriceIntervalOneHour       HistoricalPriceInterval = "1h"
	HistoricalPriceIntervalTwoHour       HistoricalPriceInterval = "2h"
	HistoricalPriceIntervalOneDay        HistoricalPriceInterval = "1d"
	HistoricalPriceIntervalFiveDay       HistoricalPriceInterval = "5d"
	HistoricalPriceIntervalSevenDay      HistoricalPriceInterval = "7d"
	HistoricalPriceIntervalThirtyDay     HistoricalPriceInterval = "30d"
)

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"
	HistoricalPricePeriodSixMonth   HistoricalPricePeriod = "6M"
	HistoricalPricePeriodFiveYear   HistoricalPricePeriod = "5Y"
	HistoricalPricePeriodAll        HistoricalPricePeriod = "All"
)

type HistoricalRatiosKey

type HistoricalRatiosKey string
const (
	HistoricalRatiosKeyGrossMargin                          HistoricalRatiosKey = "gross-margin"
	HistoricalRatiosKeyEBITDA                               HistoricalRatiosKey = "ebitda"
	HistoricalRatiosKeyPERatio                              HistoricalRatiosKey = "pe-ratio"
	HistoricalRatiosKeyOperatingMargin                      HistoricalRatiosKey = "favok_marji"
	HistoricalRatiosKeyFreeCashFlowGrowth                   HistoricalRatiosKey = "serbest_nakit_akisi_buyumesi"
	HistoricalRatiosKeyDaysPayable                          HistoricalRatiosKey = "days-payable"
	HistoricalRatiosKeyInventoryTurnover                    HistoricalRatiosKey = "inventory-turnover"
	HistoricalRatiosKeyDepositGrowth                        HistoricalRatiosKey = "mevduat_buyumesi"
	HistoricalRatiosKeyNetInterestMargin                    HistoricalRatiosKey = "net_faiz_marji"
	HistoricalRatiosKeyClaimPaymentsGrowth                  HistoricalRatiosKey = "gerceklesen_tazminatlar_buyumesi"
	HistoricalRatiosKeyClaimsPerPremiumRatio                HistoricalRatiosKey = "prim_basina_tazminat_orani"
	HistoricalRatiosKeyEVToOCF                              HistoricalRatiosKey = "evOcf"
	HistoricalRatiosKeyEVToIC                               HistoricalRatiosKey = "evic"
	HistoricalRatiosKeyEBT                                  HistoricalRatiosKey = "ebt"
	HistoricalRatiosKeyCAPEX                                HistoricalRatiosKey = "capex"
	HistoricalRatiosKeyFinancialInvestments                 HistoricalRatiosKey = "financial_investments"
	HistoricalRatiosKeyRealtimeEPSBasic                     HistoricalRatiosKey = "realtime_eps-basic"
	HistoricalRatiosKeyQuickRatio                           HistoricalRatiosKey = "quick-ratio"
	HistoricalRatiosKeyEVToEBITDA                           HistoricalRatiosKey = "ev-to-ebitda"
	HistoricalRatiosKeyROCE                                 HistoricalRatiosKey = "roce"
	HistoricalRatiosKeyROIC                                 HistoricalRatiosKey = "roic"
	HistoricalRatiosKeyROA                                  HistoricalRatiosKey = "roa"
	HistoricalRatiosKeyDaysSalesOutstanding                 HistoricalRatiosKey = "days-sales-outstanding"
	HistoricalRatiosKeyLoanToAssetRatio                     HistoricalRatiosKey = "kredi_aktif_orani"
	HistoricalRatiosKeyLoanToDepositRatio                   HistoricalRatiosKey = "kredi_mevduat_orani"
	HistoricalRatiosKeyTechnicalProfitGrowth                HistoricalRatiosKey = "teknik_kar_buyumesi"
	HistoricalRatiosKeyNetPremiumEarnedGrowth               HistoricalRatiosKey = "net_kazanilan_prim_buyumesi"
	HistoricalRatiosKeyEBITGrowth                           HistoricalRatiosKey = "ebitGrowth"
	HistoricalRatiosKeyCROIC                                HistoricalRatiosKey = "croic"
	HistoricalRatiosKeyRealtimeMarketValue                  HistoricalRatiosKey = "realtime_piyasa_degeri"
	HistoricalRatiosKeyRealtimePBRatio                      HistoricalRatiosKey = "realtime_pb-ratio"
	HistoricalRatiosKeyRealtimePERatio                      HistoricalRatiosKey = "realtime_pe-ratio"
	HistoricalRatiosKeyCurrentRatio                         HistoricalRatiosKey = "current-ratio"
	HistoricalRatiosKeyDaysInventory                        HistoricalRatiosKey = "days-inventory"
	HistoricalRatiosKeyNetMargin                            HistoricalRatiosKey = "net-margin"
	HistoricalRatiosKeySalesGrowth                          HistoricalRatiosKey = "satis_buyumesi"
	HistoricalRatiosKeyROE                                  HistoricalRatiosKey = "roe"
	HistoricalRatiosKeyAssetTurnover                        HistoricalRatiosKey = "asset-turnover"
	HistoricalRatiosKeyLeverageRatio                        HistoricalRatiosKey = "leverage-ratio"
	HistoricalRatiosKeySales                                HistoricalRatiosKey = "satislar"
	HistoricalRatiosKeyNetProfit                            HistoricalRatiosKey = "net_kar"
	HistoricalRatiosKeyInterestCoverage                     HistoricalRatiosKey = "interestCoverage"
	HistoricalRatiosKeyTotalOperationalExpense              HistoricalRatiosKey = "total_operational_expense"
	HistoricalRatiosKeyTotalOperationalExpenseToGrossProfit HistoricalRatiosKey = "total_operational_expense_gross_profit_ratio"
	HistoricalRatiosKeyCashAndCashEquivalents               HistoricalRatiosKey = "cash_and_cash_equivalents"
	HistoricalRatiosKeyCashToAssets                         HistoricalRatiosKey = "cash_to_assets"
	HistoricalRatiosKeyCAPEXToNetProfit                     HistoricalRatiosKey = "capex_to_net_profit"
	HistoricalRatiosKeyRealtimeEVToEBITDA                   HistoricalRatiosKey = "realtime_ev-to-ebitda"
	HistoricalRatiosKeyReceivablesTurnover                  HistoricalRatiosKey = "alacak_devir_hizi"
	HistoricalRatiosKeyEPSBasic                             HistoricalRatiosKey = "eps-basic"
	HistoricalRatiosKeyNetProfitGrowth                      HistoricalRatiosKey = "net_kar_buyumesi"
	HistoricalRatiosKeyDebtToEquity                         HistoricalRatiosKey = "debt-to-equity"
	HistoricalRatiosKeyNetDebtToEBITDA                      HistoricalRatiosKey = "net_borc_favok"
	HistoricalRatiosKeyPBRatio                              HistoricalRatiosKey = "pb-ratio"
	HistoricalRatiosKeyEBITDAGrowth                         HistoricalRatiosKey = "favok_buyumesi"
	HistoricalRatiosKeyCashConversionCycle                  HistoricalRatiosKey = "cash-conversion-cycle"
	HistoricalRatiosKeyGrossProfitGrowth                    HistoricalRatiosKey = "brut_kar_buyumesi"
	HistoricalRatiosKeyLoanGrowth                           HistoricalRatiosKey = "kredi_buyumesi"
	HistoricalRatiosKeyGrossWrittenPremiumGrowth            HistoricalRatiosKey = "brut_yazilan_prim_buyumesi"
	HistoricalRatiosKeyTechnicalProfitMargin                HistoricalRatiosKey = "teknik_kar_marji"
	HistoricalRatiosKeyCompanyPremiumRetentionRatio         HistoricalRatiosKey = "sirketin_prim_tutma_orani"
	HistoricalRatiosKeyMarketValue                          HistoricalRatiosKey = "piyasa_degeri"
	HistoricalRatiosKeyFinancialExpensesToEBITRatio         HistoricalRatiosKey = "financial_expenses_ebit_ratio"
	HistoricalRatiosKeyShortTermToLongTermObligations       HistoricalRatiosKey = "short_term_obligations_long_term_obligations"
	HistoricalRatiosKeyRetainedEarnings                     HistoricalRatiosKey = "retained_earnings"
	HistoricalRatiosKeyThreeYearCAGRFreeCashFlow            HistoricalRatiosKey = "three_year_cagr_free_cash_flow"
	HistoricalRatiosKeyPOE                                  HistoricalRatiosKey = "poe"
	HistoricalRatiosKeyLongTermLoansToPeriodProfit          HistoricalRatiosKey = "long_term_loans_period_profit_ratio"
	HistoricalRatiosKeyLongTermLoans                        HistoricalRatiosKey = "long_term_loans"
	HistoricalRatiosKeyCommercialReceivablesToCurrentAssets HistoricalRatiosKey = "commercial_receivables_total_current_assets"
	HistoricalRatiosKeyStockGrowth                          HistoricalRatiosKey = "stock_growth"
	HistoricalRatiosKeyFiveYearRetainedEarningsChange       HistoricalRatiosKey = "five_year_retained_earnings_change"
	HistoricalRatiosKeyThreeYearCAGRRetainedEarnings        HistoricalRatiosKey = "three_year_cagr_retained_earnings"
	HistoricalRatiosKeyPOCF                                 HistoricalRatiosKey = "pocf"
	HistoricalRatiosKeyFCFToEV                              HistoricalRatiosKey = "fcfEv"
	HistoricalRatiosKeyDD                                   HistoricalRatiosKey = "dd"
	HistoricalRatiosKeyNetDebt                              HistoricalRatiosKey = "net_borc"
	HistoricalRatiosKeyPaidInCapital                        HistoricalRatiosKey = "odenmis_sermaye"
)

type Holding

type Holding struct {
	PoliticianName string    `json:"politicianName"`
	Symbol         string    `json:"symbol"`
	Company        string    `json:"company"`
	Holding        string    `json:"holding"`
	Allocation     string    `json:"allocation"`
	LastUpdated    time.Time `json:"lastUpdated"`
}

type HoldingShort

type HoldingShort struct {
	Symbol     string `json:"symbol"`
	Company    string `json:"company"`
	Holding    string `json:"holding"`
	Allocation string `json:"allocation"`
}

type Industry

type Industry struct {
	ID        primitive.ObjectID `json:"id"`
	Title     string             `json:"title"`
	ImageUrl  string             `json:"imageUrl"`
	AvatarUrl string             `json:"avatarUrl"`
	NumStocks int                `json:"numStocks"`
}

type KeyInsight

type KeyInsight struct {
	Symbol  string `json:"symbol"`
	Insight string `json:"insight"`
}

type LaplaceConfiguration

type LaplaceConfiguration struct {
	APIKey  string `split_words:"true"`
	BaseURL string `split_words:"true"`
}

func LoadGlobal

func LoadGlobal(filename string) (*LaplaceConfiguration, error)

LoadGlobal loads configuration from environment variables and optionally from a .env file.

func (*LaplaceConfiguration) ApplyDefaults

func (c *LaplaceConfiguration) ApplyDefaults()

ApplyDefaults sets default values for configuration fields that are not provided.

func (*LaplaceConfiguration) Validate

func (c *LaplaceConfiguration) Validate() error

Validate performs validation checks on the configuration.

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       LaplaceHTTPErrorMsg `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 LaplaceHTTPErrorMsg

type LaplaceHTTPErrorMsg struct {
	Message   string `json:"message"`
	ErrorCode string `json:"error_code"`
}

type LevelSide

type LevelSide string

LevelSide represents the side of an orderbook level

const (
	LevelSideBid LevelSide = "bid"
	LevelSideAsk LevelSide = "ask"
)

type LiveMessageV2

type LiveMessageV2[T any] struct {
	Type MessageType `json:"t"`
	Data T           `json:"d"`
}

LiveMessageV2 is the envelope used by the v2 price feeds (live and delayed BIST prices, US prices, BIST bid/ask). On the wire every event looks like {"t":"","d":{...}}. Check Type before using Data:

  • MessageTypePrice ("pr"): Data holds a price tick.
  • MessageTypeHeartbeat ("heartbeat"): sent every 10 seconds with no "d", so Data is the zero value.
  • MessageTypeStateChange ("state_change"): emitted on the BIST live and delayed feeds when a market or stock changes state, as {"t":"state_change","d":{"marketSymbol":..,"stockSymbol":..,"state":..,"time":..}}. Market-level events reach every subscriber regardless of the symbol filter. That payload does not match T, so Data is the zero value; the state payload is not decoded yet.

type LivePriceResult

type LivePriceResult[T any] struct {
	Data  T
	Error error
}

type LivePriceStream

type LivePriceStream[T any] struct {
	// contains filtered or unexported fields
}

LivePriceStream handles live price streaming for a specific region and type

func NewLivePriceStream

func NewLivePriceStream[T any](client *Client, priceType LivePriceType, region Region) *LivePriceStream[T]

NewLivePriceStream creates a new LivePriceStream

func (*LivePriceStream[T]) Close

func (s *LivePriceStream[T]) Close() error

Close closes the stream and cleanup resources

func (*LivePriceStream[T]) Receive

func (s *LivePriceStream[T]) Receive() <-chan LivePriceResult[T]

Receive returns a channel to receive live price data. The channel is closed when Close is called, when the context passed to Subscribe is cancelled, when the server ends the stream, or when Subscribe is called again.

func (*LivePriceStream[T]) Subscribe

func (s *LivePriceStream[T]) Subscribe(ctx context.Context, symbols []string) error

Subscribe subscribes to live price updates for the given symbols. Calling Subscribe on a stream that is already subscribed switches it to the new symbols: the channel previously returned by Receive is closed and a fresh one is created, so call Receive again afterwards.

type LivePriceType

type LivePriceType string

LivePriceType represents the type of live price stream

const (
	LivePriceTypePrice        LivePriceType = "price"
	LivePriceTypeDelayedPrice LivePriceType = "delayed-price"
	LivePriceTypeOrderBook    LivePriceType = "order-book"
	LivePriceTypeBidAsk       LivePriceType = "bid-ask"
)

type Locale

type Locale string
const (
	LocaleTr   Locale = "tr"
	LocaleEn   Locale = "en"
	LocaleNone Locale = "none"
)

type LocaleString

type LocaleString map[Locale]string

type Market

type Market string
const (
	MarketYildiz      Market = "YILDIZ"
	MarketAna         Market = "ANA"
	MarketAlt         Market = "ALT"
	MarketYakinIzleme Market = "YAKIN_IZLEME"
	MarketPOIP        Market = "POIP"
	MarketFon         Market = "FON"
	MarketGirisim     Market = "GIRISIM"
	MarketEmtia       Market = "EMTIA"
)

type MarketState

type MarketState struct {
	ID            int       `json:"id"`
	MarketSymbol  *string   `json:"marketSymbol,omitempty"`
	State         string    `json:"state"`
	LastTimestamp time.Time `json:"lastTimestamp"`
	StockSymbol   *string   `json:"stockSymbol,omitempty"`
}

type MessageCode

type MessageCode string
const (
	MessageCodeNewUser            MessageCode = "new_user"
	MessageCodeHasNoAccessToLevel MessageCode = "no_access_to_level"
)

type MessageType

type MessageType string

MessageType represents the type of message in live data streams

const (
	MessageTypePrice       MessageType = "pr"
	MessageTypeStateChange MessageType = "state_change"
	MessageTypeHeartbeat   MessageType = "heartbeat"
	MessageTypeOrderbook   MessageType = "ob"
)

type News

type News struct {
	ID             string          `json:"id"`
	URL            string          `json:"url"`
	ImageUrl       string          `json:"imageUrl"`
	Timestamp      time.Time       `json:"timestamp"`
	PublisherUrl   string          `json:"publisherUrl"`
	Publisher      NewsPublisher   `json:"publisher"`
	RelatedTickers []NewsTicker    `json:"relatedTickers"`
	QualityScore   int64           `json:"qualityScore"`
	CreatedAt      time.Time       `json:"createdAt"`
	Tickers        []NewsTicker    `json:"tickers,omitempty"`
	Categories     *NewsCategories `json:"categories,omitempty"`
	Sectors        *NewsSector     `json:"sectors,omitempty"`
	Content        *NewsContent    `json:"content,omitempty"`
	Industries     *NewsIndustry   `json:"industries,omitempty"`
}

type NewsApiSource

type NewsApiSource struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

NewsApiSource is a configured upstream news source as returned by the News API Source Names endpoint. The ID value is accepted by the `apiSource` filter of the News and Live News Stream endpoints (comma-separated for multiple); Name is the human-readable display name (e.g. "BBC Business", "Gazete Oksijen").

type NewsCategories

type NewsCategories struct {
	ID           string  `json:"id"`
	Name         string  `json:"name"`
	CategoryType *string `json:"categoryType,omitempty"`
}

type NewsCategory

type NewsCategory struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

NewsCategory is a canonical news category with a localized name, as returned by the News Categories endpoint. The Name value is the exact value accepted by the `categories` filter of the News V2 and Live News Stream endpoints.

type NewsContent

type NewsContent struct {
	Title           string   `json:"title"`
	Description     string   `json:"description"`
	Content         []string `json:"content"`
	Summary         []string `json:"summary"`
	InvestorInsight string   `json:"investorInsight"`
}

type NewsHighlight

type NewsHighlight struct {
	ID                      string    `json:"id"`
	CreatedAt               time.Time `json:"createdAt"`
	Consumer                []string  `json:"consumer"`
	EnergyAndUtilities      []string  `json:"energyAndUtilities"`
	Finance                 []string  `json:"finance"`
	Healthcare              []string  `json:"healthcare"`
	IndustrialsAndMaterials []string  `json:"industrialsAndMaterials"`
	Tech                    []string  `json:"tech"`
	Other                   []string  `json:"other"`
}

NewsHighlight is a single dated highlights record, with the top news items bucketed by sector group. It is one item of the paginated News Highlights response.

type NewsIndustry

type NewsIndustry struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type NewsLane

type NewsLane string

NewsLane is a curated news surface that groups upstream sources. It is accepted by the `lane` filter of the News, News V2, and Live News Stream endpoints. US lanes are NewsLaneGlobalMacro and NewsLaneFastMovers; TR lanes are NewsLaneTrEkonomi and NewsLaneBist.

const (
	NewsLaneGlobalMacro NewsLane = "global_macro"
	NewsLaneTrEkonomi   NewsLane = "tr_ekonomi"
	NewsLaneBist        NewsLane = "bist"
	NewsLaneFastMovers  NewsLane = "fast_movers"
)

type NewsLaneInfo

type NewsLaneInfo struct {
	ID    NewsLane `json:"id"`
	Label string   `json:"label"`
}

NewsLaneInfo is a selectable news lane as returned by the News Lanes endpoint. The ID value is the exact value accepted by the `lane` filter of the News, News V2, and Live News Stream endpoints.

type NewsOrderBy

type NewsOrderBy string
const (
	NewsOrderByTimestamp    NewsOrderBy = "timestamp"
	NewsOrderByQualityScore NewsOrderBy = "quality_score"
)

type NewsPublisher

type NewsPublisher struct {
	Name    string  `json:"name"`
	LogoUrl *string `json:"logoUrl"`
}

type NewsSector

type NewsSector struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type NewsStream

type NewsStream struct {
	// contains filtered or unexported fields
}

NewsStream handles live news streaming for a specific locale and filters

func (*NewsStream) Close

func (s *NewsStream) Close() error

Close closes the stream and cleanup resources

func (*NewsStream) Receive

func (s *NewsStream) Receive() <-chan NewsStreamResult

Receive returns a channel to receive news data

func (*NewsStream) Subscribe

func (s *NewsStream) Subscribe(ctx context.Context) error

Subscribe starts receiving news from the stream

type NewsStreamResult

type NewsStreamResult struct {
	Data  []NewsV2
	Error error
}

NewsStreamResult is the result type for news streams

type NewsTicker

type NewsTicker struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Symbol string `json:"symbol,omitempty"`
}

type NewsType

type NewsType string
const (
	NewsTypeBriefs    NewsType = "briefs"
	NewsTypeBloomberg NewsType = "bloomberg"
	NewsTypeFDA       NewsType = "fda"
	NewsTypeReuters   NewsType = "reuters"
)

type NewsV2

type NewsV2 struct {
	ID           string          `json:"id"`
	URL          string          `json:"url"`
	ImageUrl     string          `json:"imageUrl"`
	Timestamp    time.Time       `json:"timestamp"`
	PublisherUrl string          `json:"publisherUrl"`
	Publisher    NewsPublisher   `json:"publisher"`
	QualityScore int64           `json:"qualityScore"`
	CreatedAt    time.Time       `json:"createdAt"`
	Tickers      []NewsTicker    `json:"tickers,omitempty"`
	Categories   *NewsCategories `json:"categories,omitempty"`
	Sectors      *NewsSector     `json:"sectors,omitempty"`
	Content      *NewsContent    `json:"content,omitempty"`
	Industries   *NewsIndustry   `json:"industries,omitempty"`
}

type OrderbookDeletedLevel

type OrderbookDeletedLevel struct {
	ID   int       `json:"level"`
	Side LevelSide `json:"side"`
}

OrderbookDeletedLevel represents a deleted level in the orderbook

type OrderbookLevel

type OrderbookLevel struct {
	ID     int       `json:"level"`
	Side   LevelSide `json:"side"`
	Volume float64   `json:"vol"`
	Orders int       `json:"orders"`
	Price  float64   `json:"p"`
}

OrderbookLevel represents a single level in the orderbook

type PaginatedResponse

type PaginatedResponse[T any] struct {
	RecordCount int `json:"recordCount"`
	Items       []T `json:"items"`
}

type PaginationPageSize

type PaginationPageSize int
const (
	PageSize10 PaginationPageSize = 10
	PageSize20 PaginationPageSize = 20
	PageSize50 PaginationPageSize = 50
)

type PeerType

type PeerType string
const (
	PeerTypeSector   PeerType = "sector"
	PeerTypeIndustry PeerType = "industry"
)

type Politician

type Politician struct {
	Id             int32     `json:"id"`
	PoliticianName string    `json:"politicianName"`
	TotalHoldings  int32     `json:"totalHoldings"`
	LastUpdated    time.Time `json:"lastUpdated"`
}

type PoliticianDetail

type PoliticianDetail struct {
	Id            int32          `json:"id"`
	Name          string         `json:"name"`
	Holdings      []HoldingShort `json:"holdings"`
	TotalHoldings int32          `json:"totalHoldings"`
	LastUpdated   time.Time      `json:"lastUpdated"`
}

type Price

type Price float64

func (Price) MarshalJSON

func (p Price) MarshalJSON() ([]byte, error)

type PriceDataPoint

type PriceDataPoint struct {
	Date            int64   `json:"d"`
	Open            float64 `json:"o"`
	UnadjustedOpen  float64 `json:"uo,omitempty"`
	High            float64 `json:"h"`
	UnadjustedHigh  float64 `json:"uh,omitempty"`
	Low             float64 `json:"l"`
	UnadjustedLow   float64 `json:"ul,omitempty"`
	Close           float64 `json:"c"`
	UnadjustedClose float64 `json:"uc,omitempty"`
	Volume          float64 `json:"v,omitempty"`
	UnadjustedVol   float64 `json:"uv,omitempty"`
}

type Region

type Region string
const (
	RegionTr   Region = "tr"
	RegionUs   Region = "us"
	RegionNone Region = "none"
)

type ScreenerFilters

type ScreenerFilters struct {
	Price             *ScreenerRange `json:"price,omitempty"`
	DailyChange       *ScreenerRange `json:"dailyChange,omitempty"`
	MarketCap         *ScreenerRange `json:"marketCap,omitempty"`
	PERatio           *ScreenerRange `json:"peRatio,omitempty"`
	PBRatio           *ScreenerRange `json:"pbRatio,omitempty"`
	WeeklyReturn      *ScreenerRange `json:"weeklyReturn,omitempty"`
	MonthlyReturn     *ScreenerRange `json:"monthlyReturn,omitempty"`
	ThreeMonthReturn  *ScreenerRange `json:"threeMonthReturn,omitempty"`
	YearlyReturn      *ScreenerRange `json:"yearlyReturn,omitempty"`
	ThreeYearReturn   *ScreenerRange `json:"threeYearReturn,omitempty"`
	FiveYearReturn    *ScreenerRange `json:"fiveYearReturn,omitempty"`
	YTDReturn         *ScreenerRange `json:"ytdReturn,omitempty"`
	CompositeRating   *ScreenerRange `json:"compositeRating,omitempty"`
	CompositeScore    *ScreenerRange `json:"compositeScore,omitempty"`
	RSRating          *ScreenerRange `json:"rsRating,omitempty"`
	RSScore           *ScreenerRange `json:"rsScore,omitempty"`
	PerfQ1            *ScreenerRange `json:"perfQ1,omitempty"`
	PerfQ2            *ScreenerRange `json:"perfQ2,omitempty"`
	PerfQ3            *ScreenerRange `json:"perfQ3,omitempty"`
	PerfQ4            *ScreenerRange `json:"perfQ4,omitempty"`
	EPSRating         *ScreenerRange `json:"epsRating,omitempty"`
	EPSScore          *ScreenerRange `json:"epsScore,omitempty"`
	EPSGrowthYoY      *ScreenerRange `json:"epsGrowthYoy,omitempty"`
	EPSGrowthQoQ      *ScreenerRange `json:"epsGrowthQoq,omitempty"`
	EPSTrailing4Q     *ScreenerRange `json:"epsTrailing4q,omitempty"`
	ADScore           *ScreenerRange `json:"adScore,omitempty"`
	UpVolumeRatio     *ScreenerRange `json:"upVolumeRatio,omitempty"`
	VolumeTrend       *ScreenerRange `json:"volumeTrend,omitempty"`
	SMRScore          *ScreenerRange `json:"smrScore,omitempty"`
	SalesGrowth2Q     *ScreenerRange `json:"salesGrowth2q,omitempty"`
	GrossMargin       *ScreenerRange `json:"grossMargin,omitempty"`
	NetMargin         *ScreenerRange `json:"netMargin,omitempty"`
	ROE               *ScreenerRange `json:"roe,omitempty"`
	SMA20             *ScreenerRange `json:"sma20,omitempty"`
	SMA50             *ScreenerRange `json:"sma50,omitempty"`
	SMA150            *ScreenerRange `json:"sma150,omitempty"`
	SMA200            *ScreenerRange `json:"sma200,omitempty"`
	VolumeSMA50       *ScreenerRange `json:"volumeSma50,omitempty"`
	PriceVsSMA20      *ScreenerRange `json:"priceVsSma20,omitempty"`
	PriceVsSMA50      *ScreenerRange `json:"priceVsSma50,omitempty"`
	PriceVsSMA150     *ScreenerRange `json:"priceVsSma150,omitempty"`
	PriceVsSMA200     *ScreenerRange `json:"priceVsSma200,omitempty"`
	High52W           *ScreenerRange `json:"high52w,omitempty"`
	Low52W            *ScreenerRange `json:"low52w,omitempty"`
	OffHighPct        *ScreenerRange `json:"offHighPct,omitempty"`
	VolumeVsAvg50     *ScreenerRange `json:"volumeVsAvg50,omitempty"`
	PriceChangePct    *ScreenerRange `json:"priceChangePct,omitempty"`
	PriceChangeAmount *ScreenerRange `json:"priceChangeAmount,omitempty"`
	YTDChangePct      *ScreenerRange `json:"ytdChangePct,omitempty"`

	// Letter-grade IN-lists; values must be A..E.
	SMRRating []ScreenerRating `json:"smrRating,omitempty"`
	ADRating  []ScreenerRating `json:"adRating,omitempty"`

	// EPSAcceleration filters for stocks whose earnings growth is accelerating.
	EPSAcceleration *bool `json:"epsAcceleration,omitempty"`
}

ScreenerFilters holds the optional filter set. Every field is a range filter except SMRRating/ADRating (letter-grade IN-lists) and EPSAcceleration (bool).

type ScreenerItem

type ScreenerItem struct {
	Symbol            string          `json:"symbol"`
	Price             *float64        `json:"price"`
	DailyChange       *float64        `json:"dailyChange"`
	MarketCap         *float64        `json:"marketCap"`
	PERatio           *float64        `json:"peRatio"`
	PBRatio           *float64        `json:"pbRatio"`
	WeeklyReturn      *float64        `json:"weeklyReturn"`
	MonthlyReturn     *float64        `json:"monthlyReturn"`
	ThreeMonthReturn  *float64        `json:"threeMonthReturn"`
	YearlyReturn      *float64        `json:"yearlyReturn"`
	ThreeYearReturn   *float64        `json:"threeYearReturn"`
	FiveYearReturn    *float64        `json:"fiveYearReturn"`
	YTDReturn         *float64        `json:"ytdReturn"`
	CompositeRating   *int            `json:"compositeRating"`
	CompositeScore    *float64        `json:"compositeScore"`
	RSRating          *int            `json:"rsRating"`
	RSScore           *float64        `json:"rsScore"`
	PerfQ1            *float64        `json:"perfQ1"`
	PerfQ2            *float64        `json:"perfQ2"`
	PerfQ3            *float64        `json:"perfQ3"`
	PerfQ4            *float64        `json:"perfQ4"`
	EPSRating         *int            `json:"epsRating"`
	EPSScore          *float64        `json:"epsScore"`
	EPSGrowthYoY      *float64        `json:"epsGrowthYoy"`
	EPSGrowthQoQ      *float64        `json:"epsGrowthQoq"`
	EPSTrailing4Q     *float64        `json:"epsTrailing4q"`
	EPSAcceleration   *bool           `json:"epsAcceleration"`
	ADRating          *ScreenerRating `json:"adRating"`
	ADScore           *float64        `json:"adScore"`
	UpVolumeRatio     *float64        `json:"upVolumeRatio"`
	VolumeTrend       *float64        `json:"volumeTrend"`
	SMRRating         *ScreenerRating `json:"smrRating"`
	SMRScore          *float64        `json:"smrScore"`
	SalesGrowth2Q     *float64        `json:"salesGrowth2q"`
	GrossMargin       *float64        `json:"grossMargin"`
	NetMargin         *float64        `json:"netMargin"`
	ROE               *float64        `json:"roe"`
	SMA20             *float64        `json:"sma20"`
	SMA50             *float64        `json:"sma50"`
	SMA150            *float64        `json:"sma150"`
	SMA200            *float64        `json:"sma200"`
	VolumeSMA50       *float64        `json:"volumeSma50"`
	PriceVsSMA20      *float64        `json:"priceVsSma20"`
	PriceVsSMA50      *float64        `json:"priceVsSma50"`
	PriceVsSMA150     *float64        `json:"priceVsSma150"`
	PriceVsSMA200     *float64        `json:"priceVsSma200"`
	High52W           *float64        `json:"high52w"`
	Low52W            *float64        `json:"low52w"`
	OffHighPct        *float64        `json:"offHighPct"`
	VolumeVsAvg50     *float64        `json:"volumeVsAvg50"`
	PriceChangePct    *float64        `json:"priceChangePct"`
	PriceChangeAmount *float64        `json:"priceChangeAmount"`
	YTDChangePct      *float64        `json:"ytdChangePct"`
}

ScreenerItem is one row of screener results. Decimal fields return 0 when a value is absent; the integer ratings, letter grades and EPSAcceleration are pointers because they are null when absent.

type ScreenerRange

type ScreenerRange struct {
	Min *float64 `json:"min,omitempty"`
	Max *float64 `json:"max,omitempty"`
}

ScreenerRange is an inclusive [Min, Max] filter; both bounds are optional. If both are set, Min must be <= Max. Rows whose value is NULL in a column are excluded by any range filter touching that column.

type ScreenerRating

type ScreenerRating string

ScreenerRating is an IBD-style letter grade (A is best, E is worst) used by the SMR and Accumulation/Distribution ratings.

const (
	ScreenerRatingA ScreenerRating = "A"
	ScreenerRatingB ScreenerRating = "B"
	ScreenerRatingC ScreenerRating = "C"
	ScreenerRatingD ScreenerRating = "D"
	ScreenerRatingE ScreenerRating = "E"
)

type ScreenerRequest

type ScreenerRequest struct {
	Filters   *ScreenerFilters `json:"filters,omitempty"`
	SortBy    ScreenerSortBy   `json:"sortBy,omitempty"`
	SortOrder SortDirection    `json:"sortOrder,omitempty"`
	Page      int              `json:"page,omitempty"`
	PageSize  int              `json:"pageSize,omitempty"`
}

type ScreenerResponse

type ScreenerResponse struct {
	Items       []ScreenerItem `json:"items"`
	RecordCount int            `json:"recordCount"`
}

type ScreenerSortBy

type ScreenerSortBy string
const (
	ScreenerSortBySymbol            ScreenerSortBy = "symbol"
	ScreenerSortByPrice             ScreenerSortBy = "price"
	ScreenerSortByDailyChange       ScreenerSortBy = "dailyChange"
	ScreenerSortByMarketCap         ScreenerSortBy = "marketCap"
	ScreenerSortByPERatio           ScreenerSortBy = "peRatio"
	ScreenerSortByPBRatio           ScreenerSortBy = "pbRatio"
	ScreenerSortByWeeklyReturn      ScreenerSortBy = "weeklyReturn"
	ScreenerSortByMonthlyReturn     ScreenerSortBy = "monthlyReturn"
	ScreenerSortByThreeMonthReturn  ScreenerSortBy = "threeMonthReturn"
	ScreenerSortByYearlyReturn      ScreenerSortBy = "yearlyReturn"
	ScreenerSortByThreeYearReturn   ScreenerSortBy = "threeYearReturn"
	ScreenerSortByFiveYearReturn    ScreenerSortBy = "fiveYearReturn"
	ScreenerSortByYTDReturn         ScreenerSortBy = "ytdReturn"
	ScreenerSortByCompositeRating   ScreenerSortBy = "compositeRating"
	ScreenerSortByCompositeScore    ScreenerSortBy = "compositeScore"
	ScreenerSortByRSRating          ScreenerSortBy = "rsRating"
	ScreenerSortByRSScore           ScreenerSortBy = "rsScore"
	ScreenerSortByPerfQ1            ScreenerSortBy = "perfQ1"
	ScreenerSortByPerfQ2            ScreenerSortBy = "perfQ2"
	ScreenerSortByPerfQ3            ScreenerSortBy = "perfQ3"
	ScreenerSortByPerfQ4            ScreenerSortBy = "perfQ4"
	ScreenerSortByEPSRating         ScreenerSortBy = "epsRating"
	ScreenerSortByEPSScore          ScreenerSortBy = "epsScore"
	ScreenerSortByEPSGrowthYoY      ScreenerSortBy = "epsGrowthYoy"
	ScreenerSortByEPSGrowthQoQ      ScreenerSortBy = "epsGrowthQoq"
	ScreenerSortByEPSTrailing4Q     ScreenerSortBy = "epsTrailing4q"
	ScreenerSortByEPSAcceleration   ScreenerSortBy = "epsAcceleration"
	ScreenerSortByADRating          ScreenerSortBy = "adRating"
	ScreenerSortByADScore           ScreenerSortBy = "adScore"
	ScreenerSortByUpVolumeRatio     ScreenerSortBy = "upVolumeRatio"
	ScreenerSortByVolumeTrend       ScreenerSortBy = "volumeTrend"
	ScreenerSortBySMRRating         ScreenerSortBy = "smrRating"
	ScreenerSortBySMRScore          ScreenerSortBy = "smrScore"
	ScreenerSortBySalesGrowth2Q     ScreenerSortBy = "salesGrowth2q"
	ScreenerSortByGrossMargin       ScreenerSortBy = "grossMargin"
	ScreenerSortByNetMargin         ScreenerSortBy = "netMargin"
	ScreenerSortByROE               ScreenerSortBy = "roe"
	ScreenerSortBySMA20             ScreenerSortBy = "sma20"
	ScreenerSortBySMA50             ScreenerSortBy = "sma50"
	ScreenerSortBySMA150            ScreenerSortBy = "sma150"
	ScreenerSortBySMA200            ScreenerSortBy = "sma200"
	ScreenerSortByVolumeSMA50       ScreenerSortBy = "volumeSma50"
	ScreenerSortByPriceVsSMA20      ScreenerSortBy = "priceVsSma20"
	ScreenerSortByPriceVsSMA50      ScreenerSortBy = "priceVsSma50"
	ScreenerSortByPriceVsSMA150     ScreenerSortBy = "priceVsSma150"
	ScreenerSortByPriceVsSMA200     ScreenerSortBy = "priceVsSma200"
	ScreenerSortByHigh52W           ScreenerSortBy = "high52w"
	ScreenerSortByLow52W            ScreenerSortBy = "low52w"
	ScreenerSortByOffHighPct        ScreenerSortBy = "offHighPct"
	ScreenerSortByVolumeVsAvg50     ScreenerSortBy = "volumeVsAvg50"
	ScreenerSortByPriceChangePct    ScreenerSortBy = "priceChangePct"
	ScreenerSortByPriceChangeAmount ScreenerSortBy = "priceChangeAmount"
	ScreenerSortByYTDChangePct      ScreenerSortBy = "ytdChangePct"
)

Sort keys. Any range-filter field is sortable, plus the smrRating/adRating letter grades, epsAcceleration and symbol. Results are ordered by the chosen column (NULLS LAST) then by symbol ASC.

type SearchResponse

type SearchResponse struct {
	Stocks      []SearchResponseStock      `json:"stocks"`
	Collections []SearchResponseCollection `json:"collections"`
	Sectors     []SearchResponseCollection `json:"sectors"`
	Industries  []SearchResponseCollection `json:"industries"`
}

type SearchResponseCollection

type SearchResponseCollection struct {
	ID         primitive.ObjectID `json:"id"`
	Title      string             `json:"title"`
	Region     []Region           `json:"region"`
	AssetClass AssetClass         `json:"assetClass"`
	ImageUrl   string             `json:"imageUrl"`
	AvatarUrl  string             `json:"avatarUrl"`
}

type SearchResponseStock

type SearchResponseStock struct {
	ID         primitive.ObjectID `json:"id"`
	Name       string             `json:"name"`
	Symbol     string             `json:"title"`
	Region     string             `json:"region"`
	AssetClass string             `json:"assetType"`
	AssetType  string             `json:"type"`
}

type SearchType

type SearchType string
const (
	SearchTypeStock      SearchType = "stock"
	SearchTypeCollection SearchType = "collection"
	SearchTypeSector     SearchType = "sector"
	SearchTypeIndustry   SearchType = "industry"
)

type Sector

type Sector struct {
	ID        primitive.ObjectID `json:"id"`
	Title     string             `json:"title"`
	ImageUrl  string             `json:"imageUrl"`
	AvatarUrl string             `json:"avatarUrl"`
	NumStocks int                `json:"numStocks"`
}

type SendWebsocketEventRequest

type SendWebsocketEventRequest struct {
	ExternalUserID string          `json:"externalUserID,omitempty"`
	Event          json.RawMessage `json:"event"`
	Transient      *bool           `json:"transient,omitempty"`
	BroadCastToAll bool            `json:"broadCastToAll"`
}

type SheetItem

type SheetItem struct {
	Description     string  `json:"description"`
	Value           float64 `json:"value"`
	SheetLineItemId int     `json:"lineCodeId"`
	Indent          int     `json:"indentLevel"`
}

type SortBy

type SortBy string
const (
	SortByPriceChange SortBy = "price_change"
)

type SortDirection

type SortDirection string
const (
	SortDirectionDesc SortDirection = "desc"
	SortDirectionAsc  SortDirection = "asc"
)

type Stock

type Stock struct {
	ID          primitive.ObjectID `json:"id"`
	AssetType   AssetType          `json:"assetType"`
	Name        string             `json:"name"`
	Symbol      string             `json:"symbol"`
	SectorId    string             `json:"sectorId"`
	IndustryId  string             `json:"industryId"`
	UpdatedDate time.Time          `json:"updatedDate"`
	DailyChange float64            `json:"dailyChange,omitempty"`
	Active      bool               `json:"active"`
}

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                  string             `json:"sectorId"`
	IndustryId                string             `json:"industryId"`
	UpdatedDate               time.Time          `json:"updatedDate"`
	Active                    bool               `json:"active"`
	Markets                   []Market           `json:"markets,omitempty"`
}

type StockDividend

type StockDividend struct {
	Date           time.Time `json:"date"`
	Currency       Currency  `json:"currency"`
	NetAmount      float64   `json:"netAmount"`
	NetRatio       float64   `json:"netRatio"`
	GrossAmount    float64   `json:"grossAmount"`
	GrossRatio     float64   `json:"grossRatio"`
	PriceThen      float64   `json:"priceThen"`
	StoppageRatio  float64   `json:"stoppageRatio"`
	StoppageAmount float64   `json:"stoppageAmount"`
}

type StockHistoricalRatios

type StockHistoricalRatios struct {
	Items            []StockHistoricalRatiosData `json:"items"`
	FinalValue       float64                     `json:"finalValue"`
	ThreeYearGrowth  float64                     `json:"threeYearGrowth"`
	YearGrowth       float64                     `json:"yearGrowth"`
	FinalSectorValue float64                     `json:"finalSectorValue"`
	Slug             string                      `json:"slug"`
	Currency         string                      `json:"currency"`
	Format           string                      `json:"format"`
	Name             string                      `json:"name"`
}

type StockHistoricalRatiosData

type StockHistoricalRatiosData struct {
	Period     string  `json:"period"`
	Value      float64 `json:"value"`
	SectorMean float64 `json:"sectorMean"`
}

type StockHistoricalRatiosDescription

type StockHistoricalRatiosDescription struct {
	ID          int       `json:"id"`
	Format      string    `json:"format"`
	Currency    string    `json:"currency"`
	Slug        string    `json:"slug"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Locale      string    `json:"locale"`
	IsRealtime  bool      `json:"isRealtime"`
}

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 StockHistoricalRatiosValue

type StockHistoricalRatiosValue struct {
	Value         float64 `json:"value"`
	SectorAverage float64 `json:"sectorAverage"`
}

type StockPeerFinancialRatioComparison

type StockPeerFinancialRatioComparison struct {
	MetricName      string                                  `json:"metricName"`
	NormalizedValue float64                                 `json:"normalizedValue"`
	Data            []StockPeerFinancialRatioComparisonData `json:"data"`
}

type StockPeerFinancialRatioComparisonData

type StockPeerFinancialRatioComparisonData struct {
	Slug    string  `json:"slug"`
	Value   float64 `json:"value"`
	Average float64 `json:"average"`
}

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 StockRestriction

type StockRestriction struct {
	ID          int        `json:"id"`
	Title       string     `json:"title"`
	Description string     `json:"description"`
	Symbol      string     `json:"symbol,omitempty"`
	StartDate   *time.Time `json:"startDate"`
	EndDate     *time.Time `json:"endDate"`
	Market      string     `json:"market,omitempty"`
}

type StockStats

type StockStats struct {
	PreviousClose    float64 `json:"previousClose,omitempty"`
	YtdReturn        float64 `json:"ytdReturn,omitempty"`
	YearlyReturn     float64 `json:"yearlyReturn,omitempty"`
	MarketCap        float64 `json:"marketCap,omitempty"`
	PeRatio          float64 `json:"peRatio,omitempty"`
	PbRatio          float64 `json:"pbRatio,omitempty"`
	YearLow          float64 `json:"yearLow,omitempty"`
	YearHigh         float64 `json:"yearHigh,omitempty"`
	ThreeYearReturn  float64 `json:"3YearReturn,omitempty"`
	FiveYearReturn   float64 `json:"5YearReturn,omitempty"`
	ThreeMonthReturn float64 `json:"3MonthReturn,omitempty"`
	MonthlyReturn    float64 `json:"monthlyReturn,omitempty"`
	WeeklyReturn     float64 `json:"weeklyReturn,omitempty"`
	Symbol           string  `json:"symbol"`
	LatestPrice      float64 `json:"latestPrice,omitempty"`
	DailyChange      float64 `json:"dailyChange,omitempty"`
	DayHigh          float64 `json:"dayHigh,omitempty"`
	DayLow           float64 `json:"dayLow,omitempty"`
	LowerPriceLimit  Price   `json:"lowerPriceLimit,omitempty"`
	UpperPriceLimit  Price   `json:"upperPriceLimit,omitempty"`
	DayOpen          float64 `json:"dayOpen,omitempty"`
	Eps              float64 `json:"eps,omitempty"`
}

type StreamNewsParams

type StreamNewsParams struct {
	Region      Region
	Locale      Locale
	Lane        NewsLane
	Symbols     []string
	CategoryIds []string
	SectorIds   []string
	IndustryIds []string
	ApiSource   []string
}

StreamNewsParams holds the parameters for the news stream endpoint.

type TickRule

type TickRule struct {
	BasePrice       float64        `json:"basePrice"`
	AdditionalPrice int            `json:"additionalPrice"`
	LowerPriceLimit float64        `json:"lowerPriceLimit"`
	UpperPriceLimit float64        `json:"upperPriceLimit"`
	Rules           []TickSizeRule `json:"rules"`
}

type TickSizeRule

type TickSizeRule struct {
	PriceFrom float64 `json:"priceFrom"`
	PriceTo   float64 `json:"priceTo"`
	TickSize  float64 `json:"tickSize"`
}

type TopHolding

type TopHolding struct {
	Symbol      string                 `json:"symbol"`
	Company     string                 `json:"company"`
	Politicians []TopHoldingPolitician `json:"politicians"`
	Count       int32                  `json:"count"`
}

type TopHoldingPolitician

type TopHoldingPolitician struct {
	Name       string `json:"name"`
	Holding    string `json:"holding"`
	Allocation string `json:"allocation"`
}

type TopMover

type TopMover struct {
	Symbol     string     `json:"symbol"`
	AssetClass AssetClass `json:"assetClass,omitempty"`
	AssetType  AssetType  `json:"assetType,omitempty"`
	Change     float64    `json:"change"`
}

type TopMoversDirection

type TopMoversDirection string
const (
	TopMoversDirectionGainers TopMoversDirection = "gainers"
	TopMoversDirectionLosers  TopMoversDirection = "losers"
)

type USStockLiveData

type USStockLiveData struct {
	Symbol        string  `json:"s"`
	Price         float64 `json:"p"`
	Date          int64   `json:"d"`
	PercentChange float64 `json:"pc"`
	AmountChange  float64 `json:"ac"`
}

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"`
}

type WebSocketMonthlyUsageData

type WebSocketMonthlyUsageData struct {
	ExternalUserID      string    `json:"externalUserID"`
	FirstConnectionTime time.Time `json:"firstConnectionTime"`
	UniqueDeviceCount   int64     `json:"uniqueDeviceCount"`
}

type WebSocketUrlParams

type WebSocketUrlParams struct {
	ExternalUserId string     `json:"externalUserId"`
	Feeds          []FeedType `json:"feeds"`
}

type WebSocketUrlResponse

type WebSocketUrlResponse struct {
	URL         string      `json:"url,omitempty"`
	Message     string      `json:"message,omitempty"`
	Code        MessageCode `json:"code,omitempty"`
	ExampleBody any         `json:"exampleBody,omitempty"`
}

Jump to

Keyboard shortcuts

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