Closed critopadolf closed 2 years ago
def overrideRestAPI(cls):
__class__ = cls
# api method overide #
def APIErrorInitOverride(self, error, http_error=None):
try:
super().__init__(error['message'])
except:
super().__init__(error)
self._error = error
self._http_error = http_error
cls.__init__ = APIErrorInitOverride
overrideRestAPI(tradeapi.rest.APIError)
Here is a fix if anyone else comes across this issue, just paste this below your module import and you will be good to go. I am now getting the actual error which is "alpaca_trade_api.rest.APIError: limit price increment must be > 0.025"
Is there an existing issue for this?
Current Behavior
When I place a limit order for BCHUSD I get an error from alpaca. However, I do not know what the error is, because I get the message shown below:
alpaca_trade_api/rest.py", line 53, in init super().init(error['message']) TypeError: string indices must be integers
Expected Behavior
When I have an error in my order submission, the error handler should display the error response from alpaca. It appears that the 'error' variable is a string, not a dictionary. If this is possible then the type of the 'error' var should be checked and handled accordingly
SDK Version I encountered this issue in
alpaca-trade-api version 2.2.0
Steps To Reproduce
Filled out the Steps to Reproduce section?
Anything else?
No response