trying to fix this for my os

This commit is contained in:
TheRinger 2019-02-14 20:05:12 -08:00
parent 1eff352d96
commit 98bccb5777

View File

@ -1,8 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#encoding=utf8 #encoding=utf8
function pflag() {
P3=python3.6
install
}
# Check which python version is installed # Check which python version is installed
function check_installed_python() { function check_installed_python() {
#echo $1
if [[ $P3 ]]; then
PYTHON=python3.6
fi
python_v=$(pythonversion=$(python -V 2>&1 | grep -Po '(?<=Python )(.+)') && echo "python"$pythonversion | cut -c1-9) python_v=$(pythonversion=$(python -V 2>&1 | grep -Po '(?<=Python )(.+)') && echo "python"$pythonversion | cut -c1-9)
if [ $python_v == "python3.7" ]; then if [ $python_v == "python3.7" ]; then
echo "using Python 3.7" echo "using Python 3.7"
@ -10,7 +20,7 @@ function check_installed_python() {
return return
fi fi
if [ $python_v == "python3.6" ]; then if [ $python_v == "python3.6" ] || [[ $P3 ]]; then
echo "using Python 3.6" echo "using Python 3.6"
PYTHON=python3.6 PYTHON=python3.6
return return
@ -65,18 +75,18 @@ function install_talib() {
} }
# Install bot MacOS # Install bot MacOS
function install_macos() { #function install_macos() {
if [ ! -x "$(command -v brew)" ] # if [ ! -x "$(command -v brew)" ]
then # then
echo "-------------------------" # echo "-------------------------"
echo "Installing Brew" # echo "Installing Brew"
echo "-------------------------" # echo "-------------------------"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi # fi
brew install python3 wget # brew install python3 wget
install_talib # install_talib
test_and_fix_python_on_mac # test_and_fix_python_on_mac
} #}
# Install bot Debian_ubuntu # Install bot Debian_ubuntu
function install_debian() { function install_debian() {
@ -124,18 +134,18 @@ function reset() {
updateenv updateenv
} }
function test_and_fix_python_on_mac() { #function test_and_fix_python_on_mac() {
#
if ! [ -x "$(command -v python3.6)" ] # if ! [ -x "$(command -v python3.6)" ]
then # then
echo "-------------------------" # echo "-------------------------"
echo "Fixing Python" # echo "Fixing Python"
echo "-------------------------" # echo "-------------------------"
echo "Python 3.6 is not linked in your system. Fixing it..." # echo "Python 3.6 is not linked in your system. Fixing it..."
brew link --overwrite python # brew link --overwrite python
echo # echo
fi # fi
} #}
function config_generator() { function config_generator() {
@ -162,14 +172,24 @@ function config_generator() {
echo echo
echo "Generating exchange config " echo "Generating exchange config "
echo "------------------------" echo "------------------------"
default_api_key=$binance_api_secret
read -p "Exchange API key: " api_key read -p "Exchange API key: " api_key
api_key=${api_key:-$default_api_key}
default_api_key=$binance_api_secret
read -p "Exchange API Secret: " api_secret read -p "Exchange API Secret: " api_secret
api_secret=${api_secret:-$default_api_secret}
echo echo
echo "Generating Telegram config" echo "Generating Telegram config"
echo "-------------------------" echo "-------------------------"
default_telegram_token=$telegram_token
read -p "Telegram Token: " token read -p "Telegram Token: " token
token=${token:-$default_telegram_token}
default_telegram_chat_id=$telegram_chat_id
read -p "Telegram Chat_id: " chat_id read -p "Telegram Chat_id: " chat_id
chat_id=${chat_id:-$default_telegram_chat_id}
sed -e "s/\"max_open_trades\": 3,/\"max_open_trades\": $max_trades,/g" \ sed -e "s/\"max_open_trades\": 3,/\"max_open_trades\": $max_trades,/g" \
-e "s/\"stake_amount\": 0.05,/\"stake_amount\": $stake_amount,/g" \ -e "s/\"stake_amount\": 0.05,/\"stake_amount\": $stake_amount,/g" \
@ -256,7 +276,7 @@ function help() {
} }
# Verify if 3.6 or 3.7 is installed # Verify if 3.6 or 3.7 is installed
check_installed_python #check_installed_python
case $* in case $* in
--install|-i) --install|-i)
@ -274,8 +294,8 @@ reset
--plot|-p) --plot|-p)
plot plot
;; ;;
--check-installed-python|-t) --pflag|-p3)
check_installed_python pflag
;; ;;
*) *)
help help