cryptum 0.0.406 → 0.0.408

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05b55ff889f701b5b9251d5402e5035b85afea07941b6fbee8669ecd7f595cff
4
- data.tar.gz: e30d334ab26991773b705344488954457e5ab7ac1a275267f77b4bc32b025938
3
+ metadata.gz: 7697401b1b7ec81f2d65243808327c90231db0f893129bc9964766228bf88900
4
+ data.tar.gz: 1974a5be8c924874a519736d3c44dc385c8692725c9ec3be5a2d58c5dcf534f5
5
5
  SHA512:
6
- metadata.gz: bf629833581fb93f5df8015080f211c999f920df965c1ca2704101d191f1eaac5e391d85ec6179f5e8a636764832c887da7e8802a0b99af1d8152bef84559519
7
- data.tar.gz: d9278fc8041bd2376dd08eae0c6a255c8fb7e39e40ee8c12ebf21cf63af9b6a4589b2ebf59acbffda1213ba099e44916a0dc888679d997ead8f4cc7e1946100f
6
+ metadata.gz: 9aee8f8313e63e1f9446425e80f09e371c09d4dfe33b49f20aa41a6fbeebff87a69636ecbf684775e0b2d80f17b9447d9a874dd6fec70ff61e27865639ba69f8
7
+ data.tar.gz: 97262bfda3133cdbc7d20d3b20259f54f0420dfea493e1ca1e30192df57642ebd07a4a09a5c5274ce769c34be3a892338b2bcc8515f763416c41d69bda0ad04a
data/.rubocop.yml CHANGED
@@ -14,13 +14,13 @@ Metrics/BlockNesting:
14
14
  Metrics/ClassLength:
15
15
  Max: 128
16
16
  Metrics/CyclomaticComplexity:
17
- Max: 75
17
+ Max: 77
18
18
  Metrics/MethodLength:
19
19
  Max: 397
20
20
  Metrics/ModuleLength:
21
21
  Max: 407
22
22
  Metrics/PerceivedComplexity:
23
- Max: 75
23
+ Max: 77
24
24
  Style/HashSyntax:
25
25
  EnforcedShorthandSyntax: never
26
26
 
data/README.md CHANGED
@@ -65,7 +65,7 @@ USAGE: cryptum [opts]
65
65
  -s, --symbol=SYMBOL <Required - Crypto Symbol.(e.g. btc-usd, eth-usd, etc.)
66
66
  -l, --[no-]list-products <Optional - List Supported Crypto Currency Products and Exit>
67
67
  -p, --proxy=PROXY <Optional - HTTP Proxy e.g. "http://127.0.0.1:8080">
68
- -R, --[no-]reset-trend-countdown <Optional - Reset Market Trend Countdown at Session Init (Defaults to false)>
68
+ -R, --[no-]reset-timers <Optional - Reset Market Trend & Order Countdown at Session Init (Defaults to false)>
69
69
  -r, --session-root=PATH <Optional - Directory with etc && order_books (Defaults to ~/cryptum)>
70
70
  -S, --[no-]sandbox <Optional - Use Coinbase Sandbox Environment for Testing Ideas>
71
71
  -t, --trend-reset-time=TIME <Optional - Time Between Market Trend Reset (Default 1D)>
data/bin/cryptum CHANGED
@@ -27,7 +27,7 @@ event_history = Cryptum::OrderBook::Generate.new(
27
27
 
28
28
  # Initialize Curses UI
29
29
  terminal_win = Cryptum::UI.init(event_history: event_history)
30
- terminal_win.key_press_event.key_w = true if option_choice.reset_session_countdown
30
+ terminal_win.key_press_event.key_w = true if option_choice.reset_timers
31
31
 
32
32
  # Connect to WebSocket
33
33
  # Refresh UI and Trigger Events as Messages via Web Socket are Received.
@@ -78,6 +78,7 @@ module Cryptum
78
78
 
79
79
  # -------------------------------------------------- #
80
80
  # SAUCE 3 (SAUCE 4 RELATES TO SAUCE 3)
81
+ # TODO: Consider --reset-trend-countdown
81
82
  case option_choice.market_trend_reset_label
82
83
  when '1W'
83
84
  # SLOW BUY = 1 day
@@ -8,7 +8,7 @@ module Cryptum
8
8
  attr_accessor :driver_name,
9
9
  :list_products,
10
10
  :proxy,
11
- :reset_session_countdown,
11
+ :reset_timers,
12
12
  :session_root,
13
13
  :sandbox,
14
14
  :symbol,
@@ -33,9 +33,9 @@ module Cryptum
33
33
 
34
34
  options.on(
35
35
  '-R',
36
- '--[no-]reset-trend-countdown',
37
- '<Optional - Reset Market Trend Countdown at Session Init (Defaults to false)>'
38
- ) { |r| option_choice.reset_session_countdown = r }
36
+ '--[no-]reset-timers',
37
+ '<Optional - Reset Market Trend & Order Countdown at Session Init (Defaults to false)>'
38
+ ) { |r| option_choice.reset_timers = r }
39
39
 
