This is used for monitoring foreign exchange rate and alarm automatically when it achieve certain threshold, threshold can be changed.
There are two apple scripts called in python, one is to display notification, another is call the Facetime.
- MacOS VERSION >10.09
- Python 3 at least 3.4
- Beautiful Soup
- Requests
-
Put two apple scripts on your
home
directory -
To run the Monitor:
python3 forexAlarm.py
I use request libraries to parse the HTML and I extract some info using regular expression, luckily some of the real time forex can be accessed from the website API, which I simply using JSON parser to get the data. One thing need to notice is, if you access the page too frequently like 10 times/second, the website will block your IP address, which I am now trying to use multi thread and establish an IP pool to solve this problem. Currently I suggest let the program sleep several seconds every time after access.
You can change the growing rate here :
And modify your iphone number here:
Additionally, there is a method implemented to send email when alarm triggered: