forked from ccxt/ccxt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathallcoin.py
More file actions
129 lines (120 loc) · 4.52 KB
/
allcoin.py
File metadata and controls
129 lines (120 loc) · 4.52 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
# -*- coding: utf-8 -*-
# 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
from ccxt.okcoinusd import okcoinusd
class allcoin (okcoinusd):
def describe(self):
return self.deep_extend(super(allcoin, self).describe(), {
'id': 'allcoin',
'name': 'Allcoin',
'countries': ['CA'],
'has': {
'CORS': False,
},
'extension': '',
'urls': {
'logo': 'https://user-images.githubusercontent.com/1294454/31561809-c316b37c-b061-11e7-8d5a-b547b4d730eb.jpg',
'api': {
'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': {
'web': {
'get': [
'Home/MarketOverViewDetail/',
],
},
'public': {
'get': [
'depth',
'kline',
'ticker',
'trades',
],
},
'private': {
'post': [
'batch_trade',
'cancel_order',
'order_history',
'order_info',
'orders_info',
'repayment',
'trade',
'trade_history',
'userinfo',
],
},
},
})
def fetch_markets(self):
result = []
response = self.webGetHomeMarketOverViewDetail()
coins = response['marketCoins']
for j in range(0, len(coins)):
markets = coins[j]['Markets']
for k in range(0, len(markets)):
market = markets[k]['Market']
base = market['Primary']
quote = market['Secondary']
baseId = base.lower()
quoteId = quote.lower()
id = baseId + '_' + quoteId
symbol = base + '/' + quote
active = market['TradeEnabled'] and market['BuyEnabled'] and market['SellEnabled']
result.append({
'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': {
'amount': market['PrimaryDigits'],
'price': market['SecondaryDigits'],
},
'limits': {
'amount': {
'min': market['MinTradeAmount'],
'max': market['MaxTradeAmount'],
},
'price': {
'min': market['MinOrderPrice'],
'max': market['MaxOrderPrice'],
},
'cost': {
'min': None,
'max': None,
},
},
'info': market,
})
return result
def parse_order_status(self, 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
def get_create_date_field(self):
# allcoin typo create_data instead of create_date
return 'create_data'
def get_orders_field(self):
# allcoin typo order instead of orders(expected based on their API docs)
return 'order'