You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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??
The text was updated successfully, but these errors were encountered:
try to regenrate the API key again if it doesnt work. create a new account on Alpaca and then get the api, secret and the base url. Hope this gonna work for sure.
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 toTrue
by default. This behavior will be depracted in transformers v4.45, and will be then set toFalse
by default. For more details check this issue: huggingface/transformers#31884warnings.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??
The text was updated successfully, but these errors were encountered: