cryptum 0.0.355 → 0.0.357

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. metadata +13 -116
  3. data/.github/workflows/main.yml +0 -16
  4. data/.gitignore +0 -30
  5. data/.rspec +0 -3
  6. data/.rspec_status +0 -0
  7. data/.rubocop.yml +0 -31
  8. data/.rubocop_todo.yml +0 -32
  9. data/.ruby-gemset +0 -1
  10. data/.ruby-version +0 -1
  11. data/CODE_OF_CONDUCT.md +0 -84
  12. data/Gemfile +0 -38
  13. data/LICENSE +0 -674
  14. data/README.md +0 -87
  15. data/Rakefile +0 -19
  16. data/bin/cryptum +0 -73
  17. data/bin/cryptum-forecast +0 -200
  18. data/bin/cryptum-repl +0 -73
  19. data/bin/cryptum_autoinc_version +0 -38
  20. data/build_cryptum_gem.sh +0 -58
  21. data/cryptum.gemspec +0 -52
  22. data/cryptum_container.sh +0 -1
  23. data/docker/cryptum.json +0 -60
  24. data/docker/cryptum_container.sh +0 -59
  25. data/docker/packer_secrets.json.EXAMPLE +0 -7
  26. data/docker/provisioners/cryptum.sh +0 -11
  27. data/docker/provisioners/docker_bashrc.sh +0 -2
  28. data/docker/provisioners/docker_rvm.sh +0 -22
  29. data/docker/provisioners/init_image.sh +0 -28
  30. data/docker/provisioners/post_install.sh +0 -6
  31. data/docker/provisioners/ruby.sh +0 -16
  32. data/docker/provisioners/upload_globals.sh +0 -49
  33. data/etc/bot_confs/.gitkeep +0 -0
  34. data/etc/bot_confs/BOT_CONF.TEMPLATE +0 -10
  35. data/etc/coinbase_pro.yaml.EXAMPLE +0 -8
  36. data/etc/open_ai.yaml.EXAMPLE +0 -1
  37. data/git_commit.sh +0 -22
  38. data/lib/cryptum/api.rb +0 -688
  39. data/lib/cryptum/bot_conf.rb +0 -197
  40. data/lib/cryptum/event/bot_conf.rb +0 -34
  41. data/lib/cryptum/event/buy.rb +0 -145
  42. data/lib/cryptum/event/cancel.rb +0 -35
  43. data/lib/cryptum/event/exit.rb +0 -35
  44. data/lib/cryptum/event/gtfo.rb +0 -36
  45. data/lib/cryptum/event/history.rb +0 -105
  46. data/lib/cryptum/event/key_press.rb +0 -64
  47. data/lib/cryptum/event/order_book.rb +0 -34
  48. data/lib/cryptum/event/pane.rb +0 -65
  49. data/lib/cryptum/event/parse.rb +0 -181
  50. data/lib/cryptum/event/scroll.rb +0 -200
  51. data/lib/cryptum/event/sell.rb +0 -124
  52. data/lib/cryptum/event.rb +0 -27
  53. data/lib/cryptum/log.rb +0 -34
  54. data/lib/cryptum/matrix.rb +0 -181
  55. data/lib/cryptum/open_ai.rb +0 -156
  56. data/lib/cryptum/option/choice.rb +0 -28
  57. data/lib/cryptum/option.rb +0 -206
  58. data/lib/cryptum/order_book/generate.rb +0 -114
  59. data/lib/cryptum/order_book/indicator.rb +0 -15
  60. data/lib/cryptum/order_book/market_trend.rb +0 -137
  61. data/lib/cryptum/order_book/profit_margin.rb +0 -55
  62. data/lib/cryptum/order_book.rb +0 -19
  63. data/lib/cryptum/portfolio/balance.rb +0 -123
  64. data/lib/cryptum/portfolio.rb +0 -15
  65. data/lib/cryptum/ui/command.rb +0 -314
  66. data/lib/cryptum/ui/key_press_event.rb +0 -33
  67. data/lib/cryptum/ui/market_trend.rb +0 -74
  68. data/lib/cryptum/ui/order_execute_details.rb +0 -297
  69. data/lib/cryptum/ui/order_execution.rb +0 -573
  70. data/lib/cryptum/ui/order_plan.rb +0 -503
  71. data/lib/cryptum/ui/order_plan_details.rb +0 -240
  72. data/lib/cryptum/ui/order_timer.rb +0 -121
  73. data/lib/cryptum/ui/portfolio.rb +0 -221
  74. data/lib/cryptum/ui/signal_engine.rb +0 -109
  75. data/lib/cryptum/ui/terminal_window.rb +0 -111
  76. data/lib/cryptum/ui/ticker.rb +0 -319
  77. data/lib/cryptum/ui.rb +0 -343
  78. data/lib/cryptum/version.rb +0 -5
  79. data/lib/cryptum/web_sock/coinbase.rb +0 -102
  80. data/lib/cryptum/web_sock/event_machine.rb +0 -274
  81. data/lib/cryptum/web_sock.rb +0 -16
  82. data/lib/cryptum.rb +0 -120
  83. data/order_books/.gitkeep +0 -0
  84. data/reinstall_cryptum_gemset.sh +0 -29
  85. data/spec/lib/cryptum/api_spec.rb +0 -10
  86. data/spec/lib/cryptum/event_spec.rb +0 -10
  87. data/spec/lib/cryptum/log_spec.rb +0 -10
  88. data/spec/lib/cryptum/option_spec.rb +0 -10
  89. data/spec/lib/cryptum/order_book/generate_spec.rb +0 -10
  90. data/spec/lib/cryptum/order_book/market_trend_spec.rb +0 -10
  91. data/spec/lib/cryptum/order_book_spec.rb +0 -10
  92. data/spec/lib/cryptum/ui/command_spec.rb +0 -10
  93. data/spec/lib/cryptum/ui/ticker_spec.rb +0 -10
  94. data/spec/lib/cryptum/ui_spec.rb +0 -10
  95. data/spec/lib/cryptum/web_sock_spec.rb +0 -10
  96. data/spec/lib/cryptum_spec.rb +0 -10
  97. data/spec/spec_helper.rb +0 -3
  98. data/upgrade_Gemfile_gems.sh +0 -20
  99. data/upgrade_cryptum.sh +0 -13
  100. data/upgrade_gem.sh +0 -4
  101. data/upgrade_ruby.sh +0 -45
