cuemacro/finmarketpy

Chartpy - Empty chart

lefig opened this issue · 3 comments

lefig commented

Hi there,

Firstly, thank you for three excellent projects. Only recently have I tried plotting a chart using Chartpy. And this has been unsuccessful. I am struggling to figure out why the chart output is not being rendered. I get a PNG and matplotlib display that is blank. The logs are:

2019-08-10 17:38:28,860 - findatapy.market.datavendorweb - INFO - Request AlphaVantage data
2019-08-10 17:38:30,496 - findatapy.market.datavendorweb - INFO - Completed request from Alpha Vantage for ['VUSA.open', 'VUSA.high', 'VUSA.low', 'VUSA.close', 'VUSA.volume']
2019-08-10 17:38:32,513 - findatapy.market.ioengine - WARNING - Couldn't push MarketDataRequest_527__abstract_curve_key-None__alpha_vantage_api_key-x__category-None__category_key-backtest_default-cat_alphavantage_intraday_NYC_VUSA__cut-NYC__data_source-alphavantage__environment-backtest__expiry_date-NaT__fields-open_high_low_close_volume__finish_date-2019-08-10 16:38:27_377636__fred_api_key-x__freq-intraday__freq_mult-1__gran_freq-None__quandl_api_key-x__resample-None__resample_how-last__start_date-2019-08-03 16:38:28_406628__tickers-VUSA__trade_side-trade__vendor_fields-open_high_low_close_volume__vendor_tickers-VUSA_L to Redis: Error 10061 connecting to 127.0.0.1:6379. No connection could be made because the target machine actively refused it.
2019-08-10 17:38:32,749 - matplotlib.legend - WARNING - No handles with labels found to put in legend.

I would really appreciate any thoughts or suggestions.

Thanks

Fig

@lefig have you checked the dataframe is not empty? Eg. you can print it beforehand

lefig commented

Hi @saeedamen ,

Thank you for coming back to me. I am still investigating but am at present unable to download any data. I get a strange error...

File "c:\work\quant\python\data\findatapy\findatapy\market\datavendorweb.py", line 496, in load_ticker
data_frame = data_frame.to_frame().unstack()
File "C:\work\python\3.6.7\python-3.6.7.amd64\lib\site-packages\pandas\core\generic.py", line 5180, in getattr
return object.getattribute(self, name)
AttributeError: 'DataFrame' object has no attribute 'to_frame'

And the code responsible:
if run_example == 1 or run_example == 0:

# downloaded S&P500
md_request = MarketDataRequest(
    start_date="decade",            # start date
    data_source='yahoo',            # use Bloomberg as data source
    tickers=['Apple'], # ticker (findatapy)
    fields=['close', 'open'],       # which fields to download
    vendor_tickers=['aapl'],   # ticker (Yahoo)
    vendor_fields=['Close', 'Open'])# which Bloomberg fields to download)

df = market.fetch_market(md_request)

Yahoo changed their API, so pandas_datareader, which broke findatapy's Yahoo downloader. I've rewritten the Yahoo downloader in findatapy to use yfinance (pip install yfinance). If you remove findatapy and install the latest version (with yfinance too), it should work.