bitso-ruby 0.0.2
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 +7 -0
- data/README.md +8 -0
- data/lib/bitso.rb +128 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1d9bc223bddf2b4ca1002afb54b979452e84ee882980c089b50b6e5e5d35b3ac
|
4
|
+
data.tar.gz: 11d2f0526d6e990847e440e32e99e7e5203f4b71ad8cb0c03ef0e663459b9959
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8fc0e89b43ac71a6a1719f7f569c971387f2cff8bd2c086d28a5c848c59705e8d0254f2760c50afbb03ceb518b9c8ab06821d070562b9981ca424691eb920c78
|
7
|
+
data.tar.gz: c538de12903adbe6a5d2c7b81900d66ef02dfd28a50bdbd4d619a8ea0d95445520f64be687f8f849f9a44b21b02d76c6b2b99dc8c803a7631fb17a7762ee7d73
|
data/README.md
ADDED
data/lib/bitso.rb
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rest-client'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
# Clase principal
|
7
|
+
class Bitso
|
8
|
+
URI = 'https://api.bitso.com/v3/'
|
9
|
+
def initialize(key, secret)
|
10
|
+
@key = key
|
11
|
+
@secret = secret
|
12
|
+
end
|
13
|
+
|
14
|
+
def available_books
|
15
|
+
@response = RestClient.get URI + 'available_books'
|
16
|
+
resp @response.body
|
17
|
+
end
|
18
|
+
|
19
|
+
def ticker(params = nil)
|
20
|
+
@params = ''
|
21
|
+
@params = '?book=' + params unless params.nil?
|
22
|
+
@response = RestClient.get URI + 'ticker' + @params
|
23
|
+
resp @response.body
|
24
|
+
end
|
25
|
+
|
26
|
+
def order_book(params)
|
27
|
+
@params = '?book=' + params unless params.nil?
|
28
|
+
@response = RestClient.get URI + 'order_book' + @params
|
29
|
+
resp @response.body
|
30
|
+
end
|
31
|
+
|
32
|
+
def trades(params)
|
33
|
+
@params = '?book=' + params unless params.nil?
|
34
|
+
@response = RestClient.get URI + 'trades' + @params
|
35
|
+
resp @response.body
|
36
|
+
end
|
37
|
+
|
38
|
+
def account_status
|
39
|
+
@nonce = Time.now.to_i
|
40
|
+
@message = "#{@nonce}GET/v3/account_status"
|
41
|
+
@signature = OpenSSL::HMAC.hexdigest('sha256', @secret, @message)
|
42
|
+
@response = RestClient::Request.execute(
|
43
|
+
method: :get,
|
44
|
+
url: URI + 'account_status',
|
45
|
+
headers: { Authorization: "Bitso #{@key}:#{@nonce}:#{@signature}" },
|
46
|
+
content_type: :json)
|
47
|
+
resp @response.body
|
48
|
+
end
|
49
|
+
|
50
|
+
def balance
|
51
|
+
@nonce = Time.now.to_i
|
52
|
+
@message = "#{@nonce}GET/v3/balance"
|
53
|
+
@signature = OpenSSL::HMAC.hexdigest('sha256', @secret, @message)
|
54
|
+
@response = RestClient::Request.execute(
|
55
|
+
method: :get,
|
56
|
+
url: URI + 'balance',
|
57
|
+
headers: { Authorization: "Bitso #{@key}:#{@nonce}:#{@signature}" },
|
58
|
+
content_type: :json)
|
59
|
+
resp @response.body
|
60
|
+
end
|
61
|
+
|
62
|
+
def ledger
|
63
|
+
@nonce = Time.now.to_i
|
64
|
+
@message = "#{@nonce}GET/v3/ledger"
|
65
|
+
@signature = OpenSSL::HMAC.hexdigest('sha256', @secret, @message)
|
66
|
+
@response = RestClient::Request.execute(
|
67
|
+
method: :get,
|
68
|
+
url: URI + 'ledger',
|
69
|
+
headers: { Authorization: "Bitso #{@key}:#{@nonce}:#{@signature}" },
|
70
|
+
content_type: :json)
|
71
|
+
resp @response.body
|
72
|
+
end
|
73
|
+
def withdrawals
|
74
|
+
@nonce = Time.now.to_i
|
75
|
+
@message = "#{@nonce}GET/v3/withdrawals"
|
76
|
+
@signature = OpenSSL::HMAC.hexdigest('sha256', @secret, @message)
|
77
|
+
@response = RestClient::Request.execute(
|
78
|
+
method: :get,
|
79
|
+
url: URI + 'withdrawals',
|
80
|
+
headers: { Authorization: "Bitso #{@key}:#{@nonce}:#{@signature}" },
|
81
|
+
content_type: :json)
|
82
|
+
resp @response.body
|
83
|
+
end
|
84
|
+
def fundings
|
85
|
+
@nonce = Time.now.to_i
|
86
|
+
@message = "#{@nonce}GET/v3/fundings"
|
87
|
+
@signature = OpenSSL::HMAC.hexdigest('sha256', @secret, @message)
|
88
|
+
@response = RestClient::Request.execute(
|
89
|
+
method: :get,
|
90
|
+
url: URI + 'fundings',
|
91
|
+
headers: { Authorization: "Bitso #{@key}:#{@nonce}:#{@signature}" },
|
92
|
+
content_type: :json)
|
93
|
+
resp @response.body
|
94
|
+
end
|
95
|
+
|
96
|
+
def user_trades
|
97
|
+
@nonce = Time.now.to_i
|
98
|
+
@message = "#{@nonce}GET/v3/user_trades"
|
99
|
+
@signature = OpenSSL::HMAC.hexdigest('sha256', @secret, @message)
|
100
|
+
@response = RestClient::Request.execute(
|
101
|
+
method: :get,
|
102
|
+
url: URI + 'user_trades',
|
103
|
+
headers: { Authorization: "Bitso #{@key}:#{@nonce}:#{@signature}" },
|
104
|
+
content_type: :json)
|
105
|
+
resp @response.body
|
106
|
+
end
|
107
|
+
|
108
|
+
def open_orders(params)
|
109
|
+
@nonce = Time.now.to_i
|
110
|
+
@message = "#{@nonce}GET/v3/open_orders?book=#{params}"
|
111
|
+
@signature = OpenSSL::HMAC.hexdigest('sha256', @secret, @message)
|
112
|
+
@response = RestClient::Request.execute(
|
113
|
+
method: :get,
|
114
|
+
url: URI + "open_orders?book=#{params}",
|
115
|
+
headers: { Authorization: "Bitso #{@key}:#{@nonce}:#{@signature}" },
|
116
|
+
content_type: :json)
|
117
|
+
resp @response.body
|
118
|
+
end
|
119
|
+
|
120
|
+
def resp(response)
|
121
|
+
@json = JSON.parse(response)
|
122
|
+
if @json['success']
|
123
|
+
@json['payload']
|
124
|
+
else
|
125
|
+
@json['error']
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bitso-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shadow Myst
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-09 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Wrapper para conectarse al API de Bitso
|
14
|
+
email:
|
15
|
+
- theshadowmyst@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- README.md
|
21
|
+
- lib/bitso.rb
|
22
|
+
homepage: https://shadowmyst.net
|
23
|
+
licenses: []
|
24
|
+
metadata:
|
25
|
+
source_code_uri: https://github.com/ShadowMyst/bitso-ruby.git
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubygems_version: 3.0.6
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Bitso API No oficial
|
45
|
+
test_files: []
|