Commit 1afb622c authored by Gampe Sebastian's avatar Gampe Sebastian
Browse files

improvements

parent 6f37fccb
......@@ -17,21 +17,27 @@ function get_data(){
$('#conf').html( JSON.stringify( DATA.config).replace(/\,/g,'<br>').replace(/\"|\{|\}/g,'').replace(/\:/g,' = ') );
$('#formulas').html( JSON.stringify( DATA.formulas).replace(/\,/g,'<br>').replace(/\"|\{|\}/g,'').replace(/\:/g,' = ') );
var tmp='';
DATA.history.forEach(
DATA.history.slice(0,1).concat(DATA.history.slice(1).reverse()).forEach(
function(v,i){
var V=v.split(/,/g);
if( V.length > 1 ){
tmp+='<div class="row">'
tmp+='<div class="col">'+(( i == 0 ) ? V[0] : new Date(V[0]*1000).toJSON().slice(0,16).replace(/T/g,' '))+'</div>';
tmp+='<div class="col">'+V[1]+'</div>';
tmp+='<div class="col">'+V[2]+'</div>';
tmp+='<div class="col">'+V[3]+'</div>';
tmp+='<div class="col">'+V[4]+'</div>';
tmp+='<div class="col">'+V[5]+'</div>';
tmp+='<div class="col">'+V[6]+'</div>';
tmp+='</div>';
}
tmp+=history_out(v,i);
}
);
$('#history').html(tmp);
}
function history_out(v,i){
var V=v.split(/,/g);
var tmp='';
if( V.length > 1 ){
tmp+='<div class="row">'
tmp+='<div class="col-sm-2">'+(( i == 0 ) ? V[0] : new Date(V[0]*1000).toJSON().slice(0,16).replace(/T/g,' '))+'</div>';
tmp+='<div class="col">'+V[1]+'</div>';
tmp+='<div class="col">'+V[2]+'</div>';
tmp+='<div class="col">'+V[3]+'</div>';
tmp+='<div class="col">'+V[4]+'</div>';
tmp+='<div class="col">'+V[5]+'</div>';
tmp+='<div class="col">'+V[6]+'</div>';
tmp+='</div>';
}
return tmp;
}
......@@ -123,14 +123,15 @@ function get_data($upd){
$bid_price=$lp*$btceur;
$fv_bid_bid = max( BID_MIN_EUR, intVal(($bid_price - BID_OFFSET_EUR)*10)/10 );
$fv_bis_ask = max( BID_MIN_EUR, intVal(($ask_price - BID_OFFSET_EUR)*10)/10 );
$fv_bid_ask = max( BID_MIN_EUR, intVal(($ask_price - BID_OFFSET_EUR)*10)/10 );
$fv_ask = $ask_price+ASK_OFFSET_EUR;
// add hysteresis for freevision bid price
// if new calculation is lower than current price then ask side counts
// if new calculation is higher than current price then bid side counts
$JS['FREEVISION']['fv_bid']=floatval($JS['FREEVISION']['fv_bid']);
if( $fv_bid_ask < $JS['FREEVISION']['fv_bid'] ){
$fv_bid=$fv_bis_ask;
$fv_bid=$fv_bid_ask;
} elseif( $fv_bid_bid > $JS['FREEVISION']['fv_bid'] ) {
$fv_bid=$fv_bid_bid;
} else {
......@@ -168,19 +169,8 @@ function get_data($upd){
fwrite($fp,$hist);
fclose($fp);
/*
$fp=fopen(FREEVISION_HISTORY,'r');
$history=fread($fp,filesize(FREEVISION_HISTORY));
fclose($fp);
$H=preg_split('/
',$history);
*/
//$J['history']=$H;
//return json_encode($J);
return get_data(false);
}
echo update_data();
......
......@@ -23,18 +23,36 @@
}
.finfo_formulas {
padding:1em;
font-size:0.7em;
padding:1rem;
background:lavender;
margin:0.5em;
margin:0.5rem;
}
#formulas {
font-size:0.7em;
}
.finfo_chart {
font-size:0.7em;
padding:1rem;
background:lavender;
margin:0.5rem;
height:39em;
}
.ticker {
margin:0.5em;
padding:1.5em;
background:steelblue;
margin:0.5rem;
padding:1.5rem;
background:lightblue;
}
#history > .row:first-child > .col {
.api {
font-size: 0.8em;
line-height: 0.1em;
}
#history > .row:first-child > * {
font-weight:bold;
}
......@@ -43,6 +61,14 @@
color:blue;
}
.finfo_history {
font-size:0.8em;
padding:1rem;
background:lavender;
margin:0.5rem;
}
</style>
</head>
<body>
......@@ -89,27 +115,26 @@
<span class="input-group-text">&euro;</span>
</div>
</div>
</div>
<div class="col finfo_config">
<h4>API</h4>
<p><a href="data/freevision.json">JSON</a></p>
</div>
<div class="col finfo_config">
<h4>configuration parameters</h4>
<p id="conf"></p>
</div>
</div>
<div class="row">
<div class="col finfo_formulas">
<br>
<h4>calculation formulas</h4>
<p id="formulas"></p>
<h4>API</h4>
<p class="api"><a href="data/freevision.json">CURRENT TICKER DATA.JSON</a></p>
<p class="api"><a href="data/freevision_history.csv">HISTORICAL TICKER DATA.CSV</a></p>
</div>
<div class="col finfo_chart">
<h4>chart graphics coming soon ...</h4>
</div>
</div>
<div class="row">
<div class="col finfo_history">
<div class="col-sm-8 finfo_history">
<h4>history</h4>
<span id="history"></span>
</div>
<div class="col finfo_config">
<h4>configuration parameters</h4>
<p id="conf"></p>
</div>
</div>
</div>
<script src="assets/js/jquery.min.js"></script>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment