|
These APIs are available for free personal use. Each can be used with an AJAX call and returns JSON. If you would like to host these APIs on your own server, or for business use, please contact me.
TSP Fund Prices
This API provides access to TSP fund share prices from their inception date to the last business day. It can be queried from a Google Chart or directly using one of the parameter sets below.
URL
http://www.ebrent.net/apis/tsp.php
Parameters
- or -
- fund - Required. Name of the TSP fund. Fund names currently available:
- G Fund
- F Fund
- C Fund
- S Fund
- I Fund
- L Income
- L 2010
- L 2020
- L 2030
- L 2040
- L 2050
- date - Date for a single price, formatted as YYYY-MM-DD. Defaults to the last business day.
- start - In lieu of date, starting date of a range
- end - Ending date of a range (requires start)
Example
Request:
http://www.ebrent.net/apis/tsp.php?fund=G+Fund&start=2010-01-01&end=2010-01-10
Result:
{"error":"Call to a member function getElementsByTagName() on null"}
NOTE: If using the Google Visualization parameter set, the result format will vary based on the request.
Savings Bond Values
This API returns the value of a $25 (face value) savings bond. This data is drawn from data supplied by TreasuryDirect.
URL
http://www.ebrent.net/apis/savingsbonds.php
Parameters
- series - Required. One of:
- I
- E
- EE (N is also accepted for EE bonds)
- S
- iy - Required. The four-digit year of issue.
- im - Required. The numeric month of issue (1 = January)
- ry - The four-digit year of redemption. Defaults to the current year.
- rm - The numeric month of redemption. Defaults to the current month.
Example
This request gets the value of a $25 face value EE Series bond issued in November of 1984. A bond with a $50 face value would be worth twice the returned value.
Request:
http://www.ebrent.net/apis/savingsbonds.php?series=EE&iy=1984&im=11
Result:
Warning: file_get_contents(http://www.treasurydirect.gov/indiv/tools/sb202412.asc): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/ebrent/www/www/apis/savingsbonds.php on line 45
ERROR: Cannot fetch http://www.treasurydirect.gov/indiv/tools/sb202412.asc{"value":0}
Extinct Currency Exchange Rates
This API provides access to exchange rates between currencies, both expired and existing. It uses the yahoo.finance.xchange data store for existing currencies. For extinct currencies without an ISO 4217 code, use this table.
URL
http://api.worldcoindatabase.com/xrate.php
Parameters
- from - Currency ISO 4217 code to convert from
- to - Currency ISO 4217 code to convert to
Example
Request:
http://api.worldcoindatabase.com/xrate.php?from=DEM&to=USD
Result:
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /home/worldcoin/www/api/xrate.php on line 65
Warning: file_get_contents(http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20%3D%20%22EURUSD%22&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys): Failed to open stream: php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /home/worldcoin/www/api/xrate.php on line 65
Warning: Attempt to read property "query" on null in /home/worldcoin/www/api/xrate.php on line 66
Warning: Attempt to read property "results" on null in /home/worldcoin/www/api/xrate.php on line 66
Warning: Attempt to read property "rate" on null in /home/worldcoin/www/api/xrate.php on line 66
Warning: Attempt to read property "Rate" on null in /home/worldcoin/www/api/xrate.php on line 66
{"error":"Invalid ISO 4217 Code"}
|
|