Token


  • How to place order with token?
    After generating token how to place order without generating new session or feed token

    In python sdk
    Plz write piece of code for every person searching it


  • @admin plz respond to query


  • @admin i don't any software team i am an individual trader that's why i ask for help


  • @admin said in Token:

    As this is a user specific requirement you need to connect with your own software team.

    please note this you need to connect with you own software team.


  • @admin market is running out kindly try to solve my query or provide a way to solve it


  • @admin take remote access and try to solve my problem and please tell me how to contact with your software team


  • @rishi6310 said in Token:

    admin i am trying to create gui in tkinter for buying and selling of stocks but not able to link with orderparam with def function but it generate new session everytime when code run and not able to place order with that

    As this is a user specific requirement you need to connect with your own software team.


  • @admin i am trying to create gui in tkinter for buying and selling of stocks but not able to link with orderparam with def function but it generate new session everytime when code run and not able to place order with that


  • @admin C:\Users\rishi\PycharmProjects\pythonProjectnew\venv\Scripts\python.exe C:/Users/rishi/PycharmProjects/pythonProjectnew/trading.py

    Process finished with exit code 0

    Unresolved reference 'obj' line 25 in this line (orderId=obj.placeOrder(orderparams)
    this is my piece of code
    from smartapi import SmartConnect
    from smartapi import SmartWebSocket
    import login as l

    feedToken=l.feed_token

    def place_order():
    try:
    orderparams = {
    "variety": "NORMAL",
    "tradingsymbol": "ITC",
    "symboltoken": "1660",
    "transactiontype": "buy",
    "exchange": "NSE-EQ",
    "ordertype": "MARKET",
    "producttype": "CARRYFORWARD",
    "duration": "DAY",
    "price": "0",
    "squareoff": "0",
    "stoploss": "0",
    "quantity": 1
    }
    orderId=obj.placeOrder(orderparams)
    print("The order id is: {}".format(orderId))
    except Exception as e:
    print("Order placement failed: {}".format(e.message))


  • @admin said in Token:

    Hi @rishi6310 You can go through below piece of code
    https://smartapi.angelbroking.com/topic/1194/basic-smartapi-integration-using-python

    There are self explanatory codes available here.


  • Hi @rishi6310 send us your req and response.


  • @admin i am not able to take position try to resolve my query market is running out of time


  • @admin how to do it
    here i generate a feedtoken and want to place order but i am not able to do it please tell me market is running out of time
    here is piece of code

    from smartapi import SmartConnect
    from smartapi import SmartWebSocket
    import login as l

    feedToken=l.feed_token

    def place_order():
    try:
    orderparams = {
    "variety": "NORMAL",
    "tradingsymbol": "ITC",
    "symboltoken": "1660",
    "transactiontype": "buy",
    "exchange": "NSE-EQ",
    "ordertype": "MARKET",
    "producttype": "CARRYFORWARD",
    "duration": "DAY",
    "price": "0",
    "squareoff": "0",
    "stoploss": "0",
    "quantity": 1
    }
    orderId=obj.placeOrder(orderparams)
    print("The order id is: {}".format(orderId))
    except Exception as e:
    print("Order placement failed: {}".format(e.message))
    i have feedtoken generated please provide piece of code to place order


  • @rishi6310 said in Token:

    if i have feedtoken and to place order multiple times how can i able to do it
    for eg; if a position is open and want to close and open new position with same token how to do it
    if my orderparams are in different python file

    hello your tokens are valid till 5am in morning so you dont need to regenerate it again and again.You can place order with same tokens in the day.


  • @admin if i have feedtoken and to place order multiple times how can i able to do it
    for eg; if a position is open and want to close and open new position with same token how to do it
    if my orderparams are in different python file
    this is generate by token as you mention
    from smartapi import SmartConnect

    ####generate session #####

    obj =SmartConnect(api_key="AW41v31e")

    login = obj.generateSession('Your client id', 'Your password')

    refreshToken = login['data']['refreshToken']

    feedToken = obj.getfeedToken()

    print ("This is my feedtoken::",feedToken)

    #####get ltp#############

    profile = obj.getProfile(refreshToken)
    print (profile)

    ##########################

    orderbook = obj.orderBook()
    print (orderbook)

    ###########################

    orderparams = {
    "variety": "AMO",
    "tradingsymbol": "SBIN-EQ",
    "symboltoken": "3045",
    "transactiontype": "BUY",
    "exchange": "NSE",
    "ordertype": "LIMIT",
    "producttype": "INTRADAY",
    "duration": "DAY",
    "price": "425",
    "squareoff": "0",
    "stoploss": "0",
    "quantity": "1"
    }
    orderId=obj.placeOrder(orderparams)
    print (orderId)
    if i want to close position with only orderparam with generating new token how to do it
    and create other position as per my algo with def (orderparam) only with token in python