bitpanda fixes

This commit is contained in:
olli 2023-05-07 23:09:40 +02:00
parent 1173980f3e
commit 8f3495e497
7 changed files with 13 additions and 49 deletions

5
.gitignore vendored
View File

@ -4,4 +4,7 @@ data/index.html
data/index.html.tmp data/index.html.tmp
dabo/.binance-secrets dabo/.binance-secrets
dabo/.bitpanda-secrets dabo/.bitpanda-secrets
home/.ssh/ home/.ssh
home/.viminfo
home/.bash_history
home/.dabo-bot.sh.lock

View File

@ -15,7 +15,7 @@ I thought this fits quite well to the cryptotrading world and that's why i chose
# Features # Features
## General: ## General:
- Compatible with the following crypto exchanges: Binance - Compatible with the following crypto exchanges: Binance, Bitpanda
- Consideration of trading fees - Consideration of trading fees
- Automatic selection of cryptocurrencies to invest in - Automatic selection of cryptocurrencies to invest in
- Filtering of cryptocurrencies by market capitalization (data via coingecko API) e.g. only trade the 50 largest by market capitalization if available on the exchange - Filtering of cryptocurrencies by market capitalization (data via coingecko API) e.g. only trade the 50 largest by market capitalization if available on the exchange
@ -27,6 +27,7 @@ I thought this fits quite well to the cryptotrading world and that's why i chose
- Recording of available price values incl. RSI and MACD indicators of available cryptocurrencies - Recording of available price values incl. RSI and MACD indicators of available cryptocurrencies
- Analysis tool for collected historical values to try out buy or sell conditions based on them - Analysis tool for collected historical values to try out buy or sell conditions based on them
- ReadOnly web interface for overview - ReadOnly web interface for overview
- Runnable in a non-root docker container
## Buy conditions ## Buy conditions
- definable RSI Indicator signals min/max (RSI5, 14 and 21) - definable RSI Indicator signals min/max (RSI5, 14 and 21)
@ -78,4 +79,3 @@ The access rights to this file should be set to the minimum necessary for securi
- Overview trades/profits/losses for tax declaration - Overview trades/profits/losses for tax declaration
- Support for decentralized exchanges like uniswap to gain more "security" - Support for decentralized exchanges like uniswap to gain more "security"
- mutliple trading strategies - mutliple trading strategies
- run in a docker container

View File

@ -16,7 +16,7 @@ TRANSFER_CURRENCY="NONE"
LARGEST_MARKETCAP="250" LARGEST_MARKETCAP="250"
# Blacklist Currencies # Blacklist Currencies
BLACKLIST="^DAI${CURRENCY}|^BUSD${CURRENCY}|^USDC${CURRENCY}|^USDP${CURRENCY}|^TUSD${CURRENCY}|^USDD${CURRENCY}|^GUSD${CURRENCY}|^FEI${CURRENCY}|^USTC${CURRENCY}|^FRAX${CURRENCY}|^USDJ${CURRENCY}|^LUSD${CURRENCY}|^EURS${CURRENCY}|^TRIBE${CURRENCY}|^BNB${CURRENCY}" BLACKLIST="^USDT${CURRENCY}|^DAI${CURRENCY}|^BUSD${CURRENCY}|^USDC${CURRENCY}|^USDP${CURRENCY}|^TUSD${CURRENCY}|^USDD${CURRENCY}|^GUSD${CURRENCY}|^FEI${CURRENCY}|^USTC${CURRENCY}|^FRAX${CURRENCY}|^USDJ${CURRENCY}|^LUSD${CURRENCY}|^EURS${CURRENCY}|^TRIBE${CURRENCY}|^BNB${CURRENCY}"
## Signal Group for Notifications ## Signal Group for Notifications
SIGNAL_GROUP="Krypto-Bot" SIGNAL_GROUP="Krypto-Bot"
@ -29,7 +29,7 @@ INVEST="5"
# The market performance is calculated from the average percentage development of various indicators such as development MSCI World, Bitcoin and Ethereum as well as forecasts. # The market performance is calculated from the average percentage development of various indicators such as development MSCI World, Bitcoin and Ethereum as well as forecasts.
# for details see functions/market_performance.sh # for details see functions/market_performance.sh
# If the market performance is under this value no buying will be done # If the market performance is under this value no buying will be done
GOOD_MARKET_PERFORMANCE_INDEX="0.3" GOOD_MARKET_PERFORMANCE_INDEX="-1"
# Stop all trading and sell everything if the complete balance shrinks under this value in ${CURRENCY} # Stop all trading and sell everything if the complete balance shrinks under this value in ${CURRENCY}
EMERGENCY_STOP="190" EMERGENCY_STOP="190"
@ -66,7 +66,7 @@ BUY_RSI720_SIGNAL_FROM="0"
# Here you can specify a percentage range. # Here you can specify a percentage range.
# If only the buy signal should be considered, simply specify the range 0 and 100. # If only the buy signal should be considered, simply specify the range 0 and 100.
# decimal numbers are not allowed here. # decimal numbers are not allowed here.
BUY_MACD_RELATION_FROM="60" BUY_MACD_RELATION_FROM="40"
BUY_MACD_RELATION_TO="95" BUY_MACD_RELATION_TO="95"
# Don't buy if price change is under this percentage values # Don't buy if price change is under this percentage values

View File

