-
Notifications
You must be signed in to change notification settings - Fork 40
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
Placing orders (buy/sell) for funds #31
Comments
Haven't yet reached the point to testing place_order in production yet but when skimming through the code I dont see any restrictions for the type of order. Just specify which instrument by order_book_id: Line 1476 in 3f3a4c5
|
I tried using the |
Ah yeah your’e right, its a whole different endpoint |
For the one implementing this in the future:
|
I added fund buying functionality in a new function This is not elegant yet and should probably be tested more. But it worked to send a buy order for a fund that showed up on the Avanza website. Only the first request from @warna720 's comment (#31 (comment)) seems to be strictly needed. And I left out the Maybe it helps with a proper implementation... |
Here are some details for the sell call to the API (as performed by the website): Two requests:
|
Huh, so both volume and amount works in the first request works? |
The requests in my comment are for a sell transaction, while your request examples in #31 (comment) is for a buy transaction. |
Ah got it. Will you make a PR soon btw? |
I might want to refactor the code a bit and I would like to have both buy and sell working before doing a pull request. But of course anybody is more than welcome to use what already is present in my fork to speed up an implementation... |
Now I also implemented a function to sell funds shares. Its available at https://github.com/tux2000/avanza/tree/fund_orders Deleting of fund orders is possible with the already available function |
Nice job! |
Not really happy yet with introducing two more functions but it works for now. I will send a pull request in a minute to start the discussion how this can be included in upstream... |
Hej.
I was looking for functionality to buy and sell funds using this library. To what I could see this functionality is not yet available and the function
place_order
is limited to instruments like stocks and certificates that are traded on an exchange.In the website the API endpoint I am looking for is https://www.avanza.se/_api/fund-guide/fund-order-page/buy with the request payload being for example:
{"orderbookId":"56127","accountId":"NNNNNNNN","amount":"100","orderbookName":"Simplicity Likviditet A"}
I assume the corresponding endpoint is available in the mobile API too and thus hopefully this should be possible to implement.
The text was updated successfully, but these errors were encountered: