aeron7 / nsepython Goto Github PK
View Code? Open in Web Editor NEWThe Unofficial Python Wrapper for NSEIndia API
Home Page: https://unofficed.com/nse-python/
License: GNU General Public License v3.0
The Unofficial Python Wrapper for NSEIndia API
Home Page: https://unofficed.com/nse-python/
License: GNU General Public License v3.0
Hi Team,
I have installed the library via pip3
while executing the below code , I am getting the below error mentioned
from nsepython import *
print(indices)
# print(nse_optionchain_scrapper('PVR'))
print(nse_eq('PVR'))
Error Code
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Complete Error Code
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/thoughtworks/projects/coursera/pythonPract/stock-details.py", line 5, in <module>
print(nse_eq('PVR'))
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/nsepython/rahu.py", line 289, in nse_eq
payload = nsefetch('https://www.nseindia.com/api/quote-equity?symbol='+symbol)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/nsepython/rahu.py", line 18, in nsefetch
output = requests.get(payload,headers=headers).json()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
System Configuration:
Mac
Python 3.11.2
pip 23.1.2
The expiry_list('NIFTY')
function doesn't work anymore. It just gets stuck. Is it because of issues in NSE website or with the library? Please help.
Hi Team,
I have installed the library via pip3
while executing the below code , I am getting the below error mentioned
from nsepython import *
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
ssl._create_default_https_context = ssl._create_unverified_context
ssl._create_default_https_context = ssl._create_stdlib_context
print(indices)
print(fnolist())
print(nse_optionchain_scrapper('PVR'))
Error Code
MaxRetryError: HTTPSConnectionPool(host='www.nseindia.com', port=443): Max retries exceeded with url: /api/equity-stockIndices?index=SECURITIES%20IN%20F%26O (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)')))
Complete Error Code
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 419, in connect
self.sock = ssl_wrap_socket(
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 517, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1075, in _create
self.do_handshake()
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1346, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)
For all python request ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
, I would use verify=False
like requests.get('http://api.xxxx.com/v1/sbin',verify=False)
, but not sure how to pass the SSL verification false for the nsepython library
certificate verify failed: unable to get local issuer certificate
System Configuration:
Mac
Python 3.11.2
pip 23.1.2
Few days back I was able to fetch data using nsepython but I am unable to fetch data now for some reason. Can someone let me know if the library is working fine on their end?
Issue:
can't able to fetch index history using index_history function
ERROR:
"""
KeyError Traceback (most recent call last)
in <cell line: 6>()
4 start_date_r = start_date.strftime("%d-%b-%Y")
5 print(end_date_r, start_date_r)
----> 6 df = index_history(symbol,start_date_r,end_date_r)
7 len(df)
/usr/local/lib/python3.10/dist-packages/nsepython/rahu.py in index_history(symbol, start_date, end_date)
746 data = "{'name':'"+symbol+"','startDate':'"+start_date+"','endDate':'"+end_date+"'}"
747 payload = requests.post('https://niftyindices.com/Backpage.aspx/getHistoricaldatatabletoString', headers=niftyindices_headers, data=data).json()
--> 748 payload = json.loads(payload["d"])
749 payload=pd.DataFrame.from_records(payload)
750 return payload
KeyError: 'd'
"""
note:
payload = requests.post('https://niftyindices.com/Backpage.aspx/getHistoricaldatatabletoString', headers=niftyindices_headers, data=data).json()
payload={'Message': 'There was an error processing the request.',
'StackTrace': '',
'ExceptionType': ''}
Tried nsefetch(“https://www.nseindia.com/api/equity-stockIndices?index=NIFTY%2050”)
in a loop.
Output: b'<HTML><HEAD>\n<TITLE>Access Denied</TITLE>\n</HEAD><BODY>\n<H1>Access Denied</H1>\n \nYou don\'t have permission to access "http://www.nseindia.com/api/equity-stockIndices?" on this server.<P>\nReference #18.5c01d517.1715925139.41f263\n<P>https://errors.edgesuite.net/18.5c01d517.1715925139.41f263</P>\n</BODY>\n</HTML>\n’
Getting requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
due to Unauthorized 401 error resulting after Mimicking FrontPage visit.
Even after using the commit b0b7d36 was not able to resolve the issue
Have raised PR for tackling below issue 70accbf
The main use case is to iterate over all nse_eq symbols
symbols = nse_eq_symbols()
for symbol in symbols[:3]:
print("This is my symbol :: ",symbol)
df = nse_eq(symbol)
print("Price info :: ",df['priceInfo'])
open_val,high,low,current = df['priceInfo']['open'],df['priceInfo']['intraDayHighLow']['max'],df['priceInfo']['intraDayHighLow']['min'],df['priceInfo']['lastPrice']
print("Open value :: ",open_val)
print("High value :: ",high)
print("Low value :: ",low)
print("Current value :: ",current)
Hi sir
everything works fine on local pc but not working on any of cloud server VM
print(indices)
print(fnolist())
above two function works fine in cloud too..
print(nse_optionchain_scrapper('PVR')) is not woking ...
please resolve it ...
thank you
from nsepython import *
print(nsetools_get_quote("reliance"))
This piece of code is returning
{'symbol': 'RELIANCE', 'identifier': '', 'series': 'EQ', 'open': '2590.3', 'dayHigh': '2641.35', 'dayLow': '2582.2', 'lastPrice': '2632', 'previousClose': '2591.1', 'change': 40.9, 'pChange': 1.58, 'totalTradedVolume': 5838244, 'totalTradedValue': 15332513157.68, 'lastUpdateTime': '31-DEC-2999', 'yearHigh': '2856.15', 'yearLow': '2083.4', 'nearWKH': 7.847977172067296, 'nearWKL': -26.33195737736392, 'perChange365d': 20.76, 'date365dAgo': '13-Aug-2021', 'chart365dPath': 'https://static.nseindia.com/sparklines/365d/RELIANCE-EQ.jpg', 'date30dAgo': '15-Jul-2022', 'perChange30d': 7.88, 'chart30dPath': 'https://static.nseindia.com/sparklines/30d/RELIANCE-EQ.jpg', 'chartTodayPath': 'https://static.nseindia.com/sparklines/today/RELIANCEEQN.jpg', 'meta': {'symbol': 'RELIANCE', 'companyName': 'Reliance Industries Limited', 'industry': 'REFINERIES', 'activeSeries': ['EQ'], 'debtSeries': [], 'tempSuspendedSeries': [], 'isFNOSec': True, 'isCASec': False, 'isSLBSec': True, 'isDebtSec': False, 'isSuspended': False, 'isETFSec': False, 'isDelisted': False, 'isin': 'INE002A01018'}}
a valid JSON requires double quotes for its strings.
Unable to get any data for index options history. Not sure what is happening
I am running NSEPython from Ubuntu VPS in Digital Ocean. I am running the function to fetch expiry date of the contracts. But it isn't loading anything. But from my local Windows desktop it is working. Is there any special configuration I should do to run in Ubuntu? But through Firefox in Ubuntu, I am able to access the nseindia.com API URL. Kindly help. Thanks.
KeyError Traceback (most recent call last)
in
----> 1 nsepython.nse_quote_ltp('M&M', 'latest', 'Fut')
c:\users<>\appdata\local\programs\python\python38\lib\site-packages\nsepython\rahu.py in nse_quote_ltp(symbol, expiryDate, optionType, strikePrice)
192
193 if(expiryDate=="latest") or (expiryDate=="next"):
--> 194 dates=list(set((payload["expiryDates"])))
195 dates.sort(key = lambda date: datetime.datetime.strptime(date, '%d-%b-%Y'))
196 if(expiryDate=="latest"): expiryDate=dates[0]
KeyError: 'expiryDates'
The previous api call is not working. Update it to new api call : https://www.nseindia.com/api/historical/cm/equity?symbol=TRIDENT&series=[%22EQ%22]&from=23-04-2023&to=23-05-2023
while try to build the script with NSEPython getting error as Build failed: arm-linux-androideabi-gfortran not found.
Hi,
I need your assistance to create a moving average channel code for trading Index, DM me in telegram @marudwarak
I am trying to get the last closed price of a stock. And the nsefetch()
gets a 401 error response. And when we try to get json from it we get a requests.exceptions.JSONDecodeError
Details/Steps to recreate
I am running everything for a local setup. And for my code I am using this.
from nsepython import *
symbol = 'SWSOLAR'
print(nse_eq(symbol)['priceInfo']['close'])
And it errors out here when we try make the get call to https://www.nseindia.com/api/quote-equity?symbol=SWSOLAR
. It returns a 401 and when we try to jsoninfy it we get the error raised up requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
.
This is the details of the 401 response that we get.
{'_content': b'<!DOCTYPE html>\r\n<html lang="en">\r\n<head>\r\n <meta chars'
b'et="UTF-8">\r\n <title>Oops</title>\r\n</head>\r\n<body style'
b'="background-color: #e8e8e8;">\r\n <div style="font-size: 14p'
b'x; padding: 50px 0; text-align: center;">\r\n <h1>\r\n N'
b'o authorization token was found\r\n </h1>\r\n <h2>\r\n '
b' 401\r\n </h2>\r\n <pre style="text-align: left; font-s'
b'ize: 11px;">UnauthorizedError: No authorization token was fo'
b'und\n at middleware (/www/nse-website-node-v2/files/node_m'
b'odules/express-jwt/lib/index.js:79:21)\n at Layer.handle ['
b'as handle_request] (/www/nse-website-node-v2/files/node_modules/'
b'express/lib/router/layer.js:95:5)\n at next (/www/nse-webs'
b'ite-node-v2/files/node_modules/express/lib/router/route.js:137:1'
b'3)\n at attachCors (/www/nse-website-node-v2/files/server/'
b'middleware.js:188:3)\n at Layer.handle [as handle_request]'
b' (/www/nse-website-node-v2/files/node_modules/express/lib/router'
b'/layer.js:95:5)\n at next (/www/nse-website-node-v2/files/'
b'node_modules/express/lib/router/route.js:137:13)\n at Rout'
b'e.dispatch (/www/nse-website-node-v2/files/node_modules/express/'
b'lib/router/route.js:112:3)\n at Layer.handle [as handle_re'
b'quest] (/www/nse-website-node-v2/files/node_modules/express/lib/'
b'router/layer.js:95:5)\n at /www/nse-website-node-v2/files/'
b'node_modules/express/lib/router/index.js:281:22\n at Funct'
b'ion.process_params (/www/nse-website-node-v2/files/node_modules/'
b'express/lib/router/index.js:335:12)\n at next (/www/nse-we'
b'bsite-node-v2/files/node_modules/express/lib/router/index.js:275'
b':10)\n at next (/www/nse-website-node-v2/files/node_module'
b's/express/lib/router/route.js:127:14)\n at /www/nse-websit'
b'e-node-v2/files/server/routes.js:388:11</pre>\r\n </div>\r\n</b'
b'ody>\r\n</html>\r\n',
'_content_consumed': True,
'_next': None,
'connection': <requests.adapters.HTTPAdapter object at 0x151135cc0>,
'cookies': <RequestsCookieJar[Cookie(version=0, name='AKA_A2', value='A', port=None, port_specified=False, domain='.nseindia.com', domain_specified=True, domain_initial_dot=False, path='/', path_specified=True, secure=True, expires=1694352722, discard=False, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False), Cookie(version=0, name='ak_bmsc', value='3FF27A5BD0D6CA89B241FE09D6BE37DD~000000000000000000000000000000~YAAQKkw5F3zBT3qKAQAAktwTfxVprxRxAcgBFTxytM1PfqlASuI9TI8joQ2Ye9qvEBer7lG6V75Y+iSYBuOnUAqBvmWyY0hnqnYcK7sgA9zVYAOHWG8/PCGTeqY6hGbYGkm9tELEjEU+PrLsdw8FePPXkRh1mDEqLOLegucczlNt1WBNI6lak4II4Ygd25ZzH40AabtyJpjwMcvYUfLHeYXPJHrnPlseOWqFRRy2wMQPBlEcGo/vU24kqu4lxCThxjcOFccUGIgx3pok3O1VXIwzbc3NDnRRzNdIrKJrov1u2HtH+e9rQbwx6zs6HwmknR9VFkosHJiG31AXheHIwupmiXSvEomrOsDLcSNbp5VG5aMh0WPvh7okBQKzkj60fw==', port=None, port_specified=False, domain='.nseindia.com', domain_specified=True, domain_initial_dot=True, path='/', path_specified=True, secure=False, expires=1694356322, discard=False, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False)]>,
'elapsed': datetime.timedelta(microseconds=354280),
'encoding': 'utf-8',
'headers': {'Server': 'Apache', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Content-Security-Policy': "font-src *; default-src 'self' *; img-src * data: https://www.google.co.in https://www.google-analytics.com www.google-analytics.com https://nse-widget.interface.ai; style-src * 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.youtube.com *.gstatic.com https://www.google.com/ *.cloudflare.com *.googletagmanager.com *.highcharts.com *.go-mpulse.net https://stats.g.doubleclick.net/ https://www.google.com/ *.doubleclick.net https://nse-uat-widget.interface.ai/widget-loader.js www.google-analytics.com *.g.doubleclick.net/ https://analytics.google.com/ https://nse-widget.interface.ai", 'Access-Control-Allow-Origin': 'beta.nseindia.com, nseindia.com', 'Access-Control-Allow-Methods': 'GET,POST', 'Access-Control-Allow-Headers': 'Content-Type', 'Content-Type': 'text/html; charset=utf-8', 'Content-Encoding': 'gzip', 'Date': 'Sun, 10 Sep 2023 12:32:02 GMT', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive, Transfer-Encoding', 'Vary': 'Accept-Encoding', 'Set-Cookie': 'AKA_A2=A; expires=Sun, 10-Sep-2023 13:32:02 GMT; path=/; domain=nseindia.com; secure; HttpOnly, ak_bmsc=3FF27A5BD0D6CA89B241FE09D6BE37DD~000000000000000000000000000000~YAAQKkw5F3zBT3qKAQAAktwTfxVprxRxAcgBFTxytM1PfqlASuI9TI8joQ2Ye9qvEBer7lG6V75Y+iSYBuOnUAqBvmWyY0hnqnYcK7sgA9zVYAOHWG8/PCGTeqY6hGbYGkm9tELEjEU+PrLsdw8FePPXkRh1mDEqLOLegucczlNt1WBNI6lak4II4Ygd25ZzH40AabtyJpjwMcvYUfLHeYXPJHrnPlseOWqFRRy2wMQPBlEcGo/vU24kqu4lxCThxjcOFccUGIgx3pok3O1VXIwzbc3NDnRRzNdIrKJrov1u2HtH+e9rQbwx6zs6HwmknR9VFkosHJiG31AXheHIwupmiXSvEomrOsDLcSNbp5VG5aMh0WPvh7okBQKzkj60fw==; Domain=.nseindia.com; Path=/; Expires=Sun, 10 Sep 2023 14:32:02 GMT; Max-Age=7200; HttpOnly', 'Server-Timing': 'cdn-cache; desc=REVALIDATE, edge; dur=85, origin; dur=35, ak_p; desc="1694349122490_389631018_485543705_11957_9607_71_86_-";dur=1', 'Link': '<https://www.nseindia.com/assets/webfonts/fa-brands-400.woff2>;rel="preload";as="font";type="font/woff2";crossorigin,<https://www.nseindia.com/assets/webfonts/fa-solid-900.woff2>;rel="preload";as="font";type="font/woff2";crossorigin, <https://www.google-analytics.com>;rel="preconnect"', 'Strict-Transport-Security': 'max-age=31536000 ; includeSubDomains ; preload'},
'history': [],
'raw': <urllib3.response.HTTPResponse object at 0x151135b40>,
'reason': 'Unauthorized',
'request': <PreparedRequest [GET]>,
'status_code': 401,
'url': 'https://www.nseindia.com/api/quote-equity?symbol=SWSOLAR'}
Hi,
I am using oi_chain_builder(), But getting following warning.
rahu.py:146: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
I tried to modify line no. 146 of rahu.py: oi_data = oi_data.append(oi_row, ignore_index=True) as oi_data = pd.concat([oi_data,oi_row],index=False), but not succeed.
Could anyone please guide me to get rid of this error.
using nsepython
getting below error while invoking nse_eq(symbol)
Error occurred while processing : <class 'requests.exceptions.JSONDecodeError'>
DEBUG:urllib3.connectionpool:https://www.nseindia.com:443 "GET /api/quote-derivative?symbol=NIFTY HTTP/1.1" 200 None
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nsepython/rahu.py", line 279, in nse_quote_meta
return metadata
UnboundLocalError: local variable 'metadata' referenced before assignment
the pandas dataframe returned by the above mentioned function is using frame.append
which is deprecated. pandas is suggesting to use pandas.concat
insead. are there plans to fix this?
Hi so I am using Results Calendar function of this library and also read that I will have to use curl shell command to run code in Cloud
Can u provide me a road map or code of exactly how to run code using cURL command ??
Thanks
from nsepython import index_pe_pb_div
def dataset_generator():
symbol = "NIFTY 50"
start_date = "01-Mar-2011"
end_date = "07-Jun-2021"
print(index_pe_pb_div(symbol,start_date,end_date))
dataset_generator()
Traceback (most recent call last):
File "C:\Users\Dev.Juneja\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\Dev.Juneja\Downloads\Fin-Maestro\Prerequisites\test.py", line 9, in <module>
dataset_generator()
File "c:\Users\Dev.Juneja\Downloads\Fin-Maestro\Prerequisites\test.py", line 7, in dataset_generator
print(index_pe_pb_div(symbol,start_date,end_date))
File "C:\Users\Dev.Juneja\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\nsepython\rahu.py", line 727, in index_pe_pb_div
payload = requests.post('https://niftyindices.com/Backpage.aspx/getpepbHistoricaldataDBtoString', headers=niftyindices_headers, data=data).json()
File "C:\Users\Dev.Juneja\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
index_history doesn't seem to work, even using the recent updated version of rahu.py of @buzzvolt
https://github.com/buzzvolt/nsepython/blob/master/nsepython/rahu.py
Traceback (most recent call last):
File "/mnt/c/python/misc/portfolio.py", line 138, in <module>
test = plr.index_history('NIFTY 50','2000-01-01','2023-01-01')
File "/mnt/c/python/misc/rahu.py", line 748, in index_history
payload = json.loads(payload["d"])
KeyError: 'd'
oi_chain_builder is supposed to return the data for any expiry date based on the date but it does not return the same. If we pass any date as an argument it returns a blank dataframe.
Suggestion to rename the default "latest" argument to "current". Equity has only 3 concurrent expiry dates. Hence names suggested "current", "next" and "last"
For Indices there are options for 21 expiry dates running concurrently at a given time. So giving a list of date options or allowing an integer input for no of weeks to expiry can make usage easy.
In local usage of nsepython, it logs all request responses, without giving a way to control this logging.
I understand this may be helpful in debugging nsepython itself, but a client app should have a way to control its library logs.
This causes unpleasant spamming in client logs and makes client logic harder to debug.
File .venv/lib/python3.12/site-packages/nsepython/rahu.py", line 484, in nse_get_fno_lot_sizes (code, name) = [x.strip() for x in line.split(',')[1:3]] ^^^^^^^^^^^^ ValueError: not enough values to unpack (expected 2, got 1)
Seems like the problem is in the url:
url="https://archives.nseindia.com/content/fo/fo_mktlots.csv"
Throws 404. Perhaps need a new URL?
I have just downloaded nsepython and wanted to give it try. But it seems that the documentation link https://unofficed.com/nse-python/documentation/
isn't working
Can we have a filter for the time range for nse_events, for example, If we want to have a custom filter based on filters present on the website it would be great .
Example: https://www.nseindia.com/companies-listing/corporate-filings-event-calendar
Thanks & regards,
Dipanjan
function is_market_open return true even if is holiday today.
Problem is in the line:
Line 909 in 6f3a728
This only checks for first holiday from the nse_holidays() json result and return True by checking only the first. It should be continue here to check for the next holiday date and a final return true at the end of function.
Unable to get derivative history.
The sample program in documentation also does not work.
symbol = "SBIN"
start_date = "15-05-2021"
end_date ="15-06-2021"
instrumentType = "options"
expiry_date ="24-Jun-2021"
strikePrice = 300
optionType="PE"
print(derivative_history(symbol,start_date,end_date,instrumentType,expiry_date,strikePrice,optionType))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.