ERROR:
orderpreview = orders.preview_equity_order(**order_spec)
File "/usr/local/lib/python3.6/dist-packages/pyetrade/order.py", line 322, in preview_equity_order
return self.perform_request(self.session.post, resp_format, api_url, payload)
File "/usr/local/lib/python3.6/dist-packages/pyetrade/order.py", line 201, in perform_request
req.raise_for_status()
File "/usr/local/lib/python3.6/dist-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.etrade.com/v1/accounts/XXXXXXXXXXXXXXXXX/orders/preview
I've tried switching from accountKey to accountID and still the same response. I've tried XML and JSON. No changes.
CODE:
def OrderPreview(symbol,quantity,orderAction="BUY",priceType="MARKET",marketSession="REGULAR",orderTerm="GOOD_FOR_DAY"): client_order_id = random.randint(1000000000, 9999999999) accountID = AccountKey()
ERROR: orderpreview = orders.preview_equity_order(**order_spec) File "/usr/local/lib/python3.6/dist-packages/pyetrade/order.py", line 322, in preview_equity_order return self.perform_request(self.session.post, resp_format, api_url, payload) File "/usr/local/lib/python3.6/dist-packages/pyetrade/order.py", line 201, in perform_request req.raise_for_status() File "/usr/local/lib/python3.6/dist-packages/requests/models.py", line 943, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.etrade.com/v1/accounts/XXXXXXXXXXXXXXXXX/orders/preview