The calculator presented on this web site uses a REST API which is published on SwaggerHub. Just try it out and feel free to use it in your own application.
The server part of the Etherrigs application collects the Ethereum network parameters (average values of total hash rate, block reward, and block creation time) once per hour. Based on the parameters provided by the client application (rig hash rate, power consumption, and electricity price) the application calculates the Ether exhange rate threshold and some other other data such as the average time needed to mine the next block. All details are published on SwaggerHub.
The Etherrigs API may be used by operators of mining rigs who would like to decide if they should start or stop mining.
It is free. The calculation performed by the API is completely transparent and based on the most recent blockchain entries. (See page How it works for the details.) In my earlier life as a physicist I have learned that measured values are rather useless if their uncertainties are unknown. Therefore the uncertainty of the Ether exchange rate threshold is delivered as well.