Getting pyLiveTrader to work without calling Polygon

Environment

Language
Python

Alpaca SDK Version
latest

Other Environment Details
yaml variable set to “use_polygon: false”

Problem

Summary
While running the pyLiveTrader, it attempts to call Polygon which requires a different key/secret. Shoudl the use_polygon: false prevent this from happening? Looking at the code it appears in …\alpaca|trade|api\polygon\rest.py that polygon.io is specifically coded. Should this call to rest.py instead be to …\alpaca_trade_api\rest.api (note the difference is the polygon directory containing a copy of rest.py

Paper or Live Tradng?
paper

Example Code
def _request(self, method, path, params=None):
url = ‘https://api.polygon.io/v1’ + path
params = params or {}
params[‘apiKey’] = self._api_key
if self._staging:
params[‘staging’] = ‘true’
resp = self._session.request(method, url, params=params)
resp.raise_for_status()
return resp.json()

Update: This problem is in the portfolio_management example

Hi, not sure I understand your issue.
but when you specify use_polygon false, you are using the alpaca data module.
there’s another rest.py which calls the alpaca api.
is that what you meant?

Yes, there is a “polygon” folder with a different rest.py that is being called. That rest.py has polygon coded in the url.

I pulled the source from github and assume it is all the latest.

Found there is a difference in the codebase. If you install according to the instructions (using Anaconda, etc) you get an “older” version as compared to what I get from gitHub (the download zip).

Should pyLIveTrader install and work with Python 3.8.5?

the recommended python is 3.6 ( this is a limitation by zipline)

Thanks - will try Python 3.6 as when I try to install there are numerous “builds” that are attempt and it is failing somewhere in the middle.

1 Like