forked from ccxt/ccxt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathallcoin.php
More file actions
138 lines (129 loc) · 4.96 KB
/
allcoin.php
File metadata and controls
138 lines (129 loc) · 4.96 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
<?php
namespace ccxt;
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
use Exception as Exception; // a common import
class allcoin extends okcoinusd {
public function describe () {
return array_replace_recursive (parent::describe (), array (
'id' => 'allcoin',
'name' => 'Allcoin',
'countries' => array ( 'CA' ),
'has' => array (
'CORS' => false,
),
'extension' => '',
'urls' => array (
'logo' => 'https://user-images.githubusercontent.com/1294454/31561809-c316b37c-b061-11e7-8d5a-b547b4d730eb.jpg',
'api' => array (
'web' => 'https://www.allcoin.com',
'public' => 'https://api.allcoin.com/api',
'private' => 'https://api.allcoin.com/api',
),
'www' => 'https://www.allcoin.com',
'doc' => 'https://www.allcoin.com/About/APIReference',
),
'api' => array (
'web' => array (
'get' => array (
'Home/MarketOverViewDetail/',
),
),
'public' => array (
'get' => array (
'depth',
'kline',
'ticker',
'trades',
),
),
'private' => array (
'post' => array (
'batch_trade',
'cancel_order',
'order_history',
'order_info',
'orders_info',
'repayment',
'trade',
'trade_history',
'userinfo',
),
),
),
));
}
public function fetch_markets () {
$result = array ();
$response = $this->webGetHomeMarketOverViewDetail ();
$coins = $response['marketCoins'];
for ($j = 0; $j < count ($coins); $j++) {
$markets = $coins[$j]['Markets'];
for ($k = 0; $k < count ($markets); $k++) {
$market = $markets[$k]['Market'];
$base = $market['Primary'];
$quote = $market['Secondary'];
$baseId = strtolower ($base);
$quoteId = strtolower ($quote);
$id = $baseId . '_' . $quoteId;
$symbol = $base . '/' . $quote;
$active = $market['TradeEnabled'] && $market['BuyEnabled'] && $market['SellEnabled'];
$result[] = array (
'id' => $id,
'symbol' => $symbol,
'base' => $base,
'quote' => $quote,
'baseId' => $baseId,
'quoteId' => $quoteId,
'active' => $active,
'type' => 'spot',
'spot' => true,
'future' => false,
'maker' => $market['AskFeeRate'], // BidFeeRate 0, AskFeeRate 0.002, we use just the AskFeeRate here
'taker' => $market['AskFeeRate'], // BidFeeRate 0, AskFeeRate 0.002, we use just the AskFeeRate here
'precision' => array (
'amount' => $market['PrimaryDigits'],
'price' => $market['SecondaryDigits'],
),
'limits' => array (
'amount' => array (
'min' => $market['MinTradeAmount'],
'max' => $market['MaxTradeAmount'],
),
'price' => array (
'min' => $market['MinOrderPrice'],
'max' => $market['MaxOrderPrice'],
),
'cost' => array (
'min' => null,
'max' => null,
),
),
'info' => $market,
);
}
}
return $result;
}
public function parse_order_status ($status) {
if ($status === -1)
return 'canceled';
if ($status === 0)
return 'open';
if ($status === 1)
return 'open'; // partially filled
if ($status === 2)
return 'closed';
if ($status === 10)
return 'canceled';
return $status;
}
public function get_create_date_field () {
// allcoin typo create_data instead of create_date
return 'create_data';
}
public function get_orders_field () {
// allcoin typo order instead of orders (expected based on their API docs)
return 'order';
}
}