-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.php
84 lines (58 loc) · 2.05 KB
/
index.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
<?php
// feed $API_PUBLIC_KEY & $API_SECRET_KEY in api_tradesatoshi.php file
@include('api_tradesatoshi.php');
// to avoid problems in case Keys
function keysToLower($obj)
{
if(!is_object($obj) && !is_array($obj)) return $obj;
foreach($obj as $key=>$element)
{
$element=keysToLower($element);
if(is_object($obj))
{
$obj->{strtolower($key)}=$element;
if(!ctype_lower($key)) unset($obj->{$key});
}
else if(is_array($obj) && ctype_upper($key))
{
$obj[strtolower($key)]=$element;
unset($obj[$key]);
}
}
return $obj;
}
/* ----- Public Functions ----- */
$R = GetCurrencies();
// $R = GetTicker('NKA_BTC'); // market
// $R = GetMarketHistory('NKA_BTC',20); // market,count
// $R = GetMarketSummary('NKA_BTC'); // market
// $R = GetMarketSummaries();
// $R = GetOrderBook('LTC_BTC','Buy',20); // market,type,count
/* ----- Private Functions ----- */
// $R = GetBalance("BTC"); // currency
// $R = GetBalances();
// $R = GetOrder(1001); //OrderId
// $R = GetOrders('LTC_BTC',20); //Market,Count
// $R = SubmitOrder('NKA_BTC','Buy',10000,0.00000001); //Market,Type,Amount,Price
// $R = CancelOrder('Single',1001,''); //Type,OrderId,Market
// $R = GetTradeHistory('NKA_BTC',20); //Market,Count
// $R = GenerateAddress('PPC'); //Currency
// $R = SubmitWithdraw('DOGE','DLciqeWyaG8wQ7sK96hcR33Fguovk8betK',13); //Currency,Address,Amount
// $R = GetDeposits('DOGE'); //Currency
// $R = GetWithdrawals('DOGE',20); //Currency,Count
/* ----- RESULTS ----- */
$R = keysToLower($R); // convert all keys returned to lower
if (is_object($R) && (!$R->success || !$R->result || $R->message))
{
die('<h1>API ERROR</h1><h2>message: '.$R->message.'</h2>');
}
else if (is_object($R))
{
$R = $R->result;
}
else
{
die('Something went wrong (TradeSatoshi unavailable perhaps...) '.$R);
}
var_dump($R);
?>