Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //PRIMERO SE TRAE DE LA BD LOS PRECIOS FIJOS (SI QUERES TE MUESTRO COMO LOS CALCULA)
- one_month_price_ib = {{ one_month_price_ib }}
- three_months_price_ib = {{ three_months_price_ib }}
- six_months_price_ib = {{ six_months_price_ib }}
- ytd_price_ib = {{ ytd_price_ib }};
- one_years_price_ib = {{ one_years_price_ib }};
- three_years_price_ib = {{ three_years_price_ib }};
- five_years_price_ib = {{ five_years_price_ib }};
- eight_years_price_ib = {{ eight_years_price_ib }};
- all_price_ib = 1000;
- one_month_price_spy = {{ one_month_price_spy }}
- three_months_price_spy = {{ three_months_price_spy }}
- six_months_price_spy = {{ six_months_price_spy }}
- ytd_price_spy = {{ ytd_price_spy }};
- one_years_price_spy = {{ one_years_price_spy }};
- three_years_price_spy = {{ three_years_price_spy }};
- five_years_price_spy = {{ five_years_price_spy }};
- eight_years_price_spy = {{ eight_years_price_spy }};
- //DESPUES SE TRAE EL BILLION Y SYP POR EL API
- $.get('/realtimewithpath/?tickers=^BILLION,^GSPC&callback=?', function(data){
- //Y POR ULTIMO HACE LOS CALCULOS
- price_spy = data[1].price; //ESE DATA ES EL DATA QUE AGARRA DEL GET ARRIBA EN EL 1 VIENE EL S&P EN EL 0 VIENE EL BILON COMO HACE ABAJO
- //price_spy = parseFloat(price_spy.replace(',', ''));
- ytd_perf_spy = ( ( price_spy / ytd_price_spy ) -1 ) * 100;
- one_month_perf_spy = ( ( price_spy / one_month_price_spy ) -1 ) * 100;
- three_months_perf_spy = ( ( price_spy / three_months_price_spy ) -1 ) * 100;
- six_months_perf_spy = ( ( price_spy / six_months_price_spy ) -1 ) * 100;
- one_years_perf_spy = ( ( price_spy / one_years_price_spy ) -1 ) * 100;
- three_years_perf_spy = ( Math.pow( ( price_spy / three_years_price_spy ) , (1/3) ) -1 ) * 100;
- five_years_perf_spy = ( Math.pow( ( price_spy / five_years_price_spy ) , (1/5) ) -1 ) * 100;
- eight_years_perf_spy = ( Math.pow( ( price_spy / eight_years_price_spy ) , (1/8) ) -1 ) * 100;
- all_perf_spy = ( ( price_spy / all_price_spy ) -1 ) * 100;
- //IB
- price = data[0].price;
- //price = parseFloat(price.replace(',', ''));
- ytd_perf_ib = ( ( price / ytd_price_ib ) -1 ) * 100;
- one_month_perf_ib = ( ( price / one_month_price_ib ) -1 ) * 100;
- three_months_perf_ib = ( ( price / three_months_price_ib ) -1 ) * 100;
- six_months_perf_ib = ( ( price / six_months_price_ib ) -1 ) * 100;
- one_years_perf_ib = ( ( price / one_years_price_ib ) -1 ) * 100;
- three_years_perf_ib = ( Math.pow( ( price / three_years_price_ib ) , (1/3) ) -1 ) * 100;
- five_years_perf_ib = ( Math.pow( ( price / five_years_price_ib ) , (1/5) ) -1 ) * 100;
- eight_years_perf_ib = ( Math.pow( ( price / eight_years_price_ib ) , (1/8) ) -1 ) * 100;
- all_perf_ib = ( ( price / all_price_ib ) -1 ) * 100;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement