fhqvst / avanza

A JavaScript client for the unofficial Avanza API
MIT License
229 stars 59 forks source link

Placing an alert #66

Open ridulfo opened 2 years ago

ridulfo commented 2 years ago

Hi! First of, great repository

It would be very convenient if the library had a function for placing an alert on a stock at a specific price and expiration. I could not find this in the source code. The app supports it, which means that there must be an end-point for it(?).

fhqvst commented 2 years ago

Yeah, that's a feature I've been wanting to have as well. Should definitely be possible to add - it's just a matter of setting up the proxy and seeing what API calls the app makes.

ridulfo commented 2 years ago

It would be very useful! I have always wondered how you were able to get the end-points (not an app reverse-engineer myself šŸ˜„)!

ridulfo commented 2 years ago

I tried the proxy approach. Got pretty far, but got stuck with a certificate error after certificate error. Perhaps someone else has better luck.

asifma commented 2 years ago

Hey, couldn't agree more! Very useful repo šŸ‘ This would be very useful!! Anyone that wants to collaborate around this?

Is it possible to use the web-endpoints somehow? E.g.: https://www.avanza.se/_cqbe/marketing/service/alert/ with payload: {"price":"87","validUntil":"2022-08-30","notification":true}

fhqvst commented 2 years ago

IIRC, there are also a couple other routes under /_cqbe that might be useful, such as fetching "inspiration lists" and more.

asifma commented 2 years ago

@fhqvst : Vill du kika pƄ det ihop med mig? Om du har tid och lust :)

asifma commented 2 years ago

@fhqvst : Okey, I solved it. Will create a PR!

image

asifma commented 2 years ago

PR Created, please review when you have time :) -> #68