cryptum 0.0.312 → 0.0.314
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cryptum/option.rb +3 -2
- data/lib/cryptum/order_book/market_trend.rb +51 -4
- data/lib/cryptum/version.rb +1 -1
- data/lib/cryptum/web_sock/event_machine.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ab9f5b8899b906bfb3513dc4fc3fad39607dc52a62f067703fec47fd82f59e1
|
4
|
+
data.tar.gz: 8de5152998ff10668b8b871e97d8b60e19add14f4f67ff5f2a05ade3b1e1684a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc5f8b121978b119733c2df5f08bdc782a2a65a9de75cea7236645ab03ccff3adca327cc844be54aaa2956e2cebf4a24af78305be77b161d75a908b99f2f8495
|
7
|
+
data.tar.gz: 37d87a451bd6cbc10adeabaa41e68474e264b87e34b05346770ac41f805b91b5e993b04c60f95cd533673ce8f00e862505f3d496ab6cc7920ca13bf694de6655
|
data/lib/cryptum/option.rb
CHANGED
@@ -122,7 +122,8 @@ module Cryptum
|
|
122
122
|
when 60
|
123
123
|
option_choice.market_trend_reset_label = '1m'
|
124
124
|
else
|
125
|
-
|
125
|
+
usage = true
|
126
|
+
reason = :market_trend_reset
|
126
127
|
end
|
127
128
|
|
128
129
|
if usage
|
@@ -132,7 +133,7 @@ module Cryptum
|
|
132
133
|
when :repo_root
|
133
134
|
puts "ERROR: #{option_choice.repo_root} does not exist.\n\n"
|
134
135
|
when :market_trend_reset
|
135
|
-
puts "ERROR: #{option_choice.market_trend_reset}
|
136
|
+
puts "ERROR: #{option_choice.market_trend_reset} - Possible values are: 604_800 || 86_400 || 14_400 || 10_800 || 7_200 || 3_600 || 2_700 || 1_800 || 900 || 300 || 180 || 60\n\n"
|
136
137
|
end
|
137
138
|
|
138
139
|
puts `#{option_choice.driver_name} --help`
|
@@ -112,21 +112,68 @@ module Cryptum
|
|
112
112
|
# Refactor TPM to be 0.01 > than fee tier,
|
113
113
|
# particularly as fee tier goes up or down
|
114
114
|
fees = event_history.order_book[:fees]
|
115
|
-
|
115
|
+
maker_rate = 0.4
|
116
|
+
maker_rate = fees[:maker_fee_rate].to_f unless fees.empty?
|
117
|
+
maker_fee = format('%0.2f', maker_rate * 100)
|
118
|
+
|
119
|
+
taker_rate = 0.6
|
116
120
|
taker_rate = fees[:taker_fee_rate].to_f unless fees.empty?
|
117
121
|
taker_fee = format('%0.2f', taker_rate * 100)
|
118
|
-
|
122
|
+
# BE EXTREMELY CAREFUL CHANGING THIS VALUE AS IT DICTATES
|
123
|
+
# THE TARGET PRICE AND SUBSEQUENT TIME IT TAKES FOR AN OPEN
|
124
|
+
# SELL ORDER TO BE TRIGGERED!!! SHOULD NEVER BE > 1
|
125
|
+
default_net_tpm = 1
|
119
126
|
|
120
127
|
if ai_enabled
|
128
|
+
# Set default_net_tpm if AI is true in bot_conf.
|
121
129
|
low_24h = event_history.order_book[:low_24h].to_f
|
122
130
|
high_24h = event_history.order_book[:high_24h].to_f
|
123
|
-
|
131
|
+
|
132
|
+
case option_choice.market_trend_reset
|
133
|
+
when 604_800
|
134
|
+
# 1W Chart
|
135
|
+
ai_net_tpm = ((1 - (low_24h / high_24h)) * 100) * 7
|
136
|
+
when 86_400
|
137
|
+
# 1D Chart
|
138
|
+
ai_net_tpm = (1 - (low_24h / high_24h)) * 100
|
139
|
+
when 14_400
|
140
|
+
# 4H Chart
|
141
|
+
ai_net_tpm = ((1 - (low_24h / high_24h)) * 100) / 6
|
142
|
+
when 10_800
|
143
|
+
# 3H Chart
|
144
|
+
ai_net_tpm = ((1 - (low_24h / high_24h)) * 100) / 8
|
145
|
+
when 7_200
|
146
|
+
# 2H Chart
|
147
|
+
ai_net_tpm = ((1 - (low_24h / high_24h)) * 100) / 12
|
148
|
+
when 3_600
|
149
|
+
# 1H Chart
|
150
|
+
ai_net_tpm = ((1 - (low_24h / high_24h)) * 100) / 24
|
151
|
+
when 2_700
|
152
|
+
# 45m Chart
|
153
|
+
ai_net_tpm = (((1 - (low_24h / high_24h)) * 100) / 24) * 0.75
|
154
|
+
when 1_800
|
155
|
+
# 30m Chart
|
156
|
+
ai_net_tpm = (((1 - (low_24h / high_24h)) * 100) / 24) * 0.5
|
157
|
+
when 900
|
158
|
+
# 15m Chart
|
159
|
+
ai_net_tpm = (((1 - (low_24h / high_24h)) * 100) / 24) * 0.25
|
160
|
+
when 300
|
161
|
+
# 5m Chart
|
162
|
+
ai_net_tpm = (((1 - (low_24h / high_24h)) * 100) / 24) * 0.083
|
163
|
+
when 180
|
164
|
+
# 3m Chart
|
165
|
+
ai_net_tpm = (((1 - (low_24h / high_24h)) * 100) / 24) * 0.05
|
166
|
+
when 60
|
167
|
+
# 1m Chart
|
168
|
+
ai_net_tpm = (((1 - (low_24h / high_24h)) * 100) / 24) * 0.017
|
169
|
+
end
|
170
|
+
|
124
171
|
default_net_tpm = ai_net_tpm if ai_net_tpm > default_net_tpm
|
125
172
|
end
|
126
173
|
|
127
174
|
min_gross_tpm = format(
|
128
175
|
'%0.2f',
|
129
|
-
(
|
176
|
+
(maker_fee.to_f + taker_fee.to_f) + default_net_tpm
|
130
177
|
)
|
131
178
|
|
132
179
|
if ai_enabled && min_gross_tpm != gross_tpm.to_s
|
data/lib/cryptum/version.rb
CHANGED
@@ -241,7 +241,8 @@ module Cryptum
|
|
241
241
|
end
|
242
242
|
rescue Faye::WebSocket::API::ErrorEvent,
|
243
243
|
Errno::ECONNREFUSED,
|
244
|
-
Errno::ECONNRESET
|
244
|
+
Errno::ECONNRESET,
|
245
|
+
LoadError => e
|
245
246
|
|
246
247
|
File.open('/tmp/cryptum-errors.txt', 'a') do |f|
|
247
248
|
f.puts Time.now.strftime('%Y-%m-%d %H:%M:%S.%N %z')
|