Skip to content

Commit

Permalink
Added a plugin to display the Shiller PE ratio (matryer#1436)
Browse files Browse the repository at this point in the history
* [plugin] new plugin that shows Shiller PE ratio

* author github and dependencies

* quoted output SC2046

* Made executable

Co-authored-by: Jørgen Teunis <[email protected]>
  • Loading branch information
jtorvald and jtorvald authored May 16, 2020
1 parent bf5ee7f commit cc223e0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Finance/shiller-pe.4h.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# <bitbar.title>Shiller PE ratio</bitbar.title>
# <bitbar.author>Jørgen</bitbar.author>
# <bitbar.author.github>jtorvald</bitbar.author.github>
# <bitbar.desc>Gets the current Shiller PE ratio. Information is provided ‘as is’ and solely for informational purposes, not for trading purposes or advice, and may be delayed.</bitbar.desc>
# <bitbar.dependencies>bash, curl</bitbar.dependencies>

SHILLER_PE=$(curl -s https://www.multpl.com/shiller-pe | grep "Current Shiller PE Ratio is" | awk '{print $16}' | cut -d, -f1)

if [ "$(echo "17 > $SHILLER_PE" | bc -l)" -eq 1 ]; then
ICON="💸 "
COLOR=green
elif [ "$(echo "21 > $SHILLER_PE" | bc -l)" -eq 1 ]; then
ICON="💵 "
COLOR=orange
else
ICON=""
COLOR=black
fi

echo "${ICON}$SHILLER_PE | color=${COLOR}"
echo "---"
echo "Current Shiller PE ${SHILLER_PE} | color=${COLOR}"
echo "See chart | href=https://www.multpl.com/shiller-pe"

0 comments on commit cc223e0

Please sign in to comment.