-
Notifications
You must be signed in to change notification settings - Fork 6
/
install_updateConfig
71 lines (63 loc) · 3.59 KB
/
install_updateConfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
echo setting variables
configfile=/usr/local/freqtrade/config.json
echo saving current configuration
botname=$(grep '^ *"bot_name":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
stake_currency=$(grep '^ *"stake_currency":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
display_currency=$(grep '^ *"fiat_display_currency":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
stake_amount=$(grep '^ *"stake_amount":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
max_open_trades=$(grep '^ *"max_open_trades":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
exchange_name=$(grep '^ *"name":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
exchange_key=$(grep '^ *"key":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
exchange_secret=$(grep '^ *"secret":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
telegram_token=$(grep '^ *"token":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
telegram_chatid=$(grep '^ *"chat_id":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
webuser=$(grep '^ *"username":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
webpass=$(grep '^ *"password":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
webport=$(grep '^ *"listen_port":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
ipaddress=$(grep '^ *"listen_ip_address":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
secretkey=$(grep '^ *"jwt_secret_key":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
strategy=$(grep '^ *"strategy":' $configfile | awk '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//')
echo
echo Bot Name: $botname
echo Stake Curency: $stake_currency
echo Display Currency: $display_currency
echo Stake Amount: $stake_amount
echo Max Open Trades: $max_open_trades
echo Exchange Name: $exchange_name
echo Exchange Key: $exchange_key
echo Exchange Secret: $exchange_secret
echo Telegram Token: $telegram_token
echo Telegram Chat ID: $telegram_chatid
echo FreqUI Username: $webuser
echo FreqUI Password: $webpass
echo Listen Port: $webport
echo Listen IP Address: $ipaddress
echo Secret Key: $secretkey
echo Strategy: $strategy
echo
echo stopping freqtrade
systemctl stop freqtrade.service
echo removing old configuration
rm $configfile
echo downloading updated configuration
wget -q https://raw.githubusercontent.com/aristosv/freqtrade/main/install_config --output-document="$configfile"
echo writing saved configuration
sed -i "s/\$botname/$botname/g" $configfile
sed -i "s/\$stake_currency/$stake_currency/g" $configfile
sed -i "s/\$display_currency/$display_currency/g" $configfile
sed -i "s/\$stake_amount/$stake_amount/g" $configfile
sed -i "s/\$max_open_trades/$max_open_trades/g" $configfile
sed -i "s/\$exchange_name/$exchange_name/g" $configfile
sed -i "s/\$exchange_key/$exchange_key/g" $configfile
sed -i "s/\$exchange_secret/$exchange_secret/g" $configfile
sed -i "s/\$telegram_token/$telegram_token/g" $configfile
sed -i "s/\$telegram_chatid/$telegram_chatid/g" $configfile
sed -i "s/\$webuser/$webuser/g" $configfile
sed -i "s/\$webpass/$webpass/g" $configfile
sed -i "s/\$webport/$webport/g" $configfile
sed -i "s/\$ipaddress/$ipaddress/g" $configfile
sed -i "s/\$secretkey/$secretkey/g" $configfile
sed -i "s/\$strategy/$strategy/g" $configfile
echo starting freqtrade
systemctl start freqtrade.service