1

我正在尝试获取 nse 股票数据,但我无法这样做,因为每当我尝试这样做时,即使在尝试升级 nsepy 之后,我也会使用此代码获得空数据框

from nsepy import get_history
from datetime import date
SBIN=get_history(symbol="SBIN", start=date(2020,7,1),end=date(2020,7,10),index=True)
4

1 回答 1

0

消除index=True

In [12]: from nsepy import get_history
    ...: from datetime import date
    ...: SBIN=get_history(symbol="SBIN", start=date(2020,7,1),end=date(2020,7,10))

In [13]: SBIN
Out[13]:
           Symbol Series  Prev Close    Open    High     Low    Last   Close    VWAP     Volume      Turnover  Trades  Deliverable Volume  %Deliverble
Date
2020-07-01   SBIN     EQ      178.45  179.45  185.40  178.60  184.60  184.80  182.86   54015536  9.877262e+14  248849            10498374       0.1944
2020-07-02   SBIN     EQ      184.80  185.65  188.00  184.00  185.60  185.45  186.13   52127613  9.702375e+14  251208             7943823       0.1524
2020-07-03   SBIN     EQ      185.45  186.65  186.85  183.40  184.65  184.70  184.82   38050996  7.032539e+14  169515             6310460       0.1658
2020-07-06   SBIN     EQ      184.70  186.60  189.85  186.15  187.90  188.05  188.35   43789749  8.247963e+14  215925             9492655       0.2168
2020-07-07   SBIN     EQ      188.05  187.00  189.20  184.05  188.00  188.60  186.66   55124984  1.028941e+15  245296             7395581       0.1342
2020-07-08   SBIN     EQ      188.60  188.90  197.45  188.40  191.70  191.90  194.17  143083196  2.778285e+15  620914            33127615       0.2315
2020-07-09   SBIN     EQ      191.90  192.80  201.00  192.55  199.85  199.10  196.73   89540860  1.761546e+15  394257            18566358       0.2074
2020-07-10   SBIN     EQ      199.10  198.00  202.50  194.80  195.50  195.60  198.49  111410003  2.211416e+15  501575            16941444       0.1521

更新:

In [11]: NIFTY=get_history(symbol="NIFTY", start=date(2020,7,1),end=date(2020,7,19), index=True)

In [12]: NIFTY
Out[12]:
                Open      High       Low     Close     Volume      Turnover
Date
2020-07-01  10323.80  10447.05  10299.60  10430.05  573550127  2.873628e+11
2020-07-02  10493.05  10598.20  10485.55  10551.70  597423931  3.123517e+11
2020-07-03  10614.95  10631.30  10562.65  10607.35  525190704  2.518639e+11
2020-07-06  10723.85  10811.40  10695.10  10763.65  571212914  2.985754e+11
2020-07-07  10802.85  10813.80  10689.70  10799.65  636764929  3.650237e+11
2020-07-08  10818.65  10847.85  10676.55  10705.75  767941333  3.767634e+11
2020-07-09  10755.55  10836.85  10733.00  10813.45  618652409  3.131587e+11
2020-07-10  10764.10  10819.40  10713.00  10768.05  590705425  3.155758e+11
2020-07-13  10851.85  10894.05  10756.05  10802.70  554050579  3.060630e+11
2020-07-14  10750.85  10755.65  10562.90  10607.35  532368699  3.090247e+11
2020-07-15  10701.00  10827.45  10577.75  10618.20  715901258  4.237603e+11
2020-07-16  10706.20  10755.30  10595.20  10739.95  694402635  4.145395e+11
2020-07-17  10752.00  10933.45  10749.65  10901.70  676881092  3.559283e+11
于 2020-07-20T08:18:37.653 回答