cryptum 0.0.321 → 0.0.323

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: 618890a4abd0cf25d2ed57e8c159e24809f002d00bf1f80477ee527e9c10af80
4
- data.tar.gz: f440a2343fc364c1889b0808101fbd86a6d543bd193ab226255c386740abea78
3
+ metadata.gz: e522f21a65cef1a50c40d23d8a8414bb497a0205e0bf146e74d9179c56a81ef0
4
+ data.tar.gz: 02a029b2056b507ce6d9aca8538a6697e7d12208b0f7d66fc35babdb9ea27cc3
5
5
  SHA512:
6
- metadata.gz: cc9cb05b462c3e2384249c6e6465793cbdfee40d0ac1d89fb86ece35e9e47e72294730b758f284fb88a6ae38cb22b17a672dbed94a4adc5322ba1996b796eb15
7
- data.tar.gz: eeeee4adb494120eb55fe8301cdbbc00d1176e3a83494a0293d12cea3bbd2c4ba697ec7891bcd431275accc4074a72bd0198676e79ce9f8d6acaea65503db67e
6
+ metadata.gz: f3973aa9521539f46d831cc0677dce3684b76c5012670c0ea68b0348f1fd4729a823883f275d6ce35a241584c2d2704169c97b3eb87737c47bf5393a0a842343
7
+ data.tar.gz: c82fc92fa7f30b95220d032ebf5c64f1b475711cd94d5d2341eec49636576ef4e187ed231cd9a30e93cdd1adf5b5ec30ff111839c07cba481d0f687ae7f111a1
data/README.md CHANGED
@@ -9,7 +9,7 @@ The goal of cryptum is three-fold:
9
9
  - Grow asset portfolios.
10
10
 
11
11
  #### How ####
12
- Leveraging a timing algorithm based upon portfolio balances, market trends, and a duration of time, cryptum determines order size amounts to trickle-buy crytpo. Once a given buy order is filled, a limit sell order is submitted at a specific, fixed profit margin which can be defined by the user.
12
+ Leveraging multiple algorithms based upon portfolio balances, market trends / % margins of change, and a duration of time, cryptum determines order size amounts to trickle-buy crytpo. Once a given buy order is filled, a limit sell order is submitted at a specific, fixed profit margin which can be defined by the user.
13
13
 
14
14
  ### **Installation** ###
15
15
  Tested on Linux, & OSX leveraging Ruby via RVM.
@@ -22,17 +22,17 @@ $ gem install --verbose cryptum
22
22
  $ cryptum --help
23
23
  ```
24
24
 
25
- - Create a Local Cryptum Config Folder
25
+ - Create a Local Cryptum Session Folder
26
26
  ```
27
27
  $ mkdir -p ~/cryptum/order_books
28
28
  ```
29
29
 
30
- - Copy the Gem etc to the Local Config Folder
30
+ - Copy the cryptum Gem's etc Folder to the Local Session Folder
31
31
  ```
32
32
  $ cp -a $(ruby -r cryptum -e 'puts "#{Gem.path.first}/gems/cryptum-#{Cryptum::VERSION}/etc"') ~/cryptum
33
33
  ```
34
34
 
35
- - Copy coinbase_pro.yaml.EXAMPLE to the Local Config Folder
35
+ - Copy coinbase_pro.yaml.EXAMPLE to the Local Session Folder
36
36
  ```
37
37
  $ cp ~/cryptum/etc/coinbase_pro.yaml.EXAMPLE \
38
38
  ~/cryptum/etc/coinbase_pro.yaml
@@ -51,7 +51,7 @@ $ rvm use ruby-<VERSION>@cryptum
51
51
  $ cryptum --help
52
52
  $ cryptum --symbol btc-usd \
53
53
  --autotrade \
54
- --repo-root ~/cryptum
54
+ --session-root ~/cryptum
55
55
  ```
56
56
 
57
57
  From an error monitoring perspective, they can be monitored via:
data/bin/cryptum-forecast CHANGED
@@ -11,7 +11,7 @@ class Choice
11
11
  :cycles_complete,
12
12
  :driver_name,
13
13
  :proxy,
14
- :repo_root,
14
+ :session_root,
15
15
  :sandbox,
16
16
  :symbol,
17
17
  :tpm,
@@ -60,9 +60,9 @@ begin
60
60
 
61
61
  options.on(
62
62
  '-rPATH',
63
- '--repo-root=PATH',
63
+ '--session-root=PATH',
64
64
  '<Optional - Directory of Cloned Repo (Defaults to Dir.pwd)">'
65
- ) { |r| option_choice.repo_root = r }
65
+ ) { |r| option_choice.session_root = r }
66
66
 
67
67
  options.on(
68
68
  '-tTPM',
@@ -83,16 +83,16 @@ begin
83
83
  reason = :symbol
84
84
  end
85
85
 
86
- option_choice.repo_root = Dir.pwd if option_choice.repo_root.nil?
86
+ option_choice.session_root = Dir.pwd if option_choice.session_root.nil?
87
87
 
88
88
  if option_choice.autotrade_percent.to_f > 100
89
89
  usage = true
90
90
  reason = :autotrade_percent
91
91
  end
92
92
 
93
- unless Dir.exist?(option_choice.repo_root)
93
+ unless Dir.exist?(option_choice.session_root)
94
94
  usage = true
95
- reason = :repo_root
95
+ reason = :session_root
96
96
  end
97
97
 
98
98
  if usage
@@ -101,8 +101,8 @@ begin
101
101
  puts 'ERROR: --autotrade PERCENT value cannot exceed 100'
102
102
  when :symbol
103
103
  puts "ERROR: --symbol Flag is Required.\n\n"
104
- when :repo_root
105
- puts "ERROR: #{option_choice.repo_root} does not exist.\n\n"
104
+ when :session_root
105
+ puts "ERROR: #{option_choice.session_root} does not exist.\n\n"
106
106
  end
107
107
 
108
108
  puts `#{option_choice.driver_name} --help`
@@ -125,7 +125,7 @@ begin
125
125
 
126
126
  # crypto = products.last[:base_currency]
127
127
  fiat = products.last[:quote_currency]
128
- fiat_portfolio_file = "#{option_choice.repo_root}/order_books/#{fiat}_PORTFOLIO.json"
128
+ fiat_portfolio_file = "#{option_choice.session_root}/order_books/#{fiat}_PORTFOLIO.json"
129
129
 
130
130
  # portfolio = Cryptum::API.get_portfolio(
131
131
  # option_choice: option_choice,
@@ -10,10 +10,12 @@ module Cryptum
10
10
  option_choice = opts[:option_choice]
11
11
  event_history = opts[:event_history]
12
12
 
13
- bot_conf_file = "#{option_choice.repo_root}/etc/bot_confs/#{option_choice.symbol}_bot_conf.yaml"
13
+ session_root = option_choice.session_root
14
+ symbol = option_choice.symbol
15
+ bot_conf_file = "#{session_root}/etc/bot_confs/#{symbol}_bot_conf.yaml"
14
16
  unless File.exist?(bot_conf_file)
15
17
  FileUtils.cp(
16
- "#{option_choice.repo_root}/etc/bot_confs/BOT_CONF.TEMPLATE",
18
+ "#{session_root}/etc/bot_confs/BOT_CONF.TEMPLATE",
17
19
  bot_conf_file
18
20
  )
19
21
  end
@@ -161,7 +163,9 @@ module Cryptum
161
163
  key = opts[:key].to_s.to_sym
162
164
  value = opts[:value]
163
165
 
164
- bot_conf_file = "#{option_choice.repo_root}/etc/bot_confs/#{option_choice.symbol}_bot_conf.yaml"
166
+ session_root = option_choice.session_root
167
+ symbol = option_choice.symbol
168
+ bot_conf_file = "#{session_root}/etc/bot_confs/#{symbol}_bot_conf.yaml"
165
169
 
166
170
  bot_conf[key] = value
167
171
  File.write(bot_conf_file, bot_conf.to_yaml)
data/lib/cryptum/event.rb CHANGED
@@ -35,7 +35,7 @@ module Cryptum
35
35
  # order_history = event_history.order_book[:order_history]
36
36
  this_product = event_history.order_book[:this_product]
37
37
  fiat = this_product[:quote_currency]
38
- fiat_portfolio_file = "#{option_choice.repo_root}/order_books/#{fiat}_PORTFOLIO.json"
38
+ fiat_portfolio_file = "#{option_choice.session_root}/order_books/#{fiat}_PORTFOLIO.json"
39
39
 
40
40
  # Determine if Summary UI needs updated data
