cdpcontrol

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeValidation       = "VALIDATION"
	CodeChartNotFound    = "CHART_NOT_FOUND"
	CodeAPIUnavailable   = "API_UNAVAILABLE"
	CodeEvalFailure      = "EVAL_FAILURE"
	CodeEvalTimeout      = "EVAL_TIMEOUT"
	CodeCDPUnavailable   = "CDP_UNAVAILABLE"
	CodeSnapshotNotFound = "SNAPSHOT_NOT_FOUND"
	CodeNoteNotFound     = "NOTE_NOT_FOUND"
)

Variables

View Source
var ChartTypeMap = map[string]int{
	"bars":              0,
	"candles":           1,
	"line":              2,
	"area":              3,
	"renko":             4,
	"kagi":              5,
	"point_and_figure":  6,
	"line_break":        7,
	"heikin_ashi":       8,
	"hollow_candles":    9,
	"baseline":          10,
	"high_low":          12,
	"columns":           13,
	"line_with_markers": 14,
	"step_line":         15,
	"hlc_area":          16,
	"volume_candles":    19,
	"hlc_bars":          21,
}

ChartTypeMap maps human-readable chart type names to TradingView ChartStyle enum values.

View Source
var ChartTypeReverseMap = func() map[int]string {
	m := make(map[int]string, len(ChartTypeMap))
	for name, id := range ChartTypeMap {
		m[id] = name
	}
	return m
}()

ChartTypeReverseMap maps TradingView ChartStyle enum values back to human-readable names.

View Source
var KnownShapes = func() map[string]ShapeInfo {
	m := make(map[string]ShapeInfo)
	for _, g := range ShapeGroups {
		for _, s := range g.Shapes {
			m[s.Name] = s
		}
	}
	return m
}()

KnownShapes is a flat lookup built from ShapeGroups for validation.

View Source
var ShapeGroups = []ShapeGroup{
	{Category: "lines", Label: "Lines", Shapes: []ShapeInfo{
		{Name: "trend_line", Label: "Trend Line", Points: 2},
		{Name: "ray", Label: "Ray", Points: 2},
		{Name: "info_line", Label: "Info Line", Points: 2},
		{Name: "extended", Label: "Extended Line", Points: 2},
		{Name: "trend_angle", Label: "Trend Angle", Points: 2},
		{Name: "horizontal_line", Label: "Horizontal Line", Points: 1},
		{Name: "horizontal_ray", Label: "Horizontal Ray", Points: 1},
		{Name: "vertical_line", Label: "Vertical Line", Points: 1},
		{Name: "cross_line", Label: "Cross Line", Points: 1},
	}},
	{Category: "channels", Label: "Channels", Shapes: []ShapeInfo{
		{Name: "parallel_channel", Label: "Parallel Channel", Points: 3},
		{Name: "regression_trend", Label: "Regression Trend", Points: 2},
		{Name: "flat_bottom", Label: "Flat Top/Bottom", Points: 3},
		{Name: "disjoint_angle", Label: "Disjoint Channel", Points: 3},
	}},
	{Category: "pitchforks", Label: "Pitchforks", Shapes: []ShapeInfo{
		{Name: "pitchfork", Label: "Pitchfork", Points: 3},
		{Name: "schiff_pitchfork", Label: "Schiff Pitchfork", Points: 3},
		{Name: "schiff_pitchfork_modified", Label: "Modified Schiff Pitchfork", Points: 3},
		{Name: "inside_pitchfork", Label: "Inside Pitchfork", Points: 3},
	}},
	{Category: "fibonacci", Label: "Fibonacci", Shapes: []ShapeInfo{
		{Name: "fib_retracement", Label: "Fib Retracement", Points: 2},
		{Name: "fib_trend_ext", Label: "Trend-Based Fib Extension", Points: 3},
		{Name: "fib_channel", Label: "Fib Channel", Points: 3},
		{Name: "fib_timezone", Label: "Fib Time Zone", Points: 2},
		{Name: "fib_speed_resist_fan", Label: "Fib Speed Resistance Fan", Points: 2},
		{Name: "fib_trend_time", Label: "Trend-Based Fib Time", Points: 3},
		{Name: "fib_circles", Label: "Fib Circles", Points: 2},
		{Name: "fib_spiral", Label: "Fib Spiral", Points: 2},
		{Name: "fib_speed_resist_arcs", Label: "Fib Speed Resistance Arcs", Points: 2},
		{Name: "fib_wedge", Label: "Fib Wedge", Points: 3},
		{Name: "pitchfan", Label: "Pitchfan", Points: 3},
	}},
	{Category: "gann", Label: "Gann", Shapes: []ShapeInfo{
		{Name: "gannbox_square", Label: "Gann Box", Points: 2},
		{Name: "gannbox_fixed", Label: "Gann Square Fixed", Points: 2},
		{Name: "gannbox", Label: "Gann Square", Points: 2},
		{Name: "gannbox_fan", Label: "Gann Fan", Points: 2},
	}},
	{Category: "patterns", Label: "Patterns", Shapes: []ShapeInfo{
		{Name: "xabcd_pattern", Label: "XABCD Pattern", Points: 5},
		{Name: "cypher_pattern", Label: "Cypher Pattern", Points: 5},
		{Name: "head_and_shoulders", Label: "Head and Shoulders", Points: 7},
		{Name: "abcd_pattern", Label: "ABCD Pattern", Points: 4},
		{Name: "triangle_pattern", Label: "Triangle Pattern", Points: 4},
		{Name: "3divers_pattern", Label: "Three Drives Pattern", Points: 7},
	}},
	{Category: "elliott_waves", Label: "Elliott Waves", Shapes: []ShapeInfo{
		{Name: "elliott_impulse_wave", Label: "Elliott Impulse Wave (12345)", Points: 6},
		{Name: "elliott_correction", Label: "Elliott Correction Wave (ABC)", Points: 4},
		{Name: "elliott_triangle_wave", Label: "Elliott Triangle Wave (ABCDE)", Points: 6},
		{Name: "elliott_double_combo", Label: "Elliott Double Combo Wave (WXY)", Points: 4},
		{Name: "elliott_triple_combo", Label: "Elliott Triple Combo Wave (WXYXZ)", Points: 6},
	}},
	{Category: "cycles", Label: "Cycles", Shapes: []ShapeInfo{
		{Name: "cyclic_lines", Label: "Cyclic Lines", Points: 2},
		{Name: "time_cycles", Label: "Time Cycles", Points: 2},
		{Name: "sine_line", Label: "Sine Line", Points: 2},
	}},
	{Category: "projection", Label: "Projection", Shapes: []ShapeInfo{
		{Name: "long_position", Label: "Long Position", Points: 2},
		{Name: "short_position", Label: "Short Position", Points: 2},
		{Name: "forecast", Label: "Forecast", Points: 2},
		{Name: "bars_pattern", Label: "Bars Pattern", Points: 2},
		{Name: "ghost_feed", Label: "Ghost Feed", Points: 5},
		{Name: "projection", Label: "Projection", Points: 3},
	}},
	{Category: "volume_based", Label: "Volume Based", Shapes: []ShapeInfo{
		{Name: "anchored_vwap", Label: "Anchored VWAP", Points: 1},
		{Name: "fixed_range_volume_profile", Label: "Fixed Range Volume Profile", Points: 2},
		{Name: "anchored_volume_profile", Label: "Anchored Volume Profile", Points: 1},
	}},
	{Category: "measurer", Label: "Measurer", Shapes: []ShapeInfo{
		{Name: "price_range", Label: "Price Range", Points: 2},
		{Name: "date_range", Label: "Date Range", Points: 2},
		{Name: "date_and_price_range", Label: "Date and Price Range", Points: 2},
	}},
	{Category: "brushes", Label: "Brushes", Shapes: []ShapeInfo{
		{Name: "brush", Label: "Brush", Points: -1},
		{Name: "highlighter", Label: "Highlighter", Points: -1},
	}},
	{Category: "arrows", Label: "Arrows", Shapes: []ShapeInfo{
		{Name: "arrow_marker", Label: "Arrow Marker", Points: 2},
		{Name: "arrow", Label: "Arrow", Points: 2},
		{Name: "arrow_up", Label: "Arrow Mark Up", Points: 1},
		{Name: "arrow_down", Label: "Arrow Mark Down", Points: 1},
	}},
	{Category: "shapes", Label: "Shapes", Shapes: []ShapeInfo{
		{Name: "rectangle", Label: "Rectangle", Points: 2},
		{Name: "rotated_rectangle", Label: "Rotated Rectangle", Points: 3},
		{Name: "path", Label: "Path", Points: -1},
		{Name: "circle", Label: "Circle", Points: 2},
		{Name: "ellipse", Label: "Ellipse", Points: 3},
		{Name: "polyline", Label: "Polyline", Points: -1},
		{Name: "triangle", Label: "Triangle", Points: 3},
		{Name: "arc", Label: "Arc", Points: 3},
		{Name: "curve", Label: "Curve", Points: 2},
		{Name: "double_curve", Label: "Double Curve", Points: 2},
	}},
	{Category: "text_and_notes", Label: "Text & Notes", Shapes: []ShapeInfo{
		{Name: "text", Label: "Text", Points: 1},
		{Name: "anchored_text", Label: "Anchored Text", Points: 1},
		{Name: "note", Label: "Note", Points: 1},
		{Name: "text_note", Label: "Text Note", Points: 2},
		{Name: "anchored_note", Label: "Anchored Note", Points: 1},
		{Name: "price_note", Label: "Price Note", Points: 2},
		{Name: "balloon", Label: "Pin", Points: 1},
		{Name: "table", Label: "Table", Points: 1},
		{Name: "callout", Label: "Callout", Points: 2},
		{Name: "comment", Label: "Comment", Points: 1},
		{Name: "price_label", Label: "Price Label", Points: 1},
		{Name: "signpost", Label: "Signpost", Points: 1},
		{Name: "flag", Label: "Flag Mark", Points: 1},
	}},
	{Category: "content", Label: "Content", Shapes: []ShapeInfo{
		{Name: "image", Label: "Image", Points: 1},
		{Name: "tweet", Label: "Tweet", Points: 1},
		{Name: "idea", Label: "Idea", Points: 1},
	}},
	{Category: "icons", Label: "Icons", Shapes: []ShapeInfo{
		{Name: "icon", Label: "Icon", Points: 1},
		{Name: "emoji", Label: "Emoji", Points: 1},
		{Name: "sticker", Label: "Sticker", Points: 1},
	}},
}

