cryptum 0.0.230
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/main.yml +16 -0
- data/.gitignore +30 -0
- data/.rspec +3 -0
- data/.rspec_status +0 -0
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +250 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +36 -0
- data/LICENSE +674 -0
- data/README.md +72 -0
- data/Rakefile +19 -0
- data/bin/cryptum +72 -0
- data/bin/cryptum-forecast +199 -0
- data/bin/cryptum-repl +73 -0
- data/bin/cryptum_autoinc_version +38 -0
- data/build_cryptum_gem.sh +52 -0
- data/cryptum.gemspec +50 -0
- data/cryptum_container.sh +1 -0
- data/docker/cryptum.json +60 -0
- data/docker/cryptum_container.sh +59 -0
- data/docker/packer_secrets.json.EXAMPLE +7 -0
- data/docker/provisioners/cryptum.sh +11 -0
- data/docker/provisioners/docker_bashrc.sh +2 -0
- data/docker/provisioners/docker_rvm.sh +22 -0
- data/docker/provisioners/init_image.sh +28 -0
- data/docker/provisioners/post_install.sh +6 -0
- data/docker/provisioners/ruby.sh +16 -0
- data/docker/provisioners/upload_globals.sh +49 -0
- data/etc/bot_confs/.gitkeep +0 -0
- data/etc/bot_confs/BOT_CONF.TEMPLATE +10 -0
- data/etc/coinbase_pro.yaml.EXAMPLE +8 -0
- data/git_commit.sh +22 -0
- data/lib/cryptum/api.rb +693 -0
- data/lib/cryptum/bot_conf.rb +76 -0
- data/lib/cryptum/event/buy.rb +144 -0
- data/lib/cryptum/event/cancel.rb +49 -0
- data/lib/cryptum/event/history.rb +64 -0
- data/lib/cryptum/event/key_press.rb +64 -0
- data/lib/cryptum/event/sell.rb +120 -0
- data/lib/cryptum/event.rb +168 -0
- data/lib/cryptum/log.rb +34 -0
- data/lib/cryptum/matrix.rb +181 -0
- data/lib/cryptum/option/choice.rb +26 -0
- data/lib/cryptum/option.rb +161 -0
- data/lib/cryptum/order_book/generate.rb +111 -0
- data/lib/cryptum/order_book/indicator.rb +16 -0
- data/lib/cryptum/order_book/market_trend.rb +161 -0
- data/lib/cryptum/order_book/profit_margin.rb +55 -0
- data/lib/cryptum/order_book/weighted_avg.rb +157 -0
- data/lib/cryptum/order_book.rb +156 -0
- data/lib/cryptum/portfolio/balance.rb +123 -0
- data/lib/cryptum/portfolio.rb +15 -0
- data/lib/cryptum/ui/command.rb +274 -0
- data/lib/cryptum/ui/key_press_event.rb +22 -0
- data/lib/cryptum/ui/market_trend.rb +117 -0
- data/lib/cryptum/ui/order_execution.rb +478 -0
- data/lib/cryptum/ui/order_plan.rb +376 -0
- data/lib/cryptum/ui/order_timer.rb +119 -0
- data/lib/cryptum/ui/portfolio.rb +231 -0
- data/lib/cryptum/ui/signal_engine.rb +122 -0
- data/lib/cryptum/ui/terminal_window.rb +95 -0
- data/lib/cryptum/ui/ticker.rb +317 -0
- data/lib/cryptum/ui.rb +306 -0
- data/lib/cryptum/version.rb +5 -0
- data/lib/cryptum/web_sock/coinbase.rb +94 -0
- data/lib/cryptum/web_sock/event_machine.rb +182 -0
- data/lib/cryptum/web_sock.rb +16 -0
- data/lib/cryptum.rb +183 -0
- data/order_books/.gitkeep +0 -0
- data/reinstall_cryptum_gemset.sh +29 -0
- data/spec/lib/cryptum/api_spec.rb +10 -0
- data/spec/lib/cryptum/event_spec.rb +10 -0
- data/spec/lib/cryptum/log_spec.rb +10 -0
- data/spec/lib/cryptum/option_spec.rb +10 -0
- data/spec/lib/cryptum/order_book/generate_spec.rb +10 -0
- data/spec/lib/cryptum/order_book/market_trend_spec.rb +10 -0
- data/spec/lib/cryptum/order_book_spec.rb +10 -0
- data/spec/lib/cryptum/ui/command_spec.rb +10 -0
- data/spec/lib/cryptum/ui/ticker_spec.rb +10 -0
- data/spec/lib/cryptum/ui_spec.rb +10 -0
- data/spec/lib/cryptum/web_sock_spec.rb +10 -0
- data/spec/lib/cryptum_spec.rb +10 -0
- data/spec/spec_helper.rb +3 -0
- data/upgrade_Gemfile_gems.sh +20 -0
- data/upgrade_cryptum.sh +13 -0
- data/upgrade_gem.sh +4 -0
- data/upgrade_ruby.sh +46 -0
- metadata +472 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/bin/bash --login
|
2
|
+
source /etc/profile.d/globals.sh
|
3
|
+
|
4
|
+
cryptum_root="${CRYPTUM_ROOT}"
|
5
|
+
|
6
|
+
echo "Installing cryptum Dependencies..."
|
7
|
+
$screen_cmd "${apt} install -y tmux ${assess_update_errors}"
|
8
|
+
grok_error
|
9
|
+
|
10
|
+
sudo /bin/bash --login -c "cd ${cryptum_root} && ./build_cryptum_gem.sh"
|
11
|
+
/bin/bash --login -c "cd ${cryptum_root} && ./init_cryptum_web.sh start"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/bin/bash --login
|
2
|
+
source /etc/profile.d/globals.sh
|
3
|
+
|
4
|
+
key1='409B6B1796C275462A1703113804BB82D39DC0E3'
|
5
|
+
key2='7D2BAF1CF37B13E2069D6956105BD0E739499BDB'
|
6
|
+
|
7
|
+
# sudo /bin/bash --login -c "gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys ${key1} ${key2}"
|
8
|
+
$screen_cmd "curl -sSL https://rvm.io/mpapis.asc | sudo gpg2 --import - ${assess_update_errors}"
|
9
|
+
grok_error
|
10
|
+
|
11
|
+
$screen_cmd "curl -sSL https://rvm.io/pkuczynski.asc | sudo gpg2 --import - ${assess_update_errors}"
|
12
|
+
grok_error
|
13
|
+
|
14
|
+
$screen_cmd "echo -e \"trust\n5\ny\n\" | gpg2 --no-tty --command-fd 0 --edit-key ${key1} ${assess_update_errors}"
|
15
|
+
grok_error
|
16
|
+
|
17
|
+
$screen_cmd "echo -e \"trust\n5\ny\n\" | gpg2 --no-tty --command-fd 0 --edit-key ${key2} ${assess_update_errors}"
|
18
|
+
grok_error
|
19
|
+
|
20
|
+
# Multi-user install required due to the need to run MSFRPCD as root w/in metasploit gemset
|
21
|
+
$screen_cmd "curl -sSL https://get.rvm.io | sudo bash -s latest ${assess_update_errors}"
|
22
|
+
grok_error
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/bin/bash --login
|
2
|
+
source /etc/profile.d/globals.sh
|
3
|
+
|
4
|
+
cryptum_env_file='/etc/profile.d/cryptum_envs.sh'
|
5
|
+
|
6
|
+
$screen_cmd "chmod 755 ${cryptum_env_file} ${assess_update_errors}"
|
7
|
+
grok_error
|
8
|
+
|
9
|
+
$screen_cmd "${apt} install -y curl gnupg2 openssh-server net-tools"
|
10
|
+
grok_error
|
11
|
+
|
12
|
+
$screen_cmd "service ssh start"
|
13
|
+
grok_error
|
14
|
+
|
15
|
+
$screen_cmd "${apt} dist-upgrade -y ${assess_update_errors}"
|
16
|
+
grok_error
|
17
|
+
|
18
|
+
$screen_cmd "${apt} full-upgrade -y ${assess_update_errors}"
|
19
|
+
grok_error
|
20
|
+
|
21
|
+
$screen_cmd "useradd -m -s /bin/bash admin ${assess_update_errors}"
|
22
|
+
grok_error
|
23
|
+
|
24
|
+
$screen_cmd "usermod -aG sudo admin ${assess_update_errors}"
|
25
|
+
grok_error
|
26
|
+
|
27
|
+
# Restrict Home Directory
|
28
|
+
sudo chmod 700 /home/admin
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/bin/bash --login
|
2
|
+
source /etc/profile.d/globals.sh
|
3
|
+
|
4
|
+
cryptum_root="${CRYPTUM_ROOT}"
|
5
|
+
|
6
|
+
$screen_cmd "${apt} install -y build-essential bison openssl libreadline-dev curl git-core git zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev autoconf libc6-dev ncurses-dev automake libtool libpcap-dev libsqlite3-dev libgmp-dev ${assess_update_errors}"
|
7
|
+
grok_error
|
8
|
+
|
9
|
+
# Clone now to get the proper version of Ruby
|
10
|
+
sudo /bin/bash --login -c "mkdir /root/.ssh"
|
11
|
+
sudo /bin/bash --login -c "ssh-keyscan -H github.com > /root/.ssh/known_hosts"
|
12
|
+
sudo /bin/bash --login -c "git clone ssh://git@github.com/0dayinc/cryptum.git ${cryptum_root}"
|
13
|
+
|
14
|
+
ruby_version=`cat ${cryptum_root}/.ruby-version`
|
15
|
+
ruby_gemset=`cat ${cryptum_root}/.ruby-gemset`
|
16
|
+
sudo /bin/bash --login -c "source /etc/profile.d/rvm.sh && rvm install ruby-${ruby_version}"
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/bin/bash --login
|
2
|
+
cryptum_env_file='/etc/profile.d/cryptum_envs.sh'
|
3
|
+
|
4
|
+
apt update && apt install -y sudo screen apt-utils
|
5
|
+
|
6
|
+
sudo tee -a $cryptum_env_file << EOF
|
7
|
+
export SSH_AUTH_SOCK=/ssh-agent
|
8
|
+
export CRYPTUM_ROOT='/opt/cryptum'
|
9
|
+
EOF
|
10
|
+
|
11
|
+
sudo tee -a /etc/profile.d/globals.sh << 'EOF'
|
12
|
+
#!/bin/bash --login
|
13
|
+
export DEBIAN_FRONTEND=noninteractive
|
14
|
+
export TERM=xterm
|
15
|
+
|
16
|
+
screen_session=`basename -- ${0} .sh`
|
17
|
+
screen_cmd="screen -T xterm -L -S ${screen_session} -d -m sudo /bin/bash --login -c"
|
18
|
+
assess_update_errors='|| echo IMAGE_ABORT && exit 1'
|
19
|
+
debconf_set='/usr/bin/debconf-set-selections'
|
20
|
+
apt="DEBIAN_FRONTEND=noninteractive apt -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confnew'"
|
21
|
+
|
22
|
+
grok_error() {
|
23
|
+
while true; do
|
24
|
+
# Wait until screen exits session
|
25
|
+
screen -ls | grep $screen_session
|
26
|
+
if [[ $? == 1 ]]; then
|
27
|
+
grep IMAGE_ABORT screenlog.*
|
28
|
+
if [[ $? == 0 ]]; then
|
29
|
+
echo "Failures encountered in $(ls screenlog.*) for ${screen_session} session!!!"
|
30
|
+
cat screenlog.*
|
31
|
+
rm screenlog.*
|
32
|
+
exit 1
|
33
|
+
else
|
34
|
+
echo "No errors in $(ls screenlog.*) detected...moving onto the next."
|
35
|
+
ls screenlog.* > /dev/null 2>&1
|
36
|
+
if [[ $? == 0 ]]; then
|
37
|
+
rm screenlog.*
|
38
|
+
fi
|
39
|
+
break
|
40
|
+
fi
|
41
|
+
else
|
42
|
+
printf '.'
|
43
|
+
sleep 9
|
44
|
+
fi
|
45
|
+
done
|
46
|
+
}
|
47
|
+
EOF
|
48
|
+
|
49
|
+
sudo chmod 755 /etc/profile.d/globals.sh
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#---------------------------------------#
|
2
|
+
# Enable Artifical Intelligence #
|
3
|
+
#---------------------------------------#
|
4
|
+
artifical_intelligence: true
|
5
|
+
|
6
|
+
#---------------------------------------#
|
7
|
+
# Goals & Risk Management %s #
|
8
|
+
#---------------------------------------#
|
9
|
+
autotrade_portfolio_percent: 10.00
|
10
|
+
target_profit_margin_percent: 5.00
|
data/git_commit.sh
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/bin/bash --login
|
2
|
+
if [[ $1 != "" && $2 != "" && $3 != "" ]]; then
|
3
|
+
# Default Strategy is to merge codebase
|
4
|
+
git config pull.rebase false
|
5
|
+
git config commit.gpgsign true
|
6
|
+
git pull origin master
|
7
|
+
git add . --all
|
8
|
+
echo 'Updating Gems to Latest Versions in Gemfile...'
|
9
|
+
./upgrade_Gemfile_gems.sh
|
10
|
+
cryptum_autoinc_version
|
11
|
+
git commit -a -S --author="${1} <${2}>" -m "${3}"
|
12
|
+
./upgrade_cryptum.sh
|
13
|
+
# Tag for every 100 commits (i.e. 0.1.100, 0.1.200, etc)
|
14
|
+
tag_this_version_bool=`ruby -r 'cryptum' -e 'if Cryptum::VERSION.split(".")[-1].to_i % 100 == 0; then print true; else print false; end'`
|
15
|
+
if [[ $tag_this_version_bool == 'true' ]]; then
|
16
|
+
this_version=`ruby -r 'cryptum' -e 'print Cryptum::VERSION'`
|
17
|
+
echo "Tagging: ${this_version}"
|
18
|
+
git tag $this_version
|
19
|
+
fi
|
20
|
+
else
|
21
|
+
echo "USAGE: ${0} '<full name>' <email address> '<git commit comments>'"
|
22
|
+
fi
|