Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FairCoin
FairCoin FreeVision
Commits
1afb622c
Commit
1afb622c
authored
Feb 05, 2019
by
Gampe Sebastian
Browse files
improvements
parent
6f37fccb
Changes
3
Hide whitespace changes
Inline
Side-by-side
assets/js/ticker.js
View file @
1afb622c
...
...
@@ -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
;
}
functions/get_data.php
View file @
1afb622c
...
...
@@ -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_bi
s
_ask
=
max
(
BID_MIN_EUR
,
intVal
((
$ask_price
-
BID_OFFSET_EUR
)
*
10
)
/
10
);
$fv_bi
d
_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_bi
s
_ask
;
$fv_bid
=
$fv_bi
d
_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
();
...
...
price_ticker.html
View file @
1afb622c
...
...
@@ -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
:
steel
blue
;
margin
:
0.5
r
em
;
padding
:
1.5
r
em
;
background
:
light
blue
;
}
#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"
>
€
</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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment