Code Monkey home page Code Monkey logo

nsedt's Introduction

Howdy 👋💻, I'm Pratik Anand

I'm a DevSecOps


  • 🌱 I’m currently learning

go

go


  • 🔭 I’m currently working on ...

terraform     


  • 💬 Ask me about

    terraform      jenkins      gitlab      python      ansible      aws      docker     

linux


  • 📫 How to reach me: open mypage

nsedt's People

Contributors

aaekay avatar jitendravarma avatar pratik141 avatar shivam2502 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nsedt's Issues

Problem with reapeted request with the equity utility

i want to use the eq.get_price() function multiple times in the same program however it answers only 1 time and the returns errors show

1.First error ,this is shown once only
PS C:\data\stockmarket> python z_prototyping.py
{
"time": "12/07/2023 06:21:19 PM",
"lineno": "139",
"name": "[root]",
"loglevel": "ERROR",
"process": "15880",
"filename": "equity.py",
"funcName": "get_price",
"logmessage": "https://www.nseindia.com/api/historical/securityArchives?symbol=TCS&from=18-07-2023&to=06-09-2023&dataType=priceVolumeDeliverable&series=EQ got exception: Please try again in a minute.. Please try again later.",
}
Traceback (most recent call last):
File "C:\data\stockmarket\z_prototyping.py", line 12, in
print(eq.get_price(start_date, end_date, symbol="TCS"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\Lib\site-packages\nsedt\equity.py", line 140, in get_price
raise exc
File "C:\python\Lib\site-packages\nsedt\equity.py", line 136, in get_price
dataframe = future.result()
^^^^^^^^^^^^^^^
File "C:\python\Lib\concurrent\futures_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "C:\python\Lib\concurrent\futures_base.py", line 401, in __get_result
raise self.exception
File "C:\python\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\Lib\site-packages\nsedt\utils_init
.py", line 81, in fetch_url
raise ValueError("Please try again in a minute.")
ValueError: Please try again in a minute.

2.After the above error is shown once ,then this error keeps on occuring when i use the function

PS C:\data\stockmarket> python z_prototyping.py
Traceback (most recent call last):
File "C:\data\stockmarket\z_prototyping.py", line 12, in
print(eq.get_price(start_date, end_date, symbol="TCS"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python\Lib\site-packages\nsedt\equity.py", line 95, in get_price
cookies = utils.get_cookies()
^^^^^^^^^^^^^^^^^^^
File "C:\python\Lib\site-packages\nsedt\utils_init_.py", line 46, in get_cookies
raise ValueError("Retry again in a minute.")
ValueError: Retry again in a minute.

--I have been using this on google colab and it works everytime,but doesnt run on my local linux and windows sytem the above error keeps occuring. Any help and suggestion on how i can get it working ,pls help.

Missing fake dependency

After the lastest merge v0.0.12, its throwing

from nsedt.reports import *
Traceback (most recent call last):
File "", line 1, in
File "/Users/witchking/Code/scuti/nsedt/nsedt/reports.py", line 7, in
from nsedt.utils import get_cookies, fetch_csv, format_date, fetch_zip
File "/Users/witchking/Code/scuti/nsedt/nsedt/utils/init.py", line 19, in
from fake_http_header import FakeHttpHeader
ModuleNotFoundError: No module named 'fake_http_header'

Although, I have added in requirements.txt and setup.py

Is options data available?

I would like to inquire if options data is accessible.
I am interested in knowing if options data is provided.

nsedt library returns empty data whereas nseindia url return valid value

Describe the bug
Sometimes, mostly right after the day closure of nse, when i try to run nsedt library to see Close Price, I can see empty dataframe returned.

To Reproduce

https://www.nseindia.com/api/quote-equity?symbol=SBIN returns correct data, but not nsedt lib.
Time of Execution :

2023-10-09 16:31:15 IST
2023-10-09 13:01:15 CET

Name: nsedt
Version: 0.0.10

Please check the uploaded screenshots.

Expected behavior
Correct dataframe is returned instead of empty dataframe.
I hope there is any time constraints to execute nsedt ?

Screenshots
Valid response from nseindia
valid_value_from_nseindia

Empty dataframe from nsedt

Empty_Dataframe_From_nsedt

Getting Wrong Close Price for POWERGRID stock, ex : 2023-09-11 - value 264.5/- but in google 52wk High is 205/-

Describe the bug
Wrong Close Price for stock POWERGRID - NSE, for multiple dates in Sep 2023. Its w2wk high is only 204, but we are getting > 260 multiple days in Sep 2023

To Reproduce
Steps to reproduce the behavior:

  1. install nsedt 0.0.10
  2. Try to fetch data for ("POWERGRID", "01-09-2023", "19-09-2023")

Expected behavior
Correct value is returned for Close Price

Screenshots
Below screenshot is from our library while fetching ("POWERGRID", "01-09-2023", "19-09-2023")

image

Below screenshot is from google, which says POWERGRID never went above 260 in last 1 year.

image

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: windows
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Hourly data

Hi,

Is it possible to get hourly data? (each candle is 1 hour)

Thanks.

Attribute Error

Tried running the code as mentioned in the README.md. Got an error..

AttributeError                            
Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_24156\278695389.py in <module>
      5 end_date = "03-05-2023"
      6 print(eq.get_corpinfo(start_date, end_date, symbol="TCS"))
----> 7 print(eq.get_event(start_date, end_date))
      8 print(eq.get_event())

AttributeError: module 'nsedt.equity' has no attribute 'get_event'

Typo in README

image

Here you have made a typo.
'pip install . --upgrade' is correct insted of 'pip installl . --upgrade'

Add No of trades

Sir your project is very helpful. Please add 'No of trades' which is present in nse bhavcopy so that we can get no of trades.

[EQ]: New APIs

TODO:

  • historical price
  • corporates-corporateActions
  • event-calendar
  • corporates-financial-results
  • marketStatus
  • daily-reports
  • marketstatus
  • chartdata

ValueError: Retry again in a minute.

Describe the bug
ValueError: Retry again in a minute.

To Reproduce
Steps to reproduce the behavior:

from nsedt import equity as eq
from datetime import date
import pandas as pd
from datetime import datetime,timedelta

start_date= datetime.today() - timedelta(365)
end_date= datetime.today()
print(start_date.date())
print(end_date.date())

finalDF=pd.DataFrame()

for i,sym in enumerate(eq.get_symbols_list()):
    try:
        tempDF=eq.get_price(start_date, end_date, symbol=sym)[['Date','Close Price']]
        if finalDF.shape[0]==0:
            finalDF=pd.concat([finalDF,tempDF],axis=0)
        else:
            finalDF=pd.merge(finalDF,tempDF,how='left',on='Date')
    except Exception as e:
        print(f'ERROR for {i,sym}: ',e)

Expected behavior
I was fetching one year data for all sym by for loop in a dataframe

Screen Short
image.

Desktop (please complete the following information):

  • OS: Ubuntu
  • Browser : Firefox
  • Version : 22

Additional Information
NSE got my ip making too many request so I think they blocked my ip address
is there any way to fake Ip address also?

Wrong Close Price for NSE stocks compared to NSE India, Google or TradingView in nsedt library

Describe the bug
nsedt is giving wrong Close Price w.r.to NSE India, Google or TradingView. After NSE hours, say 4:00 PM CET, when we are checking all 3 - NSE India / Google / TradingView have same value, but when we fetch same stock value via nsedt, it gives some other value.

To Reproduce
Please refer screenshot attached.

Name: nsedt
Version: 0.0.10

Expected behavior
nsedt should give same value as nseindia/google.

Screenshots

I did an analysis on 9th Oct 2023 for 5 stocks. All 5 had incorrect Close Price for nsedt but same for NSE India/Google/TradingView.

image

Incorrect value from nsedt library - 3638.35

tcs_incorrect_nsedt

Correct value from NSE India

close_price_correct_nseindia

Correct Close Price from Google

tcs_correct_google

Correct Close Price from TradingView

tcs_correct_tradingview

[EQ] get_price returns only 50 entries

Irrespective of the start. end date specified, it returns a data frame of length 50. Probably we need to adjust the window size. Or do you see any other better solution of getting more data at once?

missing pkg from nsedt import utils

hi , i am getting below error on first run of application . any suggestion .

from nsedt import equity as eq

ImportError: cannot import name 'equity' from 'nsedt' (unknown location)

Dynamic headers for making API calls to NSE

Right now I see that we have fixed headers for making api requests to NSE. Problem with this is, if many users are requesting the NSE api, then NSE blocks the given headers. So no new reqports file will be downloaded for same headers.

Solution that I like to propose it, to use python header faker library to mock headers and then shoot request. That way all different users will have their own set of headers and wont get blocked.

Library: https://pypi.org/project/fake-headers/

Refactor equity.py

split equity.py

create a separate module for price, infos and other

This will help in adding more APIs in a easier manner.

dates not working well on index data

I tried to get nifty50 data, but dates input and the output don't match, this problem does not happen with equity

code

from nsedt import indices as eq
from datetime import date

start_date = date(2023, 9, 4)
end_date = date(2023, 9, 7)
print(eq.get_price(start_date, end_date, symbol="NIFTY 50"))

output

Open Price High Price Close Price Low Price Date Total Traded Quantity Total Traded Value
0 19525.05 19545.15 19528.80 19432.85 2023-09-03T18:30:00.000Z 396071122 24822.79
1 19564.65 19587.05 19574.90 19525.75 2023-09-04T18:30:00.000Z 303958622 24029.89
2 19581.20 19636.45 19611.05 19491.50 2023-09-05T18:30:00.000Z 512974083 32500.52

Output is 3rd 4th and 5th of September whereas input was 4 to 7

Problem Downloading Options Data

File "/Users/nijanjyakhwo/Splash-Trade-Automation/Strategy/IndicatorBased/NSEDT/nsedt.py", line 1, in
from nsedt import derivatives as de
File "/Users/nijanjyakhwo/Splash-Trade-Automation/Strategy/IndicatorBased/NSEDT/nsedt.py", line 1, in
from nsedt import derivatives as de
ImportError: cannot import name 'derivatives' from partially initialized module 'nsedt' (most likely due to a circular import) (/Users/nijanjyakhwo/Splash-Trade-Automation/Strategy/IndicatorBased/NSEDT/nsedt.py)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.