ShapeGroups defines all known drawing shapes, grouped by category. Order matches the TradingView left toolbar.

Functions

This section is empty.

Types

type ActiveChartInfo

type ActiveChartInfo struct {
	ChartID    string `json:"chart_id"`
	TargetID   string `json:"target_id"`
	URL        string `json:"url"`
	Title      string `json:"title,omitempty"`
	ChartIndex int    `json:"chart_index"`
	ChartCount int    `json:"chart_count"`
}

ActiveChartInfo describes the currently active chart.

type AlertsApiProbe

type AlertsApiProbe struct {
	Found       bool           `json:"found"`
	AccessPaths []string       `json:"access_paths"`
	Methods     []string       `json:"methods"`
	State       map[string]any `json:"state"`
}

AlertsApiProbe describes the result of probing for the getAlertsRestApi() singleton.

type AvailableCurrency

type AvailableCurrency struct {
	Code        string `json:"code"`
	Description string `json:"description"`
	ID          string `json:"id"`
	Kind        string `json:"kind"`
}

AvailableCurrency describes a single currency available for conversion.

type AvailableUnit

type AvailableUnit struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Type        string `json:"type"`
}

AvailableUnit describes a single unit available for conversion.

type BatchDeleteError

type BatchDeleteError struct {
	ID    int    `json:"id"`
	Error string `json:"error"`
}

BatchDeleteError describes a single layout deletion failure.

type BatchDeleteResult

type BatchDeleteResult struct {
	Deleted []int              `json:"deleted"`
	Skipped []int              `json:"skipped,omitempty"`
	Errors  []BatchDeleteError `json:"errors,omitempty"`
}

BatchDeleteResult describes the result of a batch layout delete operation.

type ChartApiProbe

type ChartApiProbe struct {
	Found       bool     `json:"found"`
	AccessPaths []string `json:"access_paths"`
	Methods     []string `json:"methods"`
}

ChartApiProbe describes the result of probing for the chartApi() singleton.

type ChartExportResult

type ChartExportResult struct {
	Symbol     string               `json:"symbol"`
	Resolution string               `json:"resolution"`
	BarCount   int                  `json:"bar_count"`
	TimeColIdx int                  `json:"time_col_idx"`
	Columns    []ExportSchemaColumn `json:"schema"`
	Bars       [][]any              `json:"bars"`
}

ChartExportResult is returned by ExportChartData. Schema describes each column; Bars is a 2-D array in schema order. Null values (study gaps, before-history) are represented as JSON null.

type ChartInfo

type ChartInfo struct {
	ChartID  string `json:"chart_id"`
	TargetID string `json:"target_id"`
	URL      string `json:"url"`
	Title    string `json:"title,omitempty"`
}

ChartInfo describes a chart tab mapped from a browser target.

type ChartToggles

type ChartToggles struct {
	LogScale      *bool `json:"log_scale,omitempty"`
	AutoScale     *bool `json:"auto_scale,omitempty"`
	ExtendedHours *bool `json:"extended_hours,omitempty"`
}

ChartToggles describes the state of chart toolbar toggles (log scale, auto scale, extended hours).

type Client

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

func NewClient

func NewClient(cdpURL, tabFilter string, evalTimeout time.Duration) *Client

func (*Client) ActivateChart

func (c *Client) ActivateChart(ctx context.Context, index int) (LayoutStatus, error)

func (*Client) ActivateReplay

func (c *Client) ActivateReplay(ctx context.Context, chartID string, date float64) (map[string]any, error)

func (*Client) ActivateReplayAuto

func (c *Client) ActivateReplayAuto(ctx context.Context, chartID string) (map[string]any, error)

func (*Client) AddIndicatorBySearch

func (c *Client) AddIndicatorBySearch(ctx context.Context, chartID, query string, index int) (IndicatorAddResult, error)

func (*Client) AddPineToChart

func (c *Client) AddPineToChart(ctx context.Context) (PineState, error)

func (*Client) AddStudy

func (c *Client) AddStudy(ctx context.Context, chartID, name string, inputs map[string]any, forceOverlay bool) (Study, error)

func (*Client) AddWatchlistSymbols

func (c *Client) AddWatchlistSymbols(ctx context.Context, id string, symbols []string) (WatchlistDetail, error)

func (*Client) AppendColoredWatchlist

func (c *Client) AppendColoredWatchlist(ctx context.Context, color string, symbols []string) (ColoredWatchlist, error)

func (*Client) ApplyStudyTemplate

func (c *Client) ApplyStudyTemplate(ctx context.Context, chartID, name string) (StudyTemplateApplyResult, error)

func (*Client) BrowserScreenshot

func (c *Client) BrowserScreenshot(ctx context.Context, format string, quality int, fullPage bool) ([]byte, error)

BrowserScreenshot captures a viewport screenshot via CDP Page.captureScreenshot. No TradingView JS is involved — this captures whatever is visible in the browser tab.

func (*Client) BulkRemoveColoredWatchlist

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

func (*Client) ChangeAutoplayDelay

func (c *Client) ChangeAutoplayDelay(ctx context.Context, chartID string, delay float64) (float64, error)

func (*Client) CloneAlerts

func (c *Client) CloneAlerts(ctx context.Context, ids []string) error

func (*Client) CloneDrawing

func (c *Client) CloneDrawing(ctx context.Context, chartID, shapeID string) (string, error)

func (*Client) CloneLayout

func (c *Client) CloneLayout(ctx context.Context, name string) (LayoutActionResult, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) error

func (*Client) CreateAlert

func (c *Client) CreateAlert(ctx context.Context, params map[string]any) (any, error)

func (*Client) CreateDrawing

func (c *Client) CreateDrawing(ctx context.Context, chartID string, point ShapePoint, options map[string]any) (string, error)

func (*Client) CreateMultipointDrawing

func (c *Client) CreateMultipointDrawing(ctx context.Context, chartID string, points []ShapePoint, options map[string]any) (string, error)

func (*Client) CreateNote

func (c *Client) CreateNote(ctx context.Context, symbolFull, description, title, snapshotUID string) (Note, error)

func (*Client) CreateTweetDrawing

func (c *Client) CreateTweetDrawing(ctx context.Context, chartID string, tweetURL string) (TweetDrawingResult, error)

func (*Client) CreateWatchlist

func (c *Client) CreateWatchlist(ctx context.Context, name string) (WatchlistInfo, error)

func (*Client) DeactivateReplay

func (c *Client) DeactivateReplay(ctx context.Context, chartID string) error

func (*Client) DeepHealthCheck

func (c *Client) DeepHealthCheck(ctx context.Context) (DeepHealthResult, error)

func (*Client) DeleteAlerts

func (c *Client) DeleteAlerts(ctx context.Context, ids []string) error

func (*Client) DeleteAllFires

func (c *Client) DeleteAllFires(ctx context.Context) error

func (*Client) DeleteFires

func (c *Client) DeleteFires(ctx context.Context, ids []string) error

func (*Client) DeleteLayout

func (c *Client) DeleteLayout(ctx context.Context, id int) (LayoutActionResult, error)

func (*Client) DeleteNote

func (c *Client) DeleteNote(ctx context.Context, noteID int) error

func (*Client) DeleteWatchlist

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

func (*Client) DismissDialog

func (c *Client) DismissDialog(ctx context.Context) (LayoutActionResult, error)

func (*Client) EditNote

func (c *Client) EditNote(ctx context.Context, noteID int, description, title, snapshotUID string) (Note, error)

func (*Client) EnableNetworkDomain

func (c *Client) EnableNetworkDomain(ctx context.Context) error

EnableNetworkDomain enables the Network CDP domain on the first available chart tab session so that Network.* events are emitted.

func (*Client) ExecuteAction

func (c *Client) ExecuteAction(ctx context.Context, chartID, actionID string) error

func (*Client) ExportChartData

func (c *Client) ExportChartData(ctx context.Context, chartID string) (ChartExportResult, error)

func (*Client) ExportDrawingsState

func (c *Client) ExportDrawingsState(ctx context.Context, chartID string) (any, error)

func (*Client) FlagSymbol

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

func (*Client) GetActiveChart

func (c *Client) GetActiveChart(ctx context.Context) (ActiveChartInfo, error)

func (*Client) GetActiveStrategy

func (c *Client) GetActiveStrategy(ctx context.Context, chartID string) (map[string]any, error)

func (*Client) GetActiveWatchlist

func (c *Client) GetActiveWatchlist(ctx context.Context) (WatchlistDetail, error)

func (*Client) GetAlerts

func (c *Client) GetAlerts(ctx context.Context, ids []string) (any, error)

func (*Client) GetAvailableCurrencies

func (c *Client) GetAvailableCurrencies(ctx context.Context, chartID string) ([]AvailableCurrency, error)

func (*Client) GetAvailableUnits

func (c *Client) GetAvailableUnits(ctx context.Context, chartID string) ([]AvailableUnit, error)

func (*Client) GetChartToggles

func (c *Client) GetChartToggles(ctx context.Context, chartID string) (ChartToggles, error)

func (*Client) GetChartType

func (c *Client) GetChartType(ctx context.Context, chartID string) (int, error)

func (*Client) GetCurrency

func (c *Client) GetCurrency(ctx context.Context, chartID string) (CurrencyInfo, error)

func (*Client) GetDrawing

func (c *Client) GetDrawing(ctx context.Context, chartID, shapeID string) (map[string]any, error)

func (*Client) GetDrawingToggles

func (c *Client) GetDrawingToggles(ctx context.Context, chartID string) (DrawingToggles, error)

func (*Client) GetDrawingTool

func (c *Client) GetDrawingTool(ctx context.Context, chartID string) (string, error)

