vexapion 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/vexapion/bitflyer.rb +164 -17
- data/lib/vexapion/template.rb +121 -0
- data/lib/vexapion/version.rb +1 -1
- data/lib/vexapion/zaif.rb +1 -1
- metadata +3 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28b59cf177eae960a829717727624d49714484b6
|
4
|
+
data.tar.gz: 3b1cf4c5bda2c08090f1fd7ce20ad843f74f36e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2b11378b807f020baf1fba42a87739dba44d59e427f61983da8cf8952381d758c2f835dcb366ae92ee5015f913985ab501e93dbcfc6ae5592eec030d409aa84
|
7
|
+
data.tar.gz: 7b13dbbe0b911625c777b65ae9d7e8eb51d57858587aa301ce3b5beee1e87011833fb6bf101f353786b6f018386fced3b2fe4ffc46e874def80df87a126cae95
|
data/lib/vexapion/bitflyer.rb
CHANGED
@@ -23,18 +23,27 @@ module Vexapion
|
|
23
23
|
|
24
24
|
# Public API
|
25
25
|
#板情報
|
26
|
+
# @param [String] pair product_codeを指定します。
|
27
|
+
# @return [Hash]
|
26
28
|
def board(pair)
|
27
29
|
public_get('board', product_code: pair.upcase)
|
28
30
|
end
|
29
31
|
alias get_board board
|
30
32
|
|
31
33
|
#Ticker
|
34
|
+
# @param [String] pair product_codeを指定します。
|
35
|
+
# @return [Hash]
|
32
36
|
def ticker(pair)
|
33
37
|
public_get('ticker', product_code: pair.upcase)
|
34
38
|
end
|
35
39
|
alias get_ticker ticker
|
36
40
|
|
37
41
|
#約定履歴
|
42
|
+
# @param [String] pair product_codeを指定します。
|
43
|
+
# @param [Integer] count 結果の個数を指定します。
|
44
|
+
# @param [Integer] before このパラメータに指定した値より小さいidを持つデータを取得します。
|
45
|
+
# @param [Integer] after このパラメータに指定した値より大きいidを持つデータを取得します。
|
46
|
+
# @return [Hash]
|
38
47
|
def executions(pair, count='', before='', after='')
|
39
48
|
params = {
|
40
49
|
product_code: pair.upcase
|
@@ -48,37 +57,48 @@ module Vexapion
|
|
48
57
|
alias get_public_executions executions
|
49
58
|
|
50
59
|
#チャット
|
60
|
+
# @params [???] 日付を指定するようです。形式不明。省略すると5日前からのデータを取得します。
|
61
|
+
# @return [Hash]
|
51
62
|
def get_chats(date)
|
52
63
|
public_get('getchats', from_date: date)
|
53
64
|
end
|
54
65
|
|
55
66
|
#取引所の状態
|
67
|
+
# @return [Hash]
|
56
68
|
def get_health
|
57
69
|
public_get('gethealth')
|
58
70
|
end
|
59
71
|
|
60
72
|
# Private API
|
61
73
|
#APIキーの権限を取得
|
74
|
+
# @return [Hash]
|
62
75
|
def get_permissions
|
63
76
|
get('getpermissions')
|
64
77
|
end
|
65
78
|
|
66
79
|
#資産残高を取得
|
80
|
+
# @return [Hash]
|
67
81
|
def get_balance
|
68
82
|
get('getbalance')
|
69
83
|
end
|
70
84
|
|
71
85
|
#証拠金の状態を取得
|
86
|
+
# @return [Hash]
|
72
87
|
def get_collateral
|
73
88
|
get('getcollateral')
|
74
89
|
end
|
75
90
|
|
76
91
|
#預入用BTC/ETHアドレス取得
|
92
|
+
# @return [Hash]
|
77
93
|
def get_addresses
|
78
94
|
get('getaddresses')
|
79
95
|
end
|
80
96
|
|
81
97
|
#BTC/ETH預入履歴
|
98
|
+
# @param [Integer] count 結果の個数を指定します。
|
99
|
+
# @param [Integer] before このパラメータに指定した値より小さいidを持つデータを取得します。
|
100
|
+
# @param [Integer] after このパラメータに指定した値より大きいidを持つデータを取得します。
|
101
|
+
# @return [Hash]
|
82
102
|
def get_coin_ins(count='', before='', after='')
|
83
103
|
params = Hash.new
|
84
104
|
params[:count] = count if count != ''
|
@@ -88,6 +108,12 @@ module Vexapion
|
|
88
108
|
end
|
89
109
|
|
90
110
|
#BTC/ETH外部送付
|
111
|
+
# @param [String] currency 送付する通貨名を指定します。~BTC" または "ETH"を指定します。
|
112
|
+
# @param [Float] amount 送付する数量を数値で指定します。
|
113
|
+
# @param [String] address 送付先アドレスを指定します。
|
114
|
+
# @param [Float] fee 追加の手数料を指定します。上限は0.0005です。
|
115
|
+
# @param [String] code 二段階認証の確認コードです。コイン外部送付時の二段階認証を設定している場合のみ必要。
|
116
|
+
# @return [Hash]
|
91
117
|
def sendcoin(currency, amount, address, fee='', code='')
|
92
118
|
params = {
|
93
119
|
currency_code: currency.upcase,
|
@@ -98,12 +124,16 @@ module Vexapion
|
|
98
124
|
fee = 0.0005 < fee.to_f ? 0.0005 : fee.to_f
|
99
125
|
params[:additional_fee] = fee
|
100
126
|
end
|
101
|
-
params[:code]
|
127
|
+
params[:code] = code.to_i if code != ''
|
102
128
|
|
103
129
|
post('sendcoin', params)
|
104
130
|
end
|
105
131
|
|
106
132
|
#BTC/ETH送付履歴
|
133
|
+
# @param [Integer] count 結果の個数を指定します。
|
134
|
+
# @param [Integer] before このパラメータに指定した値より小さいidを持つデータを取得します。
|
135
|
+
# @param [Integer] after このパラメータに指定した値より大きいidを持つデータを取得します。
|
136
|
+
# @return [Hash]
|
107
137
|
def get_coin_outs(count='', before='', after='')
|
108
138
|
params = Hash.new
|
109
139
|
#params[:message_id] = id if id != ''
|
@@ -115,7 +145,7 @@ module Vexapion
|
|
115
145
|
end
|
116
146
|
|
117
147
|
#BTC/ETH送付状況確認
|
118
|
-
# @
|
148
|
+
# @param [String] message_id sendcoinAPIの戻り値を指定
|
119
149
|
# @return [hash]
|
120
150
|
def get_coin_outs_id(message_id)
|
121
151
|
params = { message_id: message_id }
|
@@ -124,11 +154,16 @@ module Vexapion
|
|
124
154
|
end
|
125
155
|
|
126
156
|
#銀行口座一覧取得
|
157
|
+
# @return [Hash]
|
127
158
|
def get_bank_accounts
|
128
159
|
get('getbankaccounts')
|
129
160
|
end
|
130
161
|
|
131
162
|
#デポジット入金履歴
|
163
|
+
# @param [Integer] count 結果の個数を指定します。
|
164
|
+
# @param [Integer] before このパラメータに指定した値より小さいidを持つデータを取得します。
|
165
|
+
# @param [Integer] after このパラメータに指定した値より大きいidを持つデータを取得します。
|
166
|
+
# @return [Hash]
|
132
167
|
def get_deposits(count='', before='', after='')
|
133
168
|
params = Hash.new
|
134
169
|
params[:count] = count if count != ''
|
@@ -139,6 +174,11 @@ module Vexapion
|
|
139
174
|
end
|
140
175
|
|
141
176
|
#デポジット解約(出金)
|
177
|
+
# @param [String] currency 送付する通貨名を指定します。現在は"JPY"のみ対応しています。
|
178
|
+
# @param [Integer] id 出金先口座のidを指定します。
|
179
|
+
# @param [Integer] amount 解約する数量を指定します。
|
180
|
+
# @param [String] code 二段階認証の確認コードです。出金時の二段階認証を設定している場合のみ必要。
|
181
|
+
# @return [Hash]
|
142
182
|
def withdraw(currency, id, amount, code='')
|
143
183
|
params = {
|
144
184
|
currency_code: currency.upcase,
|
@@ -151,6 +191,10 @@ module Vexapion
|
|
151
191
|
end
|
152
192
|
|
153
193
|
#デポジット解約履歴(出金)
|
194
|
+
# @param [Integer] count 結果の個数を指定します。
|
195
|
+
# @param [Integer] before このパラメータに指定した値より小さいidを持つデータを取得します。
|
196
|
+
# @param [Integer] after このパラメータに指定した値より大きいidを持つデータを取得します。
|
197
|
+
# @return [Hash]
|
154
198
|
def get_withdrawals(count='', before='', after='')
|
155
199
|
params = Hash.new
|
156
200
|
params[:count] = count if count != ''
|
@@ -161,11 +205,18 @@ module Vexapion
|
|
161
205
|
end
|
162
206
|
|
163
207
|
|
164
|
-
|
165
|
-
|
208
|
+
#指値で新規注文を出す
|
209
|
+
# @param [String] pair product_codeを指定します。
|
210
|
+
# @param [String] side 買い注文の場合は"BUY"、売り注文の場合は"SELL"を指定します。
|
211
|
+
# @param [Float] price 価格を指定します。 ただしJPYの場合はInteger
|
212
|
+
# @param [Float] size 注文数量を指定します。
|
213
|
+
# @param [Integer] expire 期限切れまでの時間を分で指定します。省略した場合の値は525600(365日間)です。
|
214
|
+
# @param [String] force 執行数量条件を"GTC"、"IOC"、"FOK"のいずれかで指定します。省略した場合は"GTC"です。
|
215
|
+
# @return [Hash]
|
216
|
+
def send_child_order(pair, side, price, size, expire='', force='')
|
166
217
|
params = {
|
167
218
|
product_code: pair.upcase,
|
168
|
-
child_order_type:
|
219
|
+
child_order_type: 'LIMIT',
|
169
220
|
side: side.upcase,
|
170
221
|
price: price,
|
171
222
|
size: size.to_f
|
@@ -176,7 +227,30 @@ module Vexapion
|
|
176
227
|
post('sendchildorder', params)
|
177
228
|
end
|
178
229
|
|
230
|
+
#成行で新規注文を出す
|
231
|
+
# @param [String] pair product_codeを指定します。
|
232
|
+
# @param [String] side 買い注文の場合は"BUY"、売り注文の場合は"SELL"を指定します。
|
233
|
+
# @param [Float] size 注文数量を指定します。
|
234
|
+
# @param [Integer] expire 期限切れまでの時間を分で指定します。省略した場合の値は525600(365日間)です。
|
235
|
+
# @param [String] force 執行数量条件を"GTC"、"IOC"、"FOK"のいずれかで指定します。省略した場合は"GTC"です。
|
236
|
+
# @return [Hash]
|
237
|
+
def send_child_order_market(pair, side, size, expire='', force='')
|
238
|
+
params = {
|
239
|
+
product_code: pair.upcase,
|
240
|
+
child_order_type: 'MARKET',
|
241
|
+
side: side.upcase,
|
242
|
+
size: size.to_f
|
243
|
+
}
|
244
|
+
params[:minute_to_expire] = expire if expire != ''
|
245
|
+
params[:time_in_force] = force if force != ''
|
246
|
+
|
247
|
+
post('sendchildorder', params)
|
248
|
+
end
|
249
|
+
|
179
250
|
#child_order_idを指定して、注文をキャンセルする
|
251
|
+
# @param [String] pair product_codeを指定します。
|
252
|
+
# @param [Integer] order_id child_order_idを指定します。
|
253
|
+
# @return [Hash]
|
180
254
|
def cancel_child_order(pair, order_id)
|
181
255
|
params = {
|
182
256
|
product_code: pair.upcase,
|
@@ -187,6 +261,9 @@ module Vexapion
|
|
187
261
|
end
|
188
262
|
|
189
263
|
#child_order_acceptance_idを指定して、注文をキャンセルする
|
264
|
+
# @param [String] pair product_codeを指定します。
|
265
|
+
# @param [Integer] child_order_acceptance_id child_order_acceptance_idを指定します。
|
266
|
+
# @return [Hash]
|
190
267
|
def cancel_child_order_specify_acceptance_id(pair, acceptance_id)
|
191
268
|
params = {
|
192
269
|
product_code: pair.upcase,
|
@@ -199,11 +276,14 @@ module Vexapion
|
|
199
276
|
#新規の親注文を出す(特殊注文)
|
200
277
|
#https://lightning.bitflyer.jp/docs/specialorder を熟読して使用のこと
|
201
278
|
#とても自由度が高いため、ユーザーがパラメータを組み立ててそれを引数にする
|
279
|
+
# @return [Hash]
|
202
280
|
#def send_parent_order(params)
|
203
281
|
# post('sendparentorder', params)
|
204
282
|
#end
|
205
283
|
|
206
284
|
#parent_order_idを指定して、親注文をキャンセルする
|
285
|
+
# @param [String] pair product_codeを指定します。
|
286
|
+
# @return [Hash]
|
207
287
|
#def cancel_parent_order(pair, order_id)
|
208
288
|
# params = {
|
209
289
|
# product_code: pair.upcase,
|
@@ -214,6 +294,8 @@ module Vexapion
|
|
214
294
|
#end
|
215
295
|
|
216
296
|
#parent_order_acceptance_idを指定して、親注文をキャンセルする
|
297
|
+
# @param [String] pair product_codeを指定します。
|
298
|
+
# @return [Hash]
|
217
299
|
#def cancel_parent_order_specify_acceptance_id(pair, acceptance_id)
|
218
300
|
# params = {
|
219
301
|
# product_code: pair.upcase,
|
@@ -223,17 +305,25 @@ module Vexapion
|
|
223
305
|
#end
|
224
306
|
|
225
307
|
#すべての注文をキャンセルする
|
308
|
+
# @param [String] pair product_codeを指定します。
|
309
|
+
# @return [Hash]
|
226
310
|
def cancel_all_child_order(pair)
|
227
311
|
post('cancelallchildorders', product_code: pair.upcase)
|
228
312
|
end
|
229
313
|
|
230
314
|
#注文の一覧を取得
|
231
|
-
|
315
|
+
#stateが指定されない場合、ACTIVE, COMPLETED, CANCELED, RXPIRED, REJECTEDのすべてが返されます。
|
316
|
+
# @param [String] pair product_codeを指定します。
|
317
|
+
# @param [String] state ACTIVE, COMPLETED, CANCELED, RXPIRED, REJECTEDのいずれかを指定します。省略可。
|
318
|
+
# @param [Integer] count 結果の個数を指定します。
|
319
|
+
# @param [Integer] before このパラメータに指定した値より小さいidを持つデータを取得します。
|
320
|
+
# @param [Integer] after このパラメータに指定した値より大きいidを持つデータを取得します。
|
321
|
+
# @return [Hash]
|
322
|
+
def get_child_orders(pair, state='', count='', before='', after='')
|
232
323
|
params = {
|
233
324
|
product_code: pair.upcase
|
234
325
|
}
|
235
326
|
params[:child_order_state] = state if state != ''
|
236
|
-
params[:parent_order_id] = pid if pid != ''
|
237
327
|
params[:count] = count if count != ''
|
238
328
|
params[:before] = before if before != ''
|
239
329
|
params[:after] = after if after != ''
|
@@ -241,7 +331,26 @@ module Vexapion
|
|
241
331
|
get('getchildorders', params)
|
242
332
|
end
|
243
333
|
|
334
|
+
#parent_order_idに関連した注文の一覧を取得
|
335
|
+
# @param [String] pair product_codeを指定します。
|
336
|
+
# @param [Integer] parent_order_id parent_order_idを指定します。
|
337
|
+
# @return [Hash]
|
338
|
+
def get_child_orders_parent_order_id(pair, parent_order_id)
|
339
|
+
params = {
|
340
|
+
product_code: pair.upcase,
|
341
|
+
parent_order_id: parent_order_id
|
342
|
+
}
|
343
|
+
|
344
|
+
get('getchildorders', params)
|
345
|
+
end
|
346
|
+
|
244
347
|
#親注文の一覧を取得
|
348
|
+
# @param [String] pair product_codeを指定します。
|
349
|
+
# @param [String] state ACTIVE, COMPLETED, CANCELED, RXPIRED, REJECTEDのいずれかを指定します。省略可。
|
350
|
+
# @param [Integer] count 結果の個数を指定します。
|
351
|
+
# @param [Integer] before このパラメータに指定した値より小さいidを持つデータを取得します。
|
352
|
+
# @param [Integer] after このパラメータに指定した値より大きいidを持つデータを取得します。
|
353
|
+
# @return [Hash]
|
245
354
|
#def get_parent_orders(pair, state='', count='', before='', after='')
|
246
355
|
# params = {
|
247
356
|
# product_code: pair.upcase
|
@@ -255,25 +364,30 @@ module Vexapion
|
|
255
364
|
#end
|
256
365
|
|
257
366
|
#parent_order_idを指定して、親注文の詳細を取得
|
367
|
+
# @param [Integer] parent_order_id parent_order_idを指定します。
|
368
|
+
# @return [Hash]
|
258
369
|
#def get_parent_order(parent_order_id)
|
259
370
|
# get('getparentorder', parent_order_id: parent_order_id)
|
260
371
|
#end
|
261
372
|
|
262
373
|
#parent_order_acceptance_idを指定して、親注文の詳細を取得
|
374
|
+
# @param [Integer] parent_order_acceptance_id parent_order_acceptance_idを指定します。
|
375
|
+
# @return [Hash]
|
263
376
|
#def get_parent_order_specify_acceptance_id(acceptance_id)
|
264
377
|
# get('getparentorder', parent_order_acceptance_id: acceptance_id)
|
265
378
|
#end
|
266
379
|
|
267
380
|
#約定の一覧を取得
|
268
|
-
|
269
|
-
|
381
|
+
# @param [String] pair product_codeを指定します。
|
382
|
+
# @param [Integer] count 結果の個数を指定します。
|
383
|
+
# @param [Integer] before このパラメータに指定した値より小さいidを持つデータを取得します。
|
384
|
+
# @param [Integer] after このパラメータに指定した値より大きいidを持つデータを取得します。
|
385
|
+
# @return [Hash]
|
386
|
+
def get_executions(pair, count='', before='', after='')
|
387
|
+
#必須パラメータ
|
270
388
|
params = {
|
271
389
|
product_code: pair.upcase
|
272
390
|
}
|
273
|
-
params['child_order_id'] = coid if coid != ''
|
274
|
-
if child_order_acceptance_id != ''
|
275
|
-
params['child_order_acceptance_id'] = child_order_acceptance_id
|
276
|
-
end
|
277
391
|
params[:count] = count if count != ''
|
278
392
|
params[:before] = before if before != ''
|
279
393
|
params[:after] = after if after != ''
|
@@ -281,9 +395,42 @@ module Vexapion
|
|
281
395
|
get('getexecutions', params)
|
282
396
|
end
|
283
397
|
|
284
|
-
|
285
|
-
|
286
|
-
|
398
|
+
#child_order_idに関連した約定の一覧を取得
|
399
|
+
# @param [String] pair product_codeを指定します。
|
400
|
+
# @param [Integer] child_order_id child_order_idを指定します。
|
401
|
+
# @return [Hash]
|
402
|
+
def get_executions_child_order_id(pair, child_order_id)
|
403
|
+
#必須パラメータ
|
404
|
+
params = {
|
405
|
+
product_code: pair.upcase,
|
406
|
+
child_order_id: child_order_id
|
407
|
+
}
|
408
|
+
|
409
|
+
get('getexecutions', params)
|
410
|
+
end
|
411
|
+
|
412
|
+
#child_order_acceptance_idに関連した約定の一覧を取得
|
413
|
+
# @param [String] pair product_codeを指定します。
|
414
|
+
# @param [Integer] child_order_acceptance_id child_order_acceptance_idを指定します。
|
415
|
+
# @return [Hash]
|
416
|
+
def get_executions_acceptance_id(pair, child_order_acceptance_id='')
|
417
|
+
params = {
|
418
|
+
product_code: pair.upcase,
|
419
|
+
child_order_acceptance_id: child_order_acceptance_id
|
420
|
+
}
|
421
|
+
|
422
|
+
get('getexecutions', params)
|
423
|
+
end
|
424
|
+
|
425
|
+
# 建玉の一覧を取得
|
426
|
+
# @param [String] pair product_codeを指定します。 "FX_BTC_JPY"を指定します。
|
427
|
+
# @return [Hash]
|
428
|
+
def get_positions(pair)
|
429
|
+
params = {
|
430
|
+
product_code: pair.upcase
|
431
|
+
}
|
432
|
+
|
433
|
+
get('getpositions', params)
|
287
434
|
end
|
288
435
|
|
289
436
|
|
@@ -331,7 +478,7 @@ module Vexapion
|
|
331
478
|
request.body = body
|
332
479
|
|
333
480
|
res = do_command(uri, request)
|
334
|
-
error_check(res)
|
481
|
+
#error_check(res)
|
335
482
|
res
|
336
483
|
end
|
337
484
|
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
# 新しい取引所を追加するときに利用するテンプレート
|
4
|
+
|
5
|
+
require 'vexapion'
|
6
|
+
|
7
|
+
module Vexapion
|
8
|
+
|
9
|
+
# ....のAPIラッパークラスです。
|
10
|
+
# 各メソッドの戻り値は下記URLを参照してください。
|
11
|
+
# @see http://....
|
12
|
+
|
13
|
+
class NewExchangesName < BaseExchanges
|
14
|
+
|
15
|
+
def initialize(key = nil, secret = nil)
|
16
|
+
super(key,secret)
|
17
|
+
|
18
|
+
@public_url = 'https://...'
|
19
|
+
@private_url = 'https://...'
|
20
|
+
end
|
21
|
+
|
22
|
+
def available_pair
|
23
|
+
end
|
24
|
+
|
25
|
+
# Public API
|
26
|
+
|
27
|
+
# @raise RequestFailed APIリクエストの失敗
|
28
|
+
# @raise SocketError ソケットエラー
|
29
|
+
# @raise RetryException リクエストの結果が確認できないとき 408, 500, 503
|
30
|
+
# @raise Warning 何かがおかしいと時(200 && response.body == nil), 509
|
31
|
+
# @raise Error クライアントエラー 400, 401, 403
|
32
|
+
# @raise Fatal APIラッパーの修正が必要と思われるエラー, 404
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
# 例:ティッカー
|
37
|
+
# @param [String] pair 取得したい通貨ペア
|
38
|
+
# @return [Hash]
|
39
|
+
def ticker(pair)
|
40
|
+
get('ticker', pair)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Private API
|
44
|
+
|
45
|
+
|
46
|
+
# 未約定の注文一覧を取得します
|
47
|
+
# @param [String] pair トレードしたい通貨ペア
|
48
|
+
# @param [String] action 注文の種類 ask(売)/bid(買)
|
49
|
+
# @param [Float] price 注文価格(ただしBTC_JPYの時はInteger)
|
50
|
+
# @param [Float] amount 注文量
|
51
|
+
# @param [Float] limit リミット注文価格(ただしBTC_JPYの時はInteger)
|
52
|
+
# @return [Hash]
|
53
|
+
def trade(pair, action, price, amount, limit = '')
|
54
|
+
params = {
|
55
|
+
currency_pair: pair,
|
56
|
+
action: action,
|
57
|
+
price: price,
|
58
|
+
amount: amount
|
59
|
+
}
|
60
|
+
params['limit'] = limit if limit != ''
|
61
|
+
|
62
|
+
post('trade', params)
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
# Create request header & body
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def get(method, pair)
|
71
|
+
url = "#{@public_url}#{method.downcase}/#{pair.downcase}"
|
72
|
+
uri = URI.parse url
|
73
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
74
|
+
|
75
|
+
do_command(uri, request)
|
76
|
+
end
|
77
|
+
|
78
|
+
def post(method, params = {})
|
79
|
+
uri = URI.parse @private_url
|
80
|
+
params['method'] = method
|
81
|
+
params['nonce'] = get_nonce
|
82
|
+
|
83
|
+
request = Net::HTTP::Post.new(uri)
|
84
|
+
request.set_form_data(params) #クエリをURLエンコード (p1=v1&p2=v2...)
|
85
|
+
request['Key'] = @key
|
86
|
+
request['Sign'] = signature(request)
|
87
|
+
|
88
|
+
res = do_command(uri, request)
|
89
|
+
error_check(res)
|
90
|
+
res
|
91
|
+
end
|
92
|
+
|
93
|
+
def delete(method)
|
94
|
+
nonce = get_nonce.to_s
|
95
|
+
uri = URI.parse "#{@private_url}#{method}"
|
96
|
+
message = "#{nonce}#{uri.to_s}"
|
97
|
+
sig = signature(message)
|
98
|
+
header = headers(nonce, sig)
|
99
|
+
request = Net::HTTP::Delete.new(uri.request_uri, headers)
|
100
|
+
|
101
|
+
res = do_command(uri, request)
|
102
|
+
error_check(res) #TODO check require
|
103
|
+
res
|
104
|
+
end
|
105
|
+
|
106
|
+
def signature(req)
|
107
|
+
algo = OpenSSL::Digest.new('sha512')
|
108
|
+
OpenSSL::HMAC.hexdigest(algo, @secret, req.body)
|
109
|
+
end
|
110
|
+
|
111
|
+
def header(nonce, signature)
|
112
|
+
{
|
113
|
+
'Content-Type' => 'application/json',
|
114
|
+
'ACCESS-KEY' => '@key,
|
115
|
+
'ACCESS-NONCE' => nonce,
|
116
|
+
'ACCESS-SIGNATURE' => signature
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
120
|
+
end #of class
|
121
|
+
end #of Vexapion module
|
data/lib/vexapion/version.rb
CHANGED
data/lib/vexapion/zaif.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vexapion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fuyuton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bigdecimal
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.2.6
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 1.2.6
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: json
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.8'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.8'
|
41
13
|
- !ruby/object:Gem::Dependency
|
42
14
|
name: bundler
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,6 +53,7 @@ files:
|
|
81
53
|
- lib/vexapion/errors/http_errors.rb
|
82
54
|
- lib/vexapion/errors/vexapion_errors.rb
|
83
55
|
- lib/vexapion/poloniex.rb
|
56
|
+
- lib/vexapion/template.rb
|
84
57
|
- lib/vexapion/version.rb
|
85
58
|
- lib/vexapion/zaif.rb
|
86
59
|
homepage: https://github.com/fuyuton/vexapion
|