Giter Club home page Giter Club logo

Comments (13)

pranjal-joshi avatar pranjal-joshi commented on June 21, 2024

Seems like they've shutdown the archives URL
Need to figure out the replacement for this on new NSE and then push it in the next release

from screeni-py.

sandeep255 avatar sandeep255 commented on June 21, 2024

We can make use of these.

https://nsearchives.nseindia.com/content/fo/NSE_FO_contract_06052024.csv.gz

from screeni-py.

pranjal-joshi avatar pranjal-joshi commented on June 21, 2024

Thanks @sandeep255 for pointing this out.
Will try to implement with the new data source.

from screeni-py.

ankur2ankur avatar ankur2ankur commented on June 21, 2024

suggestion from @sandeep255 is welcomed, but its implementation will be expensive.
because its a archive file (need to extract it every time to read) and it has more than 146K rows in it (will take time to arrange & sort data).

from screeni-py.

ankur2ankur avatar ankur2ankur commented on June 21, 2024

Found new info, look at this:
https://www.nseindia.com/products-services/equity-derivatives-contract-information

from screeni-py.

github-actions avatar github-actions commented on June 21, 2024

This Issue is marked as Stale due to Inactivity. This Issue will be Closed soon.

from screeni-py.

ksshaha avatar ksshaha commented on June 21, 2024

Unable to get F&O Stocks.

I lookup the code & found that the url "https://archives.nseindia.com/content/fo/fo_mktlots.csv" returning 404 status code. is there any other alternative resource for the same?

I am also in search of this.....do you get any luck on this?

from screeni-py.

ankur2ankur avatar ankur2ankur commented on June 21, 2024

Unable to get F&O Stocks.
I lookup the code & found that the url "https://archives.nseindia.com/content/fo/fo_mktlots.csv" returning 404 status code. is there any other alternative resource for the same?

I am also in search of this.....do you get any luck on this?

Nope, but i have made my own csv of F&O stocks, hosted in my storage and using that file.
That is working for me temporarily.
if @pranjal-joshi wants, then I can Send Pull Request.

alternate Solution, we can use list of static list in code to get F&O scripts.

Here is code snapshot of my changes.
image

from screeni-py.

pranjal-joshi avatar pranjal-joshi commented on June 21, 2024

Hi @ankur2ankur

Static file is not an optimized approach as NSE keeps changing lot sizes and Stock codes in this list quite often!

Thankfully @sandeep255 has suggested the URL above in which we can replace datestamp dynamically to pull the data.

We can make use of these.

https://nsearchives.nseindia.com/content/fo/NSE_FO_contract_06052024.csv.gz

As of now it works well from the browser but I am not able to pull the same Gzip from python using Requests library (Most likely because NSE wants some particular headers/cookies along with the request to validate if the requests are originating from browsers)

If anyone can find a workaround for the above idea, I can accept a PR for this if it passes all the workflows.

Thanks!

from screeni-py.

ankur2ankur avatar ankur2ankur commented on June 21, 2024

I am not master in python, but this code should work (I have added cookie):

import requests

url = "https://nsearchives.nseindia.com/content/fo/NSE_FO_contract_06052024.csv.gz"

payload = {}
headers = {
  'Cookie': '_abck=762933D34495D0CAA23489F894B021EC~-1~YAAQrCdzaNUz1b+PAQAANzNEzQus/TIIx6aW/La96DbWdpDIcDK745ktGbQECFoAmOu4LL7X6Hh0dc8xIta9FLAYT3VJXbNelOWCHyoOOFexpuq90WY5OPgk4d48y9niPVGMOZeslZGJwovYtITfMsSBJjkMCfaZBdRN1ESBPRZNslEmsb/uKL0O8dMpnnDaEcosUsgAXro1wRxJPy5OfLQwswgUBjNacafHvRlay3L3oQ2oz+cKIdt4SUOiF6RrjYwrQ0+7apQnV8ZENfckwyDXpEhc7PVQeUAgP/KtuKMZziKrdp+YSX+9ng9KdrsNwDI1hbjrqQAvmVeNuT7rDx9Yvuj3i8DjyWYXiEsKhogAebpWdf4OfJn5Tw==~-1~-1~-1; bm_sz=56574DCF2D9307C210A11CC0C1FEF50C~YAAQrCdzaNYz1b+PAQAANzNEzRfhDQCxz2ewCGQkfF+jPX3Q7cnrtKnqgKnxR4/lOiQ+kbia67AKh3ppygk4F2vw8fiUHQMJdP9FxM2MApt20Pt8hDEzO0ywstLBdm+gNh1LObIvSI7cUl11E2XpXgR+Y0XoMtaZpKW2Zt1/ghWLqHSn9pvyDzjqWrEkg6Mg9n00AqGbdkkA8DTkcfjCel9CREptqxLAroZFCaWTkEY2dBd6kYjD2E1eisiINOgk0fdxVOyfye8BK/zcVnSPDPNe/f93X7DWilLJ8IrCqg0ilgehfwoIiatlRCH3gmSHBUQT+e5MZvqtrvgCKkZq1nWRpN6cpgcUgKPmK9dpug==~4403769~3753027'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

from screeni-py.

pranjal-joshi avatar pranjal-joshi commented on June 21, 2024

@ankur2ankur

Have you obtained this cookie through the browser?
What is the expiration for this cookie?
Is there any way to get this cookie from NSE through Python requests using the user-agent method?

from screeni-py.

ankur2ankur avatar ankur2ankur commented on June 21, 2024

Got the cookie from postman.
In Postman there are 2 methods to obtain file: httpclient & request.
Above mentioned is though request.

from screeni-py.

github-actions avatar github-actions commented on June 21, 2024

This Issue is marked as Stale due to Inactivity. This Issue will be Closed soon.

from screeni-py.

Related Issues (20)

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.