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

when i run the code i encounter many exceptions... #27

Open
TryHard1110 opened this issue Sep 20, 2024 · 0 comments
Open

when i run the code i encounter many exceptions... #27

TryHard1110 opened this issue Sep 20, 2024 · 0 comments

Comments

@TryHard1110
Copy link

So whenever i run the file i encounter many exceptions and then the code does not work. Below is what i get when i run this script.

2024-09-20 18:14:55 | lumibot.credentials | INFO | .env file loaded from: C:\Users\mrhac\Desktop\Tanmay\MLTradingBot-main.venv\Scripts.env
C:\Users\mrhac\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\tokenization_utils_base.py:1601: FutureWarning: clean_up_tokenization_spaces was not set. It will be set to True by default. This behavior will be depracted in transformers v4.45, and will be then set to False by default. For more details check this issue: huggingface/transformers#31884
warnings.warn(
2024-09-20 18:15:00 | asyncio | INFO | [unknown] Waiting for the socket stream connection to be established,
method _stream_established must be called
2024-09-20 18:15:00 | alpaca.trading.stream | INFO | started trading stream
2024-09-20 18:15:00 | alpaca.trading.stream | INFO | starting trading websocket connection
Traceback (most recent call last):
File "C:\Users\mrhac\AppData\Local\Programs\Python\Python310\lib\site-packages\alpaca\common\rest.py", line 196, in _one_request
response.raise_for_status()
File "C:\Users\mrhac\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://paper-api.alpaca.markets/v2/account

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\mrhac\Desktop\Tanmay\MLTradingBot-main\tradingbot.py", line 83, in
strategy = MLTrader(name='mlstrat', broker=broker,
File "C:\Users\mrhac\AppData\Local\Programs\Python\Python310\lib\site-packages\lumibot\strategies_strategy.py", line 333, in init
self.update_broker_balances()
File "C:\Users\mrhac\AppData\Local\Programs\Python\Python310\lib\site-packages\lumibot\strategies_strategy.py", line 505, in update_broker_balances
broker_balances = self.broker._get_balances_at_broker(self.quote_asset)
File "C:\Users\mrhac\AppData\Local\Programs\Python\Python310\lib\site-packages\lumibot\brokers\alpaca.py", line 252, in _get_balances_at_broker
response = self.api.get_account()
File "C:\Users\mrhac\AppData\Local\Programs\Python\Python310\lib\site-packages\alpaca\trading\client.py", line 446, in get_account
response = self.get("/account")
File "C:\Users\mrhac\AppData\Local\Programs\Python\Python310\lib\site-packages\alpaca\common\rest.py", line 221, in get
return self._request("GET", path, data, **kwargs)
File "C:\Users\mrhac\AppData\Local\Programs\Python\Python310\lib\site-packages\alpaca\common\rest.py", line 129, in _request
return self._one_request(method, url, opts, retry)
File "C:\Users\mrhac\AppData\Local\Programs\Python\Python310\lib\site-packages\alpaca\common\rest.py", line 205, in _one_request
raise APIError(error, http_error)
alpaca.common.exceptions.APIError: {"message": "forbidden."}

Can anyone give me a fix to this issue??

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

1 participant