public class KiteTicker extends Object
Modifier and Type | Field and Description |
---|---|
int |
BseCD |
int |
BseCM |
int |
BseFO |
int |
Indices |
int |
McxFO |
int |
McxSX |
static String |
modeFull |
static String |
modeLTP |
static String |
modeQuote |
int |
NseCD |
int |
NseCM |
int |
NseFO |
Constructor and Description |
---|
KiteTicker(String accessToken,
String apiKey)
Initialize Kite Ticker.
|
Modifier and Type | Method and Description |
---|---|
void |
connect()
Establishes a web socket connection.
|
void |
disconnect()
Disconnects websocket connection.
|
void |
doReconnect()
Performs reconnection after a particular interval if count is less than maximum retries.
|
Order |
getOrder(org.json.JSONObject data) |
com.neovisionaries.ws.client.WebSocketAdapter |
getWebsocketAdapter()
Returns a WebSocketAdapter to listen to ticker related events.
|
boolean |
isConnectionOpen()
Returns true if websocket connection is open.
|
void |
setMaximumRetries(int maxRetries)
Set max number of retries for reconnection, for infinite retries set value as -1.
|
void |
setMaximumRetryInterval(int interval) |
void |
setMode(ArrayList<Long> tokens,
String mode)
Setting different modes for an arraylist of tokens.
|
void |
setOnConnectedListener(OnConnect listener)
Set listener for on connection established.
|
void |
setOnDisconnectedListener(OnDisconnect listener)
Set listener for on connection is disconnected.
|
void |
setOnErrorListener(OnError listener)
Set error listener.
|
void |
setOnOrderUpdateListener(OnOrderUpdate listener)
Set listener for order updates.
|
void |
setOnTickerArrivalListener(OnTicks onTickerArrivalListener)
Set listener for listening to ticks.
|
void |
setTryReconnection(boolean retry)
Set tryReconnection, to instruct KiteTicker that it has to reconnect, if com.zerodhatech.ticker is disconnected.
|
void |
subscribe(ArrayList<Long> tokens)
Subscribes for list of tokens.
|
void |
unsubscribe(ArrayList<Long> tokens)
Unsubscribes ticks for list of tokens.
|
public final int NseCM
public final int NseFO
public final int NseCD
public final int BseCM
public final int BseFO
public final int BseCD
public final int McxFO
public final int McxSX
public final int Indices
public static String modeFull
public static String modeQuote
public static String modeLTP
public void doReconnect()
public void setTryReconnection(boolean retry)
retry
- will denote whether reconnection should be tried or not.public void setOnErrorListener(OnError listener)
listener
- of type OnError which listens to all the type of errors that may arise in Kite Ticker class.public void setMaximumRetries(int maxRetries) throws KiteException
maxRetries
- denotes maximum number of retries that the com.zerodhatech.ticker can perform.KiteException
- when maximum retries is less than 0.public void setMaximumRetryInterval(int interval) throws KiteException
KiteException
public void setOnTickerArrivalListener(OnTicks onTickerArrivalListener)
onTickerArrivalListener
- is listener which listens for each tick.public void setOnConnectedListener(OnConnect listener)
listener
- is used to listen to onConnected event.public void setOnDisconnectedListener(OnDisconnect listener)
listener
- is used to listen to onDisconnected event.public void setOnOrderUpdateListener(OnOrderUpdate listener)
listener
- is used to listen to order updates.public void connect()
public com.neovisionaries.ws.client.WebSocketAdapter getWebsocketAdapter()
public void disconnect()
public boolean isConnectionOpen()
public void setMode(ArrayList<Long> tokens, String mode)
tokens
- an arraylist of tokensmode
- the mode that needs to be set. Scroll up to see different
kind of modespublic void subscribe(ArrayList<Long> tokens)
tokens
- is list of tokens to be subscribed for.public void unsubscribe(ArrayList<Long> tokens)
tokens
- is the list of tokens that needs to be unsubscribed.public Order getOrder(org.json.JSONObject data)
Copyright © 2022. All rights reserved.