max_exchange_api 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -3
- data/CHANGELOG.md +4 -1
- data/README.md +153 -1
- data/lib/max_exchange_api.rb +1 -0
- data/lib/max_exchange_api/base_api.rb +1 -1
- data/lib/max_exchange_api/config.rb +17 -0
- data/lib/max_exchange_api/public_api.rb +53 -0
- data/lib/max_exchange_api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71535a1c969d383e36c7af1860aeab28c78f55fb62d0e2ef4cb05c9fe8d0df27
|
4
|
+
data.tar.gz: c132f2796b57303bfd288a64f0b14cf966d4117568dadb02b606270c316d08c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f51b1539a5cbc487c325fec8b46e5ef38b6c12f4fd909631769fba2e2d82bdbe8dba39ae0130919ca6951aed220e677ec07f64e5d465907fdb0d4cae7224080d
|
7
|
+
data.tar.gz: 2afa7b1325fe0756f92416b33e762b9fd264abb6ff4615d6495c4e1d92e8c265b92f680ce8ede43c4e408503cacd15f8b0d9adf84ce31799ca2d25a4aa360e1c
|
data/.rubocop.yml
CHANGED
@@ -243,7 +243,7 @@ Metrics/ModuleLength:
|
|
243
243
|
Metrics/ParameterLists:
|
244
244
|
Description: 'Avoid parameter lists longer than three or four parameters.'
|
245
245
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
|
246
|
-
Enabled:
|
246
|
+
Enabled: false
|
247
247
|
|
248
248
|
Metrics/PerceivedComplexity:
|
249
249
|
Description: >-
|
@@ -337,7 +337,7 @@ Rails/HasAndBelongsToMany:
|
|
337
337
|
|
338
338
|
Rails/Output:
|
339
339
|
Description: 'Checks for calls to puts, print, etc.'
|
340
|
-
Enabled:
|
340
|
+
Enabled: false
|
341
341
|
|
342
342
|
Rails/ReadWriteAttribute:
|
343
343
|
Description: >-
|
@@ -812,7 +812,7 @@ Style/NumericLiterals:
|
|
812
812
|
Add underscores to large numeric literals to improve their
|
813
813
|
readability.
|
814
814
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
|
815
|
-
Enabled:
|
815
|
+
Enabled: false
|
816
816
|
|
817
817
|
Style/OneLineConditional:
|
818
818
|
Description: >-
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -35,16 +35,81 @@ Or install it yourself as:
|
|
35
35
|
|
36
36
|
$ gem install max_exchange_api
|
37
37
|
|
38
|
+
## Default config
|
39
|
+
|
40
|
+
Change default api timeout time (in seconds)
|
41
|
+
|
42
|
+
```rb
|
43
|
+
MaxExchangeApi.config.default_timeout = 3
|
44
|
+
```
|
45
|
+
|
38
46
|
## Usage
|
39
47
|
|
40
|
-
### Public
|
48
|
+
### Public Api Examples
|
41
49
|
|
42
50
|
```rb
|
43
51
|
@api = MaxExchangeApi::PublicApi.new
|
44
52
|
```
|
45
53
|
|
54
|
+
#### [GET GET /api/v2/vip_levels](https://max.maicoin.com/documents/api_list#!/public/getApiV2VipLevels)
|
55
|
+
|
56
|
+
> Get all VIP level fees.
|
57
|
+
|
58
|
+
<details>
|
59
|
+
<summary>Show code</summary>
|
60
|
+
|
61
|
+
```rb
|
62
|
+
@api.vip_levels
|
63
|
+
```
|
64
|
+
</details>
|
65
|
+
|
66
|
+
#### [GET /api/v2/vip_levels/{level}](https://max.maicoin.com/documents/api_list#!/public/getApiV2VipLevelsLevel)
|
67
|
+
|
68
|
+
> Get VIP level fee by level.
|
69
|
+
|
70
|
+
<details>
|
71
|
+
<summary>Show code</summary>
|
72
|
+
|
73
|
+
```rb
|
74
|
+
@api.vip_levels(2)
|
75
|
+
```
|
76
|
+
</details>
|
77
|
+
|
78
|
+
#### [GET /api/v2/currencies](https://max.maicoin.com/documents/api_list#!/public/getApiV2Currencies)
|
79
|
+
|
80
|
+
> Get all available currencies.
|
81
|
+
|
82
|
+
<details>
|
83
|
+
<summary>Show code</summary>
|
84
|
+
|
85
|
+
```rb
|
86
|
+
@api.currencies
|
87
|
+
```
|
88
|
+
</details>
|
89
|
+
|
90
|
+
#### [GET /api/v2/k](https://max.maicoin.com/documents/api_list#!/public/getApiV2K)
|
91
|
+
|
92
|
+
> Get OHLC(k line) of a specific market.
|
93
|
+
|
94
|
+
<details>
|
95
|
+
<summary>Show code</summary>
|
96
|
+
|
97
|
+
```rb
|
98
|
+
# use default parameters
|
99
|
+
@api.k('btctwd')
|
100
|
+
|
101
|
+
# provide all possible parameters
|
102
|
+
@api.k('btctwd', limit: 30, period: 1, timestamp: 1624705402)
|
103
|
+
```
|
104
|
+
</details>
|
105
|
+
|
46
106
|
#### [GET /api/v2/depth](https://max.maicoin.com/documents/api_list#!/public/getApiV2Depth)
|
47
107
|
|
108
|
+
> Get depth of a specified market.
|
109
|
+
|
110
|
+
<details>
|
111
|
+
<summary>Show code</summary>
|
112
|
+
|
48
113
|
```rb
|
49
114
|
# use default parameters
|
50
115
|
@api.depth('maxtwd')
|
@@ -52,6 +117,93 @@ Or install it yourself as:
|
|
52
117
|
# provide all possible parameters
|
53
118
|
@api.depth('maxtwd', limit: 10, sort_by_price: true)
|
54
119
|
```
|
120
|
+
</details>
|
121
|
+
|
122
|
+
#### [GET /api/v2/trades](https://max.maicoin.com/documents/api_list#!/public/getApiV2Trades)
|
123
|
+
|
124
|
+
> Get recent trades on market, sorted in reverse creation order.
|
125
|
+
|
126
|
+
<details>
|
127
|
+
<summary>Show code</summary>
|
128
|
+
|
129
|
+
```rb
|
130
|
+
# use default parameters
|
131
|
+
@api.trades('btctwd')
|
132
|
+
|
133
|
+
# provide all possible parameters
|
134
|
+
@api.trades(
|
135
|
+
'maxtwd',
|
136
|
+
timestamp: 1624705402,
|
137
|
+
from: 68444,
|
138
|
+
to: 69444,
|
139
|
+
order_by: 'asc',
|
140
|
+
pagination: true,
|
141
|
+
page: 3,
|
142
|
+
limit: 15,
|
143
|
+
offset: 5,
|
144
|
+
)
|
145
|
+
```
|
146
|
+
</details>
|
147
|
+
|
148
|
+
#### [GET /api/v2/markets](https://max.maicoin.com/documents/api_list#!/public/getApiV2Markets)
|
149
|
+
|
150
|
+
> Get all available markets.
|
151
|
+
|
152
|
+
<details>
|
153
|
+
<summary>Show code</summary>
|
154
|
+
|
155
|
+
```rb
|
156
|
+
@api.markets
|
157
|
+
```
|
158
|
+
</details>
|
159
|
+
|
160
|
+
#### [GET /api/v2/summary](https://max.maicoin.com/documents/api_list#!/public/getApiV2Summary)
|
161
|
+
|
162
|
+
> Overview of market data for all tickers.
|
163
|
+
|
164
|
+
<details>
|
165
|
+
<summary>Show code</summary>
|
166
|
+
|
167
|
+
```rb
|
168
|
+
@api.summary
|
169
|
+
```
|
170
|
+
</details>
|
171
|
+
|
172
|
+
#### [GET /api/v2/tickers/{path_market}](https://max.maicoin.com/documents/api_list#!/public/getApiV2TickersPathMarket)
|
173
|
+
|
174
|
+
> Get ticker of specific market.
|
175
|
+
|
176
|
+
<details>
|
177
|
+
<summary>Show code</summary>
|
178
|
+
|
179
|
+
```rb
|
180
|
+
@api.tickers('btctwd')
|
181
|
+
```
|
182
|
+
</details>
|
183
|
+
|
184
|
+
#### [GET /api/v2/tickers](https://max.maicoin.com/documents/api_list#!/public/getApiV2Tickers)
|
185
|
+
|
186
|
+
> Get ticker of all markets.
|
187
|
+
|
188
|
+
<details>
|
189
|
+
<summary>Show code</summary>
|
190
|
+
|
191
|
+
```rb
|
192
|
+
@api.tickers
|
193
|
+
```
|
194
|
+
</details>
|
195
|
+
|
196
|
+
#### [GET /api/v2/timestamp](https://max.maicoin.com/documents/api_list#!/public/getApiV2Timestamp)
|
197
|
+
|
198
|
+
> Get server current time, in seconds since Unix epoch.
|
199
|
+
|
200
|
+
<details>
|
201
|
+
<summary>Show code</summary>
|
202
|
+
|
203
|
+
```rb
|
204
|
+
@api.timestamp
|
205
|
+
```
|
206
|
+
</details>
|
55
207
|
|
56
208
|
## Development
|
57
209
|
|
data/lib/max_exchange_api.rb
CHANGED
@@ -6,10 +6,63 @@ module MaxExchangeApi
|
|
6
6
|
class PublicApi < BaseApi
|
7
7
|
base_uri 'https://max-api.maicoin.com/api/v2'
|
8
8
|
|
9
|
+
def vip_levels(level = nil)
|
10
|
+
if level
|
11
|
+
send_request(:get, "/vip_levels/#{level}", {})
|
12
|
+
else
|
13
|
+
send_request(:get, '/vip_levels', {})
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def currencies
|
18
|
+
send_request(:get, '/currencies', {})
|
19
|
+
end
|
20
|
+
|
21
|
+
def k(market, limit: 30, period: 1, timestamp: nil)
|
22
|
+
send_request(:get, '/k', market: market, limit: limit, period: period, timestamp: timestamp)
|
23
|
+
end
|
24
|
+
|
9
25
|
def depth(market, limit: 10, sort_by_price: true)
|
10
26
|
send_request(:get, '/depth', market: market, limit: limit, sort_by_price: sort_by_price)
|
11
27
|
end
|
12
28
|
|
29
|
+
def trades(market, timestamp: nil, from: nil, to: nil, order_by: 'desc', pagination: true, page: 1, limit: 50,
|
30
|
+
offset: 0)
|
31
|
+
send_request(
|
32
|
+
:get,
|
33
|
+
'/trades',
|
34
|
+
market: market,
|
35
|
+
timestamp: timestamp,
|
36
|
+
from: from,
|
37
|
+
to: to,
|
38
|
+
order_by: order_by,
|
39
|
+
pagination: pagination,
|
40
|
+
page: page,
|
41
|
+
limit: limit,
|
42
|
+
offset: offset,
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
def markets
|
47
|
+
send_request(:get, '/markets', {})
|
48
|
+
end
|
49
|
+
|
50
|
+
def summary
|
51
|
+
send_request(:get, '/summary', {})
|
52
|
+
end
|
53
|
+
|
54
|
+
def tickers(market = nil)
|
55
|
+
if market
|
56
|
+
send_request(:get, "/tickers/#{market}", {})
|
57
|
+
else
|
58
|
+
send_request(:get, '/tickers', {})
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def timestamp
|
63
|
+
send_request(:get, '/timestamp', {})
|
64
|
+
end
|
65
|
+
|
13
66
|
protected
|
14
67
|
|
15
68
|
def send_request(method, path, query)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: max_exchange_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- khiav reoy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- gemfiles/Gemfile
|
107
107
|
- lib/max_exchange_api.rb
|
108
108
|
- lib/max_exchange_api/base_api.rb
|
109
|
+
- lib/max_exchange_api/config.rb
|
109
110
|
- lib/max_exchange_api/helper.rb
|
110
111
|
- lib/max_exchange_api/public_api.rb
|
111
112
|
- lib/max_exchange_api/version.rb
|