Open pabloadmin opened 3 days ago
hey thanks @pabloadmin ! so what exactly was the issue? and how were you running it to get the problem? it works fine in render and on my local computer
Hi, i used the requirements.txt that appear in root github repository to install all libraries, but the code didn't work. Maybe was a differents versions of libraries, different functions parameters, at this line made a change in the nema of parameter:
symbol_momentum = bars_set.get_momentum(num_periods=self.period)
symbol_momentum = bars_set.get_momentum(end=self.period)
So that i shared the requirements.txt that i used.
thanks to response!
This is the correct (new) way to call get_momentum:
symbol_momentum = bars_set.get_momentum(num_periods=self.period)
If that doesn't work but using end
does, then you are using an older version of Lumibot. The signature of get_momentum changed in 3.8.2.
Can you confirm what version you tried?
Hi,
I tried this example and it didn't work initially, but I fixed it. I'm sharing it with you. Lumibot is a great tool.
Thanks!
from datetime import datetime
from lumibot.strategies.strategy import Strategy
""" Strategy Description
Buys the best performing asset from self.symbols over self.period number of days. For example, if SPY increased 2% yesterday, but VEU and AGG only increased 1% yesterday, then we will buy SPY. """
class Momentum(Strategy):
=====Overloading lifecycle methods=============
if name == "main": is_live = False
#############################################################
requirements.txt
aiodns==3.2.0 aiohappyeyeballs==2.4.3 aiohttp==3.11.6 aiosignal==1.3.1 alpaca-py==0.33.0 alpha_vantage==3.0.0 annotated-types==0.7.0 appdirs==1.4.4 APScheduler==3.10.4 asttokens==2.4.1 async-timeout==5.0.1 attrs==24.2.0 bcrypt==4.2.1 beautifulsoup4==4.12.3 bidict==0.23.1 blinker==1.9.0 ccxt==4.2.85 certifi==2024.8.30 cffi==1.15.0 charset-normalizer==3.4.0 click==8.1.7 colorama==0.4.6 contourpy==1.3.0 cryptography==43.0.3 cycler==0.12.1 decorator==5.1.1 dnspython==2.7.0 duckdb==1.1.3 email_validator==2.2.0 exceptiongroup==1.2.2 exchange_calendars==4.5.6 executing==2.1.0 Flask==3.1.0 Flask-Login==0.6.3 flask-marshmallow==1.2.1 Flask-Principal==0.4.0 Flask-Security==5.5.2 Flask-SocketIO==5.4.1 Flask-SQLAlchemy==3.1.1 Flask-WTF==1.2.2 fonttools==4.55.0 frozendict==2.4.6 frozenlist==1.5.0 greenlet==3.1.1 h11==0.14.0 holidays==0.53 html5lib==1.1 ibapi==9.81.1.post1 idna==3.10 ijson==3.3.0 importlib_metadata==8.5.0 importlib_resources==6.4.5 inflection==0.5.1 iniconfig==2.0.0 ipython==8.29.0 itsdangerous==2.2.0 jedi==0.19.2 Jinja2==3.1.4 jsonpickle==4.0.0 kiwisolver==1.4.6 korean-lunar-calendar==0.3.1 lumibot==3.3.1 lumiwealth-tradier==0.1.12 lxml==5.3.0 MarkupSafe==3.0.2 marshmallow==3.23.1 marshmallow-sqlalchemy==1.1.0 matplotlib==3.9.2 matplotlib-inline==0.1.7 more-itertools==10.5.0 msgpack==1.1.0 multidict==6.1.0 multitasking==0.0.11 numpy==1.26.4 packaging==24.2 pandas==2.2.2 pandas-datareader==0.10.0 pandas_market_calendars==4.4.2 parso==0.8.4 passlib==1.7.4 peewee==3.17.8 pillow==10.4.0 platformdirs==4.3.6 plotly==5.24.1 pluggy==1.5.0 polygon-api-client==1.14.2 prompt_toolkit==3.0.48 propcache==0.2.0 psutil==6.1.0 psycopg2-binary==2.9.10 pure_eval==0.2.3 pyarrow==18.0.0 pycares==4.4.0 pycparser==2.22 pydantic==2.0.3 pydantic_core==2.3.0 Pygments==2.18.0 pyluach==2.2.0 pyOpenSSL==22.0.0 pyopenssl-sdk==0.0.0.post0 pyparsing==3.2.0 pytest==8.3.3 python-dateutil==2.9.0.post0 python-dotenv==1.0.1 python-engineio==4.10.1 python-socketio==5.11.4 pytz==2024.2 Quandl==3.7.0 quantstats-lumi==0.3.3 requests==2.32.3 scipy==1.10.1 seaborn==0.13.2 simple-websocket==1.1.0 six==1.16.0 soupsieve==2.6 SQLAlchemy==2.0.36 sseclient-py==1.8.0 stack-data==0.6.3 tabulate==0.9.0 tenacity==9.0.0 termcolor==2.5.0 thetadata==0.9.11 tomli==2.1.0 toolz==1.0.0 tqdm==4.67.0 traitlets==5.14.3 typing_extensions==4.12.2 tzdata==2024.2 tzlocal==5.2 urllib3==2.2.3 uuid==1.30 wcwidth==0.2.13 webencodings==0.5.1 websocket-client==1.8.0 websockets==12.0 Werkzeug==3.1.3 wget==3.2 wsproto==1.2.0 WTForms==3.2.1 yarl==1.17.2 yfinance==0.2.50 zipp==3.21.0