cryptum 0.0.277 → 0.0.280
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/lib/cryptum/event/cancel.rb +0 -21
- data/lib/cryptum/order_book/market_trend.rb +23 -17
- data/lib/cryptum/version.rb +1 -1
- data/lib/cryptum/web_sock/event_machine.rb +10 -5
- 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: 8b7e5b4b12f22c90d12706f639b1e58a97789a8de8fc3ebc8191cf37a4874fa0
|
4
|
+
data.tar.gz: 859098f14afce0affd6d1225ebc121e4e3f0f0b57b3c9df5fa41a94d10eaf5c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad27f846924423c7b6615091591d4af8d9e8c13b6011f706f58fa7e3b619d37963d97fedf9d47db31e2b8f0c7f394f76cffc97f6a345e4f69a7c30ec095bd477
|
7
|
+
data.tar.gz: 057a58470a7873ebe704740664c0f08c765f78870f212a82eb335475ac2d2dd1c637b97e037536ba2d87a3a02758a5d4829594b817678b79c7509e3114ef2eb9
|
data/lib/cryptum/event/cancel.rb
CHANGED
@@ -15,27 +15,6 @@ module Cryptum
|
|
15
15
|
# order_type = opts[:order_type]
|
16
16
|
# order_action = opts[:order_action]
|
17
17
|
|
18
|
-
# Consume Latest Order History Justification from
|
19
|
-
# Order Book & cancel orders tagged as pie
|
20
|
-
# event_history = Cryptum::API.cancel_synced_oj_and_oh(
|
21
|
-
# option_choice: option_choice,
|
22
|
-
# env: env,
|
23
|
-
# event_history: event_history,
|
24
|
-
# order_type: order_type,
|
25
|
-
# order_action: order_action
|
26
|
-
# )
|
27
|
-
|
28
|
-
# event_history
|
29
|
-
# event_history.order_canceled = true
|
30
|
-
# event_history.event_notes = "{ \"event_type\": \"#{event_history.event_type}\", \"cancel\": \"#{event_history.order_canceled}\", \"submitted\": \"#{event_history.order_submitted}\" }" if option_choice.proxy
|
31
|
-
|
32
|
-
# Cryptum::API.cancel_all_open_orders(
|
33
|
-
# env: env,
|
34
|
-
# option_choice: option_choice,
|
35
|
-
# order_type: order_type,
|
36
|
-
# event_notes: event_history.event_notes
|
37
|
-
# )
|
38
|
-
|
39
18
|
terminal_win.key_press_event.key_c = false
|
40
19
|
Cryptum::API.cancel_all_open_orders(
|
41
20
|
env: env,
|
@@ -74,29 +74,35 @@ module Cryptum
|
|
74
74
|
# Only retain past 24 hours of
|
75
75
|
# order history meta for bought, sold, and expired
|
76
76
|
# keep open limit sell orders indefintely
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
order_history_meta.delete_if do |ohm|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
77
|
+
# order_history = event_history.order_book[:order_history]
|
78
|
+
# order_history_meta = event_history.order_book[:order_history_meta]
|
79
|
+
# before_twenty_four_hrs_ago = Time.now - 86_400
|
80
|
+
# order_history_meta.delete_if do |ohm|
|
81
|
+
# order_history.find do |oh|
|
82
|
+
# next unless oh[:done_at]
|
83
|
+
|
84
|
+
# Time.parse(oh[:done_at]) < before_twenty_four_hrs_ago && (
|
85
|
+
# oh[:id] == ohm[:buy_order_id] ||
|
86
|
+
# oh[:id] == ohm[:sell_order_id]
|
87
|
+
# ) && (
|
88
|
+
# ohm[:color].to_sym == :white ||
|
89
|
+
# ohm[:color].to_sym == :green ||
|
90
|
+
# ohm[:color].to_sym == :cyan ||
|
91
|
+
# ohm[:color].to_sym == :red
|
92
|
+
# )
|
93
|
+
# end
|
94
|
+
# end
|
90
95
|
|
91
96
|
# Only keep order history meta for those
|
92
97
|
# hashes that exist in the last order history
|
93
98
|
# response
|
94
99
|
order_history_meta.keep_if do |ohm|
|
95
100
|
order_history.find do |oh|
|
96
|
-
oh[:id] == ohm[:buy_order_id] ||
|
97
|
-
|
98
|
-
|
99
|
-
|
101
|
+
(oh[:id] == ohm[:buy_order_id] || oh[:id] == ohm[:sell_order_id]) && (
|
102
|
+
ohm[:color].to_sym == :white ||
|
103
|
+
ohm[:color].to_sym == :green ||
|
104
|
+
ohm[:color].to_sym == :yellow
|
105
|
+
)
|
100
106
|
end
|
101
107
|
end
|
102
108
|
event_history.order_book[:order_history_meta] = order_history_meta
|
data/lib/cryptum/version.rb
CHANGED
@@ -212,11 +212,12 @@ module Cryptum
|
|
212
212
|
# Ready to Submit a BUY order
|
213
213
|
event_history.order_ready = true
|
214
214
|
|
215
|
-
# Reload Bot Conf (i.e. Risk Allocation)
|
215
|
+
# Reload Bot Conf (i.e. Risk Allocation),
|
216
|
+
# Recalculate Order Plan, and Write to File
|
216
217
|
terminal_win.key_press_event.key_r = true
|
217
218
|
|
218
219
|
# Write Order Book to Disk
|
219
|
-
terminal_win.key_press_event.key_w = true
|
220
|
+
# terminal_win.key_press_event.key_w = true
|
220
221
|
end
|
221
222
|
end
|
222
223
|
|
@@ -227,11 +228,15 @@ module Cryptum
|
|
227
228
|
event_history: event_history,
|
228
229
|
bot_conf: bot_conf
|
229
230
|
)
|
231
|
+
|
230
232
|
# Reload Bot Conf (i.e. Risk Allocation)
|
233
|
+
# Recalculate Order Plan, and Write to File
|
231
234
|
terminal_win.key_press_event.key_r = true
|
232
|
-
|
233
|
-
#
|
234
|
-
|
235
|
+
# IMPORTANT:
|
236
|
+
# Wait for Order Plan recalculation to occur
|
237
|
+
# once Cryptum::UI::OrderPlan is refreshed
|
238
|
+
# in Cryptum::Event _BEFORE_ writing the order
|
239
|
+
# book to file.
|
235
240
|
end
|
236
241
|
end
|
237
242
|
rescue Faye::WebSocket::API::ErrorEvent,
|