0:00
as an algo Trader you're often required
0:02
to download live data from the NSE
0:03
website things like bow copies live
0:05
option chain data latest price info
0:07
historic data of EES top gainers losers
0:09
fi activity and much more although there
0:12
are a few packages already available in
0:13
GitHub uh when I last check them some of
0:15
them have stopped working or some of
0:17
them don't have all the functionality
0:18
that we usually want so I created a
0:20
simple python utility that does all of
0:22
that and I'm hoping that it could be of
0:23
some use to you as well in this video
0:25
I'll walk you through this python
0:26
utility and show you how to use it you
0:28
can download this code for free from our
0:29
community website so let's get
0:32
started if this is your first time here
0:34
welcome my name is VI and I'm a
0:36
financial independent alut trator this
0:37
channel is all about building our
0:38
community of Alo Traders we discuss
0:40
everything about Alo trading using
0:41
python building and practing trading
0:42
strategies Market updates and much more
0:44
please do visit our community website
0:47
trader.net Channel Fab we where I talk
0:49
about my own Financial Independence
0:50
journey and share tools methods and
0:52
strategies that help me achieve my
0:53
Financial Freedom thank
0:55
you the python code that I'm about to
0:58
walk you through uh is available on the
1:00
our community website called
1:01
theater.in so this is the website uh and
1:07
stories you would find the NS utility
1:11
python blog available and then if you
1:13
browse through the entire code base is
1:14
available here and you can just copy it
1:16
and use it as you please now let's take
1:18
a look at the code the code has two
1:20
parts the first part is the actual
1:22
utility the python utility uh called NS
1:24
utility. bu uh this basically has the
1:27
class NS utils defined and underneath it
1:29
you will you will find various methods
1:31
uh which is uh you know which do
1:33
specific downloads from NC websites for
1:34
example pre-market info is all about
1:37
extracting the pre-market uh data from
1:39
the NSE website um and then the the
1:41
second file which is the NSE download is
1:43
nothing but just a sample program that I
1:45
wrote showing how you could actually use
1:46
the NS utils and download various data
1:49
right um so in order to use this utility
1:52
you would have to first install pandas
1:53
the dependency um the usual way of doing
1:56
it is a pip install pandas which I'm
1:58
sure you're already aware of and then
2:00
once that is done uh you can copy the
2:02
the code of the utility from the website
2:04
which I just showed you I'll provide the
2:05
link as well in the description so copy
2:08
that code into a file called NS utility.
2:10
Pi place this file within your Source
2:11
route where you plan to use it and then
2:14
typically this this is how you would you
2:15
know initiate the instance which is
2:17
basically you import the NS utility
2:19
which is this one and then you create an
2:20
instance of the class that we built
2:22
which is the NS utility the file
2:24
underneath that the NS utils class and
2:25
then NSE is the instance that you've
2:27
created once that is done you just uh
2:30
you know invoke the methods that you use
2:31
and then do various functions that you
2:33
need here's a list of all the functions
2:35
that currently this utility supports
2:37
let's look at a few examples on how
2:38
which methods you could use I I don't
2:40
plan to walk you through entire list of
2:41
functions here but we'll we'll take a
2:44
few quick ones and then take you through
2:45
it the first one is called the the get
2:46
Equity full list and then when you run
2:48
it you typically get the the list of all
2:51
equity instruments within nsse and then
2:53
if you don't really want the full
2:54
details but only want the list of the uh
2:57
you know the instruments you can just
2:58
say list only as true and then when you
3:00
run it you typically get a list a python
3:03
list containing just the symbols alone
3:04
so that's one way of doing it and
3:06
similarly you can do the same for fono
3:08
symbols uh if you want the pre-market
3:10
info again if you run it and then give
3:12
specific you know which which instrument
3:14
or the indices that you want it'll
3:15
download the entire table from NSE uh
3:17
which contains a premarket data um often
3:20
in our strategies we need the the list
3:23
of instruments contained within an index
3:25
right for example let's say you want all
3:26
the symbols within the nifty50 and this
3:28
is one way of getting it so get index
3:30
details and then when you run it it
3:32
provides me again a python list
3:34
containing all the 50 um you know
3:36
instruments within that you can change
3:37
it to let's say Nifty 100 and then it
3:40
it'll again provide the data accordingly
3:43
uh so the list of symbols and the
3:44
indices are provided here so you can do
3:46
a quick reference if you want uh anytime
3:49
one um NSE holidays typically two two
3:52
types of holidays the clearing holidays
3:53
and the and the trading holiday so if
3:55
you want the clearing holidays you can
3:57
just simply run this and then it'll give
3:59
you a list of all the dates for this
4:00
particular year where there are clearing
4:02
holidays and similarly you can do it for
4:04
the trading holidays as well and then
4:06
you can also check if current date
4:08
whatever date that you're currently
4:09
running is also a clearing holiday or
4:10
not so if you run it for without an
4:12
input parameter in it it basically takes
4:14
today's date as input and then check
4:15
senses if it's a clearing holiday in
4:17
this case it's saying it's true and then
4:18
you can also provide a specific date and
4:20
then it'll tell you whether that
4:21
particular date uh it's a holiday or not
4:24
it again gives you a returns either a
4:25
true or a false if you want all the
4:27
information about a specific script you
4:30
can provide the the Syble code and it'll
4:32
give you an entire complete dump of all
4:33
the information that you typically see
4:34
on the NSE website right it every tab
4:37
the data contained within every tab is
4:39
all collated and and given to you in a
4:42
format the price info function is one of
4:44
very useful functions that I frequently
4:46
use this gets you the high low open
4:48
close uh along with the upper circuit
4:50
the lower circuit details including the
4:52
weap so this I where you use very often
4:54
and then the next one is it provides you
4:56
the 52 week high and low not just the
4:57
high and low value but along also the
4:59
day on which the high and low we hit
5:01
which is again pretty useful information
5:04
um and they get Market depth you get the
5:06
standard five levels of Market depth and
5:08
you run this um and then along with that
5:11
if you want the the entire option chain
5:13
downloaded for a simpol you can use this
5:15
function again it's pretty useful or if
5:17
you want just the the Futures symbols
5:19
alone for a given symbol U you know you
5:21
can run this and then get that data the
5:23
next set of functions are very very
5:25
useful and most frequently used by many
5:26
trailers which is the B copy download in
5:29
this you can actually download all of
5:30
those just the delivery B copy the
5:32
equity indices or ifo so here in this
5:34
case uh let me just run it since it's a
5:37
large file I'm only printing just the
5:39
the top five rows of it um so this is
5:42
how you provide a date and then it
5:43
downloads the entire B copy for that
5:45
date and in addition to that you get
5:47
some of these auxiliary items like the F
5:49
activity uh which is pretty useful and
5:51
then the top gainers and losers in each
5:53
of these category for example for Nifty
5:55
Bank Nifty the xfy so you can get
5:57
separate list uh containing the top
6:00
and one more useful item is is getting
6:02
the historic data for any indices so I
6:03
think right now it provides only the day
6:05
the daily candles uh but you can give a
6:07
start and an end date and then provide
6:09
the the indexes that you index that you
6:11
want the historic data for and then it
6:12
downloads the entire data onto a data
6:15
frame and with that we've come to the
6:17
end of the video I hope you like this
6:19
little utility and you make full use of
6:20
it and if there's any addition
6:22
functionalities that you would like me
6:23
to add please leave a comment I'll
6:24
definitely include that to the code and
6:26
publish it again if you found some value
6:28
on this video please consider
6:29
subscribing and liking the video and I
6:30
will see you soon in another video Until