@admin Todays somes automatic entries appear in my order book.
SBIN BUY @425
I am not hitting or testing any API. Is you do some testing from your side..Pls clear.
It happens 3-4 days before also..
Posts made by VIJAY KADTAN
-
RE: PlaceOrder API gives blank output
-
RE: PlaceOrder API gives blank output
@admin pls at least solve this issue of Max retries
Exception while retriving IP Address,using local host IP address HTTPSConnectionPool(host='api.ipify.org', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001D846B5A130>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')) -
RE: PlaceOrder API gives blank output
@admin i am now trying SmartConnect
Give following outputException while retriving IP Address,using local host IP address HTTPSConnectionPool(host='api.ipify.org', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001D846B5A130>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed'))
This is my feedtoken:: 0931788167
{'status': True, 'message': 'SUCCESS', 'errorcode': '', 'data': {'clientcode': 'V187845', 'name': 'VIJAY KADTAN', 'email': '', 'mobileno': '', 'exchanges': ['bse_cm', 'cde_fo', 'nse_cm', 'nse_fo', 'mcx_fo', 'ncx_fo'], 'products': ['BO', 'NRML', 'CO', 'CNC', 'MIS', 'MARGIN'], 'lastlogintime': '', 'broker': ''}}Here output windows first take some time 3-4 sec..then show error and then sow output..
My code is
from smartapi import SmartConnect
####generate session #####obj =SmartConnect(api_key="1GjVLyP9")
login = obj.generateSession('V187845', 'xxxxxxxx')
refreshToken = login['data']['refreshToken']
feedToken = obj.getfeedToken()
print ("This is my feedtoken::",feedToken)
userProfile= obj.getProfile(refreshToken)
print (userProfile)
-
RE: PlaceOrder API gives blank output
@admin From where to download SmartConnect lib
-
RE: PlaceOrder API gives blank output
@admin Please test in Python and replay. I tried today again its still not working..
-
RE: PlaceOrder API gives blank output
@admin Your request shown not looks in Python..Which language should use?
-
RE: PlaceOrder API gives blank output
@admin I made changes (quantity 1 ->25) but still response is BLANK..
Also suggest you for any any issue..never give BLANK response, response should be Failure with reason or at least ERROR ..but never give BLANK response..It is very dangerous when project goes live.. -
PlaceOrder API gives blank output
I have tested your other Python API like GenerateToken, GetProfile, GettRMS all these are working fine.
But when I tested PlaceOrder code, it showed blank output, no errors, nothing.
I tried much more but output.
I write mail to smartapi@angelbroking.com but o response from last 12 days
Please check following codeimport sys
import pyodbc
dbconn = pyodbc.connect('Driver={SQL Server};'
'Server=DESKTOP-HUVNA8M\SQLEXPRESS;'
'Database=ABAlgo;'
'Trusted_Connection=yes;')#strSQL1="SELECT * FROM ABAlgo.dbo.ParaTab WHERE PN=4"
#cursor.execute(strSQL1)
#for row in cursor:PK=row.PVALUE
#strSQL1="SELECT * FROM ABAlgo.dbo.ParaTab WHERE PN=1"
#cursor.execute(strSQL1)
#for row in cursor:JT=row.PVALUE
PK='1GjVLyP9'
JT='eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6IlYxODc4NDUiLCJyb2xlcyI6MCwidXNlcnR5cGUiOiJVU0VSIiwiaWF0IjoxNjI5MjczODkxLCJleHAiOjE3MTU2NzM4OTF9.QQj-STyO1ZmgM6KvxJxK0O1Iu0oaByw0SC_AxRgn4j4UJZeq7BD0iVGbxWc2Mg2B4mA1qEMFXu3eXCIBp4om8g'import http.client
import mimetypes
conn = http.client.HTTPSConnection(
"apiconnect.angelbroking.com"
)VAREXCH = '"NFO"'
VARTRADSYM = '"BANKNIFTY26AUG2132500PE"'
VARSYMTOKEN = '"50616"'
VARQTY = '"1"'
VARPRICE = '"0"'
VARTRGPRICE = '"0"'
VARTRATYPE = '"BUY"'
VARORDERTYPE = '"MARKET"' #MARKET, LIMIT, STOPLOSS_LIMIT, STOPLOSS_MARKET
VARVARIETY = '"NORMAL"' #VARIETY = NORMAL, STOPLOSS, AMO, ROBO
VARPRODUCTTYPE = '"INTRADAY"' #PRODUCTYPE - INTRADAY, CARRYFORWARD, DELIVERY
VARORDERTAG = '"O1"' #CLIENT UNIQUE IDENTIFIERpayload = "{\n "exchange":" + VAREXCH + ",\n"tradingsymbol":" + VARTRADSYM + ",\n"symboltoken":" + VARSYMTOKEN + ",\n"quantity":" + VARQTY + ",\n"transactiontype":" + VARTRATYPE + ",\n"price":" + VARPRICE + ",\n"triggerprice":" + VARTRGPRICE + ",\n"ordertype":" + VARORDERTYPE + ",\n"variety":" + VARVARIETY + ",\n"producttype":" + VARPRODUCTTYPE + ",\n"ordertag":" + VARORDERTAG + "\n}"
headers = {
'Authorization': 'Bearer ' + JT,
'Accept': 'application/json',
'X-UserType': 'USER',
'X-SourceID': 'WEB',
'X-ClientLocalIP': '192.168.1.101',
'X-ClientPublicIP': '117.204.252.92',
'X-MACAddress': 'E0-94-67-6B-48-47',
'X-PrivateKey': '' + PK
}conn.request("POST",
"/rest/secure/angelbroking/order/v1/placeOrder",
payload,
headers)res = conn.getresponse()
data = res.read()
output = data.decode("utf-8")
print(output)