使用 nsepy 0.4 和 Python 2.7 运行它会返回一个空数据帧。这一直工作到上周。
from nsepy import get_history as gh
from datetime import date
stk1 = gh(symbol='SBIN',start=date(2015,1,1),end=date(2015,1,10))
print(stk1)
输出:
Empty DataFrame
Columns: [Symbol, Series, Prev Close, Open, High, Low, Last, Close, VWAP, Volume, Turnover, Trades, Deliverable Volume, %Deliverble]
Index: []
鉴于,这有效:
stk1 = gh(symbol='NIFTY',start=date(2015,1,1),end=date(2015,1,10), index=True)
print(stk1)
输出:
Date Open High Low Close Volume Turnover
2015-01-01 8272.80 8294.70 8248.75 8284.00 56560411 2.321880e+10
2015-01-02 8288.70 8410.60 8288.70 8395.45 101887024 4.715720e+10
2015-01-05 8407.95 8445.60 8363.90 8378.40 118160545 5.525520e+10
2015-01-06 8325.30 8327.85 8111.35 8127.35 172799618 8.089190e+10
2015-01-07 8118.65 8151.20 8065.45 8102.10 164075424 7.464330e+10
2015-01-08 8191.40 8243.50 8167.30 8234.60 143802802 8.147400e+10
2015-01-09 8285.45 8303.30 8190.80 8284.50 152612528 9.305950e+10
我究竟做错了什么?