41
41
  event_history = Cryptum::Portfolio::Balance.refresh(
@@ -9,7 +9,7 @@ module Cryptum
9
9
  :driver_name,
10
10
  :list_products,
11
11
  :proxy,
12
- :repo_root,
12
+ :session_root,
13
13
  :sandbox,
14
14
  :symbol,
15
15
  :market_trend_reset,
@@ -43,9 +43,9 @@ module Cryptum
43
43
 
44
44
  options.on(
45
45
  '-rPATH',
46
- '--repo-root=PATH',
47
- '<Optional - Directory of Cloned Repo (Defaults to ~/cryptum)>'
48
- ) { |r| option_choice.repo_root = r }
46
+ '--session-root=PATH',
47
+ '<Optional - Directory with etc && order_books (Defaults to ~/cryptum)>'
48
+ ) { |r| option_choice.session_root = r }
49
49
 
50
50
  options.on(
51
51
  '-S',
@@ -82,11 +82,11 @@ module Cryptum
82
82
  reason = :symbol
83
83
  end
84
84
 
85
- option_choice.repo_root = "#{Dir.home}/cryptum" if option_choice.repo_root.nil?
85
+ option_choice.session_root = "#{Dir.home}/cryptum" if option_choice.session_root.nil?
86
86
 
87
- unless Dir.exist?(option_choice.repo_root)
87
+ unless Dir.exist?(option_choice.session_root)
88
88
  usage = true
89
- reason = :repo_root
89
+ reason = :session_root
90
90
  end
91
91
 
92
92
  option_choice.market_trend_reset = 86_400 if option_choice.market_trend_reset.to_i.zero?
@@ -130,8 +130,8 @@ module Cryptum
130
130
  case reason
131
131
  when :symbol
132
132
  puts "ERROR: --symbol Flag is Required.\n\n"
133
- when :repo_root
134
- puts "ERROR: #{option_choice.repo_root} does not exist.\n\n"
133
+ when :session_root
134
+ puts "ERROR: #{option_choice.session_root} does not exist.\n\n"
135
135
  when :market_trend_reset
136
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"
137
137
  end
@@ -168,7 +168,7 @@ module Cryptum
168
168
  public_class_method def self.get_env(opts = {})
169
169
  option_choice = opts[:option_choice]
170
170
 
171
- yaml_conf_file = "#{option_choice.repo_root}/etc/coinbase_pro.yaml"
171
+ yaml_conf_file = "#{option_choice.session_root}/etc/coinbase_pro.yaml"
172
172
  yaml_conf = YAML.load_file(
173
173
  yaml_conf_file,
174
174
  symbolize_names: true
@@ -20,16 +20,9 @@ module Cryptum
20
20
  option_choice = opts[:option_choice]
21
21
  env = opts[:env]
22
22
 
23
- order_book_file = "#{option_choice.repo_root}/order_books/#{option_choice.symbol}.ORDER_BOOK.json"
24
-
25
- order_history_meta = []
26
- if File.exist?(order_book_file)
27
- last_order_book = Cryptum::OrderBook.analyze(
28
- order_book_file: order_book_file,
29
- option_choice: option_choice
30
- )
31
- order_history_meta = last_order_book[:order_history_meta] unless last_order_book[:order_history_meta].empty?
32
- end
23
+ session_root = option_choice.session_root
24
+ symbol = option_choice.symbol
25
+ order_book_file = "#{session_root}/order_books/#{symbol}.ORDER_BOOK.json"
33
26
 
34
27
  # Only need to retrieve a product list once / session.
35
28
  products = Cryptum::API.get_products(
@@ -43,7 +36,7 @@ module Cryptum
43
36
 
44
37
  order_book = {
45
38
  path: order_book_file,
46
- symbol: option_choice.symbol,
39
+ symbol: symbol,
47
40
  open_24h: 0.00,
48
41
  high_24h: 0.00,
49
42
  low_24h: 0.00,
@@ -51,8 +44,6 @@ module Cryptum
51
44
  ticker_price: 0.00,
52
45
  ticker_price_second_to_last: 0.00,
53
46
  ticker_price_third_to_last: 0.00,
54
- highest_pie_in_sky_buy_percent: 0.00,
55
- highest_pie_in_sky_sell_percent: 0.00,
56
47
  sequence: -1,
57
48
  this_product: this_product,
58
49
  portfolio: [],
@@ -70,7 +61,7 @@ module Cryptum
70
61
  sell_end: '--'
71
62
  },
72
63
  order_history: [],
73
- order_history_meta: order_history_meta
64
+ order_history_meta: []
74
65
  }
75
66
 
76
67
  # Order History Retention ---------------------------------------#
@@ -83,6 +74,13 @@ module Cryptum
83
74
  order_book: order_book
84
75
  )
85
76
 
77
+ if File.exist?(order_book_file)
78
+ order_book = JSON.parse(
79
+ File.read(order_book_file),
80
+ symbolize_names: true
81
+ )
82
+ end
83
+
86
84
  event_history.order_book = order_book
87
85
 
88
86
  event_history
@@ -11,143 +11,6 @@ module Cryptum
11
11
  autoload :MarketTrend, 'cryptum/order_book/market_trend'
12
12
  autoload :ProfitMargin, 'cryptum/order_book/profit_margin'
13
13
 
14
- # Supported Method Parameters::
15
- # Cryptum::OrderBook.get_populated_indicators(
16
- # indicator_status: 'required - indicator_status object instantiated via Cryptum::OrderBook::Indicators'
17
- # )
18
- public_class_method def self.get_populated_indicators(opts = {})
19
- indicator_status = opts[:indicator_status]
20
-
21
- indicator_type_hash = {}
22
- indicator_type_hash[:trend_indicator_arr] = []
23
- trend_indicator_arr = indicator_type_hash[:trend_indicator_arr]
24
-
25
- indicator_type_hash[:health_indicator_arr] = []
26
- health_indicator_arr = indicator_type_hash[:health_indicator_arr]
27
-
28
- if indicator_status.order_trend
29
- trend_indicator_arr.push(
30
- indicator_status.order_trend
31
- )
32
- end
33
-
34
- if indicator_status.weighted_avg
35
- health_indicator_arr.push(
36
- indicator_status.weighted_avg
37
- )
38
- end
39
-
40
- if indicator_status.profit_margin
41
- health_indicator_arr.push(
42
- indicator_status.profit_margin
43
- )
44
- end
45
-
46
- indicator_type_hash
47
- rescue StandardError => e
48
- raise e
49
- end
50
-
51
- # Supported Method Parameters::
52
- # base_currency_overrides = Cryptum::OrderBook.base_currency_overrides
53
- public_class_method def self.base_currency_overrides
54
- %i[
55
- 1inch
56
- aave
57
- ada
58
- amp
59
- ankr
60
- bal
61
- band
62
- bat
63
- bnt
64
- bond
65
- cgld
66
- chz
67
- clv
68
- comp
69
- crv
70
- ctsi
71
- dot
72
- enj
73
- farm
74
- fet
75
- fil
76
- forth
77
- grt
78
- gtc
79
- icp
80
- keep
81
- lpt
82
- lrc
83
- mana
84
- mask
85
- matic
86
- mir
87
- mkr
88
- mln
89
- nkn
90
- nmr
91
- nu
92
- ogn
93
- poly
94
- qnt
95
- ren
96
- rly
97
- shib
98
- skl
99
- snx
100
- sol
101
- storj
102
- sushi
103
- trb
104
- tribe
105
- uma
106
- uni
107
- wbtc
108
- yfi
109
- zrx
110
- ]
111
- rescue StandardError => e
112
- raise e
113
- end
114
-
115
- # Supported Method Parameters::
116
- # Cryptum::OrderBook.analyze(
117
- # order_book_file: 'required - path to order book file'
118
- # )
119
- public_class_method def self.analyze(opts = {})
120
- order_book_file = opts[:order_book_file]
121
- option_choice = opts[:option_choice]
122
- # TODO: Handle File that exists
123
- # w/ Zero size...N number of
124
- # attempts? Timeout may be better.
125
- order_book = JSON.parse(
126
- File.read(order_book_file),
127
- symbolize_names: true
128
- )
129
-
130
- order_book[:option_choice] = option_choice
131
-
132
- bot_conf = Cryptum::BotConf.read(option_choice: option_choice)
133
- order_book[:bot_conf] = bot_conf
134
-
135
- env = Cryptum::Option.get_env(option_choice: option_choice)
136
- order_book[:env] = env
137
-
138
- order_book
139
- rescue JSON::ParserError => e
140
- File.open('/tmp/cryptum-errors.txt', 'a') do |f|
141
- f.puts Time.now.strftime('%Y-%m-%d %H:%M:%S.%N %z')
142
- f.puts "Module: #{self}"
143
- f.puts "#{e}\n\n\n"
144
- end
145
-
146
- retry
147
- rescue StandardError => e
148
- raise e
149
- end
150
-
151
14
  # Display Usage for this Module
152
15
  public_class_method def self.help
153
16
  constants.sort
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptum
4
- VERSION = '0.0.321'
4
+ VERSION = '0.0.323'
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.321
4
+ version: 0.0.323
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.