40
40
  options.on(
41
41
  '-rPATH',
@@ -29,6 +29,8 @@ module Cryptum
29
29
  end
30
30
  this_product = this_product_arr.last
31
31
 
32
+ ftimestr = '%Y-%m-%d %H:%M:%S.%N%z'
33
+
32
34
  order_book = {
33
35
  path: order_book_file,
34
36
  symbol: symbol,
@@ -45,8 +47,8 @@ module Cryptum
45
47
  fiat_portfolio: [],
46
48
  fees: [],
47
49
  order_plan: [],
48
- last_trend_reset: Time.now.strftime('%Y-%m-%d %H:%M:%S.%N%z'),
49
- last_order_exec: Time.now.strftime('%Y-%m-%d %H:%M:%S.%N%z'),
50
+ last_trend_reset: Time.now.strftime(ftimestr),
51
+ last_order_exec: Time.now.strftime(ftimestr),
50
52
  market_trend: {
51
53
  buy: 0,
52
54
  buy_start: '--',
@@ -63,11 +65,6 @@ module Cryptum
63
65
  # Instantiate Event History attr_accessible
64
66
  # Object to Keep Track of Everything as Events
65
67
  # are Parsed.
66
- event_history = Cryptum::Event::History.new(
67
- option_choice: option_choice,
68
- order_book: order_book
69
- )
70
-
71
68
  if File.exist?(order_book_file)
72
69
  order_book = JSON.parse(
73
70
  File.read(order_book_file),
@@ -75,17 +72,18 @@ module Cryptum
75
72
  )
76
73
  end
77
74
 
75
+ event_history = Cryptum::Event::History.new(
76
+ option_choice: option_choice,
77
+ order_book: order_book
78
+ )
78
79
  event_history.order_book = order_book
79
- if option_choice.reset_session_countdown
80
+
81
+ if option_choice.reset_timers
80
82
  event_history.order_book[:order_plan] = []
81
83
  event_history.order_book[:market_trend][:buy] = 0
82
84
  event_history.order_book[:market_trend][:sell] = 0
83
- event_history.order_book[:last_trend_reset] = Time.now.strftime(
84
- '%Y-%m-%d %H:%M:%S.%N%z'
85
- )
86
- event_history.order_book[:last_order_exec] = Time.now.strftime(
87
- '%Y-%m-%d %H:%M:%S.%N%z'
88
- )
85
+ event_history.order_book[:last_trend_reset] = Time.now.strftime(ftimestr)
86
+ event_history.order_book[:last_order_exec] = Time.now.strftime(ftimestr)
89
87
  end
90
88
 
91
89
  event_history
@@ -255,8 +255,8 @@ module Cryptum
255
255
  # and append to JSON log to allow for machine learning.
256
256
  buy_order_id = meta[:buy_order_id]
257
257
  learning = meta
258
- order_history_buy_details = order_history.select {|oh| oh[:id] == buy_order_id }
259
- order_history_sell_details = order_history.select {|oh| oh[:id] == sell_order_id }
258
+ order_history_buy_details = order_history.select { |oh| oh[:id] == buy_order_id }
259
+ order_history_sell_details = order_history.select { |oh| oh[:id] == sell_order_id }
260
260
  learning[:buy_details] = order_history_buy_details.first
261
261
  learning[:sell_details] = order_history_sell_details.first
262
262
  Cryptum::Log.append(
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.406'
4
+ VERSION = '0.0.408'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.406
4
+ version: 0.0.408
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.