bittrex 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +57 -0
- data/.ruby-version +1 -1
- data/bittrex.gemspec +1 -0
- data/lib/bittrex.rb +1 -0
- data/lib/bittrex/deposit.rb +3 -1
- data/lib/bittrex/helpers.rb +8 -0
- data/lib/bittrex/market.rb +3 -1
- data/lib/bittrex/order.rb +8 -4
- data/lib/bittrex/quote.rb +1 -0
- data/lib/bittrex/summary.rb +3 -1
- data/lib/bittrex/version.rb +1 -1
- data/lib/bittrex/withdrawal.rb +3 -1
- data/spec/fixtures/open_order.json +17 -0
- data/spec/models/order_spec.rb +36 -12
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dad1b17f535502441708ef65e4c5b83b7d8d6cb
|
4
|
+
data.tar.gz: 2d7a5d84190b5b8778a70164335e623181121a7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a1b15f16822ebd7e88d089c212f5d4562a7cbb04528b8cc15074008c0c83c91fab631b38a7adee526c4576958d8854cbbb5352fb646b8a2ff1fa95b8708ecfa
|
7
|
+
data.tar.gz: 1bfb9206a91e60559a5f8362400529a6999be713e7f6617270fe73f679e8b0bcc5539b5dfb7e799c1f5208fc243932da056a321cad6ecf3b97135b4727beec45
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
# specify the version you desire here
|
10
|
+
- image: circleci/ruby:2.3.3-node-browsers
|
11
|
+
|
12
|
+
# Specify service dependencies here if necessary
|
13
|
+
# CircleCI maintains a library of pre-built images
|
14
|
+
# documented at https://circleci.com/docs/2.0/circleci-images/
|
15
|
+
# - image: circleci/postgres:9.4
|
16
|
+
|
17
|
+
working_directory: ~/repo
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- checkout
|
21
|
+
|
22
|
+
# Download and cache dependencies
|
23
|
+
- restore_cache:
|
24
|
+
keys:
|
25
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
26
|
+
# fallback to using the latest cache if no exact match is found
|
27
|
+
- v1-dependencies-
|
28
|
+
|
29
|
+
- run:
|
30
|
+
name: install dependencies
|
31
|
+
command: |
|
32
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
33
|
+
|
34
|
+
- save_cache:
|
35
|
+
paths:
|
36
|
+
- ./vendor/bundle
|
37
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
38
|
+
|
39
|
+
# run tests!
|
40
|
+
- run:
|
41
|
+
name: run tests
|
42
|
+
command: |
|
43
|
+
mkdir /tmp/test-results
|
44
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
45
|
+
|
46
|
+
bundle exec rspec --format progress \
|
47
|
+
--format RspecJunitFormatter \
|
48
|
+
--out /tmp/test-results/rspec.xml \
|
49
|
+
--format progress \
|
50
|
+
"${TEST_FILES}"
|
51
|
+
|
52
|
+
# collect reports
|
53
|
+
- store_test_results:
|
54
|
+
path: /tmp/test-results
|
55
|
+
- store_artifacts:
|
56
|
+
path: /tmp/test-results
|
57
|
+
destination: test-results
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.4
|
data/bittrex.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.6"
|
24
24
|
spec.add_development_dependency "rake"
|
25
25
|
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "rspec_junit_formatter"
|
26
27
|
spec.add_development_dependency "simplecov"
|
27
28
|
spec.add_development_dependency "mocha"
|
28
29
|
spec.add_development_dependency "figaro"
|
data/lib/bittrex.rb
CHANGED
data/lib/bittrex/deposit.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Bittrex
|
2
2
|
class Deposit
|
3
|
+
include Helpers
|
4
|
+
|
3
5
|
attr_reader :id, :transaction_id, :address, :quantity, :currency, :confirmations, :executed_at
|
4
6
|
|
5
7
|
def initialize(attrs = {})
|
@@ -9,7 +11,7 @@ module Bittrex
|
|
9
11
|
@quantity = attrs['Amount']
|
10
12
|
@currency = attrs['Currency']
|
11
13
|
@confirmations = attrs['Confirmations']
|
12
|
-
@executed_at =
|
14
|
+
@executed_at = extract_timestamp(attrs['LastUpdated'])
|
13
15
|
end
|
14
16
|
|
15
17
|
def self.all
|
data/lib/bittrex/market.rb
CHANGED
@@ -2,6 +2,8 @@ require 'time'
|
|
2
2
|
|
3
3
|
module Bittrex
|
4
4
|
class Market
|
5
|
+
include Helpers
|
6
|
+
|
5
7
|
attr_reader :name, :currency, :base, :currency_name, :base_name, :minimum_trade, :active, :created_at, :raw
|
6
8
|
|
7
9
|
def initialize(attrs = {})
|
@@ -12,7 +14,7 @@ module Bittrex
|
|
12
14
|
@base_name = attrs['BaseCurrencyLong']
|
13
15
|
@minimum_trade = attrs['MinTradeSize']
|
14
16
|
@active = attrs['IsActive']
|
15
|
-
@created_at =
|
17
|
+
@created_at = extract_timestamp(attrs['Created'])
|
16
18
|
@raw = attrs
|
17
19
|
end
|
18
20
|
|
data/lib/bittrex/order.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
module Bittrex
|
2
2
|
class Order
|
3
|
-
|
4
|
-
|
3
|
+
include Helpers
|
4
|
+
|
5
|
+
attr_reader :type, :id, :limit, :opened_at, :closed_at,
|
6
|
+
:exchange, :price, :quantity, :remaining, :commission,
|
5
7
|
:total, :fill, :executed_at, :raw
|
6
8
|
|
7
9
|
def initialize(attrs = {})
|
@@ -14,9 +16,11 @@ module Bittrex
|
|
14
16
|
@total = attrs['Total']
|
15
17
|
@fill = attrs['FillType']
|
16
18
|
@limit = attrs['Limit']
|
17
|
-
@commission = attrs['Commission']
|
19
|
+
@commission = (attrs['Commission'] || attrs['CommissionPaid']).to_f
|
18
20
|
@raw = attrs
|
19
|
-
@
|
21
|
+
@opened_at = extract_timestamp(attrs['Opened'])
|
22
|
+
@executed_at = extract_timestamp(attrs['TimeStamp'])
|
23
|
+
@closed_at = extract_timestamp(attrs['Closed'])
|
20
24
|
end
|
21
25
|
|
22
26
|
def self.book(market, type, depth = 50)
|
data/lib/bittrex/quote.rb
CHANGED
data/lib/bittrex/summary.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Bittrex
|
2
2
|
class Summary
|
3
|
+
include Helpers
|
4
|
+
|
3
5
|
attr_reader :name, :high, :low, :volume, :last, :base_volume, :raw, :created_at
|
4
6
|
|
5
7
|
alias_method :vol, :volume
|
@@ -13,7 +15,7 @@ module Bittrex
|
|
13
15
|
@last = attrs['Last']
|
14
16
|
@base_volume = attrs['BaseVolume']
|
15
17
|
@raw = attrs
|
16
|
-
@created_at =
|
18
|
+
@created_at = extract_timestamp(attrs['TimeStamp'])
|
17
19
|
end
|
18
20
|
|
19
21
|
def self.all
|
data/lib/bittrex/version.rb
CHANGED
data/lib/bittrex/withdrawal.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Bittrex
|
2
2
|
class Withdrawal
|
3
|
+
include Helpers
|
4
|
+
|
3
5
|
attr_reader :id, :currency, :quantity, :address, :authorized,
|
4
6
|
:pending, :canceled, :invalid_address,
|
5
7
|
:transaction_cost, :transaction_id, :executed_at
|
@@ -15,7 +17,7 @@ module Bittrex
|
|
15
17
|
@invalid_address = attrs['Canceled']
|
16
18
|
@transaction_cost = attrs['TxCost']
|
17
19
|
@transaction_id = attrs['TxId']
|
18
|
-
@executed_at =
|
20
|
+
@executed_at = extract_timestamp(attrs['Opened'])
|
19
21
|
end
|
20
22
|
|
21
23
|
def self.all
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"OrderUuid": "1af0399d-e845-4xxx-9d85-aa332d831e95",
|
3
|
+
"Exchange": "BTC-HPY",
|
4
|
+
"Opened": "2014-06-21T04:08:08.75",
|
5
|
+
"Closed": "2014-06-22T04:08:08.75",
|
6
|
+
"OrderType": "LIMIT_SELL",
|
7
|
+
"Limit": 1.6E-7,
|
8
|
+
"Quantity": 371810.26006413,
|
9
|
+
"QuantityRemaining": 371810.26006413,
|
10
|
+
"Price": 0.0,
|
11
|
+
"PricePerUnit": null,
|
12
|
+
"CancelInitiated": false,
|
13
|
+
"IsConditional": false,
|
14
|
+
"Condition": "NONE",
|
15
|
+
"ConditionTarget": null,
|
16
|
+
"ImmediateOrCancel": false
|
17
|
+
}
|
data/spec/models/order_spec.rb
CHANGED
@@ -4,18 +4,42 @@ describe Bittrex::Order do
|
|
4
4
|
let(:data){ fixture(:order) }
|
5
5
|
let(:subject){ Bittrex::Order.new(data) }
|
6
6
|
|
7
|
-
attr_reader :type, :id, :quantity, :rate, :total, :fill, :raw, :executed_at
|
7
|
+
attr_reader :type, :id, :quantity, :rate, :total, :fill, :raw, :executed_at, :commission, :opened_at, :closed_at
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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, Time.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, Time.parse('2014-06-21T04:08:08.75')) }
|
42
|
+
it { should_assign_attribute(subject, :closed_at, Time.parse('2014-06-22T04:08:08.75')) }
|
43
|
+
end
|
20
44
|
end
|
21
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bittrex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Werner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
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'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: simplecov
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,6 +129,7 @@ executables: []
|
|
115
129
|
extensions: []
|
116
130
|
extra_rdoc_files: []
|
117
131
|
files:
|
132
|
+
- ".circleci/config.yml"
|
118
133
|
- ".gitignore"
|
119
134
|
- ".ruby-version"
|
120
135
|
- Gemfile
|
@@ -128,6 +143,7 @@ files:
|
|
128
143
|
- lib/bittrex/configuration.rb
|
129
144
|
- lib/bittrex/currency.rb
|
130
145
|
- lib/bittrex/deposit.rb
|
146
|
+
- lib/bittrex/helpers.rb
|
131
147
|
- lib/bittrex/market.rb
|
132
148
|
- lib/bittrex/order.rb
|
133
149
|
- lib/bittrex/quote.rb
|
@@ -138,6 +154,7 @@ files:
|
|
138
154
|
- spec/fixtures/currency.json
|
139
155
|
- spec/fixtures/deposit.json
|
140
156
|
- spec/fixtures/market.json
|
157
|
+
- spec/fixtures/open_order.json
|
141
158
|
- spec/fixtures/order.json
|
142
159
|
- spec/fixtures/quote.json
|
143
160
|
- spec/fixtures/summary.json
|
@@ -182,6 +199,7 @@ test_files:
|
|
182
199
|
- spec/fixtures/currency.json
|
183
200
|
- spec/fixtures/deposit.json
|
184
201
|
- spec/fixtures/market.json
|
202
|
+
- spec/fixtures/open_order.json
|
185
203
|
- spec/fixtures/order.json
|
186
204
|
- spec/fixtures/quote.json
|
187
205
|
- spec/fixtures/summary.json
|