How to generate PIN?
Posts made by HP
-
Forget login issue
from smartapi.smartWebSocketV2 import SmartWebSocketV2
from smartapi import SmartConnect
import pyotpdef angelbrok_login():
try:
global feed_token, client_code, angel, password, totpangel = SmartConnect(api_key="") client_code = " " password = " " qrOtp = " " totp = pyotp.TOTP(qrOtp) totp = totp.now() data = angel.generateSession(client_code,password,totp) refreshToken = data['data']['refreshToken'] feed_token = angel.getfeedToken() print("Login successful") except Exception as e: print("Error in login", e)
Note: once you login successfully, do not try to generate again,
who will resolve my "In on pong function==> b'\x00'" issue ? -
what if I do not have android or IOS Phone?
what if I do not have android or IOS Phone? ask to SEBI
-
RE: WebSocketV2 not working to get Live Feed
@J88913 said in WebSocketV2 not working to get Live Feed:
from SmartApi.smartWebSocketV2 import SmartWebSocketV2
AUTH_TOKEN = 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6Iko4ODkxMyIsInJvbGVzIjowLCJ1c2VydHlwZSI6IlVTRVIiLCJpYXQiOjE2NjAxMDc2MDIsImV4cCI6MTc0NjUwNzYwMn0.GxHWWlTKnC-pGIyrz_PLBpwz4Dw2qYdQTTqum5KUKgSsaHFsts1gP1kzgkJELfTAbFmnlyA1dQtgruNP_5vWBQ'
API_KEY = 'IpUZc95q'
CLIENT_CODE = 'J77913'
FEED_TOKEN = '0935239566'
correlation_id = "erroroutp1"
action = 1
mode = 3
token_list = [{"exchangeType": 1, "tokens": ["11536"]}]
sws = SmartWebSocketV2(AUTH_TOKEN, API_KEY, CLIENT_CODE, FEED_TOKEN)
def on_data(wsapp, message):
print("Ticks: {}".format(message))
def on_open(wsapp):
print("on open")
sws.subscribe(correlation_id, mode, token_list)
def on_error(wsapp, error):
print(error)
def on_close(wsapp):
print("Close")Assign the callbacks.
sws.on_open = on_open
sws.on_data = on_data
sws.on_error = on_error
sws.on_close = on_closesws.connect()
I am using the above code but do not get any live feed. Only received following output
on open
In on pong function==> b'\x00'
In on pong function==> b'\x00'
In on pong function==> b'\x00' -
RE: API is down please fix it
@admin ss = SmartWebSocket(FEED_TOKEN, CLIENT_CODE)
TypeError: init() should return None, not 'str' -
RE: SEBI's proposed algo trading guidelines for retail investors
Like all securities, mutual funds are subject to market, or systematic, risk. This is because there is no way to predict what will happen in the future or whether a given asset will increase or decrease in value. Because the market cannot be accurately predicted or completely controlled, no investment is risk-free.
so why need approval?
simple arguement ask to SEBI -
[WinError 10054]
[WinError 10054] An existing connection was forcibly closed by the remote host
Error info: __on_close() takes 2 positional arguments but 4 were given -
RE: fetch banknifty index data
ohlc= get_ohlc(name="BANKNIFTY25NOV21FUT", exchange="NFO")
-
RE: "Order placement failed: 'NoneType' object is not subscriptable"
@prasan
orderparams={"variety": 'NORMAL',
"tradingsymbol": 'BANKNIFTY07OCT2136100CE',
"symboltoken": '40671',
"transactiontype": 'BUY',
"exchange": 'NFO',
"ordertype": 'MARKET',
"producttype": 'INTRADAY',
"duration": 'DAY',
"price": 0.0,
"squareoff": 0.0,
"stoploss": 0.0,
"triggerprice": 0.0,
"trailingstoploss": 0.0,
"quantity": 1
} -
RE: "Order placement failed: 'NoneType' object is not subscriptable"
@prasan said in "Order placement failed: 'NoneType' object is not subscriptable":
"tradingsymbol": "CRUDEOIL21NOV630000PE",
"symboltoken": "233501",
"transactiontype": "BUY",
*** "exchange": "NFO",**wrong exchange