utxoracle 0.0.3 → 0.1.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/.gitignore +0 -1
- data/Gemfile.lock +118 -0
- data/README.md +49 -1
- data/bin/benchmarks/run +39 -0
- data/bin/benchmarks/run_range +40 -0
- data/bin/run +9 -21
- data/bin/run_range +16 -0
- data/lib/utxoracle/batch_oracle.rb +34 -0
- data/lib/utxoracle/oracle.rb +7 -5
- data/lib/utxoracle/provider.rb +2 -0
- data/lib/utxoracle/version.rb +1 -1
- data/lib/utxoracle.rb +1 -0
- data/utxoracle.gemspec +2 -2
- metadata +15 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 27cdbbaf670f00da5da626ef21a0edeea1f94a046f07a6b7eedf3a6082522f74
|
|
4
|
+
data.tar.gz: 41879792ecb2ca00f62c78316676c800a46dcfb50c735b12ce9ca19bc0e6e025
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12d274a91721d318f7ba7cfac53fcfb9d3ae0925a62f5645071b409af44bd18dbaf25b6f3107e0c4e5b57c4c195200065b942eb7f436e9be417753f508d7bef1
|
|
7
|
+
data.tar.gz: af8065f8b177b0f57d938e94dba0605974d035d8289a9b6b3bd9de19654deaca0d47cb4d6f7820b7582ec22d6f246cabf927dea5244e0d86e3e49ef09e59fefd
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
utxoracle (0.1.1)
|
|
5
|
+
cleanrpc (~> 0.0.2)
|
|
6
|
+
typhoeus (~> 1.4.0)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
ansi (1.5.0)
|
|
12
|
+
ast (2.4.2)
|
|
13
|
+
cleanrpc (0.0.3)
|
|
14
|
+
coderay (1.1.3)
|
|
15
|
+
diff-lcs (1.5.1)
|
|
16
|
+
docile (1.4.0)
|
|
17
|
+
ethon (0.16.0)
|
|
18
|
+
ffi (>= 1.15.0)
|
|
19
|
+
ffi (1.17.0)
|
|
20
|
+
ffi (1.17.0-aarch64-linux-gnu)
|
|
21
|
+
ffi (1.17.0-aarch64-linux-musl)
|
|
22
|
+
ffi (1.17.0-arm-linux-gnu)
|
|
23
|
+
ffi (1.17.0-arm-linux-musl)
|
|
24
|
+
ffi (1.17.0-arm64-darwin)
|
|
25
|
+
ffi (1.17.0-x86-linux-gnu)
|
|
26
|
+
ffi (1.17.0-x86-linux-musl)
|
|
27
|
+
ffi (1.17.0-x86_64-darwin)
|
|
28
|
+
ffi (1.17.0-x86_64-linux-gnu)
|
|
29
|
+
ffi (1.17.0-x86_64-linux-musl)
|
|
30
|
+
json (2.7.2)
|
|
31
|
+
language_server-protocol (3.17.0.3)
|
|
32
|
+
method_source (1.1.0)
|
|
33
|
+
parallel (1.25.1)
|
|
34
|
+
parser (3.3.3.0)
|
|
35
|
+
ast (~> 2.4.1)
|
|
36
|
+
racc
|
|
37
|
+
pry (0.14.2)
|
|
38
|
+
coderay (~> 1.1)
|
|
39
|
+
method_source (~> 1.0)
|
|
40
|
+
racc (1.8.0)
|
|
41
|
+
rainbow (3.1.1)
|
|
42
|
+
rake (13.2.1)
|
|
43
|
+
regexp_parser (2.9.2)
|
|
44
|
+
rexml (3.3.0)
|
|
45
|
+
strscan
|
|
46
|
+
rspec (3.13.0)
|
|
47
|
+
rspec-core (~> 3.13.0)
|
|
48
|
+
rspec-expectations (~> 3.13.0)
|
|
49
|
+
rspec-mocks (~> 3.13.0)
|
|
50
|
+
rspec-core (3.13.0)
|
|
51
|
+
rspec-support (~> 3.13.0)
|
|
52
|
+
rspec-expectations (3.13.1)
|
|
53
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
54
|
+
rspec-support (~> 3.13.0)
|
|
55
|
+
rspec-mocks (3.13.1)
|
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
57
|
+
rspec-support (~> 3.13.0)
|
|
58
|
+
rspec-support (3.13.1)
|
|
59
|
+
rubocop (1.64.1)
|
|
60
|
+
json (~> 2.3)
|
|
61
|
+
language_server-protocol (>= 3.17.0)
|
|
62
|
+
parallel (~> 1.10)
|
|
63
|
+
parser (>= 3.3.0.2)
|
|
64
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
65
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
66
|
+
rexml (>= 3.2.5, < 4.0)
|
|
67
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
|
68
|
+
ruby-progressbar (~> 1.7)
|
|
69
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
|
70
|
+
rubocop-ast (1.31.3)
|
|
71
|
+
parser (>= 3.3.1.0)
|
|
72
|
+
rubocop-rspec (3.0.1)
|
|
73
|
+
rubocop (~> 1.61)
|
|
74
|
+
ruby-progressbar (1.13.0)
|
|
75
|
+
simplecov (0.22.0)
|
|
76
|
+
docile (~> 1.1)
|
|
77
|
+
simplecov-html (~> 0.11)
|
|
78
|
+
simplecov_json_formatter (~> 0.1)
|
|
79
|
+
simplecov-console (0.9.1)
|
|
80
|
+
ansi
|
|
81
|
+
simplecov
|
|
82
|
+
terminal-table
|
|
83
|
+
simplecov-html (0.12.3)
|
|
84
|
+
simplecov_json_formatter (0.1.4)
|
|
85
|
+
stackprof (0.2.26)
|
|
86
|
+
strscan (3.1.0)
|
|
87
|
+
terminal-table (3.0.2)
|
|
88
|
+
unicode-display_width (>= 1.1.1, < 3)
|
|
89
|
+
typhoeus (1.4.1)
|
|
90
|
+
ethon (>= 0.9.0)
|
|
91
|
+
unicode-display_width (2.5.0)
|
|
92
|
+
|
|
93
|
+
PLATFORMS
|
|
94
|
+
aarch64-linux-gnu
|
|
95
|
+
aarch64-linux-musl
|
|
96
|
+
arm-linux-gnu
|
|
97
|
+
arm-linux-musl
|
|
98
|
+
arm64-darwin
|
|
99
|
+
ruby
|
|
100
|
+
x86-linux-gnu
|
|
101
|
+
x86-linux-musl
|
|
102
|
+
x86_64-darwin
|
|
103
|
+
x86_64-linux-gnu
|
|
104
|
+
x86_64-linux-musl
|
|
105
|
+
|
|
106
|
+
DEPENDENCIES
|
|
107
|
+
pry
|
|
108
|
+
rake
|
|
109
|
+
rspec
|
|
110
|
+
rubocop
|
|
111
|
+
rubocop-rspec
|
|
112
|
+
simplecov
|
|
113
|
+
simplecov-console
|
|
114
|
+
stackprof
|
|
115
|
+
utxoracle!
|
|
116
|
+
|
|
117
|
+
BUNDLED WITH
|
|
118
|
+
2.5.7
|
data/README.md
CHANGED
|
@@ -19,6 +19,7 @@ The purpose of releasing Utxoracle as a Gem is multi-fold:
|
|
|
19
19
|
- [Usage](#usage)
|
|
20
20
|
* [Requiring the gem](#requiring-the-gem)
|
|
21
21
|
* [Fetching Price](#fetching-price)
|
|
22
|
+
- [Performance](#performance)
|
|
22
23
|
- [Development](#development)
|
|
23
24
|
- [Contributing](#contributing)
|
|
24
25
|
- [License](#license)
|
|
@@ -92,6 +93,53 @@ blocks_on_this_day: 165
|
|
|
92
93
|
Price Estimate: $27,045
|
|
93
94
|
```
|
|
94
95
|
|
|
96
|
+
## Performance
|
|
97
|
+
|
|
98
|
+
Without optimization at the algorithmic/implementation level, UTXOracle.rb is able to compute prices for an entire month in ~10 minutes using native Ruby threads.
|
|
99
|
+
|
|
100
|
+
Results on 3Ghz 6-Core Intel i5
|
|
101
|
+
|
|
102
|
+
For October 2023:
|
|
103
|
+
```ruby
|
|
104
|
+
$ ./bin/benchmark/run_range aUser aPassword 127.0.0.1 8332 2023-10-01 2023-11-01
|
|
105
|
+
[1] pry(main)> ret.sort
|
|
106
|
+
=> [[2023-10-01 00:00:00 -0400, 27364],
|
|
107
|
+
[2023-10-02 00:00:00 -0400, 28345],
|
|
108
|
+
[2023-10-03 00:00:00 -0400, 27696],
|
|
109
|
+
[2023-10-04 00:00:00 -0400, 27712],
|
|
110
|
+
[2023-10-05 00:00:00 -0400, 27725],
|
|
111
|
+
[2023-10-06 00:00:00 -0400, 28021],
|
|
112
|
+
[2023-10-07 00:00:00 -0400, 28311],
|
|
113
|
+
[2023-10-08 00:00:00 -0400, 28308],
|
|
114
|
+
[2023-10-09 00:00:00 -0400, 28000],
|
|
115
|
+
[2023-10-10 00:00:00 -0400, 27708],
|
|
116
|
+
[2023-10-11 00:00:00 -0400, 27373],
|
|
117
|
+
[2023-10-12 00:00:00 -0400, 27045],
|
|
118
|
+
[2023-10-13 00:00:00 -0400, 27058],
|
|
119
|
+
[2023-10-14 00:00:00 -0400, 27077],
|
|
120
|
+
[2023-10-15 00:00:00 -0400, 27093],
|
|
121
|
+
[2023-10-16 00:00:00 -0400, 28357],
|
|
122
|
+
[2023-10-17 00:00:00 -0400, 28664],
|
|
123
|
+
[2023-10-18 00:00:00 -0400, 28658],
|
|
124
|
+
[2023-10-19 00:00:00 -0400, 28690],
|
|
125
|
+
[2023-10-20 00:00:00 -0400, 29704],
|
|
126
|
+
[2023-10-21 00:00:00 -0400, 30034],
|
|
127
|
+
[2023-10-22 00:00:00 -0400, 30333],
|
|
128
|
+
[2023-10-23 00:00:00 -0400, 31069],
|
|
129
|
+
[2023-10-24 00:00:00 -0400, 34468],
|
|
130
|
+
[2023-10-25 00:00:00 -0400, 34858],
|
|
131
|
+
[2023-10-26 00:00:00 -0400, 34484],
|
|
132
|
+
[2023-10-27 00:00:00 -0400, 34114],
|
|
133
|
+
[2023-10-28 00:00:00 -0400, 34438],
|
|
134
|
+
[2023-10-29 00:00:00 -0400, 34841],
|
|
135
|
+
[2023-10-30 00:00:00 -0400, 34840],
|
|
136
|
+
[2023-10-31 00:00:00 -0400, 34829]]
|
|
137
|
+
[2] pry(main)> time
|
|
138
|
+
=> #<Benchmark::Tms:0x0000000110ddd310 @cstime=0.0, @cutime=0.0, @label="", @real=643.9174029999995, @stime=87.356026, @total=647.7391030000001, @utime=560.3830770000001>
|
|
139
|
+
|
|
140
|
+
# 643 seconds, or 10.7 minutes.
|
|
141
|
+
```
|
|
142
|
+
|
|
95
143
|
|
|
96
144
|
## Development
|
|
97
145
|
|
|
@@ -124,7 +172,7 @@ rake spec # Run RSpec code examples
|
|
|
124
172
|
|
|
125
173
|
## Contributing
|
|
126
174
|
|
|
127
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
175
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/BrantaOps/UTXOracle.
|
|
128
176
|
|
|
129
177
|
## License
|
|
130
178
|
|
data/bin/benchmarks/run
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# This is a copy of bin/run but with timing code.
|
|
5
|
+
# Usage:
|
|
6
|
+
#
|
|
7
|
+
# Basic wall clock measurement:
|
|
8
|
+
# $ ./bin/benchmarks/run aUser aPassword 127.0.0.1 8332 2023-10-01
|
|
9
|
+
#
|
|
10
|
+
# With StackProf measurement:
|
|
11
|
+
# ./bin/benchmarks/run aUser aPassword 127.0.0.1 8332 2023-10-01 true
|
|
12
|
+
|
|
13
|
+
require 'bundler/setup'
|
|
14
|
+
require 'utxoracle'
|
|
15
|
+
require 'benchmark'
|
|
16
|
+
|
|
17
|
+
user = ARGV[0]
|
|
18
|
+
password = ARGV[1]
|
|
19
|
+
ip = ARGV[2]
|
|
20
|
+
port = ARGV[3]
|
|
21
|
+
date = ARGV[4]
|
|
22
|
+
profile = ARGV[5]
|
|
23
|
+
|
|
24
|
+
if profile
|
|
25
|
+
require 'stackprof'
|
|
26
|
+
# See https://github.com/tmm1/stackprof#sampling: for :cpu, :wall, :object
|
|
27
|
+
StackProf.run(mode: :wall, out: 'tmp/stackprof-wall.dump', raw: true) do
|
|
28
|
+
provider = Utxoracle::Node.new(user, password, ip, port)
|
|
29
|
+
oracle = Utxoracle::Oracle.new(provider, log = false)
|
|
30
|
+
puts oracle.price(date)
|
|
31
|
+
end
|
|
32
|
+
else
|
|
33
|
+
time = Benchmark.measure do
|
|
34
|
+
provider = Utxoracle::Node.new(user, password, ip, port)
|
|
35
|
+
oracle = Utxoracle::Oracle.new(provider, log = false)
|
|
36
|
+
puts oracle.price(date)
|
|
37
|
+
end
|
|
38
|
+
puts time
|
|
39
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# This is a copy of bin/run_range but with timing code.
|
|
5
|
+
# Usage:
|
|
6
|
+
#
|
|
7
|
+
# ./bin/benchmarks/run_range aUser aPassword 127.0.0.1 8332 2023-10-01 2023-10-05
|
|
8
|
+
#
|
|
9
|
+
# Note: Too long of a range will crash the program.
|
|
10
|
+
# Bitcoin Core has limits:
|
|
11
|
+
# https://github.com/bitcoin/bitcoin/blob/c0ddd32bf629bb48426b0651def497ca1a78e6b1/src/httpserver.h#L12-L14
|
|
12
|
+
# for threads, queue and timeout.
|
|
13
|
+
#
|
|
14
|
+
# With default settings, 20 days works fine.
|
|
15
|
+
#
|
|
16
|
+
# To run for a full month, I've found the following settings to work fine:
|
|
17
|
+
#
|
|
18
|
+
# rpcworkqueue=32
|
|
19
|
+
# rpcthreads=16
|
|
20
|
+
# rpctimeout=60
|
|
21
|
+
# Database cache 1024 MiB
|
|
22
|
+
|
|
23
|
+
require 'bundler/setup'
|
|
24
|
+
require 'utxoracle'
|
|
25
|
+
require 'benchmark'
|
|
26
|
+
|
|
27
|
+
user = ARGV[0]
|
|
28
|
+
password = ARGV[1]
|
|
29
|
+
ip = ARGV[2]
|
|
30
|
+
port = ARGV[3]
|
|
31
|
+
start_date = ARGV[4]
|
|
32
|
+
end_date = ARGV[5]
|
|
33
|
+
|
|
34
|
+
time = Benchmark.measure do
|
|
35
|
+
provider = Utxoracle::Node.new(user, password, ip, port)
|
|
36
|
+
batch_oracle = Utxoracle::BatchOracle.new(provider)
|
|
37
|
+
batch_oracle.prices(start_date, end_date)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
puts time.real
|
data/bin/run
CHANGED
|
@@ -4,24 +4,12 @@
|
|
|
4
4
|
require 'bundler/setup'
|
|
5
5
|
require 'utxoracle'
|
|
6
6
|
|
|
7
|
-
user
|
|
8
|
-
password
|
|
9
|
-
ip
|
|
10
|
-
port
|
|
11
|
-
date
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
require 'stackprof'
|
|
17
|
-
# See https://github.com/tmm1/stackprof#sampling: for :cpu, :wall, :object
|
|
18
|
-
StackProf.run(mode: :wall, out: 'tmp/stackprof-wall.dump', raw: true) do
|
|
19
|
-
provider = Utxoracle::Node.new(user, password, ip, port)
|
|
20
|
-
oracle = Utxoracle::Oracle.new(provider, log = true)
|
|
21
|
-
oracle.price(date)
|
|
22
|
-
end
|
|
23
|
-
else
|
|
24
|
-
provider = Utxoracle::Node.new(user, password, ip, port)
|
|
25
|
-
oracle = Utxoracle::Oracle.new(provider, log = true)
|
|
26
|
-
oracle.price(date)
|
|
27
|
-
end
|
|
7
|
+
user = ARGV[0]
|
|
8
|
+
password = ARGV[1]
|
|
9
|
+
ip = ARGV[2]
|
|
10
|
+
port = ARGV[3]
|
|
11
|
+
date = ARGV[4]
|
|
12
|
+
|
|
13
|
+
provider = Utxoracle::Node.new(user, password, ip, port)
|
|
14
|
+
oracle = Utxoracle::Oracle.new(provider, log = true)
|
|
15
|
+
oracle.price(date)
|
data/bin/run_range
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'bundler/setup'
|
|
5
|
+
require 'utxoracle'
|
|
6
|
+
|
|
7
|
+
user = ARGV[0]
|
|
8
|
+
password = ARGV[1]
|
|
9
|
+
ip = ARGV[2]
|
|
10
|
+
port = ARGV[3]
|
|
11
|
+
start_date = ARGV[4]
|
|
12
|
+
end_date = ARGV[5]
|
|
13
|
+
|
|
14
|
+
provider = Utxoracle::Node.new(user, password, ip, port)
|
|
15
|
+
batch_oracle = Utxoracle::BatchOracle.new(provider)
|
|
16
|
+
batch_oracle.prices(start_date, end_date)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Utxoracle
|
|
4
|
+
class BatchOracle
|
|
5
|
+
def initialize(provider, log = false)
|
|
6
|
+
@provider = provider
|
|
7
|
+
@log = log
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def prices(start_date, end_date)
|
|
11
|
+
formatted_start_date = Time.parse start_date.tr('\n', '')
|
|
12
|
+
formatted_end_date = Time.parse end_date.tr('\n', '')
|
|
13
|
+
ret = {}
|
|
14
|
+
|
|
15
|
+
date = formatted_start_date
|
|
16
|
+
threads = []
|
|
17
|
+
|
|
18
|
+
while date < formatted_end_date
|
|
19
|
+
# Bind `date` to thread scope: https://ruby-doc.org/core-2.0.0/Thread.html#method-c-new
|
|
20
|
+
threads << Thread.new(date) do |t_date|
|
|
21
|
+
oracle = Utxoracle::Oracle.new(@provider, log = @log)
|
|
22
|
+
date_str = t_date.to_s[0..9]
|
|
23
|
+
ret[date_str] = oracle.price(date_str)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
date += Utxoracle::Oracle::SECONDS_PER_DAY
|
|
27
|
+
end
|
|
28
|
+
threads.each(&:join)
|
|
29
|
+
|
|
30
|
+
puts ret
|
|
31
|
+
ret
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
data/lib/utxoracle/oracle.rb
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'time'
|
|
2
4
|
|
|
3
5
|
module Utxoracle
|
|
4
6
|
class Oracle
|
|
5
|
-
|
|
7
|
+
SECONDS_PER_DAY = 86_400
|
|
6
8
|
FOUR_HOURS = 14_400
|
|
7
9
|
MAINNET_PORT = 8332
|
|
8
10
|
TESTNET_PORT = 18_332
|
|
@@ -51,7 +53,7 @@ module Utxoracle
|
|
|
51
53
|
latest_utc_midnight = Time.new(latest_year, latest_month, latest_day).utc
|
|
52
54
|
|
|
53
55
|
latest_time_in_seconds = blockheader['time']
|
|
54
|
-
yesterday_seconds = latest_time_in_seconds -
|
|
56
|
+
yesterday_seconds = latest_time_in_seconds - SECONDS_PER_DAY
|
|
55
57
|
latest_price_day = Time.at(yesterday_seconds).utc
|
|
56
58
|
latest_price_date = latest_price_day.utc.strftime('%Y-%m-%d')
|
|
57
59
|
|
|
@@ -59,7 +61,7 @@ module Utxoracle
|
|
|
59
61
|
price_day_date_utc = @requested_date
|
|
60
62
|
|
|
61
63
|
seconds_since_price_day = latest_time_in_seconds - price_day_seconds
|
|
62
|
-
blocks_ago_estimate = (144 * seconds_since_price_day.to_f /
|
|
64
|
+
blocks_ago_estimate = (144 * seconds_since_price_day.to_f / SECONDS_PER_DAY.to_f).round
|
|
63
65
|
price_day_block_estimate = (block_count - blocks_ago_estimate).to_i
|
|
64
66
|
|
|
65
67
|
block_hash_b = @provider.getblockhash(price_day_block_estimate)
|
|
@@ -67,7 +69,7 @@ module Utxoracle
|
|
|
67
69
|
time_in_seconds = block_header['time']
|
|
68
70
|
|
|
69
71
|
seconds_difference = time_in_seconds - price_day_seconds
|
|
70
|
-
block_jump_estimate = (144.0 * seconds_difference /
|
|
72
|
+
block_jump_estimate = (144.0 * seconds_difference / SECONDS_PER_DAY).round
|
|
71
73
|
|
|
72
74
|
last_estimate = 0
|
|
73
75
|
last_last_estimate = 0
|
|
@@ -81,7 +83,7 @@ module Utxoracle
|
|
|
81
83
|
|
|
82
84
|
time_in_seconds = block_header['time']
|
|
83
85
|
seconds_difference = time_in_seconds - price_day_seconds
|
|
84
|
-
block_jump_estimate = (144.0 * seconds_difference /
|
|
86
|
+
block_jump_estimate = (144.0 * seconds_difference / SECONDS_PER_DAY).round
|
|
85
87
|
end
|
|
86
88
|
|
|
87
89
|
if time_in_seconds > price_day_seconds
|
data/lib/utxoracle/provider.rb
CHANGED
data/lib/utxoracle/version.rb
CHANGED
data/lib/utxoracle.rb
CHANGED
data/utxoracle.gemspec
CHANGED
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
|
13
13
|
|
|
14
14
|
spec.summary = 'Offline price oracle for Bitcoin.'
|
|
15
15
|
spec.description = 'Offline price oracle for Bitcoin. Offers programmable data providers (Bitcoin node, mempool, etc). Can be used from commandline, or integrated into existing ruby stacks.'
|
|
16
|
-
spec.homepage = 'https://github.com/
|
|
16
|
+
spec.homepage = 'https://github.com/BrantaOps/UTXOracle'
|
|
17
17
|
spec.license = 'MIT'
|
|
18
18
|
spec.required_ruby_version = '>= 3.1.0'
|
|
19
19
|
|
|
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.bindir = 'bin'
|
|
22
22
|
spec.require_path = 'lib'
|
|
23
23
|
|
|
24
|
-
spec.add_dependency 'typhoeus', '~> 1.4.0'
|
|
25
24
|
spec.add_dependency 'cleanrpc', '~> 0.0.2'
|
|
25
|
+
spec.add_dependency 'typhoeus', '~> 1.4.0'
|
|
26
26
|
|
|
27
27
|
spec.add_development_dependency 'pry'
|
|
28
28
|
spec.add_development_dependency 'rake'
|
metadata
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: utxoracle
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Keith Gardner
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-06-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: cleanrpc
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 0.0.2
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 0.0.2
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: typhoeus
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 1.4.0
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
40
|
+
version: 1.4.0
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: pry
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -161,12 +161,17 @@ files:
|
|
|
161
161
|
- ".gitignore"
|
|
162
162
|
- ".ruby-version"
|
|
163
163
|
- Gemfile
|
|
164
|
+
- Gemfile.lock
|
|
164
165
|
- LICENSE
|
|
165
166
|
- README.md
|
|
166
167
|
- Rakefile
|
|
168
|
+
- bin/benchmarks/run
|
|
169
|
+
- bin/benchmarks/run_range
|
|
167
170
|
- bin/console
|
|
168
171
|
- bin/run
|
|
172
|
+
- bin/run_range
|
|
169
173
|
- lib/utxoracle.rb
|
|
174
|
+
- lib/utxoracle/batch_oracle.rb
|
|
170
175
|
- lib/utxoracle/oracle.rb
|
|
171
176
|
- lib/utxoracle/provider.rb
|
|
172
177
|
- lib/utxoracle/providers/mempool.rb
|
|
@@ -177,7 +182,7 @@ files:
|
|
|
177
182
|
- spec/utxoracle/oracle_spec.rb
|
|
178
183
|
- spec/utxoracle_spec.rb
|
|
179
184
|
- utxoracle.gemspec
|
|
180
|
-
homepage: https://github.com/
|
|
185
|
+
homepage: https://github.com/BrantaOps/UTXOracle
|
|
181
186
|
licenses:
|
|
182
187
|
- MIT
|
|
183
188
|
metadata: {}
|
|
@@ -196,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
196
201
|
- !ruby/object:Gem::Version
|
|
197
202
|
version: '0'
|
|
198
203
|
requirements: []
|
|
199
|
-
rubygems_version: 3.4.
|
|
204
|
+
rubygems_version: 3.4.10
|
|
200
205
|
signing_key:
|
|
201
206
|
specification_version: 4
|
|
202
207
|
summary: Offline price oracle for Bitcoin.
|