copyright, license, fixes
This commit is contained in:
@@ -1,5 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
|
||||
# cleanup
|
||||
rm -r /tmp/parallel-* /tmp/overall-result-* /tmp/g_analyze.sh-*
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
. /dabo/dabo-prep.sh
|
||||
|
||||
rm -f asset-histories/*.history.*.csv.indicators-calculating
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
. /dabo/dabo-prep.sh
|
||||
|
||||
rm -f asset-histories/*.history.*.csv.levels-calculating
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
. /dabo/dabo-prep.sh
|
||||
|
||||
while true
|
||||
|
||||
@@ -23,7 +23,7 @@ LARGEST_MARKETCAP="250"
|
||||
SYMBOLS="ETH SOL"
|
||||
|
||||
## Signal Group for Notifications
|
||||
SIGNAL_GROUP="Krypto-Bot"
|
||||
NOTIFICATION_GROUP="Dabo-Bot"
|
||||
|
||||
## Percent from balance per invest.
|
||||
# Overwritten by MIN_NOTIONAL+X% from stock if lower
|
||||
|
||||
@@ -1 +1 @@
|
||||
keep
|
||||
#keep
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
. /dabo/dabo-prep.sh
|
||||
|
||||
### MAIN ###
|
||||
@@ -58,6 +77,8 @@ do
|
||||
INTERVAL_MIN=$(echo "${INTERVAL}/60-1" | bc -l | sed -r 's/^(-?)\./\10./' | cut -d\. -f1)
|
||||
[ -z "${INTERVAL_MIN}" ] && INTERVAL_MIN=1
|
||||
|
||||
|
||||
####### TODO -> Funktionen überarbeiten ############
|
||||
### get general market data
|
||||
# Get coingecko data
|
||||
get_coingecko_data
|
||||
@@ -70,6 +91,7 @@ do
|
||||
then
|
||||
f_market_performance=$(cat MARKET_PERFORMANCE_LATEST)
|
||||
fi
|
||||
####### TODO -> Funktionen überarbeiten ENDE ###########
|
||||
|
||||
|
||||
## watch some manual defined assets
|
||||
@@ -82,8 +104,8 @@ do
|
||||
fi
|
||||
|
||||
# Get current symbols
|
||||
[ ${FULL_LOOP} = 1 ] && get_symbols_ticker
|
||||
|
||||
#[ ${FULL_LOOP} = 1 ] && get_symbols_ticker
|
||||
|
||||
# Sell something?
|
||||
#check_for_sell
|
||||
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# functions
|
||||
|
||||
BASEPATH=/dabo/htdocs
|
||||
@@ -21,6 +41,8 @@ set +a
|
||||
mkdir -p ${BASEPATH}/botdata/asset-histories
|
||||
cd ${BASEPATH}/botdata
|
||||
|
||||
ECO_ASSETS="DXY DOWJONES SP500 NASDAQ MSCIEAFE 10YRTREASURY OIL GOLD MSCIWORLD OILGAS KRE EUR-USD"
|
||||
|
||||
. ../../dabo-bot.conf
|
||||
. ../../dabo-bot.override.conf
|
||||
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
. /dabo/dabo-prep.sh
|
||||
|
||||
interval=$1
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
. /dabo/dabo-prep.sh
|
||||
|
||||
while true
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
. /dabo/dabo-prep.sh
|
||||
|
||||
while true
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
. /dabo/dabo-prep.sh
|
||||
|
||||
sleep 1800
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function calc_ema {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,4 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function calc_macd {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function calc_rsi {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function f_ccxt {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
@@ -37,7 +57,7 @@ function f_ccxt {
|
||||
if [[ $TESTNET = true ]]
|
||||
then
|
||||
g_echo_note "ATTENTION: RUNNING IN TESTNET/SIMULATION/MOCK MODE OF EXCHANGE ${STOCK_EXCHANGE}!!!"
|
||||
g_python "exchange.set_sandbox_mode(True)" || return 1
|
||||
g_python "${STOCK_EXCHANGE}.set_sandbox_mode(True)" || return 1
|
||||
fi
|
||||
g_python "${STOCK_EXCHANGE}markets=${STOCK_EXCHANGE}.load_markets()" || return 1
|
||||
f_ccxt_initialized="${f_ccxt_initialized}${STOCK_EXCHANGE},"
|
||||
@@ -70,7 +90,7 @@ function f_ccxt {
|
||||
# make the output jq-conform if json poutput
|
||||
# avoids errors like: "parse error: Invalid numeric literal at"
|
||||
f_ccxt_result=$(echo $f_ccxt_result | sed "s/'/\"/g; s/ None/ null/g; s/ True/ true/g; s/ False/ false/g; s/,,/,/g")
|
||||
# sed is needed here because bash parameter substitution like down here hands with 100% cpu usage if the variable is large. Noticed with output about ~2.5M
|
||||
# sed is needed here because bash parameter substitution like down here hangs with 100% cpu usage if the variable is large. Noticed with output about ~2.5M
|
||||
#f_ccxt_result=${f_ccxt_result//\'/\"}
|
||||
#f_ccxt_result=${f_ccxt_result// None/ null}
|
||||
#f_ccxt_result=${f_ccxt_result// True/ true}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function charts {
|
||||
if ! find ../lightweight-charts.standalone.production.js -mtime -1 2>/dev/null | grep -q "lightweight-charts.standalone.production.js"
|
||||
then
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function check_buy_conditions {
|
||||
|
||||
local f_ASSET_HIST_FILE="$1"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function check_for_buy {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function check_for_sell {
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function check_sell_conditions {
|
||||
|
||||
local f_ASSET_HIST_FILE="$1"
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function currency_converter {
|
||||
|
||||
#g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
local f_currency_amount=$1
|
||||
local f_currency=$2
|
||||
@@ -11,6 +31,13 @@ function currency_converter {
|
||||
|
||||
local f_line f_rate f_histfile f_date_array f_stablecoin f_reverse
|
||||
|
||||
if [[ $f_currency_target =~ ^20.*-.*: ]]
|
||||
then
|
||||
g_echo_warn "${FUNCNAME}: Invalid target $f_currency_target"
|
||||
g_traceback
|
||||
return 1
|
||||
fi
|
||||
|
||||
# get current date if none given
|
||||
[ -z "$f_currency_date" ] && printf -v f_currency_date '%(%Y-%m-%d %H:%M:%S)T'
|
||||
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function genchart {
|
||||
# generate css chart (line diagram) from csv file or simple file with number per line - needed charts.css included in webppage
|
||||
local mark
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_asset {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_balance {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_bitpanda_api_transactions {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_coingecko_data {
|
||||
# get data from coingecko
|
||||
local f_gecko_currencies="usd eur"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_ema {
|
||||
|
||||
local f_hist_file="$1"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_indicators_all {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_justtrade_csv_transactions {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,9 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
function get_levels_all {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
local f_levelsfile f_level f_symbol f_symbol_in_array f_price
|
||||
local f_levelsfile f_level f_symbol f_symbol_in_array t_timeframe f_lines $f_relevant_lines
|
||||
|
||||
get_symbols_ticker
|
||||
for f_symbol in "${f_symbols_array_trade[@]}"
|
||||
@@ -11,56 +30,67 @@ function get_levels_all {
|
||||
f_symbol=${f_symbol%%:*}
|
||||
f_symbol=${f_symbol//\/}
|
||||
|
||||
# check for data files
|
||||
for f_levelsfile in "asset-histories/${f_symbol}.history.1d.csv" "asset-histories/${f_symbol}.history.4h.csv" "asset-histories/${f_symbol}.history.15m.csv"
|
||||
do
|
||||
[ -s "$f_levelsfile" ] || continue 2
|
||||
done
|
||||
|
||||
# define target file
|
||||
f_levelsfile="asset-histories/${f_symbol}.history.csv"
|
||||
printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_levelsfile}.levels-calculating"
|
||||
g_echo_note "Estimating relevant levels of $f_symbol"
|
||||
|
||||
# get current price to reduce the range, save cpu-power and time
|
||||
f_symbol_in_array=${f_symbol/ /}
|
||||
f_price=${f_tickers_array[$f_symbol_in_array]}
|
||||
|
||||
# get relevant data max 30000 (+-15000) prices from current price
|
||||
#mapfile -t f_prices < <((cut -d, -f3,4,5 "asset-histories/${f_symbol}.history.1d.csv" "asset-histories/${f_symbol}.history.4h.csv" "asset-histories/${f_symbol}.history.15m.csv" ; echo $f_price) | sed 's/,/\n/g' | sort -rnu | grep -C 15000 "^${f_price}$")
|
||||
mapfile -t f_prices < <((cut -d, -f5 "asset-histories/${f_symbol}.history.1d.csv" "asset-histories/${f_symbol}.history.4h.csv" "asset-histories/${f_symbol}.history.15m.csv" ; echo $f_price) | sed 's/,/\n/g' | sort -rnu | grep -C 15000 "^${f_price}$")
|
||||
|
||||
# calculate levels
|
||||
get_levels && printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_levelsfile}.levels-calculated"
|
||||
rm -f "${f_levelsfile}.levels-calculating"
|
||||
|
||||
# write new levels file
|
||||
for f_level in "${f_levels[@]}"
|
||||
for f_timeframe in 1w 1d #4h 1h 15m
|
||||
do
|
||||
echo $f_level
|
||||
done >"${f_levelsfile}.levels.new"
|
||||
mv "${f_levelsfile}.levels.new" "${f_levelsfile}.levels"
|
||||
|
||||
f_levelsfile="asset-histories/${f_symbol}.history.$f_timeframe.csv"
|
||||
printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_levelsfile}.levels-calculating"
|
||||
g_echo_note "Estimating relevant levels of $f_levelsfile"
|
||||
|
||||
get_levels "$f_levelsfile" && printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_levelsfile}.levels-calculated"
|
||||
|
||||
echo "${f_levels[@]}" >"${f_levelsfile}.levels.new"
|
||||
mv "${f_levelsfile}.levels.new" "${f_levelsfile}.levels"
|
||||
|
||||
echo "${f_zones[@]}" >"${f_levelsfile}.zones.new"
|
||||
mv "${f_levelsfile}.zones.new" "${f_levelsfile}.zones"
|
||||
|
||||
done
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_levels {
|
||||
|
||||
|
||||
# estimates the relevant levels from price list from array f_prices and put then in array f_levels
|
||||
# - needs array $f_prices with prices sorted from low to high and no duplicates (sort -nru) to analyze
|
||||
# needs levels csv file with prices in ohlcv
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
local f_levelsfile=$1
|
||||
if ! [ -s "$f_levelsfile" ]
|
||||
then
|
||||
g_echo_warn "file $f_levelsfile does not exist or is empty"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# get number of lines in file and use only half of these numbers as relevant price lines to speed up things - later nearest numbers to the current price
|
||||
f_lines=$(wc -l "${f_levelsfile}" | cut -d" " -f1)
|
||||
f_relevant_lines=$(( $f_lines * 4 / 5 ))
|
||||
[ $f_relevant_lines -gt 1000 ] && f_relevant_lines=1000
|
||||
|
||||
# read high, low and close, sort and use only relevant lines (near current price)
|
||||
mapfile -t f_prices < <((cut -d, -f2,3,4,5 "$f_levelsfile" ; echo $f_price) | sed 's/,/\n/g' | sort -rnu | grep -C $f_relevant_lines "^${f_price}$")
|
||||
|
||||
# if there is not enough or no price data
|
||||
[ -z "${f_prices[100]}" ] && return 1
|
||||
if [ -z "${f_prices[100]}" ]
|
||||
then
|
||||
g_echo_note "not enough or no price data"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# reset old levels var
|
||||
unset f_levels
|
||||
|
||||
local f_min_occurrences i j f_level f_level_count f_level_prices f_level_first_price f_baseprice f_threshold_test
|
||||
|
||||
# some key points
|
||||
# # some key points
|
||||
local f_lowest_price=${f_prices[-1]}
|
||||
local f_highest_price=${f_prices[1]}
|
||||
local f_number_of_prices=${#f_prices[@]}
|
||||
@@ -69,34 +99,64 @@ function get_levels {
|
||||
|
||||
# calc threshold (avarage of percentual price difference)
|
||||
local f_price_range_percentage=${g_percentage_diff_result//-/}
|
||||
g_calc "$f_price_range_percentage / $f_number_of_prices / 100" || return 1
|
||||
local f_threshold=$g_calc_result
|
||||
# calc threshold in range (1/100 of percentual range)
|
||||
g_calc "$f_price_range_percentage / 100" || return 1
|
||||
local f_threshold_in_range=$g_calc_result
|
||||
|
||||
#echo "$f_threshold_in_range - $f_threshold - $f_price_range_percentage"
|
||||
#return 0
|
||||
# g_calc "$f_price_range_percentage / $f_number_of_prices * 0.07" || return 1
|
||||
# local f_threshold=$g_calc_result
|
||||
# # calc threshold in range (1/100 of percentual range)
|
||||
# g_calc "$f_threshold * 11 " || return 1
|
||||
# local f_threshold_in_range=$g_calc_result
|
||||
|
||||
# how much occurencies / same prices have so show up for a defined level - percentage from number of prices
|
||||
#local f_min_occurrences=3
|
||||
g_calc "$f_number_of_prices / 100 * 0.2" || return 1
|
||||
local f_min_occurrences=$g_calc_result
|
||||
# how much occurencies / same prices have so show up for a defined level
|
||||
local f_min_occurrences=7
|
||||
if [[ $f_levelsfile =~ \.1w\. ]]
|
||||
then
|
||||
g_calc "$f_price_range_percentage / $f_number_of_prices * 0.07" || return 1
|
||||
local f_threshold=$g_calc_result
|
||||
g_calc "$f_threshold * 11 " || return 1
|
||||
local f_threshold_in_range=$g_calc_result
|
||||
#f_threshold="0.0018"
|
||||
#f_threshold_in_range="0.18"
|
||||
f_min_occurrences=1
|
||||
fi
|
||||
if [[ $f_levelsfile =~ \.1d\. ]]
|
||||
then
|
||||
g_calc "$f_price_range_percentage / $f_number_of_prices * 0.33" || return 1
|
||||
local f_threshold=$g_calc_result
|
||||
g_calc "$f_threshold * 11 " || return 1
|
||||
local f_threshold_in_range=$g_calc_result
|
||||
#f_threshold="0.009"
|
||||
#f_threshold_in_range="0.09"
|
||||
f_min_occurrences=7
|
||||
fi
|
||||
if [[ $f_levelsfile =~ \.1h\.|\.4h\. ]]
|
||||
then
|
||||
#f_threshold="0.03"
|
||||
#f_threshold_in_range="0.04"
|
||||
f_min_occurrences=9
|
||||
fi
|
||||
if [[ $f_levelsfile =~ \.15m\.|\.5m\. ]]
|
||||
then
|
||||
#f_threshold="0.01"
|
||||
#f_threshold_in_range="0.03"
|
||||
f_min_occurrences=11
|
||||
fi
|
||||
|
||||
echo "f_threshold_in_range $f_threshold_in_range - f_threshold $f_threshold - f_price_range_percentage $f_price_range_percentage - f_min_occurrences $f_min_occurrences - f_number_of_prices $f_number_of_prices"
|
||||
|
||||
# Loop through the f_prices and compare each number with the next
|
||||
for ((i=0; i<${#f_prices[@]}-1; i++))
|
||||
do
|
||||
#echo "$i of ${#f_prices[@]}"
|
||||
|
||||
# pair this and next elemtn
|
||||
# pair this and next element
|
||||
j=$((i+1))
|
||||
|
||||
f_threshold_test=$f_threshold
|
||||
f_baseprice=${f_prices[i]}
|
||||
# if we are in a level use first price of level
|
||||
# if we are in a level use current avarage price of level
|
||||
if [ -n "$f_level_count" ]
|
||||
then
|
||||
#g_calc "($f_level_prices)/$f_level_count"
|
||||
#f_baseprice=$g_calc_result
|
||||
f_baseprice=$f_level_first_price
|
||||
f_threshold_test=$f_threshold_in_range
|
||||
fi
|
||||
@@ -108,13 +168,17 @@ function get_levels {
|
||||
if [ -z "$f_level_count" ]
|
||||
then
|
||||
# new level
|
||||
unset f_zone
|
||||
f_level_count=2
|
||||
f_level_prices="${f_prices[i]}+${f_prices[j]}"
|
||||
f_level_first_price=${f_prices[i]}
|
||||
f_zone+=("${f_prices[i]}")
|
||||
f_zone+=("${f_prices[j]}")
|
||||
else
|
||||
# add values to level
|
||||
f_level_count=$((f_level_count+1))
|
||||
f_level_prices="$f_level_prices+${f_prices[j]}"
|
||||
f_zone+=("${f_prices[j]}")
|
||||
fi
|
||||
#echo "level ($f_level_count): $f_level_prices"
|
||||
else
|
||||
@@ -124,9 +188,11 @@ function get_levels {
|
||||
#if [ "$f_level_count" -ge "$f_min_occurrences" ]
|
||||
if g_num_is_higher_equal $f_level_count $f_min_occurrences
|
||||
then
|
||||
g_calc "($f_level_prices)/$f_level_count"
|
||||
f_levels+=("$g_calc_result")
|
||||
g_echo_note "adding significant level at $g_calc_result after reaching $f_level_count times"
|
||||
g_median ${f_zone[@]}
|
||||
f_levels+=("$g_median_result")
|
||||
f_zones+=("${f_zone[0]},${f_zone[-1]},$f_level_count")
|
||||
g_echo_note "adding significant zone at level $g_median_result after reaching $f_level_count times - Zone: ${f_zone[0]} - ${f_zone[-1]}"
|
||||
|
||||
fi
|
||||
f_level_prices=""
|
||||
f_level_count=""
|
||||
|
||||
@@ -1,7 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_marketdata {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
|
||||
### CPI Data: curl hapi.bls.gov/publicAPI/v2/timeseries/data/cpi | jq -a
|
||||
### release dates: https://www.bls.gov/schedule/news_release/bls.ics
|
||||
|
||||
get_marketdata_from_url https://www.investing.com/economic-calendar/unemployment-rate-300/ US-UNEMPLOYMENT-INDEX
|
||||
get_marketdata_from_url https://www.investing.com/economic-calendar/cpi-733 US-CONSUMER-PRICE-INDEX
|
||||
get_marketdata_from_url https://www.investing.com/indices/fed-funds-composite-interest-rate-opinion US-FED-FEDERAL-FUNDS-RATE-INVERTED-INDEX
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_marketdata_yahoo {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
@@ -59,8 +79,11 @@ function get_marketdata_yahoo {
|
||||
[[ $f_item = "DEFI-USD" ]] && f_item="DEFI29200-USD"
|
||||
[[ $f_item = "TON-USD" ]] && f_item="TON11419-USD"
|
||||
[[ $f_item = "BRETT-USD" ]] && f_item="BRETT29743-USD"
|
||||
[[ $f_item = "ADS-USD" ]] && f_item="%24ADS-USD"
|
||||
#[[ $f_item = "ADS-USD" ]] && f_item="%24ADS-USD"
|
||||
[[ $f_item = "AIT-USD" ]] && f_item="AIT28882-USD"
|
||||
[[ $f_item = "PT-USD" ]] && f_item="PT28582-USD"
|
||||
[[ $f_item = "BLAST-USD" ]] && f_item="BLAST28480-USD"
|
||||
[[ $f_item = "GRT-USD" ]] && f_item="GRT6719-USD"
|
||||
|
||||
# end if already failed the last 5 minutes
|
||||
if [ -f "FAILED_YAHOO/${f_name}_HISTORIC_DOWNLOAD" ]
|
||||
@@ -85,6 +108,10 @@ function get_marketdata_yahoo {
|
||||
|
||||
if [ "$f_timeframe" = "1d" ] || [ "$f_timeframe" = "1wk" ] || [ "$f_timeframe" = "1mo" ]
|
||||
then
|
||||
# restrict to finished candles
|
||||
[ "$f_timeframe" = "1d" ] && f_sec=$(TZ=US/NY date -d 'last day 0:00' '+%s')
|
||||
[ "$f_timeframe" = "1wk" ] && f_sec=$(TZ=US/NY date -d 'last monday 0:00' '+%s')
|
||||
[ "$f_timeframe" = "1mo" ] && f_sec=$(TZ=US/NY date -d "$(date -d "@$(date -d "last month" +%s)" +'%Y-%m-01')" +%s)
|
||||
# Download historical data from yahoo
|
||||
g_wget -O "${f_targetcsvtmp}" "https://query1.finance.yahoo.com/v7/finance/download/${f_item}?period1=0&period2=${f_sec}&interval=${f_timeframe}&events=history" 2>"${f_targetcsvtmp}".err
|
||||
else
|
||||
@@ -121,7 +148,7 @@ function get_marketdata_yahoo {
|
||||
# put the csvs together
|
||||
if [ -s "${f_targetcsv}" ] && [ -s "${f_targetcsvtmp}" ]
|
||||
then
|
||||
egrep -h "^[1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-9][0-9].*,[0-9]" "${f_targetcsvtmp}" "${f_targetcsv}" | sort -k1,2 -t, -u >"${f_targetcsv}.tmp"
|
||||
egrep -h "^[1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-9][0-9].*,[0-9]" "${f_targetcsv}" "${f_targetcsvtmp}" | sort -k1,2 -t, -u | sort -k1,1 -t, -u >"${f_targetcsv}.tmp"
|
||||
mv "${f_targetcsv}.tmp" "${f_targetcsv}"
|
||||
else
|
||||
egrep -h "^[1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-9][0-9].*,[0-9]" "${f_targetcsvtmp}" | sort -k1,2 -t, -u >"$f_targetcsv"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_ohlcv-candles {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
@@ -7,9 +27,8 @@ function get_ohlcv-candles {
|
||||
[ -n $1 ] && f_timeframes=$1
|
||||
|
||||
# fetch economy candles from yahoo finance
|
||||
local f_eco_assets="DXY DOWJONES SP500 NASDAQ MSCIEAFE 10YRTREASURY OIL GOLD MSCIWORLD OILGAS KRE EUR-USD"
|
||||
local f_eco_asset
|
||||
for f_eco_asset in $f_eco_assets
|
||||
for f_eco_asset in $ECO_ASSETS
|
||||
do
|
||||
for f_timeframe in $f_timeframes
|
||||
do
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_onetrading_csv_transactions {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_orders {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,9 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_positions {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
local f_symbol f_symbols
|
||||
|
||||
get_symbols_ticker
|
||||
|
||||
# build python array of symbols
|
||||
for f_symbol in "${f_symbols_array_trade[@]}"
|
||||
do
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
function get_range {
|
||||
|
||||
#g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_rsi_indicator {
|
||||
#g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
# get histfile
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_symbols_ticker {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_transactions {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
local f_exchange f_symbol f_symbol_file f_asset f_currency f_leverage f_convert_end_month f_convert_end_year f_symbol_file_csv f_symbol_file_csv_tmp f_start_date f_end_date f_convert_file f_fiat f_fiats
|
||||
local f_exchange f_symbol f_symbol_file f_asset f_currency f_leverage f_convert_end_month f_convert_end_year f_symbol_file_csv f_symbol_file_csv_tmp f_start_date f_end_date f_convert_file f_fiat f_fiats f_return
|
||||
local DEFAULT_STOCK_EXCHANGE=$STOCK_EXCHANGE
|
||||
local DEFAULT_LEVERAGE=$LEVERAGE
|
||||
|
||||
@@ -50,15 +70,28 @@ function get_transactions {
|
||||
|
||||
# fetch only if not exists
|
||||
[ -f "$f_symbol_file" ] && continue
|
||||
g_echo_note "fetching closed orders of $f_symbol on $f_exchange"
|
||||
f_ccxt "print(${STOCK_EXCHANGE}.fetchMyTrades(symbol='$f_symbol', limit=500, params={'paginate': True}))" || continue
|
||||
|
||||
# write to file
|
||||
#[[ $f_ccxt_result = \[\] ]] && f_ccxt_result=""
|
||||
g_echo_note "fetching closed orders of $f_symbol on ${STOCK_EXCHANGE}"
|
||||
|
||||
# fetch and reset/store return code
|
||||
f_return=""
|
||||
f_ccxt "print(${STOCK_EXCHANGE}.fetchMyTrades(symbol='$f_symbol', limit=500, params={'paginate': True}))" || f_return=1
|
||||
|
||||
# write result even if its failed/empty for timestamp
|
||||
echo -n $f_ccxt_result >"$f_symbol_file"
|
||||
|
||||
# continue if no trade
|
||||
#[ -z "$f_ccxt_result" ] && continue
|
||||
# continue if fetch failed/empty
|
||||
if [ -n "$f_return" ]
|
||||
then
|
||||
g_echo_note "fetch of $f_symbol on ${STOCK_EXCHANGE} failed no json output or empty - no trades"
|
||||
continue
|
||||
fi
|
||||
|
||||
# check output for symbol
|
||||
if ! [[ $f_ccxt_result =~ $f_symbol ]]
|
||||
then
|
||||
g_echo_warn "unexpectet return in \"$f_symbol_file\" Symbol $f_symbol not present!?"
|
||||
continue
|
||||
fi
|
||||
|
||||
# get f_asset+f_currency from symbol (BTC/USDT)
|
||||
g_array "$f_symbol" f_symbol_array /
|
||||
@@ -89,11 +122,21 @@ function get_transactions {
|
||||
fi
|
||||
|
||||
# generate csv
|
||||
|
||||
# get spot buy/sell (posSide=="1")
|
||||
cat "$f_symbol_file" | jq -r "
|
||||
.[] |
|
||||
select(.side==\"buy\" or .side==\"sell\") |
|
||||
select(.info.posSide=null) |
|
||||
select(.symbol!= null) |
|
||||
.datetime + \",$f_leverage\" + .side + \",$f_asset,\" + (.amount|tostring) + \",$f_currency,\" + (.cost|tostring) + \",$f_exchange,\" + .fee.currency + \",\" + (.fee.cost|tostring)
|
||||
" >>"$f_symbol_file_csv_tmp"
|
||||
|
||||
# get longs (posSide=="1")
|
||||
cat "$f_symbol_file" | jq -r "
|
||||
.[] |
|
||||
select(.side==\"buy\" or .side==\"sell\") |
|
||||
select(.info.posSide==\"1\") |
|
||||
select(.info.posSide=\"1\") |
|
||||
select(.symbol!= null) |
|
||||
.datetime + \",$f_leverage\" + .side + \",$f_asset,\" + (.amount|tostring) + \",$f_currency,\" + (.cost|tostring) + \",$f_exchange,\" + .fee.currency + \",\" + (.fee.cost|tostring)
|
||||
" >>"$f_symbol_file_csv_tmp"
|
||||
@@ -101,21 +144,30 @@ function get_transactions {
|
||||
# get shorts (posSide=="2") sell first, then buy (https://github.com/ccxt/ccxt/issues/22518)
|
||||
cat "$f_symbol_file" | jq -r "
|
||||
.[] |
|
||||
select(.side==\"sell\") |
|
||||
select(.side==\"buy\" or .side==\"sell\") |
|
||||
select(.info.posSide==\"2\") |
|
||||
select(.symbol!= null) |
|
||||
.side = \"sell\" |
|
||||
select(.symbol!=null) |
|
||||
.datetime + \",$f_leverage\" + .side + \",$f_asset,\" + (.amount|tostring) + \",$f_currency,\" + (.cost|tostring) + \",$f_exchange,\" + .fee.currency + \",\" + (.fee.cost|tostring) + \",short\"
|
||||
" >>"$f_symbol_file_csv_tmp"
|
||||
|
||||
cat "$f_symbol_file" | jq -r "
|
||||
.[] |
|
||||
select(.side==\"buy\") |
|
||||
select(.info.posSide==\"2\") |
|
||||
select(.symbol!= null) |
|
||||
.side = \"buy\" |
|
||||
.datetime + \",$f_leverage\" + .side + \",$f_asset,\" + (.amount|tostring) + \",$f_currency,\" + (.cost|tostring) + \",$f_exchange,\" + .fee.currency + \",\" + (.fee.cost|tostring) + \",short\"
|
||||
" >>"$f_symbol_file_csv_tmp"
|
||||
# # get shorts (posSide=="2") sell first, then buy (https://github.com/ccxt/ccxt/issues/22518)
|
||||
# cat "$f_symbol_file" | jq -r "
|
||||
#.[] |
|
||||
# select(.side==\"sell\") |
|
||||
# select(.info.posSide==\"2\") |
|
||||
# select(.symbol!=null) |
|
||||
# .side = \"sell\" |
|
||||
#.datetime + \",$f_leverage\" + .side + \",$f_asset,\" + (.amount|tostring) + \",$f_currency,\" + (.cost|tostring) + \",$f_exchange,\" + .fee.currency + \",\" + (.fee.cost|tostring) + \",short\"
|
||||
#" >>"$f_symbol_file_csv_tmp"
|
||||
#
|
||||
# cat "$f_symbol_file" | jq -r "
|
||||
#.[] |
|
||||
# select(.side==\"buy\") |
|
||||
# select(.info.posSide==\"2\") |
|
||||
# select(.symbol!=null) |
|
||||
# .side = \"buy\" |
|
||||
#.datetime + \",$f_leverage\" + .side + \",$f_asset,\" + (.amount|tostring) + \",$f_currency,\" + (.cost|tostring) + \",$f_exchange,\" + .fee.currency + \",\" + (.fee.cost|tostring) + \",short\"
|
||||
#" >>"$f_symbol_file_csv_tmp"
|
||||
|
||||
if [ -s "$f_symbol_file_csv_tmp" ]
|
||||
then
|
||||
|
||||
83
dabo/functions/get_values.sh
Normal file
83
dabo/functions/get_values.sh
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_values {
|
||||
|
||||
local f_assets="$@"
|
||||
f_assets=${f_assets//:$CURRENCY/}
|
||||
f_assets=${f_assets//\//}
|
||||
|
||||
local f_eco_asset f_eco_assets f_asset f_time f_prefix f_histfile f_columns f_return f_levelsfile f_tmp_levels f_first
|
||||
|
||||
for f_eco_asset in $ECO_ASSETS
|
||||
do
|
||||
if [ -z "$f_eco_assets" ]
|
||||
then
|
||||
f_eco_assets="ECONOMY-${f_eco_asset}"
|
||||
else
|
||||
f_eco_assets="$f_eco_assets ECONOMY-${f_eco_asset}"
|
||||
fi
|
||||
done
|
||||
|
||||
# get current prices
|
||||
get_symbols_ticker
|
||||
# get values from csv files
|
||||
f_first=true
|
||||
for f_asset in $f_assets BTC${CURRENCY} $f_eco_assets
|
||||
do
|
||||
|
||||
# read latest ohlcv data and indicators per timeframe to vars
|
||||
for f_time in 5m 15m 1h 4h 1d 1w
|
||||
do
|
||||
f_prefix="${f_asset}_${f_time}_"
|
||||
[ "$f_first" = "true" ] && f_prefix="${f_time}_"
|
||||
f_prefix=${f_prefix//-/_}
|
||||
f_histfile="asset-histories/${f_asset}.history.${f_time}.csv"
|
||||
if ! [ -s "$f_histfile" ]
|
||||
then
|
||||
g_echo_warn "file $f_histfile emty or does not exist"
|
||||
f_return=1
|
||||
continue
|
||||
fi
|
||||
f_columns="${f_prefix}date,${f_prefix}open,${f_prefix}high,${f_prefix}low,${f_prefix}close,${f_prefix}volume,${f_prefix}change,${f_prefix}ath,${f_prefix}ema12,${f_prefix}ema26,${f_prefix}ema50,${f_prefix}ema100,${f_prefix}ema200,${f_prefix}ema400,${f_prefix}ema800,${f_prefix}rsi5,${f_prefix}rsi14,${f_prefix}rsi21,${f_prefix}macd,${f_prefix}macd_ema9_signal,${f_prefix}macd_histogram,${f_prefix}macd_histogram_signal,${f_prefix}macd_histogram_max,${f_prefix}macd_histogram_strength"
|
||||
g_read_csv "${f_histfile}" 1 "$f_columns"
|
||||
done
|
||||
|
||||
# read current levels and price
|
||||
f_levelsfile="asset-histories/${f_asset}.history.csv.levels"
|
||||
if [ "$f_first" = "true" ]
|
||||
then
|
||||
[ -s "$f_levelsfile" ] && v_levels="$(cat "$f_levelsfile")"
|
||||
v_price=${f_tickers_array[$f_asset]}
|
||||
else
|
||||
[ -s "$f_levelsfile" ] && declare -g v_${f_asset}_levels="$(cat "$f_levelsfile")"
|
||||
[[ $f_asset =~ ECONOMY ]] || declare -g v_${f_asset}_price="${f_tickers_array[$f_asset]}"
|
||||
fi
|
||||
|
||||
unset f_first
|
||||
|
||||
done
|
||||
|
||||
|
||||
set 2>&1 | grep ^v_ | grep -v ^v_csv_array_associative >values
|
||||
|
||||
return $f_return
|
||||
}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function get_vars_from_csv {
|
||||
|
||||
unset f_empty_var
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function market_performance {
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function order {
|
||||
# Info for log
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function position_close {
|
||||
# Info for log
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function score {
|
||||
[ -z "${s_score}" ] && s_score=0
|
||||
#s_score=$((s_score${1}))
|
||||
@@ -7,3 +27,4 @@ function score {
|
||||
s_score_hist="${s_score_hist}
|
||||
s_score=${s_score} (${1}) ${2}"
|
||||
}
|
||||
|
||||
|
||||
43
dabo/functions/strategy.sh
Normal file
43
dabo/functions/strategy.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function strategy {
|
||||
|
||||
unset s_score
|
||||
unset s_SYMBOLS
|
||||
|
||||
#find
|
||||
#. "${f_strategy}" || return 1
|
||||
|
||||
get_values
|
||||
get_symbols_ticker
|
||||
|
||||
for f_symbol in "${f_symbols_array_trade[@]}"
|
||||
do
|
||||
echo $f_symbol
|
||||
get_values $f_symbol
|
||||
done
|
||||
|
||||
|
||||
echo "Score: $s_score"
|
||||
echo $s_score_hist
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function transactions_overview {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
@@ -21,7 +41,11 @@ function transactions_overview {
|
||||
mapfile -d, -t f_asset_per_exchange_array < <(echo $f_asset_per_exchange)
|
||||
f_asset=${f_asset_per_exchange_array[0]}
|
||||
f_exchange=${f_asset_per_exchange_array[1]%$'\n'}
|
||||
|
||||
|
||||
# check values
|
||||
[ -z "$f_asset" ] && continue
|
||||
[ -z "$f_exchange" ] && continue
|
||||
|
||||
# Ignore stableCoins, EUR, USD
|
||||
[[ $f_asset = USDT ]] && continue
|
||||
[[ $f_asset = USDC ]] && continue
|
||||
@@ -51,6 +75,11 @@ function transactions_overview {
|
||||
f_type=${f_transaction_array[1]}
|
||||
f_asset_amount=${f_transaction_array[3]}
|
||||
f_currency=${f_transaction_array[4]}
|
||||
if [ -z "$f_currency" ]
|
||||
then
|
||||
g_echo_warn "f_currency empty: $f_transaction"
|
||||
continue
|
||||
fi
|
||||
f_currency_amount=${f_transaction_array[5]}
|
||||
f_currency_amount_eur=0
|
||||
f_fee_currency=${f_transaction_array[7]}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function watch_assets {
|
||||
|
||||
local f_watch_assets_array
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function webpage {
|
||||
|
||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
function webpage_transactions {
|
||||
|
||||
# calculate totals from csv
|
||||
|
||||
@@ -1,4 +1,23 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
. /etc/bash/gaboshlib.include
|
||||
|
||||
|
||||
@@ -1,4 +1,23 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
. /etc/bash/gaboshlib.include
|
||||
|
||||
|
||||
@@ -1,4 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2022-2024 olli
|
||||
#
|
||||
# This file is part of dabo (crypto bot).
|
||||
#
|
||||
# dabo is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# dabo is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
mkdir final
|
||||
ls -1 *.history.csv | while read x
|
||||
do
|
||||
|
||||
Reference in New Issue
Block a user