Documentation
¶
Index ¶
- Constants
- Variables
- func DateTimeStr(dt time.Time) string
- func GetRandomString(length int) string
- func GetStringRepresentation(data interface{}) string
- type Flags
- type OnErrorCallback
- type OnReceiveDataCallback
- type OnReceiveQuoteCallback
- type QuoteData
- type QuoteMessage
- type Socket
- type SocketInterface
- type SocketMessage
- type TOHLCV
Constants ¶
const ConnectionSetupMessagesErrorContext = "Sending connection setup messages"
ConnectionSetupMessagesErrorContext ...
const DecodeFirstMessageErrorContext = "Decoding the first message after stablishing the connection"
DecodeFirstMessageErrorContext ...
const DecodeMessageErrorContext = "Decoding the JSON message"
DecodeMessageErrorContext ...
const DecodedMessageDoesNotIncludePayloadErrorContext = "JSON message does not include the payload"
DecodedMessageDoesNotIncludePayloadErrorContext ...
const DecodedMessageHasErrorPropertyErrorContext = "JSON message has an error message"
DecodedMessageHasErrorPropertyErrorContext ...
const FinalPayloadCantBeParsedErrorContext = "The final JSON payload of the socket message couldn't be parsed"
FinalPayloadCantBeParsedErrorContext ...
const FinalPayloadHasMissingPropertiesErrorContext = "The final JSON payload doesn't have the expected data"
FinalPayloadHasMissingPropertiesErrorContext ...
const FirstMessageWithoutSessionIdErrorContext = "Does not have 'session_id' property"
FirstMessageWithoutSessionIdErrorContext ...
const GetPayloadLengthErrorContext = "Getting the payload length"
GetPayloadLengthErrorContext ...
const InitErrorContext = "Initializing the connection"
InitErrorContext ...
const PayloadCantBeParsedErrorContext = "JSON payload couldn't be parsed"
PayloadCantBeParsedErrorContext ...
const ReadFirstMessageErrorContext = "Reading the first message after stablishing the connection"
ReadFirstMessageErrorContext
const ReadMessageErrorContext = "Error while reading new messages through the socket connection"
ReadMessageErrorContext ...
const SendKeepAliveMessageErrorContext = "Sending the keep alive message"
SendKeepAliveMessageErrorContext ...
const SendMessageErrorContext = "Sending a message"
SendMessageErrorContext ...
const (
TradingViewSocketURL = "wss://data.tradingview.com/socket.io/websocket"
)
Variables ¶
var NewYork *time.Location
var Periods = []string{
"1",
"3",
"5",
"15",
"45",
"1h",
"2h",
"3h",
"4h",
"1D",
"1W",
"1M",
"3M",
"6M",
"12M",
}
Functions ¶
func DateTimeStr ¶
func GetStringRepresentation ¶
func GetStringRepresentation(data interface{}) string
GetStringRepresentation ...
Types ¶
type OnReceiveDataCallback ¶
OnReceiveDataCallback ...
type OnReceiveQuoteCallback ¶
type QuoteData ¶
type QuoteData struct {
Price *float64 `mapstructure:"lp"`
PrevClosePrice *float64 `mapstructure:"prev_close_price"`
RegularClosePrice *float64 `mapstructure:"regular_close_price"`
RegularCloseTime *int64 `mapstructure:"regular_close_time"`
HighPrice *float64 `mapstructure:"high_price"`
LowPrice *float64 `mapstructure:"low_price"`
OpenPrice *float64 `mapstructure:"open_price"`
OpenTime *int64 `mapstructure:"open_time"`
Volume *float64 `mapstructure:"volume"`
Bid *float64 `mapstructure:"bid"`
Ask *float64 `mapstructure:"ask"`
Change *float64 `mapstructure:"ch"`
Time *int64 `mapstructure:"lp_time"`
}
getSocketMessage("quote_set_fields", []string{s.quoteSessionID, "lp", "volume", "bid", "ask", "ch", "chp"}),
QuoteData ...
type QuoteMessage ¶
type QuoteMessage struct {
Symbol string `mapstructure:"n"`
Status string `mapstructure:"s"`
Data *QuoteData `mapstructure:"v"`
}
QuoteMessage ...
type Socket ¶
type Socket struct {
OnReceiveMarketDataCallback OnReceiveDataCallback
OnErrorCallback OnErrorCallback
OnReceiveQuoteCallback OnReceiveQuoteCallback
Symbol string
// contains filtered or unexported fields
}
Socket ...
func (*Socket) RemoveSymbol ¶
RemoveSymbol ...
func (*Socket) RequestQuotes ¶
type SocketInterface ¶
type SocketInterface interface {
AddSymbol(symbol string) error
RemoveSymbol(symbol string) error
Init(fields ...string) error
Close() error
RequestQuotes(symbol string, bars int, interval string, resultCallback OnReceiveQuoteCallback) error
}
SocketInterface ...
func Connect ¶
func Connect( onReceiveMarketDataCallback OnReceiveDataCallback, onErrorCallback OnErrorCallback, fields ...string, ) (socket SocketInterface, err error)
Connect - Connects and returns the trading view socket object
type SocketMessage ¶
type SocketMessage struct {
Message string `json:"m"`
Payload interface{} `json:"p"`
}
SocketMessage ...