-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
152 lines (139 loc) · 4.54 KB
/
test.php
File metadata and controls
152 lines (139 loc) · 4.54 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
ini_set('max_execution_time', 1000);
$args = [];
$args["key"] = "key";
$args["secret"] = "secret";
require 'cryptsy.php';
$bot = new \FinalHashLLC\CryptsyAPIv2($args);
function maintenance_update($currency) {
if($currency['maintenance'] == 0) {
$currency['maintenance'] = "No Issues";
}
else if ($currency['maintenance'] == 1) {
$currency['maintenance'] = "Maintenance";
}
else if ($currency['maintenance'] == 2) {
$currency['maintenance'] = "Updating Wallet";
}
else if ($currency['maintenance'] == 3) {
$currency['maintenance'] = "Network Issues";
}
return $currency;
}
function get_balance($balance, $key) {
$available_balance = $balance['available'];
$held_balance = $balance['held'];
if(array_key_exists($key, $available_balance)) {
$balance['available'] = $available_balance[$key];
}
else {
$balance['available'] = 0;
}
if(array_key_exists($key, $held_balance)) {
$balance['held'] = $held_balance[$key];
}
else {
$balance['held'] = 0;
}
return $balance;
}
?>
<h1>User Methods</h1>
<ul>
<?php
$info = $bot->info();
echo("<li> User ID: " . $info['data']['id'] . "</li>" );
echo("<li> UserName: " . $info['data']['username'] . "</li>" );
echo("<li> Acc Type: " . $info['data']['accounttype'] . "</li>" );
echo("<li> Email: " . $info['data']['email'] . "</li>" );
echo("<li> Name: " . $info['data']['first_name'] . " " . $info['data']['last_name'] . "</li>" );
echo("<li> TradeKey: " . $info['data']['trade_key'] . "</li>" );
?>
</ul>
<h1>Currencies</h1>
<table border="1">
<tr>
<th>ID</th>
<th>Name</th>
<th>Status</th>
<th>Available Balance</th>
<th>Held Balance</th>
</tr>
<?php
$currencies = $bot->currencies()['data'];
foreach($currencies as $currency) {
$currency = maintenance_update($currency);
$balance = $bot->balances($currency['id'])['data'];
$balance = get_balance($balance, $currency['id']);
echo("<tr>");
echo("<td>" . $currency['id'] . "</td>");
echo("<td>" . $currency['name'] . "</td>");
echo("<td>" . $currency['maintenance'] . "</td>");
echo("<td>" . $balance['available'] . "</td>");
echo("<td>" . $balance['held'] . "</td>");
echo("</tr>");
}
?>
</table>
<h1>Deposits</h1>
<table border="1">
<tr>
<th>Currency</th>
<th>Time</th>
<th>Address</th>
<th>Amount</th>
<th>TXID</th>
<th>Status</th>
</tr>
<?php
$deposits = $bot->deposits()['data'];
foreach($deposits as $deposit) {
$currency = $bot->currencies($deposit['currency'])['data'];
echo("<tr>");
echo("<td>" . $currency['name'] . "</td>");
echo("<td>" . $deposit['datetime'] . "</td>");
echo("<td>" . $deposit['address'] . "</td>");
echo("<td>" . $deposit['amount'] . "</td>");
echo("<td>" . $deposit['trxid'] . "</td>");
echo("<td>" . $deposit['status'] . "</td>");
echo("</tr>");
}
?>
</table>
<h1>Withdrawals</h1>
<table border="1">
<tr>
<th>Currency</th>
<th>Time</th>
<th>Address</th>
<th>Amount</th>
<th>TXID</th>
<th>Fee</th>
</tr>
<?php
$withdrawals = $bot->withdrawals()['data'];
foreach($withdrawals as $withdrawal) {
$currency = $bot->currencies($withdrawal['currencyid'])['data'];
echo("<tr>");
echo("<td>" . $currency['name'] . "</td>");
echo("<td>" . $withdrawal['datetime'] . "</td>");
echo("<td>" . $withdrawal['address'] . "</td>");
echo("<td>" . $withdrawal['amount'] . "</td>");
echo("<td>" . $withdrawal['trxid'] . "</td>");
echo("<td>" . $withdrawal['fee'] . "</td>");
echo("</tr>");
}
?>
</table>
<h1>Order Info</h1>
<pre>
<?php
$order = $bot->createOrder('DGC_BTC', 'BUY', '100', '0.00000010');
echo("<p>" . print_r($order) . "</p>")
?>
</pre>
// Order Methods
public function createOrder($marketid, $ordertype, $quantity, $price);
public function orderInfo($orderid);
public function cancelOrder($orderid);
*/