Documentation
¶
Index ¶
- Constants
- type API
- func (api *API) AddRealtimeSymbols(symbols []string) error
- func (api *API) GetHistory(symbol string, timeframe Timeframe, startFrom time.Time, ...) error
- func (api *API) OpenConnection(settings map[string]interface{}) error
- func (api *API) RemoveRealtimeSymbols(symbols []string) error
- func (api *API) RequestMoreData(candleCount int) error
- func (api *API) SwitchTimezone(timezone string) error
- type Channels
- type SessionType
- type Timeframe
Constants ¶
const DEFAULT_INITIAL_HISTORY_CANDLES = 10
default history initial candles amount if not specified
const HISTORY_TOKEN = "sds_1"
const SEPARATOR = "~m~"
random constants
const TOKEN_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789"
const TOKEN_LENGTH = 12
constants for token creation
const TV_ORIGIN_URL = "https://www.tradingview.com"
const TV_URL = "wss://data.tradingview.com/socket.io/websocket"
URL data for initialisation
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Channels Channels // contains filtered or unexported fields }
Handles data associated with an instance of the websocket
func (*API) AddRealtimeSymbols ¶
Retrieves real-time data for the given stocks/symbols which is then provided to the read channel
func (*API) GetHistory ¶
func (api *API) GetHistory(symbol string, timeframe Timeframe, startFrom time.Time, sessionType SessionType) error
Retrieves 10 candles from history for the provided symbol/stock Provides candles for the requested timeframe
sessionType is only used once per symbol. startFrom is used only when GetHistory is first invoked, never after. (pass time.Time{} for current time)
func (*API) OpenConnection ¶
Creates an active websocket connection (settings param can be nil if you want to use default settings)
func (*API) RemoveRealtimeSymbols ¶
func (*API) RequestMoreData ¶
Retrieves more data of the most recently loaded symbol, requires GetHistory() to have been used before it
func (*API) SwitchTimezone ¶
Switches the timezone the data is viewed on for the current session
type Channels ¶
type Channels struct { Read chan map[string]interface{} Error chan error // receives errors that occurred in read/write threads // contains filtered or unexported fields }
Handles data transferring between threads as well as the channels the user will be able to utilise
type SessionType ¶
type SessionType string
session data
const ( Regular SessionType = "regular" Extended SessionType = "extended" )
type Timeframe ¶
type Timeframe string
const ( OneMinute Timeframe = "1" ThreeMinutes Timeframe = "3" FiveMinutes Timeframe = "5" FifteenMinutes Timeframe = "15" ThirtyMinutes Timeframe = "30" FortyFiveMinutes Timeframe = "45" OneHour Timeframe = "60" TwoHours Timeframe = "120" ThreeHours Timeframe = "180" FourHours Timeframe = "240" OneDay Timeframe = "1D" OneWeek Timeframe = "1W" OneMonth Timeframe = "1M" ThreeMonths Timeframe = "3M" SixMonths Timeframe = "6M" TwelveMonths Timeframe = "12M" )
timeframe data