from Pyzdata import pyzdata
zdata = pyzdata(userid="USERID", password="PASSWORD", totp=123456)
# Get instrument token for given trading symbol
instrument_token = zdata.get_instrument_token(tradingsymbol="SBIN", exchange="NSE")
df = zdata.get_month_data(instrument_token, year=2023, month=2, interval=zdata.interval.minute1, oi=False)
display(df)
tradingsymbol | datetime | open | high | low | close | volume | |
---|---|---|---|---|---|---|---|
0 | SBIN | 2023-02-01 09:15:00 | 561.40 | 561.80 | 557.80 | 558.70 | 362695 |
1 | SBIN | 2023-02-01 09:16:00 | 558.30 | 559.50 | 558.10 | 559.05 | 215450 |
2 | SBIN | 2023-02-01 09:17:00 | 558.65 | 559.15 | 558.20 | 559.15 | 171662 |
3 | SBIN | 2023-02-01 09:18:00 | 559.10 | 560.20 | 559.00 | 560.05 | 153677 |
4 | SBIN | 2023-02-01 09:19:00 | 560.00 | 560.10 | 559.70 | 560.00 | 131938 |
... | ... | ... | ... | ... | ... | ... | ... |
7120 | SBIN | 2023-02-27 15:25:00 | 527.50 | 527.50 | 527.40 | 527.50 | 38693 |
7121 | SBIN | 2023-02-27 15:26:00 | 527.50 | 528.00 | 527.00 | 527.35 | 128062 |
7122 | SBIN | 2023-02-27 15:27:00 | 527.20 | 527.35 | 526.90 | 527.10 | 77312 |
7123 | SBIN | 2023-02-27 15:28:00 | 527.10 | 527.45 | 527.05 | 527.20 | 47078 |
7124 | SBIN | 2023-02-27 15:29:00 | 527.50 | 527.55 | 527.30 | 527.50 | 83278 |
7125 rows × 7 columns
df = zdata.get_year_data(instrument_token, year=2021, interval=zdata.interval.minute30)
display(df)
tradingsymbol | datetime | open | high | low | close | volume | |
---|---|---|---|---|---|---|---|
0 | SBIN | 2021-01-01 09:15:00 | 274.90 | 278.05 | 274.50 | 277.75 | 4306013 |
1 | SBIN | 2021-01-01 09:45:00 | 277.75 | 278.50 | 277.20 | 277.45 | 2394262 |
2 | SBIN | 2021-01-01 10:15:00 | 277.40 | 277.70 | 276.75 | 277.25 | 1312581 |
3 | SBIN | 2021-01-01 10:45:00 | 277.20 | 277.90 | 277.20 | 277.75 | 854730 |
4 | SBIN | 2021-01-01 11:15:00 | 277.75 | 278.20 | 277.50 | 277.70 | 1133743 |
... | ... | ... | ... | ... | ... | ... | ... |
3099 | SBIN | 2021-12-30 13:15:00 | 453.65 | 453.75 | 452.10 | 453.25 | 455789 |
3100 | SBIN | 2021-12-30 13:45:00 | 453.25 | 453.75 | 451.55 | 451.65 | 520563 |
3101 | SBIN | 2021-12-30 14:15:00 | 451.65 | 452.00 | 448.55 | 449.05 | 1760595 |
3102 | SBIN | 2021-12-30 14:45:00 | 449.05 | 452.80 | 448.50 | 452.50 | 11066556 |
3103 | SBIN | 2021-12-30 15:15:00 | 452.45 | 453.85 | 451.10 | 453.05 | 8562346 |
3104 rows × 7 columns
# csv file download at working directory
df = zdata.download_data_from_year(instrument_token, from_year=2020, interval=zdata.interval.day, print_statement=True)
display(df)
Downloading...
tradingsymbol | datetime | open | high | low | close | volume | open_interest | |
---|---|---|---|---|---|---|---|---|
0 | SBIN | 2020-01-01 | 334.70 | 335.95 | 332.15 | 334.45 | 17379320 | 0 |
1 | SBIN | 2020-01-02 | 334.50 | 339.85 | 333.35 | 339.30 | 20324236 | 0 |
2 | SBIN | 2020-01-03 | 337.95 | 337.95 | 332.00 | 333.70 | 21853208 | 0 |
3 | SBIN | 2020-01-06 | 331.70 | 331.70 | 317.70 | 319.00 | 35645325 | 0 |
4 | SBIN | 2020-01-07 | 324.45 | 327.00 | 315.40 | 318.40 | 50966826 | 0 |
... | ... | ... | ... | ... | ... | ... | ... | ... |
995 | SBIN | 2024-01-02 | 641.35 | 648.00 | 633.85 | 639.45 | 15164482 | 0 |
996 | SBIN | 2024-01-03 | 639.35 | 648.00 | 635.80 | 643.45 | 14571772 | 0 |
997 | SBIN | 2024-01-04 | 642.50 | 646.40 | 638.65 | 642.75 | 13883388 | 0 |
998 | SBIN | 2024-01-05 | 645.00 | 651.75 | 637.75 | 641.95 | 15984585 | 0 |
999 | SBIN | 2024-01-08 | 640.00 | 645.00 | 625.05 | 627.00 | 14689705 | 0 |
1000 rows × 8 columns