Qluxzz / avanza

A Python library for the unofficial Avanza API
https://qluxzz.github.io/avanza/
MIT License
91 stars 41 forks source link

Stock list (feature request) #20

Open FilterUnfiltered opened 3 years ago

FilterUnfiltered commented 3 years ago

So I haven't actually used this yet but I went through the documentation and I see that it does not seem to have a function to get s list of available stocks.

I want to be able to detect whenever a new stock is released to the market (for a stupid experiment of mine which will most likely cost me dearly lol) but I don't see that option anywhere...

Would it be possible to add a function to get all the stocks on the market? At least this way I can just make something that checks every once in a while if there is something new.

Qluxzz commented 3 years ago

Only if similar functionality already exists on the website or app today.

This library's purpose is to only expose the existing functionality, not create anything new.

FilterUnfiltered commented 3 years ago

After a quick search I found this: https://www.avanza.se/aktier/lista.html

I am assuming this is the list of things you can buy on avanza.

robiwano commented 3 years ago

https://andreandersson.se/avanza/avanza.html#avanza.avanza.Avanza.get_instrument ??

robiwano commented 3 years ago

I use that in conjunction with get_certificate_info to get hold of specific certificates.

JonasOlson commented 3 years ago

@robiwano: Right, but that gets you information about a single instrument, with a known ID, rather than returns a list of all instruments, which is what is requested here. Doesn't it?

It's, by the way, strange that Avanza doesn't have an API call for this, if that is actually the case.

faddi commented 3 years ago

I use the following to extract all ids from https://www.avanza.se/aktier/lista.html: curl https://www.avanza.se/frontend/template.html/marketing/advanced-filter/advanced-filter-template\?1623583358324\&parameters.startIndex\=0\&parameters.maxResults\=100000\&parameters.selectedFields%5B0%5D\=LIST | grep "kop/[0-9]*" | grep -oh "[0-9]*" | sort | uniq > all.txt

Gives about 10k ids right now

JonasOlson commented 3 years ago

@faddi: Thanks! I was not aware of that URL. What else can you do with it? Is there a way to list instruments other than stocks, or find out what other parameters are available?

faddi commented 3 years ago

@JonasOlson I found it by inspecting calls going out while doing filter changes at https://www.avanza.se/aktier/lista.html. You'll have to check the calls made on the other instrument listing pages.