コード例 #1
0
    "exchange": "NSE",
    "price": 19500,
    "quantity": 10,
    "triggerprice": 200000,
    "disclosedqty": 10,
    "timeperiod": 365
}
modified_id = smartApi.gttModifyRule(gttModifyParams)

cancelParams = {"id": rule_id, "symboltoken": "3045", "exchange": "NSE"}

cancelled_id = smartApi.gttCancelRule(cancelParams)

smartApi.gttDetails(rule_id)

smartApi.gttLists('List of status', '<page>', '<count>')

smartApi.terminateSession('Your Client Id')

## Websocket Programming

from smartapi import WebSocket
import multiprocessing
import sys
FEED_TOKEN = feedToken
CLIENT_CODE = "Your Client Id"
token = None
task = None
ss = WebSocket(FEED_TOKEN, CLIENT_CODE)

コード例 #2
0
        "qty": 10,
        "disclosedqty": 10,
        "triggerprice": 200000,
        "timeperiod": 365
    }
    rule_id = obj.gttCreateRule(gttCreateParams)
    print("The GTT rule id is: {}".format(rule_id))
except Exception as e:
    print("GTT Rule creation failed: {}".format(e.message))

#gtt rule list
try:
    status = ["FORALL"]  #should be a list
    page = 1
    count = 10
    lists = obj.gttLists(status, page, count)
except Exception as e:
    print("GTT Rule List failed: {}".format(e.message))

#Historic api
try:
    historicParam = {
        "exchange": "NSE",
        "symboltoken": "3045",
        "interval": "ONE_MINUTE",
        "fromdate": "2021-02-08 09:00",
        "todate": "2021-02-08 09:16"
    }
    obj.getCandleData(historicParam)
except Exception as e:
    print("Historic Api failed: {}".format(e.message))