~myrrc/koyfin_scraper

A bunch of scripts to get and aggregate data available at koyfin.com
fix
filtering things
5dd35dfd — Mike Kot 2 years ago
loisense

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~myrrc/koyfin_scraper
read/write
git@git.sr.ht:~myrrc/koyfin_scraper

You can also use your local clone with git send-email.

This script gets data from Koyfin. In order for it to work:

  1. Obtain a list of companies (the only required field is internal id key of form eq-... representing a specific company on a specific exchange). This can be done by looking at keys api method. Then you can download companies' json results and filter them, example:
cat *.txt | jq ".KID | to_entries[] | {key, ticker: .value.t, name: .value.t_n, country: .value.iso2, industry:
 .value.t_ind, sector: .value.t_sec}" > parsed_companies
  1. [optional] You can also parse companies' names and info to a separate csv file using jq -s -r -f filter.jq parsed_companies > data/companies.csv

  2. Create a file payloads with information to retrieve from Koyfin. It should hold lines of pairs name json_payload, one for each indicator. Note Koyfin api is private and can change at any time. An example is provided.

  3. Run koyfin.py to obtain json files with data. Some indicators may be missing for some companies, use this script to remove files with errors: ag "(no data in|not available)" data/ -c | cut -d: -f1 | xargs rm.

  4. Run merge.py to merge obtained data into csv files, one per company. You may need to tweak it if you change payloads.

Do not follow this link