All URIs are relative to https://tradeapi.kotaksecurities.com/apim
| Method | Description |
|---|---|
| subscribe | Get Margin Required for an order by amount or quantity. |
| unsubscribe | Gives complete Margin Details of a Client from RMS. |
object subscribe(input_tokens, auth_token, callback, broadcast_host):
Get streaming service subscription for specified instruments inputs.
from ks_api_client import ks_api
client = ks_api.KSTradeApi(access_token = "access_token", userid = "userid", \
consumer_key = "consumer_key", ip = "IP", app_id = "app_id")
#First initialize session and generate session token
try:
# Get Margin Required for an order by amount or quantity.
client.subscribe(input_tokens="", consumer_key="", consumer_secret="", callback=print, broadcast_host="https://wstreamer.kotaksecurities.com")
except Exception as e:
print("Exception when calling StreamingApi->subscribe: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| input_tokens | str | Instrument tokens with comma seperated. | Example: "475,745" |
| consumer_key | str | Consumer Key | Mandatory field |
| consumer_secret | str | Consumer Secret | Mandatory field |
| callback | obj | Method object | method of function should have one mandatory parameter to accept message. Default method is print() |
| broadcast_host | str | String host URL | default value: "https://wstreamer.kotaksecurities.com" |
object
object unsubscribe()
Request to unsubscribe from streaming service.
from ks_api_client import ks_api
client = ks_api.KSTradeApi(access_token = "access_token", userid = "userid", \
consumer_key = "consumer_key", ip = "IP", app_id = "app_id")
#First initialize session and generate session token
try:
# Get Margin details.
client.unsubscribe()
except Exception as e:
print("Exception when calling StreamingApi->unsubscribe: %s\n" % e)object