@ -15,9 +15,10 @@ function bitpanda-api-call {
fi fi
echo "${call}" | egrep -q "/account/" && local f_token="-H 'Authorization: Bearer ${API_TOKEN}'" echo "${call}" | egrep -q "/account/" && local f_token="-H 'Authorization: Bearer ${API_TOKEN}'"
echo "curl -s -X ${method} --url https://api.exchange.bitpanda.com/${call} $f_token -H 'Accept: application/json'" >${g_tmp}/API_CMD echo "curl -s -X ${method} --url https://api.exchange.bitpanda.com/${call} $f_token -H 'Accept: application/json' ${params}" >${g_tmp}/API_CMD
echo "curl -s -X ${method} --url https://api.exchange.bitpanda.com/${call} -H 'Accept: application/json'" >${g_tmp}/API_CMD_WO_KEY echo "curl -s -X ${method} --url https://api.exchange.bitpanda.com/${call} -H 'Accept: application/json'" >${g_tmp}/API_CMD_WO_KEY
g_runcmd g_retrycmd sh ${g_tmp}/API_CMD >${g_tmp}/API_CMD_OUT 2>&1 g_runcmd g_retrycmd sh ${g_tmp}/API_CMD >${g_tmp}/API_CMD_OUT 2>&1
if egrep -q -i '^{"code":|error' ${g_tmp}/API_CMD_OUT if egrep -q -i '^{"code":|error' ${g_tmp}/API_CMD_OUT
then then
g_echo_error "$(cat ${g_tmp}/API_CMD_WO_KEY): $(cat ${g_tmp}/API_CMD_OUT)" g_echo_error "$(cat ${g_tmp}/API_CMD_WO_KEY): $(cat ${g_tmp}/API_CMD_OUT)"

View File

@ -14,7 +14,7 @@ function get_assets {
elif [ ${STOCK_EXCHANGE} = "BITPANDA" ] elif [ ${STOCK_EXCHANGE} = "BITPANDA" ]
then then
bitpanda-api-call GET "public/v1/market-ticker" || return 1 bitpanda-api-call GET "public/v1/market-ticker" || return 1
cat ${g_tmp}/API_CMD_OUT | jq -r '.[] | .instrument_code + "," + .last_price' | sed 's/_//' | grep "${CURRENCY}," | egrep -v "${TRANSFER_CURRENCY},|,0[\.][0]*$" >${f_filename}_OUT.tmp cat ${g_tmp}/API_CMD_OUT | jq -r '.[] | select(.state=="ACTIVE") | .instrument_code + "," + .last_price' | sed 's/_//' | grep "${CURRENCY}," | egrep -v "${TRANSFER_CURRENCY},|,0[\.][0]*$" >${f_filename}_OUT.tmp
fi fi
# timestamp for data # timestamp for data
@ -95,43 +95,7 @@ function get_assets {
. /tmp/parallel . /tmp/parallel
# cleanup trashlines (possibly generated by kill further of this progress) # cleanup trashlines (possibly generated by kill further of this progress)
sed -i "/[0-9]$(date +%Y)-/d" asset-histories/* #sed -i "/[0-9]$(date +%Y)-/d" asset-histories/*
#cat ASSETS | while read f_ASSET
#do
# # write asset hist file with macd and rsi
# local f_ASSET_HIST_FILE="asset-histories/${f_ASSET}.history.csv"
# [ -f "${f_ASSET_HIST_FILE}" ] || touch "${f_ASSET_HIST_FILE}"
# if ! grep -q "^$(echo "${f_timestamp}" | cut -d: -f1,2)" "${f_ASSET_HIST_FILE}"
# then
# local f_line="${f_timestamp},$(egrep "^${f_ASSET}," EXCHANGE_GET_ASSETS_CMD_OUT | cut -d, -f2)"
# #g_echo_note "Writing new line (${f_line}) to history ${ASSET_HIST_FILE}"
# echo -n "${f_line}" >>${f_ASSET_HIST_FILE}
# get_macd_indicator ${f_ASSET_HIST_FILE}
# get_rsi_indicator ${f_ASSET_HIST_FILE} 30
# echo ",${f_macd},${f_rsi}" >>${f_ASSET_HIST_FILE}
# fi
# cat ASSETS | while read f_ASSET
# do
# # ignore already invested asset
# if echo "$f_ASSET" | egrep -q "$f_investedassets_regex"
# then
# g_echo_note "Already invested in $f_ASSET - ignoring for more diversification"
# continue
# fi
#
# # sort latest assets prices by highest in last timeframe (ignore - or 0)
# get_rate_percentage_min_before_and_now $(echo ${f_ASSET} | sed "s/${CURRENCY}\$//") ${CURRENCY} 1 || continue
# local f_ASSET_PERCENTAGE=${f_exchange_rate_diff_percentage}
# echo "$f_ASSET_PERCENTAGE" | egrep -q '^-|^0.0' && continue
# g_echo "adding ${f_ASSET}({$f_ASSET_PERCENTAGE}) to ASSETS_HIGHEST because marketcap in Top ${LARGEST_MARKETCAP}"
# echo "${f_ASSET_PERCENTAGE},${f_ASSET}" >>ASSETS_HIGHEST.tmp
# done
# cat ASSETS_HIGHEST.tmp | sort -r >ASSETS_HIGHEST.tmp2
# mv ASSETS_HIGHEST.tmp2 ASSETS_HIGHEST
# rm ASSETS_HIGHEST.tmp
# get MSCI World Index for analysis # get MSCI World Index for analysis
echo "wget -q -O - https://www.boerse.de/realtime-kurse/MSCI-World/XC0009692739 | egrep 'itemprop=\"price\" content=\"[0-9]+\.[0-9]+\"' | cut -d\\\" -f6" >MSCI_WORLD_CMD echo "wget -q -O - https://www.boerse.de/realtime-kurse/MSCI-World/XC0009692739 | egrep 'itemprop=\"price\" content=\"[0-9]+\.[0-9]+\"' | cut -d\\\" -f6" >MSCI_WORLD_CMD

View File

@ -1,3 +0,0 @@
id
ps ax
ps aux

View File

@ -1 +0,0 @@
1