func (*Client) GetHotlistExchanges

func (c *Client) GetHotlistExchanges(ctx context.Context) ([]HotlistExchangeDetail, error)

func (*Client) GetHotlistMarkets

func (c *Client) GetHotlistMarkets(ctx context.Context) (any, error)

func (*Client) GetLayoutFavorite

func (c *Client) GetLayoutFavorite(ctx context.Context) (LayoutFavoriteResult, error)

func (*Client) GetLayoutStatus

func (c *Client) GetLayoutStatus(ctx context.Context) (LayoutStatus, error)

func (*Client) GetOneHotlist

func (c *Client) GetOneHotlist(ctx context.Context, exchange, group string) (HotlistResult, error)

func (*Client) GetPaneInfo

func (c *Client) GetPaneInfo(ctx context.Context) (PanesResult, error)

func (*Client) GetPineConsole

func (c *Client) GetPineConsole(ctx context.Context) ([]PineConsoleMessage, error)

func (*Client) GetPineSource

func (c *Client) GetPineSource(ctx context.Context) (PineState, error)

func (*Client) GetPineStatus

func (c *Client) GetPineStatus(ctx context.Context) (PineState, error)

func (*Client) GetReplayStatus

func (c *Client) GetReplayStatus(ctx context.Context, chartID string) (ReplayStatus, error)

func (*Client) GetResolution

func (c *Client) GetResolution(ctx context.Context, chartID string) (string, error)

func (*Client) GetStrategyDateRange

func (c *Client) GetStrategyDateRange(ctx context.Context, chartID string) (any, error)

func (*Client) GetStrategyReport

func (c *Client) GetStrategyReport(ctx context.Context, chartID string) (map[string]any, error)

func (*Client) GetStudyInputs

func (c *Client) GetStudyInputs(ctx context.Context, chartID, studyID string) (StudyDetail, error)

func (*Client) GetStudyTemplate

func (c *Client) GetStudyTemplate(ctx context.Context, id int) (StudyTemplateEntry, error)

func (*Client) GetSymbol

func (c *Client) GetSymbol(ctx context.Context, chartID string) (string, error)

func (*Client) GetSymbolInfo

func (c *Client) GetSymbolInfo(ctx context.Context, chartID string) (SymbolInfo, error)

func (*Client) GetUnit

func (c *Client) GetUnit(ctx context.Context, chartID string) (UnitInfo, error)

func (*Client) GetVisibleRange

func (c *Client) GetVisibleRange(ctx context.Context, chartID string) (VisibleRange, error)

func (*Client) GetWatchlist

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

func (*Client) GoToDate

func (c *Client) GoToDate(ctx context.Context, chartID string, timestamp int64) error

func (*Client) ImportDrawingsState

func (c *Client) ImportDrawingsState(ctx context.Context, chartID string, state any) error

func (*Client) ListAlerts

func (c *Client) ListAlerts(ctx context.Context) (any, error)

func (*Client) ListCharts

func (c *Client) ListCharts(ctx context.Context) ([]ChartInfo, error)

func (*Client) ListColoredWatchlists

func (c *Client) ListColoredWatchlists(ctx context.Context) ([]ColoredWatchlist, error)

func (*Client) ListDrawings

func (c *Client) ListDrawings(ctx context.Context, chartID string) ([]Shape, error)

func (*Client) ListFavoriteIndicators

func (c *Client) ListFavoriteIndicators(ctx context.Context, chartID string) (IndicatorSearchResult, error)

func (*Client) ListFires

func (c *Client) ListFires(ctx context.Context) (any, error)

func (*Client) ListLayouts

func (c *Client) ListLayouts(ctx context.Context) ([]LayoutInfo, error)

func (*Client) ListNotes

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

func (*Client) ListStrategies

func (c *Client) ListStrategies(ctx context.Context, chartID string) (any, error)

func (*Client) ListStudies

func (c *Client) ListStudies(ctx context.Context, chartID string) ([]Study, error)

func (*Client) ListStudyTemplates

func (c *Client) ListStudyTemplates(ctx context.Context) (StudyTemplateList, error)

func (*Client) ListWatchlists

func (c *Client) ListWatchlists(ctx context.Context) ([]WatchlistInfo, error)

func (*Client) MaximizeChart

func (c *Client) MaximizeChart(ctx context.Context) (LayoutStatus, error)

func (*Client) ModifyAlert

func (c *Client) ModifyAlert(ctx context.Context, params map[string]any) (any, error)

func (*Client) ModifyStudyInputs

func (c *Client) ModifyStudyInputs(ctx context.Context, chartID, studyID string, inputs map[string]any) (StudyDetail, error)

func (*Client) NextChart

func (c *Client) NextChart(ctx context.Context) (ActiveChartInfo, error)

func (*Client) PinWatchlist

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

func (*Client) PineCommandPalette

func (c *Client) PineCommandPalette(ctx context.Context) (PineState, error)

func (*Client) PineDeleteLine

func (c *Client) PineDeleteLine(ctx context.Context, count int) (PineState, error)

func (*Client) PineFindReplace

func (c *Client) PineFindReplace(ctx context.Context, find, replace string) (PineState, error)

func (*Client) PineGoToLine

func (c *Client) PineGoToLine(ctx context.Context, line int) (PineState, error)

func (*Client) PineInsertLineAbove

func (c *Client) PineInsertLineAbove(ctx context.Context) (PineState, error)

func (*Client) PineMoveLine

func (c *Client) PineMoveLine(ctx context.Context, direction string, count int) (PineState, error)

func (*Client) PineNewIndicator

func (c *Client) PineNewIndicator(ctx context.Context) (PineState, error)

func (*Client) PineNewStrategy

func (c *Client) PineNewStrategy(ctx context.Context) (PineState, error)

func (*Client) PineNewTab

func (c *Client) PineNewTab(ctx context.Context) (PineState, error)

func (*Client) PineOpenScript

func (c *Client) PineOpenScript(ctx context.Context, name string) (PineState, error)

func (*Client) PineRedo

func (c *Client) PineRedo(ctx context.Context) (PineState, error)

func (*Client) PineToggleComment

func (c *Client) PineToggleComment(ctx context.Context) (PineState, error)

func (*Client) PineToggleConsole

func (c *Client) PineToggleConsole(ctx context.Context) (PineState, error)

func (*Client) PineUndo

func (c *Client) PineUndo(ctx context.Context) (PineState, error)

func (*Client) PrevChart

func (c *Client) PrevChart(ctx context.Context) (ActiveChartInfo, error)

func (*Client) ProbeAlertsRestApi

func (c *Client) ProbeAlertsRestApi(ctx context.Context, chartID string) (AlertsApiProbe, error)

func (*Client) ProbeAlertsRestApiDeep

func (c *Client) ProbeAlertsRestApiDeep(ctx context.Context, chartID string) (map[string]any, error)

func (*Client) ProbeBacktestingApi

func (c *Client) ProbeBacktestingApi(ctx context.Context, chartID string) (StrategyApiProbe, error)

func (*Client) ProbeChartApi

func (c *Client) ProbeChartApi(ctx context.Context, chartID string) (ChartApiProbe, error)

func (*Client) ProbeChartApiDeep

func (c *Client) ProbeChartApiDeep(ctx context.Context, chartID string) (map[string]any, error)

func (*Client) ProbeDataWindow

func (c *Client) ProbeDataWindow(ctx context.Context, chartID string) (DataWindowProbe, error)

func (*Client) ProbeHotlistsManager

func (c *Client) ProbeHotlistsManager(ctx context.Context) (HotlistsManagerProbe, error)

func (*Client) ProbeHotlistsManagerDeep

func (c *Client) ProbeHotlistsManagerDeep(ctx context.Context) (map[string]any, error)

func (*Client) ProbeIndicatorDialogDOM

func (c *Client) ProbeIndicatorDialogDOM(ctx context.Context) (map[string]any, error)

func (*Client) ProbePineDOM

func (c *Client) ProbePineDOM(ctx context.Context) (map[string]any, error)

func (*Client) ProbeReplayManager

func (c *Client) ProbeReplayManager(ctx context.Context, chartID string) (ReplayManagerProbe, error)

func (*Client) ProbeReplayManagerDeep

func (c *Client) ProbeReplayManagerDeep(ctx context.Context, chartID string) (map[string]any, error)

func (*Client) RedoChart

func (c *Client) RedoChart(ctx context.Context, chartID string) error

func (*Client) RegisterCDPEventHandler

func (c *Client) RegisterCDPEventHandler(method string, fn func(sessionID string, params json.RawMessage)) (func(), error)

RegisterCDPEventHandler registers a handler for a CDP event method (e.g. "Network.webSocketCreated"). Returns an unregister function. The caller must have called Connect first.

func (*Client) ReloadPage

func (c *Client) ReloadPage(ctx context.Context, chartID string, hard bool) error

ReloadPage reloads the browser tab for the given chart (or the first chart if chartID is empty). When hard is true, the browser cache is bypassed (equivalent to Shift+F5). After reload the session state is invalidated and the tab registry is refreshed so that subsequent calls use the new chart IDs.

func (*Client) RemoveAllDrawings

func (c *Client) RemoveAllDrawings(ctx context.Context, chartID string) error

func (*Client) RemoveColoredWatchlist

func (c *Client) RemoveColoredWatchlist(ctx context.Context, color string, symbols []string) (ColoredWatchlist, error)

func (*Client) RemoveDrawing

func (c *Client) RemoveDrawing(ctx context.Context, chartID, shapeID string, disableUndo bool) error

func (*Client) RemoveStudy

func (c *Client) RemoveStudy(ctx context.Context, chartID, studyID string) error

func (*Client) RemoveWatchlistSymbols

func (c *Client) RemoveWatchlistSymbols(ctx context.Context, id string, symbols []string) (WatchlistDetail, error)

func (*Client) RenameLayout

func (c *Client) RenameLayout(ctx context.Context, name string) (LayoutActionResult, error)

func (*Client) RenameWatchlist

func (c *Client) RenameWatchlist(ctx context.Context, id, name string) (WatchlistInfo, error)

func (*Client) ReplaceColoredWatchlist

func (c *Client) ReplaceColoredWatchlist(ctx context.Context, color string, symbols []string) (ColoredWatchlist, error)

func (*Client) ReplayStep

func (c *Client) ReplayStep(ctx context.Context, chartID string, count int) error

func (*Client) ResetReplay

func (c *Client) ResetReplay(ctx context.Context, chartID string) error

func (*Client) ResetScales

func (c *Client) ResetScales(ctx context.Context, chartID string) error

func (*Client) ResetView

func (c *Client) ResetView(ctx context.Context, chartID string) error

func (*Client) ResolveSymbol

func (c *Client) ResolveSymbol(ctx context.Context, chartID, symbol string) (ResolvedSymbolInfo, error)

func (*Client) RestartAlerts

func (c *Client) RestartAlerts(ctx context.Context, ids []string) error

func (*Client) SaveLayout

func (c *Client) SaveLayout(ctx context.Context) (LayoutActionResult, error)

func (*Client) SavePineScript

func (c *Client) SavePineScript(ctx context.Context) (PineState, error)

func (*Client) ScanAlertsAccess

func (c *Client) ScanAlertsAccess(ctx context.Context, chartID string) (map[string]any, error)

func (*Client) ScanReplayActivation

func (c *Client) ScanReplayActivation(ctx context.Context, chartID string) (map[string]any, error)

func (*Client) Scroll

func (c *Client) Scroll(ctx context.Context, chartID string, bars int) error

func (*Client) SearchIndicators

func (c *Client) SearchIndicators(ctx context.Context, chartID, query string) (IndicatorSearchResult, error)

func (*Client) SetActiveStrategy

func (c *Client) SetActiveStrategy(ctx context.Context, chartID, strategyID string) error

func (*Client) SetActiveWatchlist

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

func (*Client) SetChartType

func (c *Client) SetChartType(ctx context.Context, chartID string, chartType int) (int, error)

func (*Client) SetCurrency

func (c *Client) SetCurrency(ctx context.Context, chartID, currency string) (CurrencyInfo, error)

func (*Client) SetDrawingTool

func (c *Client) SetDrawingTool(ctx context.Context, chartID, tool string) error

func (*Client) SetDrawingVisibility

func (c *Client) SetDrawingVisibility(ctx context.Context, chartID, shapeID string, visible bool) error

func (*Client) SetDrawingZOrder

func (c *Client) SetDrawingZOrder(ctx context.Context, chartID, shapeID, action string) error

func (*Client) SetHideDrawings

func (c *Client) SetHideDrawings(ctx context.Context, chartID string, val bool) error

func (*Client) SetLayoutGrid

func (c *Client) SetLayoutGrid(ctx context.Context, template string) (LayoutStatus, error)

func (*Client) SetLockDrawings

func (c *Client) SetLockDrawings(ctx context.Context, chartID string, val bool) error

func (*Client) SetMagnet

func (c *Client) SetMagnet(ctx context.Context, chartID string, enabled bool, mode int) error

func (*Client) SetPineSource

func (c *Client) SetPineSource(ctx context.Context, source string) (PineState, error)

func (*Client) SetResolution

func (c *Client) SetResolution(ctx context.Context, chartID, resolution string) (string, error)

func (*Client) SetStrategyInput

func (c *Client) SetStrategyInput(ctx context.Context, chartID, name string, value any) error

func (*Client) SetSymbol

func (c *Client) SetSymbol(ctx context.Context, chartID, symbol string) (string, error)

