Skip to content

Commit

Permalink
Hitbtc Eth Market data successfully added
Browse files Browse the repository at this point in the history
  • Loading branch information
profchydon committed Apr 17, 2018
1 parent be41f5b commit effd29e
Show file tree
Hide file tree
Showing 9 changed files with 470 additions and 58 deletions.
4 changes: 4 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
/* margin: 0px; */
}

.container.tab-holder {
margin-bottom: 20px;
}

img.img.img-responsive.market-logo {
width: 160px;
}
Expand Down
88 changes: 84 additions & 4 deletions function/hitbtc.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,31 @@ function getBuy ($currencypair) {

}

function updateBuy ($buy, $currencypair)
{
require '../database/database.php';
$query = $pdo->prepare('UPDATE hibtc SET current_buy = :buy WHERE currencypair = :currencypair');
$query->bindParam(':currencypair' , $currencypair);
$query->bindParam(':buy' , $buy);
if ($query->execute()) {
return true;
}else {
return false;
}
}


function updateEthBuy ($buy, $currencypair)
{
require '../database/database.php';
$query = $pdo->prepare('UPDATE hibtceth SET current_buy = :buy WHERE currencypair = :currencypair');
$query->bindParam(':currencypair' , $currencypair);
$query->bindParam(':buy' , $buy);
if ($query->execute()) {
return true;
}else {
return false;
}
}


function saveData ($coin, $symbol) {
Expand All @@ -65,6 +88,25 @@ function saveData ($coin, $symbol) {

}

function saveEthData ($coin, $symbol) {

require '../database/database.php';
$query = $pdo->prepare('INSERT into hibtceth (coin, symbol) values (:coin, :symbol) ');
$query->bindParam(':coin' , $coin);
$query->bindParam(':symbol' , $symbol);

if ($query->execute()) {

return true;

}else {

return false;

}

}

function updateTable ($symbol, $currencypair)
{
require '../database/database.php';
Expand All @@ -78,12 +120,25 @@ function updateTable ($symbol, $currencypair)
}
}

function updateBuy ($buy, $currencypair)
function updateEthTable ($symbol, $currencypair)
{
require '../database/database.php';
$query = $pdo->prepare('UPDATE hibtc SET current_buy = :buy WHERE currencypair = :currencypair');
$query = $pdo->prepare('UPDATE hibtceth SET currencypair = :currencypair WHERE symbol = :symbol');
$query->bindParam(':currencypair' , $currencypair);
$query->bindParam(':buy' , $buy);
$query->bindParam(':symbol' , $symbol);
if ($query->execute()) {
return true;
}else {
return false;
}
}

function saveEth ($coin, $symbol)
{
require '../database/database.php';
$query = $pdo->prepare('INSERT into hibtceth (coin, symbol) values (:coin, :symbol) ');
$query->bindParam(':coin' , $coin);
$query->bindParam(':symbol' , $symbol);
if ($query->execute()) {
return true;
}else {
Expand All @@ -103,6 +158,18 @@ function updateTotalBuy ($total_buy_trade)
}
}

function updateTotalBuyEthMarket ($total_buy_trade)
{
require '../database/database.php';
$query = $pdo->prepare('UPDATE hibtceth SET total_buy_trade = :total_buy_trade');
$query->bindParam(':total_buy_trade' , $total_buy_trade);
if ($query->execute()) {
return true;
}else {
return false;
}
}

function getAll ()
{
require '../database/database.php';
Expand All @@ -114,6 +181,19 @@ function getAll ()

return $data;

}

function getAllEthMarket ()
{
require '../database/database.php';
$query = $pdo->prepare('SELECT * FROM hibtceth ORDER BY buy DESC LIMIT 30');

if ($query->execute()) {
$data = $query->fetchAll(PDO::FETCH_ASSOC);
}

return $data;

}


Expand Down
124 changes: 124 additions & 0 deletions hitbtc/ethmarket.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?php
include '../function/hitbtc.php';

$coins = getAllEthMarket();

if (isset($_POST['go'])) {

function redirect($location) {
header("Location: " . $location);
exit;
}

$market = htmlentities(strip_tags($_POST['market']));

$market = "../".$market."/market.php";

redirect($market);

}


?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Popular Cryptocurrencies</title>
<link rel="stylesheet" href="../css/bootstrap.min.css">
<link rel="stylesheet" href="../css/main.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Bree+Serif" rel="stylesheet">
<!-- <script src="js/jquery-3.2.1.min.js"></script>
<script src="js/script.js"></script> -->
</head>

<body>
<div id="banner">
<p class=""> <img class="img img-responsive market-logo" src="../img/logo.png" alt=""></p>
</div>

<?php

include '../form.php';

?>

<h2 id="heading">HitBTC ETH Market Cryptocurrencies Trade Guide</h2>
<!-- <h5>Sorted by popularity, in descending order</h5> -->
<div class="container">

<div class="row">

<div class="col-md-12">
<h4>Top Gaining Cryptocurrencies</h4>
<table class="table table-striped table-responsive">
<thead>
<tr>

<th>S/no</th>
<th>Coin</th>
<th>Currency Pair</th>
<th>Buy trade Vol.</th>
<th>Total buy trade vol.</th>
<th>Buy trade Vol. 5mins ago</th>
<th>Total buy trade vol. 5 mins ago</th>
<!-- <th>% Change</th> -->

</tr>
</thead>
<tbody>

<?php

$counter = 1;

foreach ($coins as $key => $coin) {

// $new_value = $coin['current_buy'];
// $old_value = $coin['buy'];
// $current_total_trade_volume = $coin['total_buy_trade'];
// $difference = abs($new_value - $old_value);
// $current_percentage = (($new_value / $current_total_trade_volume ) * 100);
// $current_percentage = round( $current_percentage , 2, PHP_ROUND_HALF_EVEN);

?>

<tr>
<td><?=$counter;?></td>
<td><?=$coin['coin'];?></td>
<td><?=$coin['currencypair'];?></td>
<!-- <td><?=$coin['current_buy'];?></td> -->
<!-- <td><?=$coin['total_buy_trade'];?></td> -->
<td><?=$coin['buy'];?></td>
<td><?=$coin['last_total_buy_trade'];?></td>
<!-- <td><?=$current_percentage;?></td> -->


</tr>

<?php
$counter++;
}


?>

</tbody>
</table>

</div>




</div>



</div>

</body></html>
Loading

0 comments on commit effd29e

Please sign in to comment.