Closed RagnarHagberg closed 2 years ago
Same problem. But a different error message.
code to run:
result = avanza.place_order(account_id=avz_account_id, order_book_id=stock_id, order_type=OrderType.BUY, price=price, valid_until=datetime.date.today(), volume=volume)
error: HTTPError: 405 Client Error: Method Not Allowed for url: https://www.avanza.se/_api/order
I got the same error but I wrote what was in the link. Avanza might have changed their API which would lead to this not working.
It is possible to read prices etc but order placement does not work apparently today.
Hej guys. The fix for the issue is to replace an endpoint for order creation in the constants.py. Row 96: "ORDER_PLACE_PATH = '/_cqbe/trading/order/new'"
Could the author make a fix?
This places only sell... even if you choose buy
Fixed in my branch, see pull request...
Addition to my last comment to fix the order type - update avanza.py, Row 1528: " 'side': order_type.value," -
I have published a new version, 3.0.1 which includes these changes.
Placing an order gives an error. Error: requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed for url: https://www.avanza.se/_api/order
URI: | /_api/order Status: 405 Message: Request method 'GET' not supported
with this data: account_id="XXXXXXX", order_book_id=290011 order_type=OrderType.SELL, price=79.6, valid_until=2022-02-17 volume=1.0