func (*Client) SetTimeFrame

func (c *Client) SetTimeFrame(ctx context.Context, chartID, preset, resolution string) (TimeFrameResult, error)

func (*Client) SetUnit

func (c *Client) SetUnit(ctx context.Context, chartID, unit string) (UnitInfo, error)

func (*Client) SetVisibleRange

func (c *Client) SetVisibleRange(ctx context.Context, chartID string, from, to float64) (VisibleRange, error)

func (*Client) StartAutoplay

func (c *Client) StartAutoplay(ctx context.Context, chartID string) error

func (*Client) StartReplay

func (c *Client) StartReplay(ctx context.Context, chartID string, point float64) error

func (*Client) StopAlerts

func (c *Client) StopAlerts(ctx context.Context, ids []string) error

func (*Client) StopAutoplay

func (c *Client) StopAutoplay(ctx context.Context, chartID string) error

func (*Client) StopReplay

func (c *Client) StopReplay(ctx context.Context, chartID string) error

func (*Client) StrategyGotoDate

func (c *Client) StrategyGotoDate(ctx context.Context, chartID string, timestamp float64, belowBar bool) error

func (*Client) SwitchLayout

func (c *Client) SwitchLayout(ctx context.Context, id int) (LayoutActionResult, error)

func (*Client) SwitchTimezone

func (c *Client) SwitchTimezone(ctx context.Context, chartID, tz string) error

func (*Client) TakeServerSnapshot

func (c *Client) TakeServerSnapshot(ctx context.Context) (ServerSnapshotResult, error)

func (*Client) TakeSnapshot

func (c *Client) TakeSnapshot(ctx context.Context, chartID, format, quality string, hideRes bool) (SnapshotResult, error)

func (*Client) ToggleAutoScale

func (c *Client) ToggleAutoScale(ctx context.Context, chartID string) error

func (*Client) ToggleExtendedHours

func (c *Client) ToggleExtendedHours(ctx context.Context, chartID string) error

func (*Client) ToggleFullscreen

func (c *Client) ToggleFullscreen(ctx context.Context) (LayoutStatus, error)

func (*Client) ToggleIndicatorFavorite

func (c *Client) ToggleIndicatorFavorite(ctx context.Context, chartID, query string, index int) (IndicatorFavoriteResult, error)

func (*Client) ToggleLayoutFavorite

func (c *Client) ToggleLayoutFavorite(ctx context.Context) (LayoutFavoriteResult, error)

func (*Client) ToggleLogScale

func (c *Client) ToggleLogScale(ctx context.Context, chartID string) error

func (*Client) TogglePineEditor

func (c *Client) TogglePineEditor(ctx context.Context) (PineState, error)

func (*Client) UndoChart

func (c *Client) UndoChart(ctx context.Context, chartID string) error

func (*Client) Zoom

func (c *Client) Zoom(ctx context.Context, chartID, direction string) error

type CodedError

type CodedError struct {
	Code    string
	Message string
	Cause   error
}

CodedError is a typed error used for stable API mapping.

func (*CodedError) Error

func (e *CodedError) Error() string

func (*CodedError) Unwrap

func (e *CodedError) Unwrap() error

type ColoredWatchlist

type ColoredWatchlist struct {
	ID       string   `json:"id"`
	Name     string   `json:"name"`
	Color    string   `json:"color"`
	Symbols  []string `json:"symbols"`
	Modified string   `json:"modified,omitempty"`
}

ColoredWatchlist describes a colored watchlist (red, orange, green, purple, blue).

type CurrencyInfo

type CurrencyInfo struct {
	Currency       string `json:"currency"`
	IsConverted    bool   `json:"is_converted"`
	NativeCurrency string `json:"native_currency"`
}

CurrencyInfo describes the current currency conversion state of a chart.

type DataWindowProbe

type DataWindowProbe struct {
	PanelVisible     bool           `json:"panel_visible"`
	DOMElements      []string       `json:"dom_elements"`
	CrosshairMethods []string       `json:"crosshair_methods,omitempty"`
	LegendElements   []string       `json:"legend_elements,omitempty"`
	ChartWidgetProps []string       `json:"chart_widget_props,omitempty"`
	ModelProps       []string       `json:"model_props,omitempty"`
	DataWindowState  map[string]any `json:"data_window_state,omitempty"`
}

DataWindowProbe describes what's discoverable about the data window / crosshair state.

type DeepHealthResult

type DeepHealthResult struct {
	TradingViewAPI  bool `json:"tradingview_api"`
	ChartWidget     bool `json:"chart_widget"`
	WebpackRequire  bool `json:"webpack_require"`
	AlertsAPI       bool `json:"alerts_api"`
	WatchlistREST   bool `json:"watchlist_rest"`
	ReplayAPI       bool `json:"replay_api"`
	BacktestingAPI  bool `json:"backtesting_api"`
	PineEditorDOM   bool `json:"pine_editor_dom"`
	MonacoWebpack   bool `json:"monaco_webpack"`
	LoadChart       bool `json:"load_chart"`
	SaveChart       bool `json:"save_chart"`
	ChartAPI        bool `json:"chart_api"`
	HotlistsManager bool `json:"hotlists_manager"`
}

DeepHealthResult describes the availability of every implementation mechanism.

type DrawingToggles

type DrawingToggles struct {
	HideAll       *bool `json:"hide_all,omitempty"`
	LockAll       *bool `json:"lock_all,omitempty"`
	MagnetEnabled *bool `json:"magnet_enabled,omitempty"`
	MagnetMode    *int  `json:"magnet_mode,omitempty"`
}

DrawingToggles describes the toggle states for drawing tools.

type ExportSchemaColumn

type ExportSchemaColumn struct {
	Type        string `json:"type"`
	SourceType  string `json:"source_type,omitempty"`
	SourceID    string `json:"source_id,omitempty"`
	SourceTitle string `json:"source_title,omitempty"`
	PlotTitle   string `json:"plot_title,omitempty"`
	PlotID      string `json:"plot_id,omitempty"`
}

ExportSchemaColumn describes one column in a chart export result.

type HotlistExchangeDetail

type HotlistExchangeDetail struct {
	Exchange string             `json:"exchange"`
	Name     string             `json:"name"`
	FullName string             `json:"full_name,omitempty"`
	Flag     string             `json:"flag,omitempty"`
	Groups   []HotlistGroupInfo `json:"groups"`
}

HotlistExchangeDetail describes an exchange with its hotlist groups.

type HotlistGroupInfo

type HotlistGroupInfo struct {
	ID    string `json:"id"`
	Title string `json:"title"`
}

HotlistGroupInfo describes a hotlist group within an exchange.

type HotlistResult

type HotlistResult struct {
	Exchange string          `json:"exchange"`
	Group    string          `json:"group"`
	Symbols  []HotlistSymbol `json:"symbols"`
}

