Created
May 15, 2018 10:14
-
-
Save rreimann/5bfee664f92ad750ff8c22d3332b1a76 to your computer and use it in GitHub Desktop.
lookup historic etf/stock prices via onvista
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -ne 1 ] ; then | |
echo "lookup historic etf/stock prices via onvista" | |
echo "Usage: $0 {ISIN}" | |
exit -1 | |
fi | |
html=$(curl -s -L https://www.onvista.de/$1) | |
name=$(echo $html | pup 'title text{}' | sort -u) | |
onvistaId=$(echo $html | pup 'div.item[data-contributor="Xetra"] attr{data-value}' | sort -u) | |
if [ -n "$onvistaId" ]; then | |
type="fonds" | |
else | |
tmpId=$(echo $html | pup 'a[href^="?notation"]:contains("Xetra") attr{href}' | sort -u) | |
onvistaId=${tmpId#"?notation="} | |
type="aktien" | |
fi | |
echo "$name" | |
echo "http://www.onvista.de/${type}/kurshistorie.html?ID_NOTATION=${onvistaId}&RANGE=120M" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment