bittrex-pro 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +58 -0
  3. data/.gitignore +28 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +2 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +53 -0
  8. data/Rakefile +11 -0
  9. data/bittrex-pro.gemspec +30 -0
  10. data/config/application.yml.example +2 -0
  11. data/lib/bittrex.rb +32 -0
  12. data/lib/bittrex/client.rb +46 -0
  13. data/lib/bittrex/configuration.rb +33 -0
  14. data/lib/bittrex/currency.rb +27 -0
  15. data/lib/bittrex/deposit.rb +29 -0
  16. data/lib/bittrex/helpers.rb +10 -0
  17. data/lib/bittrex/market.rb +31 -0
  18. data/lib/bittrex/order.rb +94 -0
  19. data/lib/bittrex/quote.rb +26 -0
  20. data/lib/bittrex/summary.rb +38 -0
  21. data/lib/bittrex/version.rb +3 -0
  22. data/lib/bittrex/wallet.rb +32 -0
  23. data/lib/bittrex/withdrawal.rb +42 -0
  24. data/spec/fixtures/currency.json +7 -0
  25. data/spec/fixtures/deposit.json +9 -0
  26. data/spec/fixtures/market.json +12 -0
  27. data/spec/fixtures/open_order.json +17 -0
  28. data/spec/fixtures/order.json +16 -0
  29. data/spec/fixtures/quote.json +5 -0
  30. data/spec/fixtures/summary.json +16 -0
  31. data/spec/fixtures/wallet.json +9 -0
  32. data/spec/fixtures/withdrawal.json +13 -0
  33. data/spec/models/configuration_spec.rb +27 -0
  34. data/spec/models/currency_spec.rb +14 -0
  35. data/spec/models/deposit_spec.rb +16 -0
  36. data/spec/models/helper_spec.rb +36 -0
  37. data/spec/models/market_spec.rb +17 -0
  38. data/spec/models/order_spec.rb +45 -0
  39. data/spec/models/quote_spec.rb +13 -0
  40. data/spec/models/summary_spec.rb +22 -0
  41. data/spec/models/wallet_spec.rb +16 -0
  42. data/spec/models/withdrawal_spec.rb +20 -0
  43. data/spec/spec_helper.rb +24 -0
  44. data/spec/support/api_helper.rb +9 -0
  45. metadata +220 -0
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bittrex::Market do
4
+ let(:data){ fixture(:market) }
5
+ let(:subject){ Bittrex::Market.new(data) }
6
+
7
+ describe '#initialization' do
8
+ it { should_assign_attribute(subject, :name, 'BTC-LTC') }
9
+ it { should_assign_attribute(subject, :currency, 'LTC') }
10
+ it { should_assign_attribute(subject, :base, 'BTC') }
11
+ it { should_assign_attribute(subject, :currency_name, 'Litecoin') }
12
+ it { should_assign_attribute(subject, :base_name, 'Bitcoin') }
13
+ it { should_assign_attribute(subject, :minimum_trade, 0.01) }
14
+ it { should_assign_attribute(subject, :active, true) }
15
+ it { should_assign_attribute(subject, :created_at, DateTime.parse('2014-02-13T00:00:00')) }
16
+ end
17
+ end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bittrex::Order do
4
+ let(:data){ fixture(:order) }
5
+ let(:subject){ Bittrex::Order.new(data) }
6
+
7
+ attr_reader :type, :id, :quantity, :rate, :total, :fill, :raw, :executed_at, :commission, :opened_at, :closed_at
8
+
9
+ describe "closed order" do
10
+ context '#initialization' do
11
+ it { should_assign_attribute(subject, :id, '1af0399d-e845-4xxx-9d85-aa332d831e95') }
12
+ it { should_assign_attribute(subject, :type, 'Limit_sell') }
13
+ it { should_assign_attribute(subject, :exchange, 'BTC-HPY') }
14
+ it { should_assign_attribute(subject, :quantity, 371810.26006413) }
15
+ it { should_assign_attribute(subject, :remaining, 371810.26006413) }
16
+ it { should_assign_attribute(subject, :limit, 0.00000016) }
17
+ it { should_assign_attribute(subject, :price, 0.0) }
18
+ it { should_assign_attribute(subject, :total, nil) }
19
+ it { should_assign_attribute(subject, :fill, nil) }
20
+ it { should_assign_attribute(subject, :executed_at, DateTime.parse('2014-06-21T04:08:08.75')) }
21
+ it { should_assign_attribute(subject, :opened_at, nil) }
22
+ it { should_assign_attribute(subject, :closed_at, nil) }
23
+ end
24
+ end
25
+
26
+ describe "open order" do
27
+ let(:data) { fixture(:open_order) }
28
+
29
+ context '#initialization' do
30
+ it { should_assign_attribute(subject, :id, '1af0399d-e845-4xxx-9d85-aa332d831e95') }
31
+ it { should_assign_attribute(subject, :type, 'Limit_sell') }
32
+ it { should_assign_attribute(subject, :exchange, 'BTC-HPY') }
33
+ it { should_assign_attribute(subject, :quantity, 371810.26006413) }
34
+ it { should_assign_attribute(subject, :remaining, 371810.26006413) }
35
+ it { should_assign_attribute(subject, :limit, 0.00000016) }
36
+ it { should_assign_attribute(subject, :commission, 0.0) }
37
+ it { should_assign_attribute(subject, :price, 0.0) }
38
+ it { should_assign_attribute(subject, :total, nil) }
39
+ it { should_assign_attribute(subject, :fill, nil) }
40
+ it { should_assign_attribute(subject, :executed_at, nil) }
41
+ it { should_assign_attribute(subject, :opened_at, DateTime.parse('2014-06-21T04:08:08.75')) }
42
+ it { should_assign_attribute(subject, :closed_at, DateTime.parse('2014-06-22T04:08:08.75')) }
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bittrex::Quote do
4
+ let(:data){ fixture(:quote) }
5
+ let(:subject){ Bittrex::Quote.new('BTC-HPY', data) }
6
+
7
+ describe '#initialization' do
8
+ it { should_assign_attribute(subject, :market, 'BTC-HPY') }
9
+ it { should_assign_attribute(subject, :bid, 0.01607601) }
10
+ it { should_assign_attribute(subject, :ask, 0.01633299) }
11
+ it { should_assign_attribute(subject, :last, 0.01635099) }
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bittrex::Summary do
4
+ let(:data){ fixture(:summary) }
5
+ let(:subject){ Bittrex::Summary.new(data) }
6
+
7
+ describe '#initialization' do
8
+ it { should_assign_attribute(subject, :name, 'LTC-ZEIT') }
9
+ it { should_assign_attribute(subject, :high, 0.00000023) }
10
+ it { should_assign_attribute(subject, :low, 0.00000020) }
11
+ it { should_assign_attribute(subject, :volume, 1406611.43827056) }
12
+ it { should_assign_attribute(subject, :last, 0.00000020) }
13
+ it { should_assign_attribute(subject, :base_volume, 0.30179011) }
14
+ it { should_assign_attribute(subject, :ask, 2.3e-07) }
15
+ it { should_assign_attribute(subject, :bid, 2.0e-07) }
16
+ it { should_assign_attribute(subject, :open_buy_orders, 7) }
17
+ it { should_assign_attribute(subject, :open_sell_orders, 8) }
18
+ it { should_assign_attribute(subject, :previous_day, 2.2e-07) }
19
+ it { should_assign_attribute(subject, :updated_at, DateTime.parse('2014-06-26T05:22:57.673')) }
20
+ it { should_assign_attribute(subject, :created_at, DateTime.parse('2014-03-01T21:00:00.000')) }
21
+ end
22
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bittrex::Wallet do
4
+ let(:data){ fixture(:wallet) }
5
+ let(:subject){ Bittrex::Wallet.new(data) }
6
+
7
+ describe '#initialization' do
8
+ it { should_assign_attribute(subject, :id, '3dab465d-d0f2-4xxx-819f-aafad450f05b') }
9
+ it { should_assign_attribute(subject, :currency, 'CRYPT') }
10
+ it { should_assign_attribute(subject, :balance, 115.0) }
11
+ it { should_assign_attribute(subject, :available, 0.0) }
12
+ it { should_assign_attribute(subject, :pending, 0.0) }
13
+ it { should_assign_attribute(subject, :address, nil) }
14
+ it { should_assign_attribute(subject, :requested, false) }
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bittrex::Withdrawal do
4
+ let(:data){ fixture(:withdrawal) }
5
+ let(:subject){ Bittrex::Withdrawal.new(data) }
6
+
7
+ describe '#initialization' do
8
+ it { should_assign_attribute(subject, :id, 'c7f7b806-36cf-4xxx-b198-fcdeb1220762') }
9
+ it { should_assign_attribute(subject, :currency, 'BTC') }
10
+ it { should_assign_attribute(subject, :quantity, 0.0098) }
11
+ it { should_assign_attribute(subject, :address, '14UKkY9xxxvk79X7u1zYpxxxRUEQ8F7Lh5') }
12
+ it { should_assign_attribute(subject, :authorized, true) }
13
+ it { should_assign_attribute(subject, :pending, false) }
14
+ it { should_assign_attribute(subject, :canceled, false) }
15
+ it { should_assign_attribute(subject, :invalid_address, false) }
16
+ it { should_assign_attribute(subject, :transaction_cost, 0.0002) }
17
+ it { should_assign_attribute(subject, :transaction_id, '0b34fc4xxx102d0f80efddafexxx6b77c6ce170100b2a579ab5b5f493a383392') }
18
+ it { should_assign_attribute(subject, :executed_at, DateTime.parse('2014-06-26T05:37:55.083')) }
19
+ end
20
+ end
@@ -0,0 +1,24 @@
1
+ require 'json'
2
+ require 'simplecov'
3
+ SimpleCov.start
4
+
5
+ require 'rspec'
6
+ require 'bittrex-pro'
7
+
8
+ Dir[File.join(Bittrex.root, 'spec/fixtures/**/*.rb')].each { |f| require f }
9
+ Dir[File.join(Bittrex.root, 'spec/support/**/*.rb')].each {|f| require f}
10
+
11
+ RSpec.configure do |config|
12
+ config.before(:each) do
13
+ allow(Bittrex).to receive(:client)
14
+ end
15
+ end
16
+
17
+ def fixture(resource)
18
+ path = File.join(Bittrex.root, "spec/fixtures/#{resource}.json")
19
+ JSON.parse File.read(path)
20
+ end
21
+
22
+ def should_assign_attribute(subject, method, value)
23
+ expect(subject.send(method)).to eq(value)
24
+ end
@@ -0,0 +1,9 @@
1
+ module APIHelper
2
+ def should_assign_attribute(subject, method, value)
3
+ subject.send(method).should eq(value)
4
+ end
5
+ end
6
+
7
+ RSpec.configure do |config|
8
+ config.extend APIHelper
9
+ end
metadata ADDED
@@ -0,0 +1,220 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bittrex-pro
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Vertbase
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-10-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.9.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec_junit_formatter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: mocha
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: figaro
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: API Client for the Bittrex API
126
+ email:
127
+ - dev@vertbase.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".circleci/config.yml"
133
+ - ".gitignore"
134
+ - ".ruby-version"
135
+ - Gemfile
136
+ - LICENSE.txt
137
+ - README.md
138
+ - Rakefile
139
+ - bittrex-pro.gemspec
140
+ - config/application.yml.example
141
+ - lib/bittrex.rb
142
+ - lib/bittrex/client.rb
143
+ - lib/bittrex/configuration.rb
144
+ - lib/bittrex/currency.rb
145
+ - lib/bittrex/deposit.rb
146
+ - lib/bittrex/helpers.rb
147
+ - lib/bittrex/market.rb
148
+ - lib/bittrex/order.rb
149
+ - lib/bittrex/quote.rb
150
+ - lib/bittrex/summary.rb
151
+ - lib/bittrex/version.rb
152
+ - lib/bittrex/wallet.rb
153
+ - lib/bittrex/withdrawal.rb
154
+ - spec/fixtures/currency.json
155
+ - spec/fixtures/deposit.json
156
+ - spec/fixtures/market.json
157
+ - spec/fixtures/open_order.json
158
+ - spec/fixtures/order.json
159
+ - spec/fixtures/quote.json
160
+ - spec/fixtures/summary.json
161
+ - spec/fixtures/wallet.json
162
+ - spec/fixtures/withdrawal.json
163
+ - spec/models/configuration_spec.rb
164
+ - spec/models/currency_spec.rb
165
+ - spec/models/deposit_spec.rb
166
+ - spec/models/helper_spec.rb
167
+ - spec/models/market_spec.rb
168
+ - spec/models/order_spec.rb
169
+ - spec/models/quote_spec.rb
170
+ - spec/models/summary_spec.rb
171
+ - spec/models/wallet_spec.rb
172
+ - spec/models/withdrawal_spec.rb
173
+ - spec/spec_helper.rb
174
+ - spec/support/api_helper.rb
175
+ homepage: https://github.com/vertbase/bittrex-pro
176
+ licenses:
177
+ - MIT
178
+ metadata: {}
179
+ post_install_message:
180
+ rdoc_options: []
181
+ require_paths:
182
+ - lib
183
+ required_ruby_version: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ required_rubygems_version: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
193
+ requirements: []
194
+ rubyforge_project:
195
+ rubygems_version: 2.6.13
196
+ signing_key:
197
+ specification_version: 4
198
+ summary: API Client for the Bittrex API
199
+ test_files:
200
+ - spec/fixtures/currency.json
201
+ - spec/fixtures/deposit.json
202
+ - spec/fixtures/market.json
203
+ - spec/fixtures/open_order.json
204
+ - spec/fixtures/order.json
205
+ - spec/fixtures/quote.json
206
+ - spec/fixtures/summary.json
207
+ - spec/fixtures/wallet.json
208
+ - spec/fixtures/withdrawal.json
209
+ - spec/models/configuration_spec.rb
210
+ - spec/models/currency_spec.rb
211
+ - spec/models/deposit_spec.rb
212
+ - spec/models/helper_spec.rb
213
+ - spec/models/market_spec.rb
214
+ - spec/models/order_spec.rb
215
+ - spec/models/quote_spec.rb
216
+ - spec/models/summary_spec.rb
217
+ - spec/models/wallet_spec.rb
218
+ - spec/models/withdrawal_spec.rb
219
+ - spec/spec_helper.rb
220
+ - spec/support/api_helper.rb