Pylivetrader: HTTPError: unauthorized on alpaca

I am trying to run the simple example on the pylivetrader github page. When I do so, I get an unauthorized message:

raise HTTPError(http_error_msg, response=self)

requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://data.alpaca.markets/v1/aggs/ticker/AAPL/range/1/minute/1589200080000/1589212140000?unadjusted=False&apiKey=PKC6MPB8R8KMQX2D3UR9

I have already gone into the Polygon REST and changed from api.polygon. io to ‘data.alpaca.markets’. I have also tried with both v1 and v2. I have uninstalled/reinstalled both the pylivetrader and alpaca_trade_api.

If I leave it with V2, then I get the following error message:

[2020-05-11 16:02:00.700034] WARNING: Alpaca: 404 Client Error: Not Found for url: https://data.alpaca.markets/v2/aggs/ticker/AAPL/range/1/minute/1589200860000/1589212920000?unadjusted=False&apiKey=PKC6MPB8R8KMQX2D3UR9

[2020-05-11 16:02:00.702945] ERROR: Executor: ‘Index’ object has no attribute ‘swaplevel’

My env vars are:

$ export APCA_API_KEY_ID=PKC6MPB8R8KMQX2D3UR9

$ export APCA_API_SECRET_KEY=xuju3RxFwRfJy37t7QW9cQQN9IENDbjISecDuWOE

$ export APCA_API_BASE_URL=https://paper-api.alpaca.markets

In order to access Polygon API, you have to have live brokerage account opened. We are updating pylivetrader to use Alpaca data API by default (with a choice of Polygon)