data/README.md DELETED
@@ -1,87 +0,0 @@
1
- ## **Welcome to Cryptum!** ###
2
- #### What ####
3
- Cryptum is an automated, momentum-trading crypto robot written in Ruby.
4
-
5
- #### Why ####
6
- The goal of cryptum is three-fold:
7
- - Identify bugs that qualify for bounty on [H1](https://hackerone.com/coinbase)
8
- - Take the emotion out of trading crypto currency.
9
- - Grow asset portfolios.
10
-
11
- #### How ####
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
-
14
- ### **Installation** ###
15
- Tested on Linux, & OSX leveraging Ruby via RVM.
16
-
17
- ```
18
- $ rvm gemset create cryptum
19
- $ rvm list gemsets
20
- $ rvm use ruby-<VERSION>@cryptum
21
- $ gem install --verbose cryptum
22
- $ cryptum --help
23
- ```
24
-
25
- - Create a Local Cryptum Session Folder
26
- ```
27
- $ mkdir -p ~/cryptum/order_books
28
- ```
29
-
30
- - Copy the cryptum Gem's etc Folder to the Local Session Folder
31
- ```
32
- $ cp -a $(ruby -r cryptum -e 'puts "#{Gem.path.first}/gems/cryptum-#{Cryptum::VERSION}/etc"') ~/cryptum
33
- ```
34
-
35
- - Copy coinbase_pro.yaml.EXAMPLE to the Local Session Folder
36
- ```
37
- $ cp ~/cryptum/etc/coinbase_pro.yaml.EXAMPLE \
38
- ~/cryptum/etc/coinbase_pro.yaml
39
- ```
40
-
41
- - Add Your API Details to ~/cryptum/etc/coinbase_pro.yaml:
42
- ```
43
- $ vi ~/cryptum/etc/coinbase_pro.yaml
44
- ```
45
-
46
- ### **To Take Advantage of More Advanced AI Features** ###
47
- - Copy open_ai.yaml.EXAMPLE to the Local Session Folder
48
- ```
49
- $ cp ~/cryptum/etc/open_ai.yaml.EXAMPLE \
50
- ~/cryptum/etc/open_ai.yaml
51
- ```
52
-
53
- - Add Your Bearer Token to ~/cryptum/etc/open_ai.yaml:
54
- ```
55
- $ vi ~/cryptum/etc/open_ai.yaml
56
- ```
57
-
58
-
59
- ### **Usage** ###
60
-
61
- ```
62
- $ rvm use ruby-<VERSION>@cryptum
63
- $ cryptum --help
64
- $ cryptum --symbol btc-usd \
65
- --autotrade \
66
- --session-root ~/cryptum
67
- ```
68
-
69
- From an error monitoring perspective, they can be monitored via:
70
- ```
71
- tail -f /tmp/cryptum-errors.txt
72
- ```
73
-
74
- ### **Contributing** ###
75
-
76
- For details around contributing to this project, please refer to the [Cryptum Development Guide](https://github.com/0dayinc/cryptum/blob/master/web/app/public/wiki/dev_getting_started.md).
77
-
78
- Bug reports and pull requests are welcome on GitHub at https://github.com/0dayinc/cryptum. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/0dayinc/cryptum/blob/master/CODE_OF_CONDUCT.md).
79
-
80
- ### **Code of Conduct** ###
81
-
82
- Everyone interacting in the Cryptum project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/0dayinc/cryptum/blob/master/CODE_OF_CONDUCT.md).
83
-
84
- ### **DISCLAIMER** ###
85
- Cryptum is for educational purposes only. No information, forward looking statements, or estimations presented herein represent any final determination on investment performance. While the capabilities implemented in this project have been researched and thought to be reasonably accurate, any investment is speculative in nature.
86
-
87
- 0day Inc. and/or its agents cannot and do not guarantee any rate of return or investment timeline based on the capabilities provided herein. Feel free to use cryptum at your own risk.
data/Rakefile DELETED
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
- require 'rdoc/task'
6
- require 'rubocop/rake_task'
7
-
8
- RSpec::Core::RakeTask.new(:spec)
9
- RuboCop::RakeTask.new do |rubocop|
10
- config_file = '.rubocop.yml'
11
- rubocop.options = ['-E', '-S', '-c', config_file]
12
- end
13
-
14
- RDoc::Task.new do |rdoc|
15
- rdoc.rdoc_files.include('lib/**/*.rb')
16
- rdoc.rdoc_dir = 'rdoc'
17
- end
18
-
19
- task default: %i[spec rubocop rdoc]
data/bin/cryptum DELETED
@@ -1,73 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # frozen_string_literal: true
4
-
5
- require 'cryptum'
6
-
7
- begin
8
- start_time = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
9
- # Initialize Driver Name & Parse cryptum Flags
10
- driver_name = File.basename($PROGRAM_NAME)
11
- option_choice = Cryptum::Option.parser(driver_name: driver_name)
12
-
13
- # Initialize the Respective Environment / API Authentication Artifacts
14
- env = Cryptum::Option.get_env(option_choice: option_choice)
15
-
16
- # Dump out supported products if --list-products flag is passed and exit
17
- if option_choice.list_products
18
- Cryptum::Option.list_products_and_exit(
19
- option_choice: option_choice,
20
- env: env
21
- )
22
- end
23
-
24
- # Instantiate Our Status Indicators & History Objects
25
- indicator_status = Cryptum::OrderBook::Indicator.new
26
-
27
- # Initialize Curses UI
28
- terminal_win = Cryptum::UI.init
29
-
30
- # Generate an Order Book for Session Tracking
31
- # Load previous order_book_justification from
32
- # Order Book File (if it exists)
33
- event_history = Cryptum::OrderBook::Generate.new_order_book(
34
- start_time: start_time,
35
- option_choice: option_choice,
36
- env: env
37
- )
38
- terminal_win.key_press_event.key_w = true if option_choice.reset_session_countdown
39
-
40
- # Automatically Create Bot Confs if they don't
41
- # Exist and Initialize Automated Trading Parameters
42
- bot_conf = Cryptum::BotConf.read(
43
- option_choice: option_choice,
44
- event_history: event_history
45
- )
46
-
47
- # Connect to WebSocket
48
- # Trigger Events as Event Data
49
- # Generated via Coinbase Pro
50
- # Web Socket HTTP Responses
51
- # Refresh UI with Event Data
52
- # Update "Status Indicators"
53
- # Leverage "Status Indicators" to Initiate Actions
54
- Cryptum::WebSock::EventMachine.run(
55
- option_choice: option_choice,
56
- env: env,
57
- terminal_win: terminal_win,
58
- event_history: event_history,
59
- indicator_status: indicator_status,
60
- bot_conf: bot_conf
61
- )
62
- rescue Interrupt
63
- # Exit Gracefully if CTRL+C is Pressed During Session
64
- Cryptum.exit_gracefully(
65
- which_self: self,
66
- event_history: event_history,
67
- option_choice: option_choice,
68
- env: env
69
- )
70
- rescue StandardError => e
71
- # Produce a Stacktrace for anything else
72
- raise e
73
- end
data/bin/cryptum-forecast DELETED
@@ -1,200 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # frozen_string_literal: true
4
-
5
- require 'optparse'
6
- require 'cryptum'
7
-
8
- # Parameters available for this driver
9
- class Choice
10
- attr_accessor :autotrade_percent,
11
- :cycles_complete,
12
- :driver_name,
13
- :proxy,
14
- :session_root,
15
- :sandbox,
16
- :symbol,
17
- :tpm,
18
- :total_holdings
19
-
20
- rescue StandardError => e
21
- # Produce a Stacktrace for anything else
22
- raise e
23
- end
24
-
25
- begin
26
- option_choice = Choice.new
27
- option_choice.driver_name = File.basename($PROGRAM_NAME)
28
-
29
- OptionParser.new do |options|
30
- options.banner = "USAGE: #{option_choice.driver_name} [opts]"
31
- options.on(
32
- '-sSYMBOL',
33
- '--symbol=SYMBOL',
34
- '<Required - Crypto Symbol.(e.g. btc-usd, eth-usd, etc.)'
35
- ) { |s| option_choice.symbol = s.to_s.gsub('-', '_').downcase.to_sym }
36
-
37
- options.on(
38
- '-aPERCENT',
39
- '--autotrade=PERCENT',
40
- '<Optional - Autotrade % (Defaults to Value in Respective Bot Conf)'
41
- ) { |a| option_choice.autotrade_percent = a.to_f }
42
-
43
- options.on(
44
- '-cNUMBER',
45
- '--cycles-completed=NUMBER',
46
- '<Optional - Total # of Autotrade Cycles to Evaluate (Defaults to 1)">'
47
- ) { |c| option_choice.cycles_complete = c.to_i }
48
-
49
- options.on(
50
- '-hHOLDINGS',
51
- '--total-holdings=HOLDINGS',
52
- '<Optional - Total Portfolio Holdings in USD (Defaults to Current Balance)'
53
- ) { |h| option_choice.total_holdings = h.to_f }
54
-
55
- options.on(
56
- '-pPROXY',
57
- '--proxy=PROXY',
58
- '<Optional - HTTP Proxy e.g. "http://127.0.0.1:8080">'
59
- ) { |p| option_choice.proxy = p }
60
-
61
- options.on(
62
- '-rPATH',
63
- '--session-root=PATH',
64
- '<Optional - Directory of Cloned Repo (Defaults to Dir.pwd)">'
65
- ) { |r| option_choice.session_root = r }
66
-
67
- options.on(
68
- '-tTPM',
69
- '--target-profit-margin=TPM',
70
- '<Optional - Target Profit Margin % (Defaults to Value in Respective Bot Conf)'
71
- ) { |t| option_choice.tpm = t.to_f }
72
-
73
- options.on(
74
- '-S',
75
- '--[no-]sandbox',
76
- '<Optional - Use Coinbase Sandbox Environment for Testing Ideas>'
77
- ) { |n| option_choice.sandbox = n }
78
- end.parse!
79
-
80
- # Conditions to display cryptum usage
81
- if option_choice.symbol.nil?
82
- usage = true
83
- reason = :symbol
84
- end
85
-
86
- option_choice.session_root = Dir.pwd if option_choice.session_root.nil?
87
-
88
- if option_choice.autotrade_percent.to_f > 100
89
- usage = true
90
- reason = :autotrade_percent
91
- end
92
-
93
- unless Dir.exist?(option_choice.session_root)
94
- usage = true
95
- reason = :session_root
96
- end
97
-
98
- if usage
99
- case reason
100
- when :autotrade_percent
101
- puts 'ERROR: --autotrade PERCENT value cannot exceed 100'
102
- when :symbol
103
- puts "ERROR: --symbol Flag is Required.\n\n"
104
- when :session_root
105
- puts "ERROR: #{option_choice.session_root} does not exist.\n\n"
106
- end
107
-
108
- puts `#{option_choice.driver_name} --help`
109
- exit 1
110
- end
111
-
112
- autotrade_cycle_tot = option_choice.cycles_complete
113
- autotrade_cycle_tot = 1 unless option_choice.cycles_complete.to_i.positive?
114
-
115
- # Initialize the Respective Environment / API Authentication Artifacts
116
- env = Cryptum::Option.get_env(option_choice: option_choice)
117
-
118
- # Read in Bot Conf Values
119
- bot_conf = Cryptum::BotConf.read(option_choice: option_choice)
120
-
121
- products = Cryptum::API.get_products(
122
- option_choice: option_choice,
123
- env: env
124
- )
125
-
126
- # crypto = products.last[:base_currency]
127
- fiat = products.last[:quote_currency]
128
- fiat_portfolio_file = "#{option_choice.session_root}/order_books/#{fiat}_PORTFOLIO.json"
129
-
130
- # portfolio = Cryptum::API.get_portfolio(
131
- # option_choice: option_choice,
132
- # env: env,
133
- # crypto: crypto,
134
- # fiat: fiat,
135
- # fiat_portfolio_file: fiat_portfolio_file
136
- # )
137
-
138
- fiat_portfolio = JSON.parse(
139
- File.read(fiat_portfolio_file),
140
- symbolize_names: true
141
- )
142
-
143
- holdings = fiat_portfolio.last[:total_holdings].to_f
144
- holdings = option_choice.total_holdings.to_f if option_choice.total_holdings.to_f.positive?
145
-
146
- autotrade = bot_conf[:autotrade_portfolio_percent].to_f / 100
147
- autotrade = option_choice.autotrade_percent.to_f / 100 if option_choice.autotrade_percent.to_f.positive?
148
-
149
- gross_tpm = bot_conf[:target_profit_margin_percent].to_f / 100
150
- gross_tpm = option_choice.tpm.to_f if option_choice.tpm.to_f.positive?
151
-
152
- fees = Cryptum::API.get_fees(
153
- option_choice: option_choice,
154
- env: env
155
- )
156
- taker_fee = format('%0.4f', fees[:taker_fee_rate].to_f)
157
- total_cycle_fees = taker_fee.to_f * 2
158
- net_tpm = gross_tpm - total_cycle_fees
159
-
160
- beautify_holdings = Cryptum.beautify_large_number(
161
- value: format('%0.2f', holdings)
162
- )
163
-
164
- print "Initial Holdings: $#{beautify_holdings} | "
165
- print "Autotrade: #{format('%0.2f', autotrade * 100)}% | "
166
- print "Gross TPM: #{format('%0.2f', gross_tpm * 100)}% | "
167
- print "Fee: #{format('%0.2f', total_cycle_fees * 100)}% | "
168
- puts "Net TPM: #{format('%0.2f', net_tpm * 100)}%"
169
-
170
- (1..autotrade_cycle_tot).each do |autotrade_cycle|
171
- risk_alloc = holdings * autotrade
172
- bal = risk_alloc
173
- bal += bal * net_tpm
174
- profit = bal - risk_alloc
175
- holdings += profit
176
-
177
- beautify_risk_alloc = Cryptum.beautify_large_number(
178
- value: format('%0.2f', risk_alloc)
179
- )
180
-
181
- beautify_profit = Cryptum.beautify_large_number(
182
- value: format('%0.2f', profit)
183
- )
184
-
185
- beautify_holdings = Cryptum.beautify_large_number(
186
- value: format('%0.2f', holdings)
187
- )
188
-
189
- print "##{autotrade_cycle} | "
190
- print "Risk Alloc: $#{beautify_risk_alloc} | "
191
- print "Profit: $#{beautify_profit} | "
192
- puts "Holdings: $#{beautify_holdings}"
193
- end
194
- rescue Interrupt
195
- # Exit Gracefully if CTRL+C is Pressed During Session
196
- puts "Interrupt detected in #{self}...goodbye."
197
- rescue StandardError => e
198
- # Produce a Stacktrace for anything else
199
- raise e
200
- end
data/bin/cryptum-repl DELETED
@@ -1,73 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'cryptum'
5
- require 'pry'
6
- require 'tty-prompt'
7
- require 'tty-reader'
8
-
9
- begin
10
- # TODO: Remove once this feature is available in mainline
11
- class Pry
12
- # Overwrite Pry::History.push method in History class to get duplicate history entries
13
- # in order to properly replay automation in this prototyping driver
14
- class History
15
- def push(line)
16
- return line if line.empty? || invalid_readline_line?(line)
17
-
18
- # begin
19
- # last_line = @history.last
20
- # rescue IndexError
21
- # last_line = nil
22
- # end
23
- # return line if line == last_line
24
-
25
- @history << line
26
- @history_line_count += 1
27
- @saver.call(line) if !should_ignore?(line) && Pry.config.history_save
28
-
29
- line
30
- end
31
- alias << push
32
- end
33
- end
34
-
35
- cli = Pry
36
-
37
- cli.config.hooks.add_hook(:before_eval, :autocomplete) do
38
- # prompt = TTY::Prompt.new
39
- reader = TTY::Reader.new
40
- reader.on(:keypress) { |key_event| prompt(key_event) }
41
- end
42
-
43
- cli::Commands.create_command 'toggle-pager' do
44
- description 'Toggle less on returned objects surpassing the terminal.'
45
-
46
- def process
47
- # Toggle pager from true to false via XOR
48
- pry_instance.config.pager ^= true
49
- end
50
- end
51
-
52
- # Custom Main & Wait (Multi-Line) Prompts
53
- title = "\001\e[1m\002\001\e[31m\002cryptum\001\e[0m\002" # Bold Red
54
- version = "\001\e[36m\002v#{Cryptum::VERSION}\001\e[0m\002" # Cyan
55
- arrow = "\001\e[32m\002>>>\001\e[0m\002" # Green
56
- splat = "\001\e[33m\002***\001\e[0m\002" # Yellow
57
-
58
- prompt = [
59
- proc do |_target_self, _nest_level, pry|
60
- line_pad = format('%0.3d', pry.input_ring.size)
61
- line_count = "\001\e[34m\002#{line_pad}\001\e[0m\002" # Blue
62
- "#{title}[#{version}]:#{line_count} #{arrow} ".to_s.scrub
63
- end,
64
- proc do |_target_self, _nest_level, pry|
65
- line_pad = format('%0.3d', pry.input_ring.size)
66
- line_count = "\001\e[34m\002#{line_pad}\001\e[0m\002" # Blue
67
- "#{title}[#{version}]:#{line_count} #{splat} ".to_s.scrub
68
- end
69
- ]
70
- cli.start(self, prompt: Pry::Prompt.new(:cryptum, 'CRYPTUM_PROTOTYPING_DRIVER', prompt))
71
- rescue StandardError => e
72
- raise e
73
- end
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # frozen_string_literal: true
4
-
5
- require 'cryptum'
6
-
7
- old_rev = Cryptum::VERSION
8
- placeholder_arr = old_rev.split('.')
9
- major = placeholder_arr[0].to_i
10
- minor = placeholder_arr[1].to_i
11
- hotfix = placeholder_arr[2].to_i
12
-
13
- if hotfix < 999
14
- hotfix += 1
15
- placeholder_arr[2] = hotfix.to_s
16
- else
17
- # TODO: Tag master branch once minor version is reached
18
- placeholder_arr[2] = '0'
19
- if minor < 9
20
- minor += 1
21
- placeholder_arr[1] = minor.to_s
22
- else
23
- placeholder_arr[1] = '0'
24
- major += 1
25
- placeholder_arr[0] = major.to_s
26
- end
27
- end
28
-
29
- new_rev = placeholder_arr.join('.')
30
-
31
- puts "Upgrading to #{new_rev}..."
32
- File.open('./lib/cryptum/version.rb', 'w') do |f|
33
- f.puts '# frozen_string_literal: true'
34
- f.puts "\n"
35
- f.puts 'module Cryptum'
36
- f.puts " VERSION = '#{new_rev}'"
37
- f.puts 'end'
38
- end
data/build_cryptum_gem.sh DELETED
@@ -1,58 +0,0 @@
1
- #!/bin/bash --login
2
- if [[ $CRYPTUM_ROOT == '' ]]; then
3
- if [[ ! -d '/opt/cryptum' ]]; then
4
- cryptum_root=$(pwd)
5
- else
6
- cryptum_root='/opt/cryptum'
7
- fi
8
- else
9
- cryptum_root="${CRYPTUM_ROOT}"
10
- fi
11
-
12
- ls pkg/*.gem 2> /dev/null | while read previous_gems; do
13
- rvmsudo rm $previous_gems
14
- done
15
- old_ruby_version=`cat ${cryptum_root}/.ruby-version`
16
- # Default Strategy is to merge codebase
17
- # rvmsudo git config pull.rebase false
18
- # rvmsudo git pull origin master
19
- git config pull.rebase false
20
- git pull origin master
21
- new_ruby_version=`cat ${cryptum_root}/.ruby-version`
22
-
23
- rvm list gemsets | grep `cat ${cryptum_root}/.ruby-gemset`
24
- if [[ $? != 0 ]]; then
25
- echo "Ruby v${new_ruby_version} is not installed. Installing..."
26
- cd $cryptum_root && ./upgrade_ruby.sh $new_ruby_version
27
- # Rely on RVM to creeate gemset
28
- cd / && cd $cryptum_root
29
- fi
30
-
31
- if [[ $old_ruby_version == $new_ruby_version ]]; then
32
- export rvmsudo_secure_path=1
33
- rvmsudo /bin/bash --login -c "cd ${cryptum_root} && ./reinstall_cryptum_gemset.sh"
34
- rvmsudo rake
35
- rvmsudo rake install
36
- rvmsudo rake rerdoc
37
- rvmsudo gem update --system
38
- rvmsudo gem rdoc --rdoc --ri --overwrite -V cryptum
39
- echo "Invoking bundle-audit Gemfile Scanner..."
40
- rvmsudo bundle-audit
41
-
42
- latest_gem=$(ls pkg/*.gem)
43
- if [[ $latest_gem != "" ]]; then
44
- echo "Pushing ${latest_gem} to RubyGems.org..."
45
- rvmsudo gem push $latest_gem --debug
46
- fi
47
- else
48
- cd $cryptum_root && ./upgrade_ruby.sh $new_ruby_version $old_ruby_version
49
- fi
50
-
51
- unpriv_user=`echo $USER`
52
- if [[ $unpriv_user != 'root' ]]; then
53
- if [[ $(uname -s) == 'Darwin' ]]; then
54
- rvmsudo chown -R $unpriv_user $cryptum_root
55
- else
56
- rvmsudo chown -R $unpriv_user:$unpriv_user $cryptum_root
57
- fi
58
- fi
data/cryptum.gemspec DELETED
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'cryptum/version'
6
-
7
- Gem::Specification.new do |spec|
8
- # Switch back when RVM has stable 3.1.2 (i.e. not just preview / p20)
9
- # spec.required_ruby_version = ">= #{File.read('.ruby-version')}"
10
- required_minor_ruby_version = File.read('.ruby-version').split('.')[0..1].join('.')
11
- spec.required_ruby_version = ">= #{required_minor_ruby_version}"
12
- spec.name = 'cryptum'
13
- spec.version = Cryptum::VERSION
14
- spec.authors = ['0day Inc.']
15
- spec.email = ['request.pentest@0dayinc.com']
16
- spec.summary = 'Coinbase Pro High-Frequency Trading Bot'
17
- spec.description = 'Personalized High-Frequency Trading Bot'
18
- spec.homepage = 'https://github.com/0dayinc/cryptum'
19
- spec.license = 'GPL'
20
- spec.metadata['rubygems_mfa_required'] = 'true'
21
-
22
- spec.files = `git ls-files -z`.split("\x0")
23
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
24
- spec.require_paths = ['lib']
25
-
26
- dev_dependency_arr = %i[
27
- bundler
28
- rake
29
- rdoc
30
- rspec
31
- ]
32
-
33
- File.readlines('./Gemfile').each do |line|
34
- columns = line.chomp.split
35
- next unless columns.first == 'gem'
36
-
37
- gem_name = columns[1].delete("'").delete(',')
38
- gem_version = columns.last.delete("'")
39
-
40
- if dev_dependency_arr.include?(gem_name.to_sym)
41
- spec.add_development_dependency(
42
- gem_name,
43
- gem_version
44
- )
45
- else
46
- spec.add_runtime_dependency(
47
- gem_name,
48
- gem_version
49
- )
50
- end
51
- end
52
- end
data/cryptum_container.sh DELETED
@@ -1 +0,0 @@
1
- docker/cryptum_container.sh
data/docker/cryptum.json DELETED
@@ -1,60 +0,0 @@
1
- {
2
- "variables": {
3
- "ssh_auth_sock": "{{env `SSH_AUTH_SOCK`}}",
4
- "repository": "{{env `REPOSITORY`}}",
5
- "aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
6
- "aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
7
- "aws_token": "{{env `AWS_TOKEN`}}",
8
- "aws_profile": "{{env `AWS_PROFILE`}}",
9
- "login_server": "{{env `LOGIN_SERVER`}}"
10
- },
11
- "builders": [{
12
- "type": "docker",
13
- "image": "kalilinux/kali-rolling",
14
- "commit": true,
15
- "volumes": {
16
- "{{user `ssh_auth_sock` }}": "/ssh-agent"
17
- },
18
- "changes": [
19
- "EXPOSE 9999"
20
- ],
21
- "run_command": [
22
- "--detach",
23
- "--interactive",
24
- "--tty",
25
- "--name=cryptum",
26
- "--entrypoint=/bin/bash",
27
- "{{.Image}}"
28
- ]
29
- }],
30
- "provisioners": [{
31
- "type": "shell",
32
- "scripts": [
33
- "provisioners/upload_globals.sh",
34
- "provisioners/init_image.sh",
35
- "provisioners/docker_rvm.sh",
36
- "provisioners/docker_bashrc.sh",
37
- "provisioners/ruby.sh",
38
- "provisioners/cryptum.sh",
39
- "provisioners/post_install.sh"
40
- ],
41
- "pause_before": "1s"
42
- }],
43
- "post-processors": [
44
- [
45
- {
46
- "type": "docker-tag",
47
- "repository": "{{user `repository`}}",
48
- "tag": "latest"
49
- },
50
- {
51
- "type": "docker-push",
52
- "ecr_login": true,
53
- "aws_access_key": "{{user `aws_access_key`}}",
54
- "aws_secret_key": "{{user `aws_secret_key`}}",
55
- "login_server": "https://{{user `repository`}}",
56
- "keep_input_artifact": false
57
- }
58
- ]
59
- ]
60
- }