Skip to content

Instantly share code, notes, and snippets.

View treycordova's full-sized avatar

Trey Cordova treycordova

View GitHub Profile
@treycordova
treycordova / ArbitrageFinder.js
Created April 2, 2013 19:40
ArbitrageFinder produces potential arbitrage information from a 2-dimensional hash table. The algorithm employed is Bellman-Ford's Algorithm, which has an overall runtime of O(n^3).
(function() {
var currencies = {
// US Dollar
"USD": {"USD": 0, "GBP": 0.616056, "EUR": 0.733837, "CAD": 0.983195, "JPY": 83.3786, "CNY": 6.56997, "INR": 45.2, "BRL": 1.66691, "RUB": 29.1986},
// British Pound
"GBP": {"USD": 1.62323, "GBP": 0, "EUR": 1.19119, "CAD": 1.59595, "JPY": 135.343, "CNY": 10.6646, "INR": 73.73, "BRL": 2.70578, "RUB": 47.396},
// Euro
"EUR": {"USD": 1.3627, "GBP": 0.8395, "EUR": 0, "CAD": 1.3398, "JPY": 113.62, "CNY": 8.9529, "INR": 61.5941, "BRL": 2.2715, "RUB": 39.7889},
// Canadian Dollar