Architecture that shows you idea →
import requests
import json
# Define the URL of your Django view
url = 'https://hook.unofficed.com/webhooks/tview/'
# Define the JSON data to be sent in the POST request
data = {
"order": [{
"tradesymbol": ["banknifty","ce","current","44251!-2"],
"tradeprice": "44251",
"tradetype": "sell",
"tradeorder": "market",
"tradequant": "2",
"tradepdt": "nrml",
"tradeexchange": "nfo",
"triggerprice": "0"
},
{
"tradesymbol": "SBIN",
"tradeprice": "140",
"tradetype": "buy",
"tradeorder": "market",
"tradequant" : "1",
"tradepdt": "nrml",
"tradeexchange": "nse",
"triggerprice": "0"
}],
"hermes_token": "gABAAABlKGD9wgpQ_UU-Wj2z9Lgg42MKDGXvkQ-cCtBZBtD0otf2Pu5NmRqr5GqatR7HDF-hN678zTJpNzYfed1ab54p85NWYw==",
"strategy_name": "Parabolic SAR 30m"
}
# Convert the data to a JSON string
data_json = json.dumps(data)
# Set the headers for the POST request
headers = {
'Content-Type': 'application/json', # This header is important for Django to recognize the data as JSON
}
# Send the POST request and get the response
response = requests.post(url, data=data_json, headers=headers)
# Print the response
print(response.text)
https://app.tradepick.in/Hermes
If the hermes_token
is correct then it will fire the order immediately.