HotlistResult describes the symbols returned for a specific exchange/group hotlist.

type HotlistSymbol

type HotlistSymbol struct {
	Symbol string         `json:"symbol"`
	Extra  map[string]any `json:"extra,omitempty"`
}

HotlistSymbol describes a single symbol entry from a hotlist.

type HotlistsManagerProbe

type HotlistsManagerProbe struct {
	Found       bool           `json:"found"`
	AccessPaths []string       `json:"access_paths"`
	Methods     []string       `json:"methods"`
	State       map[string]any `json:"state"`
}

HotlistsManagerProbe describes the result of probing for the hotlistsManager() singleton.

type IndicatorAddResult

type IndicatorAddResult struct {
	Status string `json:"status"`
	Query  string `json:"query"`
	Index  int    `json:"index"`
	Name   string `json:"name"`
}

IndicatorAddResult describes the result of adding an indicator via search.

type IndicatorFavoriteResult

type IndicatorFavoriteResult struct {
	Status     string `json:"status"`
	Query      string `json:"query"`
	Name       string `json:"name"`
	IsFavorite bool   `json:"is_favorite"`
}

IndicatorFavoriteResult describes the result of toggling an indicator's favorite status.

type IndicatorResult

type IndicatorResult struct {
	Name       string `json:"name"`
	Author     string `json:"author,omitempty"`
	Boosts     int    `json:"boosts,omitempty"`
	IsFavorite bool   `json:"is_favorite"`
	Index      int    `json:"index"`
}

IndicatorResult describes a single indicator entry from the Indicators dialog.

type IndicatorSearchResult

type IndicatorSearchResult struct {
	Status     string            `json:"status"`
	Query      string            `json:"query,omitempty"`
	Category   string            `json:"category,omitempty"`
	Results    []IndicatorResult `json:"results"`
	TotalCount int               `json:"total_count"`
}

IndicatorSearchResult describes the result of an indicator search or category browse.

type LayoutActionResult

type LayoutActionResult struct {
	Status     string `json:"status"`
	LayoutName string `json:"layout_name,omitempty"`
	LayoutID   string `json:"layout_id,omitempty"`
}

LayoutActionResult describes the result of a layout action.

type LayoutDetail

type LayoutDetail struct {
	Info         LayoutInfo   `json:"layout_info"`
	Status       LayoutStatus `json:"status"`
	Studies      []Study      `json:"studies"`
	DrawingCount int          `json:"drawing_count"`
	SnapshotURL  string       `json:"snapshot_url,omitempty"`
	PreviousID   int          `json:"previous_layout_id,omitempty"`
}

LayoutDetail describes a layout with its full content (studies, drawings, etc.).

type LayoutFavoriteResult

type LayoutFavoriteResult struct {
	LayoutID    string `json:"layout_id"`
	LayoutName  string `json:"layout_name"`
	IsFavorite  bool   `json:"is_favorite"`
	WasFavorite bool   `json:"was_favorite,omitempty"`
}

LayoutFavoriteResult describes the favorite state of a layout.

type LayoutInfo

type LayoutInfo struct {
	ID       int    `json:"id"`
	URL      string `json:"url"`
	Name     string `json:"name"`
	Symbol   string `json:"symbol,omitempty"`
	Interval string `json:"interval,omitempty"`
	Modified int64  `json:"modified,omitempty"`
	Favorite bool   `json:"favorite,omitempty"`
}

LayoutInfo describes a saved layout entry.

type LayoutStatus

type LayoutStatus struct {
	LayoutName   string `json:"layout_name"`
	LayoutID     string `json:"layout_id"`
	GridTemplate string `json:"grid_template"`
	ChartCount   int    `json:"chart_count"`
	ActiveIndex  int    `json:"active_index"`
	IsMaximized  bool   `json:"is_maximized"`
	IsFullscreen bool   `json:"is_fullscreen"`
	HasChanges   bool   `json:"has_changes"`
}

LayoutStatus describes the current layout state.

type Note

type Note struct {
	ID            int     `json:"id"`
	Title         string  `json:"title"`
	Description   string  `json:"description"`
	Created       float64 `json:"created"`
	Modified      float64 `json:"modified"`
	Symbol        string  `json:"symbol"`
	SymbolFull    string  `json:"symbol_full"`
	Snapshot      string  `json:"snapshot,omitempty"`
	SnapshotPage  string  `json:"snapshot_page,omitempty"`
	SnapshotThumb string  `json:"snapshot_thumb,omitempty"`
}

Note describes a watchlist text note from TradingView's textnotes API.

type PaneInfo

type PaneInfo struct {
	Index      int    `json:"index"`
	Symbol     string `json:"symbol"`
	Exchange   string `json:"exchange,omitempty"`
	Resolution string `json:"resolution,omitempty"`
}

PaneInfo describes one chart pane in a multi-pane grid layout.

type PanesResult

type PanesResult struct {
	GridTemplate string     `json:"grid_template"`
	ChartCount   int        `json:"chart_count"`
	ActiveIndex  int        `json:"active_index"`
	Panes        []PaneInfo `json:"panes"`
}

PanesResult describes all panes in the current grid layout.

type PineConsoleMessage

type PineConsoleMessage struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

PineConsoleMessage describes a single Pine console output message.

type PineState

type PineState struct {
	Status       string `json:"status"`
	IsVisible    bool   `json:"is_visible"`
	MonacoReady  bool   `json:"monaco_ready"`
	ScriptName   string `json:"script_name,omitempty"`
	ScriptSource string `json:"script_source,omitempty"`
	SourceLength int    `json:"source_length,omitempty"`
	LineCount    int    `json:"line_count,omitempty"`
	MatchCount   int    `json:"match_count,omitempty"`
}

PineState describes the current state of the Pine editor panel.

type ReloadResult

type ReloadResult struct {
	Status string `json:"status"`
	Mode   string `json:"mode"`
}

ReloadResult describes the result of a page reload.

type ReplayManagerProbe

type ReplayManagerProbe struct {
	Found       bool           `json:"found"`
	AccessPaths []string       `json:"access_paths"`
	Methods     []string       `json:"methods"`
	State       map[string]any `json:"state"`
}

ReplayManagerProbe describes the result of probing for the _replayManager singleton.

type ReplayStatus

type ReplayStatus struct {
	IsReplayStarted   bool    `json:"is_replay_started"`
	IsReplayFinished  bool    `json:"is_replay_finished"`
	IsReplayConnected bool    `json:"is_replay_connected"`
	IsAutoplayStarted bool    `json:"is_autoplay_started"`
	ReplayPoint       any     `json:"replay_point"`
	ServerTime        any     `json:"server_time"`
	AutoplayDelay     float64 `json:"autoplay_delay"`
	Depth             any     `json:"depth"`
}

ReplayStatus describes the current state of the replay manager.

type ResolvedSymbolInfo

type ResolvedSymbolInfo struct {
	Symbol          string `json:"symbol"`
	Name            string `json:"name,omitempty"`
	Description     string `json:"description,omitempty"`
	Exchange        string `json:"exchange,omitempty"`
	Type            string `json:"type,omitempty"`
	Currency        string `json:"currency,omitempty"`
	Timezone        string `json:"timezone,omitempty"`
	PriceScale      int    `json:"pricescale,omitempty"`
	MinMov          int    `json:"minmov,omitempty"`
	HasIntraday     bool   `json:"has_intraday,omitempty"`
	HasDaily        bool   `json:"has_daily,omitempty"`
	Session         string `json:"session,omitempty"`
	SessionHolidays string `json:"session_holidays,omitempty"`
}

ResolvedSymbolInfo describes extended metadata for any symbol resolved via chartApi().

type ServerSnapshotResult

type ServerSnapshotResult struct {
	UID string `json:"uid"`
	URL string `json:"url"`
}

ServerSnapshotResult describes the result of uploading a chart screenshot to TradingView servers.

type Shape

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

Shape describes a drawing entity from TradingView.

type ShapeGroup

type ShapeGroup struct {
	Category string      `json:"category"` // e.g. "lines"
	Label    string      `json:"label"`    // e.g. "Lines"
	Shapes   []ShapeInfo `json:"shapes"`
}

ShapeGroup groups related shapes under a UI category.

type ShapeInfo

type ShapeInfo struct {
	Name   string `json:"name"`   // internal shape name (e.g. "trend_line")
	Label  string `json:"label"`  // display name (e.g. "Trend Line")
	Points int    `json:"points"` // required point count (1 = single-point endpoint, 2+ = multipoint)
}

ShapeInfo describes a known drawing shape and its required point count.

type ShapePoint

type ShapePoint struct {
	Time  float64 `json:"time"`
	Price float64 `json:"price"`
}

ShapePoint describes a point for drawing creation.

type SnapshotChartInfo

type SnapshotChartInfo struct {
	Meta   SnapshotSymbolMeta `json:"meta"`
	OHLC   []string           `json:"ohlc,omitempty"`
	Quotes map[string]string  `json:"quotes,omitempty"`
}

SnapshotChartInfo describes one chart pane inside the snapshot metadata.

type SnapshotRawMeta

type SnapshotRawMeta struct {
	Layout string              `json:"layout,omitempty"`
	Theme  string              `json:"theme,omitempty"`
	Charts []SnapshotChartInfo `json:"charts,omitempty"`
}

SnapshotRawMeta is the metadata envelope from api._chartWidgetCollection.images().

type SnapshotResult

type SnapshotResult struct {
	DataURL  string          `json:"data_url"`
	Width    int             `json:"width"`
	Height   int             `json:"height"`
	Metadata SnapshotRawMeta `json:"metadata"`
}

SnapshotResult is the raw result from the in-page screenshot JS eval.

type SnapshotSymbolMeta

type SnapshotSymbolMeta struct {
	Symbol      string `json:"symbol,omitempty"`
	Exchange    string `json:"exchange,omitempty"`
	Resolution  string `json:"resolution,omitempty"`
	Description string `json:"description,omitempty"`
}

SnapshotSymbolMeta describes the symbol metadata for a chart pane.

type StrategyApiProbe

type StrategyApiProbe struct {
	Found       bool           `json:"found"`
	AccessPaths []string       `json:"access_paths"`
	Methods     []string       `json:"methods"`
	State       map[string]any `json:"state"`
}

StrategyApiProbe describes the result of probing for the _backtestingStrategyApi singleton.

type Study

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

Study describes a study entity from TradingView.

type StudyDetail

type StudyDetail struct {
	ID     string         `json:"id"`
	Name   string         `json:"name"`
	Inputs map[string]any `json:"inputs"`
}

StudyDetail describes a study with its input parameters.

type StudyTemplateApplyResult

type StudyTemplateApplyResult struct {
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Status string `json:"status"`
}

StudyTemplateApplyResult describes the result of applying a study template.

type StudyTemplateEntry

type StudyTemplateEntry struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	MetaInfo     any    `json:"meta_info"`
	FavoriteDate string `json:"favorite_date,omitempty"`
}

StudyTemplateEntry describes a single study (indicator) template.

type StudyTemplateList

type StudyTemplateList struct {
	Custom       []StudyTemplateEntry `json:"custom"`
	Standard     []StudyTemplateEntry `json:"standard"`
	Fundamentals []StudyTemplateEntry `json:"fundamentals"`
}

StudyTemplateList describes study templates grouped by category.

type SymbolInfo

type SymbolInfo struct {
	Symbol      string `json:"symbol"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Exchange    string `json:"exchange,omitempty"`
	Type        string `json:"type,omitempty"`
	Currency    string `json:"currency,omitempty"`
	Timezone    string `json:"timezone,omitempty"`
	PriceScale  int    `json:"pricescale,omitempty"`
	MinMov      int    `json:"minmov,omitempty"`
	HasIntraday bool   `json:"has_intraday,omitempty"`
	HasDaily    bool   `json:"has_daily,omitempty"`
}

SymbolInfo describes extended metadata for a symbol.

type TimeFrameResult

type TimeFrameResult struct {
	Preset     string  `json:"preset"`
	Resolution string  `json:"resolution"`
	From       float64 `json:"from"`
	To         float64 `json:"to"`
}

TimeFrameResult describes the result of setting a time frame preset.

type TweetDrawingResult

type TweetDrawingResult struct {
	ID     string `json:"id"`
	Status string `json:"status"`
	URL    string `json:"url"`
}

TweetDrawingResult describes the result of creating a tweet drawing.

type UnitInfo

type UnitInfo struct {
	Unit        string `json:"unit"`
	IsConverted bool   `json:"is_converted"`
}

UnitInfo describes the current unit conversion state of a chart.

type VisibleRange

type VisibleRange struct {
	From float64 `json:"from"`
	To   float64 `json:"to"`
}

VisibleRange describes the visible bar range on a chart.

type WatchlistDetail

type WatchlistDetail struct {
	ID      string   `json:"id"`
	Name    string   `json:"name"`
	Type    string   `json:"type,omitempty"`
	Symbols []string `json:"symbols"`
}

WatchlistDetail describes a watchlist with its symbols.

type WatchlistInfo

type WatchlistInfo struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Type   string `json:"type,omitempty"`
	Active bool   `json:"active,omitempty"`
	Pinned bool   `json:"pinned,omitempty"`
	Count  int    `json:"count"`
}

WatchlistInfo describes a watchlist summary.

Jump to

Keyboard shortcuts

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