Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example code does not work on Heroku #15

Open
GoodDragon opened this issue Mar 6, 2019 · 1 comment
Open

Example code does not work on Heroku #15

GoodDragon opened this issue Mar 6, 2019 · 1 comment

Comments

@GoodDragon
Copy link

It looks to be example code crashes on Heroku:

2019-03-06T20:30:30.039522+00:00 heroku[worker.1]: Starting process with command `python main.py`
2019-03-06T20:30:30.599893+00:00 heroku[worker.1]: State changed from starting to up
2019-03-06T20:30:34.456532+00:00 app[worker.1]: INFO:root:start running
2019-03-06T20:30:34.461121+00:00 app[worker.1]: DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): paper-api.alpaca.markets:443
2019-03-06T20:30:34.566766+00:00 app[worker.1]: DEBUG:urllib3.connectionpool:https://paper-api.alpaca.markets:443 "GET /v1/clock HTTP/1.1" 200 147
2019-03-06T20:30:34.621879+00:00 app[worker.1]: DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): data.alpaca.markets:443
2019-03-06T20:30:34.769843+00:00 app[worker.1]: DEBUG:urllib3.connectionpool:https://data.alpaca.markets:443 "GET /v1/bars/day?symbols=MMM%2CABT%2CABBV%2CACN%2CATVI%2CAYI%2CADBE%2CAMD%2CAAP%2CAES%2CAET%2CAMG%2CAFL%2CA%2CAPD%2CAKAM%2CALK%2CALB%2CARE%2CALXN%2CALGN%2CALLE%2CAGN%2CADS%2CLNT%2CALL%2CGOOGL%2CGOOG%2CMO%2CAMZN%2CAEE%2CAAL%2CAEP%2CAXP%2CAIG%2CAMT%2CAWK%2CAMP%2CABC%2CAME%2CAMGN%2CAPH%2CAPC%2CADI%2CANDV%2CANSS%2CANTM%2CAON%2CAOS%2CAPA%2CAIV%2CAAPL%2CAMAT%2CAPTV%2CADM%2CARNC%2CAJG%2CAIZ%2CT%2CADSK%2CADP%2CAZO%2CAV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2CPVH%2CQRVO%2CPWR%2CQCOM%2CDGX%2CRRC%2CRJF%2CRTN%2CO%2CRHT%2CREG%2CREGN%2CRF%2CRSG&limit=50&start=2019-01-14&end=2019-03-05 HTTP/1.1" 200 None
2019-03-06T20:30:35.124125+00:00 app[worker.1]: DEBUG:urllib3.connectionpool:https://data.alpaca.markets:443 "GET /v1/bars/day?symbols=RMD%2CRHI%2CROK%2CCOL%2CROP%2CROST%2CRCL%2CCRM%2CSBAC%2CSCG%2CSLB%2CSTX%2CSEE%2CSRE%2CSHW%2CSPG%2CSWKS%2CSLG%2CSNA%2CSO%2CLUV%2CSPGI%2CSWK%2CSBUX%2CSTT%2CSRCL%2CSYK%2CSTI%2CSIVB%2CSYMC%2CSYF%2CSNPS%2CSYY%2CTROW%2CTTWO%2CTPR%2CTGT%2CTEL%2CFTI%2CTXN%2CTXT%2CTMO%2CTIF%2CTWX%2CTJX%2CTMK%2CTSS%2CTSCO%2CTDG%2CTRV%2CTRIP%2CFOXA%2CFOX%2CTSN%2CUDR%2CULTA%2CUSB%2CUAA%2CUA%2CUNP%2CUAL%2CUNH%2CUPS%2CURI%2CUTX%2CUHS%2CUNM%2CVFC%2CVLO%2CVAR%2CVTR%2CVRSN%2CVRSK%2CVZ%2CVRTX%2CVIAB%2CV%2CVNO%2CVMC%2CWMT%2CWBA%2CDIS%2CWM%2CWAT%2CWEC%2CWFC%2CWELL%2CWDC%2CWU%2CWRK%2CWY%2CWHR%2CWMB%2CWLTW%2CWYN%2CWYNN%2CXEL%2CXRX%2CXLNX%2CXL%2CXYL%2CYUM%2CZBH%2CZION%2CZTS&limit=50&start=2019-01-14&end=2019-03-05 HTTP/1.1" 200 None
2019-03-06T20:30:35.401433+00:00 app[worker.1]: Traceback (most recent call last):
2019-03-06T20:30:35.401457+00:00 app[worker.1]: File "main.py", line 5, in <module>
2019-03-06T20:30:35.401637+00:00 app[worker.1]: algo.main()
2019-03-06T20:30:35.401657+00:00 app[worker.1]: File "/app/samplealgo/algo.py", line 208, in main
2019-03-06T20:30:35.401931+00:00 app[worker.1]: price_df = prices(Universe)
2019-03-06T20:30:35.401951+00:00 app[worker.1]: File "/app/samplealgo/algo.py", line 60, in prices
2019-03-06T20:30:35.402120+00:00 app[worker.1]: return _get_prices(symbols, end_dt)
2019-03-06T20:30:35.402139+00:00 app[worker.1]: File "/app/samplealgo/algo.py", line 50, in _get_prices
2019-03-06T20:30:35.402296+00:00 app[worker.1]: return barset.df
2019-03-06T20:30:35.402316+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/alpaca_trade_api/entity.py", line 102, in df
2019-03-06T20:30:35.402521+00:00 app[worker.1]: df = bars.df.copy()
2019-03-06T20:30:35.402852+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/alpaca_trade_api/entity.py", line 84, in df
2019-03-06T20:30:35.403058+00:00 app[worker.1]: df.index * 1e9, utc=True,
2019-03-06T20:30:35.403079+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pandas/core/ops.py", line 176, in invalid_op
2019-03-06T20:30:35.403304+00:00 app[worker.1]: "{typ}".format(name=name, typ=type(self).__name__))
2019-03-06T20:30:35.403333+00:00 app[worker.1]: TypeError: cannot perform __mul__ with this index type: Index
2019-03-06T20:30:35.559872+00:00 heroku[worker.1]: State changed from up to crashed
2019-03-06T20:30:35.575397+00:00 heroku[worker.1]: State changed from crashed to starting
2019-03-06T20:30:35.545925+00:00 heroku[worker.1]: Process exited with status 1

Also notice that screenshots are missing from:
https://docs.alpaca.markets/example-algos/sp500-buy-dip/#heroku-free

@jeichenseerNRX
Copy link

This is surely the same issue as #12
Try the fix recommended by @cujo0072

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants