bitflyer-cli 1.0.2 → 1.0.3
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/.github/CODEOWNERS +1 -0
- data/.github/dependabot.yml +13 -12
- data/.github/workflows/release.yaml +1 -1
- data/Gemfile.lock +18 -47
- data/README.md +4 -0
- data/lib/bitflyer/cli/command/ifdoco_by_range_command.rb +1 -1
- data/lib/bitflyer/cli/command/stop_by_range_command.rb +4 -3
- data/lib/bitflyer/cli/model/position.rb +4 -0
- data/lib/bitflyer/cli/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa038b1d0853201e4c1c416dafe4e923a7f98e94ae05d953b711f7839e1ee865
|
|
4
|
+
data.tar.gz: b5d21238aca29fbfa6bb8d16c69d5adf1980f18a85a9ba87dea80ea1752c6334
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33e6bfd2c47e66a61cb3cb3f519b33cbb7410b904365cb259b56d5aab85f257df56c3ff9ff51ffb9070b6debf72f4850a1386512b271bc9be9514457981d895d
|
|
7
|
+
data.tar.gz: 16e3f02200d8fe52441899a06380ccec2c20b8e5b030fed32ce3017925c3c747677c76fb28dfcf867b087f771b732a3d4f8e83b36b58fa18adb4b0941508dce6
|
data/.github/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @unhappychoice
|
data/.github/dependabot.yml
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
version: 2
|
|
2
2
|
updates:
|
|
3
|
-
- package-ecosystem: bundler
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
- package-ecosystem: bundler
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: daily
|
|
7
|
+
time: "12:00"
|
|
8
|
+
timezone: Asia/Tokyo
|
|
9
|
+
open-pull-requests-limit: 20
|
|
10
|
+
allow:
|
|
11
|
+
- dependency-type: direct
|
|
12
|
+
- dependency-type: indirect
|
|
13
|
+
ignore:
|
|
14
|
+
- dependency-name: parallel
|
|
15
|
+
update-types: ["version-update:semver-major"]
|
|
@@ -30,7 +30,7 @@ jobs:
|
|
|
30
30
|
- name: Setup Git
|
|
31
31
|
run: |
|
|
32
32
|
git config --global user.email "unhappychoice@gmail.com"
|
|
33
|
-
git config --global user.name "
|
|
33
|
+
git config --global user.name "Yuji Ueki"
|
|
34
34
|
- name: Install gem-release
|
|
35
35
|
run: gem install gem-release
|
|
36
36
|
- name: Bump version
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
bitflyer-cli (1.0.
|
|
4
|
+
bitflyer-cli (1.0.3)
|
|
5
5
|
bigdecimal
|
|
6
6
|
bitflyer (>= 2.0)
|
|
7
7
|
colorize (>= 0.8.1, < 1.2.0)
|
|
@@ -12,53 +12,25 @@ GEM
|
|
|
12
12
|
specs:
|
|
13
13
|
ast (2.4.3)
|
|
14
14
|
base64 (0.3.0)
|
|
15
|
-
bigdecimal (4.
|
|
16
|
-
bitflyer (2.0.
|
|
17
|
-
faraday (>= 1.0)
|
|
18
|
-
faraday_middleware (>= 1.2)
|
|
15
|
+
bigdecimal (4.1.3)
|
|
16
|
+
bitflyer (2.0.3)
|
|
19
17
|
websocket-client-simple (>= 0.9)
|
|
20
18
|
colorize (1.1.0)
|
|
21
19
|
diff-lcs (1.6.2)
|
|
22
20
|
event_emitter (0.2.6)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
faraday-em_synchrony (~> 1.0)
|
|
26
|
-
faraday-excon (~> 1.1)
|
|
27
|
-
faraday-httpclient (~> 1.0)
|
|
28
|
-
faraday-multipart (~> 1.0)
|
|
29
|
-
faraday-net_http (~> 1.0)
|
|
30
|
-
faraday-net_http_persistent (~> 1.0)
|
|
31
|
-
faraday-patron (~> 1.0)
|
|
32
|
-
faraday-rack (~> 1.0)
|
|
33
|
-
faraday-retry (~> 1.0)
|
|
34
|
-
ruby2_keywords (>= 0.0.4)
|
|
35
|
-
faraday-em_http (1.0.0)
|
|
36
|
-
faraday-em_synchrony (1.0.1)
|
|
37
|
-
faraday-excon (1.1.0)
|
|
38
|
-
faraday-httpclient (1.0.1)
|
|
39
|
-
faraday-multipart (1.2.0)
|
|
40
|
-
multipart-post (~> 2.0)
|
|
41
|
-
faraday-net_http (1.0.2)
|
|
42
|
-
faraday-net_http_persistent (1.2.0)
|
|
43
|
-
faraday-patron (1.0.0)
|
|
44
|
-
faraday-rack (1.0.0)
|
|
45
|
-
faraday-retry (1.0.3)
|
|
46
|
-
faraday_middleware (1.2.1)
|
|
47
|
-
faraday (~> 1.0)
|
|
48
|
-
json (2.18.1)
|
|
49
|
-
language_server-protocol (3.17.0.5)
|
|
21
|
+
json (3.1.0)
|
|
22
|
+
language_server-protocol (3.17.0.6)
|
|
50
23
|
lint_roller (1.1.0)
|
|
51
|
-
multipart-post (2.4.1)
|
|
52
24
|
mutex_m (0.3.0)
|
|
53
|
-
parallel (1.
|
|
54
|
-
parser (3.3.
|
|
25
|
+
parallel (1.28.0)
|
|
26
|
+
parser (3.3.13.0)
|
|
55
27
|
ast (~> 2.4.1)
|
|
56
28
|
racc
|
|
57
29
|
prism (1.9.0)
|
|
58
30
|
racc (1.8.1)
|
|
59
31
|
rainbow (3.1.1)
|
|
60
|
-
rake (13.
|
|
61
|
-
regexp_parser (2.
|
|
32
|
+
rake (13.4.2)
|
|
33
|
+
regexp_parser (2.13.1)
|
|
62
34
|
rspec (3.13.2)
|
|
63
35
|
rspec-core (~> 3.13.0)
|
|
64
36
|
rspec-expectations (~> 3.13.0)
|
|
@@ -68,30 +40,29 @@ GEM
|
|
|
68
40
|
rspec-expectations (3.13.5)
|
|
69
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
70
42
|
rspec-support (~> 3.13.0)
|
|
71
|
-
rspec-mocks (3.13.
|
|
43
|
+
rspec-mocks (3.13.8)
|
|
72
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
73
45
|
rspec-support (~> 3.13.0)
|
|
74
46
|
rspec-support (3.13.7)
|
|
75
|
-
rubocop (1.
|
|
76
|
-
json (
|
|
47
|
+
rubocop (1.92.2)
|
|
48
|
+
json (>= 2.3)
|
|
77
49
|
language_server-protocol (~> 3.17.0.2)
|
|
78
50
|
lint_roller (~> 1.1.0)
|
|
79
|
-
parallel (
|
|
51
|
+
parallel (>= 1.10)
|
|
80
52
|
parser (>= 3.3.0.2)
|
|
81
53
|
rainbow (>= 2.2.2, < 4.0)
|
|
82
|
-
regexp_parser (>= 2.
|
|
54
|
+
regexp_parser (>= 2.11.3, < 3.0)
|
|
83
55
|
rubocop-ast (>= 1.49.0, < 2.0)
|
|
84
56
|
ruby-progressbar (~> 1.7)
|
|
85
57
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
86
|
-
rubocop-ast (1.
|
|
58
|
+
rubocop-ast (1.50.0)
|
|
87
59
|
parser (>= 3.3.7.2)
|
|
88
60
|
prism (~> 1.7)
|
|
89
61
|
ruby-progressbar (1.13.0)
|
|
90
|
-
ruby2_keywords (0.0.5)
|
|
91
62
|
thor (1.5.0)
|
|
92
|
-
unicode-display_width (3.
|
|
93
|
-
unicode-emoji (~> 4.
|
|
94
|
-
unicode-emoji (4.
|
|
63
|
+
unicode-display_width (3.3.0)
|
|
64
|
+
unicode-emoji (~> 4.3)
|
|
65
|
+
unicode-emoji (4.3.0)
|
|
95
66
|
websocket (1.2.11)
|
|
96
67
|
websocket-client-simple (0.9.0)
|
|
97
68
|
base64
|
data/README.md
CHANGED
|
@@ -43,3 +43,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/unhapp
|
|
|
43
43
|
|
|
44
44
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
45
45
|
|
|
46
|
+
|
|
47
|
+
## Author
|
|
48
|
+
|
|
49
|
+
[@unhappychoice](https://unhappychoice.com)
|
|
@@ -16,7 +16,7 @@ class IFDOCOByRangeCommand
|
|
|
16
16
|
profit_price = profit_line(side: side, current_price: current_price, range: range, ratio: ratio).to_i
|
|
17
17
|
loss_price = loss_line(side: side, current_price: current_price, range: range, ratio: ratio).to_i
|
|
18
18
|
request = request(side: side, size: size, profit_price: profit_price, loss_price: loss_price)
|
|
19
|
-
response = http_private_client.send_parent_order(request)
|
|
19
|
+
response = http_private_client.send_parent_order(**request)
|
|
20
20
|
|
|
21
21
|
if response['parent_order_acceptance_id'].nil?
|
|
22
22
|
puts "An error has occurred#{response}"
|
|
@@ -10,7 +10,8 @@ class StopByRangeCommand
|
|
|
10
10
|
position = Position.new(http_private_client.positions)
|
|
11
11
|
return puts "You don't have any position now." if position.empty?
|
|
12
12
|
|
|
13
|
-
side = position.
|
|
13
|
+
side = position.size.positive? ? 'SELL' : 'BUY'
|
|
14
|
+
size = position.size.abs.to_f
|
|
14
15
|
price = position.average.abs + (options.range * (side == 'BUY' ? 1.0 : -1.0))
|
|
15
16
|
|
|
16
17
|
response = http_private_client.send_parent_order(
|
|
@@ -20,14 +21,14 @@ class StopByRangeCommand
|
|
|
20
21
|
condition_type: 'STOP',
|
|
21
22
|
side: side,
|
|
22
23
|
trigger_price: price,
|
|
23
|
-
size:
|
|
24
|
+
size: size
|
|
24
25
|
}]
|
|
25
26
|
)
|
|
26
27
|
|
|
27
28
|
if response['parent_order_acceptance_id'].nil?
|
|
28
29
|
puts "An error has occurred#{response}"
|
|
29
30
|
else
|
|
30
|
-
puts "Set
|
|
31
|
+
puts "Set stop order #{side} / #{price} / #{size}"
|
|
31
32
|
end
|
|
32
33
|
end
|
|
33
34
|
end
|
|
@@ -22,6 +22,10 @@ class Position
|
|
|
22
22
|
@positions.inject('0'.to_d) { |sum, position| sum + (position['price'].to_s.to_d * position['size'].to_s.to_d) }
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def empty?
|
|
26
|
+
@positions.empty?
|
|
27
|
+
end
|
|
28
|
+
|
|
25
29
|
def size
|
|
26
30
|
@positions.inject('0'.to_d) { |sum, position| sum + (position['size'].to_s.to_d * coefficient(position)) }
|
|
27
31
|
end
|
data/lib/bitflyer/cli/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bitflyer-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yuji Ueki
|
|
@@ -141,6 +141,7 @@ executables:
|
|
|
141
141
|
extensions: []
|
|
142
142
|
extra_rdoc_files: []
|
|
143
143
|
files:
|
|
144
|
+
- ".github/CODEOWNERS"
|
|
144
145
|
- ".github/dependabot.yml"
|
|
145
146
|
- ".github/workflows/release.yaml"
|
|
146
147
|
- ".github/workflows/test.yml"
|