HOW CAN I GET "exchange": "", "tradingSymbol": "", "symbolToken": "", EXAMPLE : SENSEX 01 Jul 82700 Call ITS SYMBOL AND TOKEN ?
Latest posts made by C1234
-
HOW CAN I GET? TOKEN AND SYMBOL?
-
aws lambda order placement
Hey everyone,
We are trying to place orders from aws lambda and S3. if anyone knows how to go about it, kindly help us out.
We are trying to mimic the behaviour of tradetron, where orders are placed at once for multiple users based on a given strategy.
Kind regards,
Bharath -
RE: Placing order using tokens
@admin
I could not find any documentation regarding this.Could you please give a step by step instruction on how it is supposed to be done?
-
RE: Issue while placing order and unauthorized order in my account.
So I use python to place orders:
def place_order(client_name,client_smartApi,tradingsymbol,symbol_token,symbolexchange,transactiontype,quantity): #place order try: orderparams = { "variety": "NORMAL", "tradingsymbol": str(tradingsymbol), "symboltoken": str(symbol_token), "transactiontype": str(transactiontype), "exchange": str(symbolexchange), "ordertype": "MARKET", "producttype": "INTRADAY", "duration": "DAY", "quantity": str(quantity) } orderId=client_smartApi.placeOrder(orderparams) print("The order id is: "+orderId+"\t client_name:"+client_name+" \t time:"+str(datetime.today())) except Exception as e: print(e) client_name = 'Username' client_smartApi=SmartConnect(api_key='api_key') login = client_smartApi.generateSession('Client_id','Client_password') refreshToken = login['data']['refreshToken'] quantity = 'quantity' place_order(client_name,client_smartApi,tradingsymbol,symbol_token,symbolexchange,transactiontype,quantity)
Once I executed the above, I got a response as follows:
HTTPSConnectionPool(host='apiconnect.angelbroking.com', port=443): Read timed out. (read timeout=7)
That's pretty much it.
-
RE: Placing order using tokens
Dear @admin, it's been a while since I posted this, could you review and help us out ?
Regards,
Bharath -
RE: Issue while placing order and unauthorized order in my account.
I faced this issue while placing orders for clients too. I faced it today, could you guide us through the correct steps?
And also give out a reason why this is happening?
Regards,
Bharath -
Placing order using tokens
Dear admin,
Once we generate a session, how do we place order using just tokens?
Right now I am doing this:
client_smartApi = SmartConnect(api_key = client_api_key) login = client_smartApi.generateSession("Client_id","Client_password") orderId=client_smartApi.placeOrder(orderparams) print("OrderId :"+str(orderId)) #obtain the required tokens access_token = client_smartApi.access_token refreshToken = login['data']['refreshToken'] jwtToken = login['data']['jwtToken']
The order is successfully placed here.
As you can see, while placing the order I generateSession for the client using the client ID and the client password.However, how do we generate a session initially and then use the tokens to place the orders at a later point in time?
I tried doing this -
client_smartApi = SmartConnect(api_key = clien_api_key) client_smartApi.setAccessToken(access_token ) client_smartApi.setRefreshToken(refreshToken ) orderId=client_smartApi.placeOrder(orderparams)
This throws an error as follows:
..........\lib\site-packages\smartapi\smartConnect.py in placeOrder(self, orderparams) 288 del(params[k]) 289 --> 290 orderResponse= self._postRequest("api.order.place", params)['data']['orderid'] 291 292 return orderResponse TypeError: string indices must be integers
Could you please guide me with this?
Thank you
-
RE: Multi user order placement
@admin Dear admin, can you be kind enough to tell me why we cant place orders for multiple clients?
Am I missing something?
Could you please guide me to the correct sources as well? -
string indices must be integers
Hey whenever I place my orders, the orders usually get executed, however sometimes, I get the error:
"string indices must be integers"Here is a gist of my code:
client_smartApi=SmartConnect(api_key='api_key')
login = client_smartApi.generateSession('Client_id','password')
try:
orderparams = {
"variety": "NORMAL",
"tradingsymbol": tradingsymbol,
"symboltoken": symbol_token,
"transactiontype": transactiontype,
"exchange": symbolexchange,
"ordertype": "MARKET",
"producttype": "CARRYFORWARD",
"duration": "DAY",
"quantity": quantity
}
orderId=client_smartApi.placeOrder(orderparams)
except Exception as e:
print(e)