alpacahq / pipeline-live

Pipeline Extension for Live Trading
https://pypi.org/project/pipeline-live/
Apache License 2.0
205 stars 56 forks source link

pipeline-live is broken for IEX #9

Closed idanre1 closed 5 years ago

idanre1 commented 5 years ago

IEX discontinued legacy API It means pipeline-live must use iexfinance 0.4.1

Currently pipelielive 0.1.6 is broken

garyha commented 5 years ago

pylivetrader using pipeline_output() is down as of June 17, 2019.

There is a plan involving additional keys for a remedy.

What might be a reasonable workaround within pipeline to replace this? from pipeline_live.data.iex.pricing import USEquityPricing

I'd like to completely avoid IEX if possible.

The error looks like this here:

____  before_trading_start
    c:\python36\lib\site-packages\pylivetrader\algorithm.py pipeline_output
    c:\python36\lib\site-packages\pylivetrader\algorithm.py list_symbols
Traceback (most recent call last):
  File "c:\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python36\Scripts\pylivetrader.exe\__main__.py", line 9, in <module>
  File "c:\python36\lib\site-packages\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "c:\python36\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\python36\lib\site-packages\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python36\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\python36\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\python36\lib\site-packages\click\decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\python36\lib\site-packages\pylivetrader\__main__.py", line 161, in run
    algorithm.run(retry=ctx.retry)
  File "c:\python36\lib\site-packages\pylivetrader\algorithm.py", line 279, in run
    return self.executor.run(retry=retry)
  File "c:\python36\lib\site-packages\pylivetrader\executor\executor.py", line 124, in run
    algo.before_trading_start(self.current_data)
  File "c:\python36\lib\site-packages\pylivetrader\algorithm.py", line 251, in before_trading_start
    self._before_trading_start(self, data)
  File "algo33.py", line 771, in before_trading_start
    c.output = pipeline_output('pipe')
  File "c:\python36\lib\site-packages\pylivetrader\misc\api_context.py", line 62, in wrapped
    return getattr(algorithm, f.__name__)(*args, **kwargs)
  File "c:\python36\lib\site-packages\pylivetrader\algorithm.py", line 1143, in pipeline_output
    output = eng.run_pipeline(self._pipelines[name])
  File "c:\python36\lib\site-packages\pipeline_live\engine.py", line 77, in run_pipeline
    initial_workspace,
  File "c:\python36\lib\site-packages\pipeline_live\engine.py", line 244, in compute_chunk
    to_load, mask_dates, symbols, mask,
  File "c:\python36\lib\site-packages\pipeline_live\data\iex\fundamentals_loader.py", line 11, in load_adjusted_array
    symbol_dict = self._load()
  File "c:\python36\lib\site-packages\pipeline_live\data\iex\fundamentals_loader.py", line 33, in _load
    return iex.company()
  File "c:\python36\lib\site-packages\pipeline_live\data\sources\iex.py", line 40, in __call__
    return _get(all_symbols)
  File "c:\python36\lib\site-packages\pipeline_live\data\sources\util.py", line 68, in wrapper
    body = func(*args, **kwargs)
  File "c:\python36\lib\site-packages\pipeline_live\data\sources\iex.py", line 37, in _get
    return parallelize(fetch, splitlen=99)(all_symbols)
  File "c:\python36\lib\site-packages\pipeline_live\data\sources\util.py", line 30, in wrapper
    task_result = task.result()
  File "c:\python36\lib\concurrent\futures\_base.py", line 425, in result
    return self.__get_result()
  File "c:\python36\lib\concurrent\futures\_base.py", line 384, in __get_result
    raise self._exception
  File "c:\python36\lib\concurrent\futures\thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "c:\python36\lib\site-packages\pipeline_live\data\sources\iex.py", line 33, in fetch
    getattr(iexfinance.stocks.Stock(symbols), method_name)(),
  File "c:\python36\lib\site-packages\iexfinance\stocks\base.py", line 251, in get_company
    return self._get_endpoint("company", params=kwargs)
  File "c:\python36\lib\site-packages\iexfinance\stocks\base.py", line 99, in _get_endpoint
    data = self.fetch(fmt_j=fmt_j, fmt_p=no_pandas)
  File "c:\python36\lib\site-packages\iexfinance\base.py", line 197, in fetch
    data = self._execute_iex_query(url)
  File "c:\python36\lib\site-packages\iexfinance\base.py", line 152, in _execute_iex_query
    return self._handle_error(response)
  File "c:\python36\lib\site-packages\iexfinance\base.py", line 165, in _handle_error
    raise auth_error("The query could not be completed. "
iexfinance.utils.exceptions.IEXAuthenticationError: The query could not be completed. There was a client-side error with your request.
ttt733 commented 5 years ago

You should now be able to use IEX Cloud if you update to v0.1.7, however, it is recommended that you switch to Alpaca pricing (and Polygon fundamentals if possible) to avoid IEX's new messaging limits.