-
Notifications
You must be signed in to change notification settings - Fork 0
/
bestprice.php
138 lines (99 loc) · 2.38 KB
/
bestprice.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
include 'config.php';
$btcavg247 = array();
$sql = "SELECT * FROM btcfiat";
if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
$btcavg247[] = $row['btcavg24'];
}
mysqli_free_result($result);
} else{echo "No records matching your query were found.";}
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
$btceusd5 = array();
$bfnxusd4 = array();
$btceusd12 = array();
$bfnxusd12 = array();
$sql = "SELECT * FROM btcedata";
if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
$btceusd4 = $row['btcprice'];
$btceusd5[] = $btceusd4;
$btceusd13 = $row['btcopen'];
$btceusd12[] = $btceusd13;
}
mysqli_free_result($result);
} else{echo "No records matching your query were found.";}
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
$sql = "SELECT * FROM bitfinexdata";
if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
$bfnxusd5 = $row['btcprice'];
$bfnxusd4[] = $bfnxusd5;
$bfnxusd13 = $row['btcopen'];
$bfnxusd12[] = $bfnxusd13;
}
mysqli_free_result($result);
} else{echo "No records matching your query were found.";}
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
mysqli_close($link);
$btceusd6 = end($btceusd5);
$bfnxusd6 = end($bfnxusd4);
$btceusd11 = end($btceusd12);
$bfnxusd11 = end($bfnxusd12);
$btcavg24 = end($btcavg247);
$btceusd = $btceusd6;
$bfxusd = $bfnxusd6;
$btceusd2 = $btceusd11;
$bfxusd2 = $bfnxusd11;
if ($btceusd > $bfxusd){
$bestprice = "$btceusd";
$btcetxt = "BTC-E";
if ( $btceusd >= $btceusd2 )
{
$arw1 = "▴";
$color1 = "green";
}
else
{
$arw1 = "▾";
$color1 = "red";
}
$bestarw = $arw1;
$bestcolor = $color1;
}
else
{
$bestprice = "$bfxusd";
$btcetxt = "BITFINEX";
if ( $bfxusd >= $bfxusd2 )
{
$arw2 = "▴";
$color2 = "green";
}
else
{
$arw2 = "▾";
$color2 = "red";
}
$bestarw = $arw2;
$bestcolor = $color2;
}
$btcchange = (($bestprice / $btcavg24)-1)*100;
$btcchange1 = round($btcchange, 2);
echo "BEST BITCOIN PRICE:";
echo "<br>";
echo "<span class=\"bigtitle\" >$bestprice USD</span>";
echo "<span class=\"bigtitle\" style=\"color:$bestcolor;\" >$bestarw</span>";
echo "<span class=\"bigtitle\" >$btcchange1 %</span>";
echo "<br>";
echo $btcetxt;
?>