Documentation ¶
Overview ¶
Package kiteticker provides kite ticker access using callbacks.
Index ¶
- Constants
- type Depth
- type DepthItem
- type LTP
- type Mode
- type OHLC
- type Tick
- type Ticker
- func (t *Ticker) Close() error
- func (t *Ticker) OnClose(f func(code int, reason string))
- func (t *Ticker) OnConnect(f func(tokens []uint32))
- func (t *Ticker) OnError(f func(err error))
- func (t *Ticker) OnMessage(f func(messageType int, message []byte))
- func (t *Ticker) OnNoReconnect(f func(attempt int))
- func (t *Ticker) OnOrderUpdate(f func(order kiteconnect.Order))
- func (t *Ticker) OnReconnect(f func(attempt int, delay time.Duration))
- func (t *Ticker) OnTick(f func(tick Tick))
- func (t *Ticker) Resubscribe() error
- func (t *Ticker) Serve(tokens []uint32)
- func (t *Ticker) SetAccessToken(aToken string)
- func (t *Ticker) SetAutoReconnect(val bool)
- func (t *Ticker) SetConnectTimeout(val time.Duration)
- func (t *Ticker) SetMode(mode Mode, tokens []uint32) error
- func (t *Ticker) SetReconnectMaxDelay(val time.Duration) error
- func (t *Ticker) SetReconnectMaxRetries(val int)
- func (t *Ticker) SetRootURL(u url.URL)
- func (t *Ticker) Subscribe(tokens []uint32) error
- func (t *Ticker) Unsubscribe(tokens []uint32) error
Constants ¶
const ( // Segment constants. NseCM = 1 + iota NseFO NseCD BseCM BseFO BseCD McxFO McxSX Indices // ModeLTP subscribes for last price. ModeLTP Mode = "ltp" // ModeFull subscribes for all the available fields. ModeFull Mode = "full" // ModeQuote represents quote mode. ModeQuote Mode = "quote" // TextMessage denotes a text data message. The text message payload is // interpreted as UTF-8 encoded text data. TextMessage = 1 // BinaryMessage denotes a binary data message. BinaryMessage = 2 // CloseMessage denotes a close control message. The optional message // payload contains a numeric code and text. Use the FormatCloseMessage // function to format a close message payload. CloseMessage = 8 // PingMessage denotes a ping control message. The optional message payload // is UTF-8 encoded text. PingMessage = 9 // PongMessage denotes a ping control message. The optional message payload // is UTF-8 encoded text. PongMessage = 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tick ¶
type Tick struct { Mode Mode InstrumentToken uint32 IsTradable bool IsIndex bool Timestamp kiteconnect.Time LastTradeTime kiteconnect.Time LastPrice float64 LastTradedQuantity uint32 TotalBuyQuantity uint32 TotalSellQuantity uint32 VolumeTraded uint32 TotalBuy uint32 TotalSell uint32 AverageTradePrice float64 OI uint32 OIDayHigh uint32 OIDayLow uint32 NetChange float64 OHLC OHLC Depth Depth }
Tick represents a single packet in the market feed.
type Ticker ¶
Ticker is a Kite connect ticker instance.
func (*Ticker) Close ¶
Close tries to close the connection gracefully. If the server doesn't close it
func (*Ticker) OnNoReconnect ¶
OnNoReconnect callback.
func (*Ticker) OnOrderUpdate ¶
func (t *Ticker) OnOrderUpdate(f func(order kiteconnect.Order))
OnOrderUpdate callback.
func (*Ticker) OnReconnect ¶
OnReconnect callback.
func (*Ticker) Resubscribe ¶
Resubscribe resubscribes to the current stored subscriptions
func (*Ticker) Serve ¶
Serve starts the connection to ticker server. Since its blocking its recommended to use it in go routine.
func (*Ticker) SetAccessToken ¶
SetAccessToken set access token.
func (*Ticker) SetAutoReconnect ¶
SetAutoReconnect enable/disable auto reconnect.
func (*Ticker) SetConnectTimeout ¶
SetConnectTimeout sets default timeout for initial connect handshake
func (*Ticker) SetReconnectMaxDelay ¶
SetReconnectMaxDelay sets maximum auto reconnect delay.
func (*Ticker) SetReconnectMaxRetries ¶
SetReconnectMaxRetries sets maximum reconnect attempts.
func (*Ticker) Unsubscribe ¶
Unsubscribe unsubscribes tick for the given list of tokens.