Compare commits

..

No commits in common. "c9da86b94c0263769ec57f02fd039e0c86caf133" and "9e918401e7956af238b8bdb8196476de24de4f6b" have entirely different histories.

8 changed files with 41 additions and 32 deletions

View File

@ -3,7 +3,7 @@
# Webpage URL # Webpage URL
URL="mydabobot.mydomain" URL="mydabobot.mydomain"
# The exchange we use for using the correct API (BINANCE or ONETRADING) # The exchange we use for using the correct API (BINANCE or BITPANDA)
STOCK_EXCHANGE="NONE" STOCK_EXCHANGE="NONE"
# fee per trade in percentage on exchange (taker and maker added) # fee per trade in percentage on exchange (taker and maker added)

View File

@ -107,10 +107,10 @@ do
TOKEN_INFO_CMD="binance_get_token_info" TOKEN_INFO_CMD="binance_get_token_info"
# command for buying/selling a token # command for buying/selling a token
TRADE_CMD='binance-api-call POST /api/v3/order "&symbol=TOKEN&quoteOrderQty=QUANTITY&side=ACTION&type=MARKET"' TRADE_CMD='binance-api-call POST /api/v3/order "&symbol=TOKEN&quoteOrderQty=QUANTITY&side=ACTION&type=MARKET"'
elif [ "${STOCK_EXCHANGE}" = "ONETRADING" ] elif [ "${STOCK_EXCHANGE}" = "BITPANDA" ]
then then
TOKEN_INFO_CMD="onetrading_get_token_info" TOKEN_INFO_CMD="bitpanda_get_token_info"
TRADE_CMD='onetrading-api-call POST public/v1/account/orders "--header \"Content-Type: application/json\" --data \"{\\\"instrument_code\\\":\\\"TOKEN\\\",\\\"side\\\":\\\"ACTION\\\",\\\"type\\\":\\\"MARKET\\\",\\\"amount\\\":\\\"QUANTITY\\\"}\""' TRADE_CMD='bitpanda-api-call POST public/v1/account/orders "--header \"Content-Type: application/json\" --data \"{\\\"instrument_code\\\":\\\"TOKEN\\\",\\\"side\\\":\\\"ACTION\\\",\\\"type\\\":\\\"MARKET\\\",\\\"amount\\\":\\\"QUANTITY\\\"}\""'
elif [ "${STOCK_EXCHANGE}" = "NONE" ] elif [ "${STOCK_EXCHANGE}" = "NONE" ]
then then
## stop here if STOCK_EXCHANGE not present ## stop here if STOCK_EXCHANGE not present

View File

@ -1,14 +1,14 @@
#!/bin/bash #!/bin/bash
function onetrading-api-call { function bitpanda-api-call {
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
local method=$1 local method=$1
local call=$2 local call=$2
local params=$3 local params=$3
if [ -s /dabo/.onetrading-secrets ] if [ -s /dabo/.bitpanda-secrets ]
then then
. /dabo/.onetrading-secrets . /dabo/.bitpanda-secrets
else else
g_echo_error "No secrets file found" g_echo_error "No secrets file found"
return 1 return 1
@ -17,6 +17,8 @@ function onetrading-api-call {
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.onetrading.com/${call} $f_token -H 'Accept: application/json' ${params}" >${g_tmp}/API_CMD echo "curl -s -X ${method} --url https://api.onetrading.com/${call} $f_token -H 'Accept: application/json' ${params}" >${g_tmp}/API_CMD
echo "curl -s -X ${method} --url https://api.onetrading.com/${call} -H 'Accept: application/json'" >${g_tmp}/API_CMD_WO_KEY echo "curl -s -X ${method} --url https://api.onetrading.com/${call} -H 'Accept: application/json'" >${g_tmp}/API_CMD_WO_KEY
#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
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

View File

@ -1,4 +1,4 @@
function onetrading_get_token_info { function bitpanda_get_token_info {
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@" g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
@ -7,16 +7,16 @@ function onetrading_get_token_info {
f_QUANTITY=$3 f_QUANTITY=$3
# cleanup cache # cleanup cache
[ -s ONETRADING_TOKEN_INFO_CMD_OUT ] && find ONETRADING_TOKEN_INFO_CMD_OUT -mmin +60 -or -empty -delete [ -s BITPANDA_TOKEN_INFO_CMD_OUT ] && find BITPANDA_TOKEN_INFO_CMD_OUT -mmin +60 -or -empty -delete
if ! [ -s ONETRADING_TOKEN_INFO_CMD_OUT ] if ! [ -s BITPANDA_TOKEN_INFO_CMD_OUT ]
then then
onetrading-api-call GET public/v1/instruments >ONETRADING_TOKEN_INFO_CMD_OUT bitpanda-api-call GET public/v1/instruments >BITPANDA_TOKEN_INFO_CMD_OUT
cat ${g_tmp}/API_CMD_OUT >ONETRADING_TOKEN_INFO_CMD_OUT cat ${g_tmp}/API_CMD_OUT >BITPANDA_TOKEN_INFO_CMD_OUT
fi fi
local f_ASSET_PRECISION=$(cat ONETRADING_TOKEN_INFO_CMD_OUT | jq -r ".[] | select(.state==\"ACTIVE\") | select(.quote.code==\"${f_CURRENCY}\") | select(.base.code==\"${f_ASSET}\") | .amount_precision") local f_ASSET_PRECISION=$(cat BITPANDA_TOKEN_INFO_CMD_OUT | jq -r ".[] | select(.state==\"ACTIVE\") | select(.quote.code==\"${f_CURRENCY}\") | select(.base.code==\"${f_ASSET}\") | .amount_precision")
local f_CURRENCY_PRECISION=$(cat ONETRADING_TOKEN_INFO_CMD_OUT | jq -r ".[] | select(.state==\"ACTIVE\") | select(.quote.code==\"${f_CURRENCY}\") | select(.base.code==\"${f_ASSET}\") | .quote.precision") local f_CURRENCY_PRECISION=$(cat BITPANDA_TOKEN_INFO_CMD_OUT | jq -r ".[] | select(.state==\"ACTIVE\") | select(.quote.code==\"${f_CURRENCY}\") | select(.base.code==\"${f_ASSET}\") | .quote.precision")
local f_ASSET_MINSIZE=$(cat ONETRADING_TOKEN_INFO_CMD_OUT | jq -r ".[] | select(.state==\"ACTIVE\") | select(.quote.code==\"${f_CURRENCY}\") | select(.base.code==\"${f_ASSET}\") | .min_size") local f_ASSET_MINSIZE=$(cat BITPANDA_TOKEN_INFO_CMD_OUT | jq -r ".[] | select(.state==\"ACTIVE\") | select(.quote.code==\"${f_CURRENCY}\") | select(.base.code==\"${f_ASSET}\") | .min_size")
local f_ASSET_PRICE=$(tail -n1 "asset-histories/${f_ASSET}${f_CURRENCY}.history.csv" | cut -d"," -f2) local f_ASSET_PRICE=$(tail -n1 "asset-histories/${f_ASSET}${f_CURRENCY}.history.csv" | cut -d"," -f2)
if [ -n "$f_QUANTITY" ] && [ -n "$f_ASSET_PRICE" ] if [ -n "$f_QUANTITY" ] && [ -n "$f_ASSET_PRICE" ]

View File

@ -56,7 +56,7 @@ ${FUNCNAME} $@"
# prepare trading command # prepare trading command
local f_CMDFILE="trade-histories/${f_DATE}-${f_CURRENCY}-TRADE_CMD" local f_CMDFILE="trade-histories/${f_DATE}-${f_CURRENCY}-TRADE_CMD"
[ ${STOCK_EXCHANGE} = "BINANCE" ] && echo "${TRADE_CMD}" | perl -pe "s/ACTION/${f_ACTION}/; s/TOKEN/${f_ASSET}${f_CURRENCY}/; s/QUANTITY/${f_QUANTITY}/" >${f_CMDFILE} [ ${STOCK_EXCHANGE} = "BINANCE" ] && echo "${TRADE_CMD}" | perl -pe "s/ACTION/${f_ACTION}/; s/TOKEN/${f_ASSET}${f_CURRENCY}/; s/QUANTITY/${f_QUANTITY}/" >${f_CMDFILE}
[ ${STOCK_EXCHANGE} = "ONETRADING" ] && echo "${TRADE_CMD}" | perl -pe "s/ACTION/${f_ACTION}/; s/TOKEN/${f_ASSET}_${f_CURRENCY}/; s/QUANTITY/${f_ASSET_QUANTITY}/" >${f_CMDFILE} [ ${STOCK_EXCHANGE} = "BITPANDA" ] && echo "${TRADE_CMD}" | perl -pe "s/ACTION/${f_ACTION}/; s/TOKEN/${f_ASSET}_${f_CURRENCY}/; s/QUANTITY/${f_ASSET_QUANTITY}/" >${f_CMDFILE}
# trade # trade
g_echo_note "Command: $(cat ${f_CMDFILE})" g_echo_note "Command: $(cat ${f_CMDFILE})"
cat ${f_CMDFILE} cat ${f_CMDFILE}
@ -91,7 +91,7 @@ ${FUNCNAME} $@"
# Check return and log trade # Check return and log trade
[ ${STOCK_EXCHANGE} = "BINANCE" ] && f_STATUS=$(cat ${f_CMDFILE}_OUT | grep '^{' | jq -r .status) [ ${STOCK_EXCHANGE} = "BINANCE" ] && f_STATUS=$(cat ${f_CMDFILE}_OUT | grep '^{' | jq -r .status)
[ ${STOCK_EXCHANGE} = "ONETRADING" ] && f_STATUS=$(cat ${f_CMDFILE}_OUT | grep '^{' | jq -r .order_id) [ ${STOCK_EXCHANGE} = "BITPANDA" ] && f_STATUS=$(cat ${f_CMDFILE}_OUT | grep '^{' | jq -r .order_id)
local f_trade_info_msg="TRADE - ${f_ACTION} ${f_ASSET}${f_CURRENCY} local f_trade_info_msg="TRADE - ${f_ACTION} ${f_ASSET}${f_CURRENCY}
${f_link} ${f_link}
@ -107,14 +107,14 @@ Comment: ${f_COMMENT}"
[ ${STOCK_EXCHANGE} = "BINANCE" ] && local f_COMMISSION=$(cat ${f_CMDFILE}_OUT | grep '^{' | jq -r .fills[].commission) | head -n1 [ ${STOCK_EXCHANGE} = "BINANCE" ] && local f_COMMISSION=$(cat ${f_CMDFILE}_OUT | grep '^{' | jq -r .fills[].commission) | head -n1
[ ${STOCK_EXCHANGE} = "BINANCE" ] && local f_COMMISSIONASSET=$(cat ${f_CMDFILE}_OUT | grep '^{' | jq -r .fills[].commissionAsset | head -n1) [ ${STOCK_EXCHANGE} = "BINANCE" ] && local f_COMMISSIONASSET=$(cat ${f_CMDFILE}_OUT | grep '^{' | jq -r .fills[].commissionAsset | head -n1)
if [ ${STOCK_EXCHANGE} = "ONETRADING" ] if [ ${STOCK_EXCHANGE} = "BITPANDA" ]
then then
sleep 10 sleep 10
onetrading-api-call GET public/v1/account/trades bitpanda-api-call GET public/v1/account/trades
cat ${g_tmp}/API_CMD_OUT >${f_CMDFILE}_OUT_ONETRADING_TRADE cat ${g_tmp}/API_CMD_OUT >${f_CMDFILE}_OUT_BITPANDA_TRADE
local f_PRICE=$(cat ${f_CMDFILE}_OUT_ONETRADING_TRADE | jq -r ".trade_history | .[] | select(.trade.order_id==\"${f_STATUS}\") | .trade.price") local f_PRICE=$(cat ${f_CMDFILE}_OUT_BITPANDA_TRADE | jq -r ".trade_history | .[] | select(.trade.order_id==\"${f_STATUS}\") | .trade.price")
local f_COMMISSION=$(cat ${f_CMDFILE}_OUT_ONETRADING_TRADE | jq -r ".trade_history | .[] | select(.trade.order_id==\"${f_STATUS}\") | .fee.fee_amount") local f_COMMISSION=$(cat ${f_CMDFILE}_OUT_BITPANDA_TRADE | jq -r ".trade_history | .[] | select(.trade.order_id==\"${f_STATUS}\") | .fee.fee_amount")
local f_COMMISSIONASSET=$(cat ${f_CMDFILE}_OUT_ONETRADING_TRADE | jq -r ".trade_history | .[] | select(.trade.order_id==\"${f_STATUS}\") | .fee.fee_currency") local f_COMMISSIONASSET=$(cat ${f_CMDFILE}_OUT_BITPANDA_TRADE | jq -r ".trade_history | .[] | select(.trade.order_id==\"${f_STATUS}\") | .fee.fee_currency")
fi fi
echo "${f_DATE},${f_ACTION},${f_CMDFILE}_OUT,${f_QUANTITY} ${f_CURRENCY},${f_PRICE},${f_COMMISSION} ${f_COMMISSIONASSET},${f_COMMENT}" | head -n1 >>trade-histories/${f_ASSET}${f_CURRENCY}.history.csv echo "${f_DATE},${f_ACTION},${f_CMDFILE}_OUT,${f_QUANTITY} ${f_CURRENCY},${f_PRICE},${f_COMMISSION} ${f_COMMISSIONASSET},${f_COMMENT}" | head -n1 >>trade-histories/${f_ASSET}${f_CURRENCY}.history.csv

View File

@ -11,9 +11,9 @@ function get_assets {
binance-api-call GET /api/v3/ticker/price || return 1 binance-api-call GET /api/v3/ticker/price || return 1
# parse API output # parse API output
cat ${g_tmp}/API_CMD_OUT | jq -r '.[] | .symbol + "," + .price' | grep "${CURRENCY}," | egrep -v "${TRANSFER_CURRENCY},|,0[\.][0]*$" >${f_filename}_OUT.tmp cat ${g_tmp}/API_CMD_OUT | jq -r '.[] | .symbol + "," + .price' | grep "${CURRENCY}," | egrep -v "${TRANSFER_CURRENCY},|,0[\.][0]*$" >${f_filename}_OUT.tmp
elif [ ${STOCK_EXCHANGE} = "ONETRADING" ] elif [ ${STOCK_EXCHANGE} = "BITPANDA" ]
then then
onetrading-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 '.[] | select(.state=="ACTIVE") | .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
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 '.[] | .instrument_code + "," + .last_price' | sed 's/_//' | grep "${CURRENCY}," | egrep -v "${TRANSFER_CURRENCY},|,0[\.][0]*$" >${f_filename}_OUT.tmp
elif [ ${STOCK_EXCHANGE} = "NONE" ] elif [ ${STOCK_EXCHANGE} = "NONE" ]

View File

@ -11,9 +11,9 @@ function get_balances {
binance-api-call GET sapi/v1/capital/config/getall || return 1 binance-api-call GET sapi/v1/capital/config/getall || return 1
# parse outout # parse outout
cat ${g_tmp}/API_CMD_OUT | jq -r '.[] | .coin + "," + .free' | egrep -v ",0$|,0[\.][0]*$|${TRANSFER_CURRENCY}" | sort >${f_filename}_OUT.tmp_raw cat ${g_tmp}/API_CMD_OUT | jq -r '.[] | .coin + "," + .free' | egrep -v ",0$|,0[\.][0]*$|${TRANSFER_CURRENCY}" | sort >${f_filename}_OUT.tmp_raw
elif [ ${STOCK_EXCHANGE} = "ONETRADING" ] elif [ ${STOCK_EXCHANGE} = "BITPANDA" ]
then then
onetrading-api-call GET public/v1/account/balances || return 1 bitpanda-api-call GET public/v1/account/balances || return 1
cat ${g_tmp}/API_CMD_OUT | jq -r '.balances[] | .currency_code + "," + .available' | egrep -v ",0$|,0[\.][0]*$|${TRANSFER_CURRENCY}" | sort >${f_filename}_OUT.tmp_raw cat ${g_tmp}/API_CMD_OUT | jq -r '.balances[] | .currency_code + "," + .available' | egrep -v ",0$|,0[\.][0]*$|${TRANSFER_CURRENCY}" | sort >${f_filename}_OUT.tmp_raw
fi fi

View File

@ -61,6 +61,7 @@ function market_performance {
f_eth_forecast=$(echo "scale=2; ${f_eth_forecast}/3" | bc -l | sed -r 's/^(-?)\./\10./') f_eth_forecast=$(echo "scale=2; ${f_eth_forecast}/3" | bc -l | sed -r 's/^(-?)\./\10./')
# Calculate available market data week changes # Calculate available market data week changes
local f_index_performance_txt=""
local f_index_performance_added=0 local f_index_performance_added=0
local f_index_performance_csv="" local f_index_performance_csv=""
local f_INDEX local f_INDEX
@ -97,11 +98,13 @@ function market_performance {
fi fi
fi fi
# finishing vars # finishing vars
f_index_performance_txt="${f_index_performance_txt}${f_INDEX}: ${f_index_performance}%; "
f_index_performance_added="$(echo "scale=2; ${f_index_performance_added}+${f_index_performance}" | bc -l | sed -r 's/^(-?)\./\10./')" f_index_performance_added="$(echo "scale=2; ${f_index_performance_added}+${f_index_performance}" | bc -l | sed -r 's/^(-?)\./\10./')"
f_index_performance_csv="${f_index_performance_csv},${f_index_performance}" f_index_performance_csv="${f_index_performance_csv},${f_index_performance}"
done done
# calculate US-FED-FEDERAL-FUNDS-RATE-INVERTED # calculate US-FED-FEDERAL-FUNDS-RATE-INVERTED
local f_economic
for f_eco_data in US-FED-FEDERAL-FUNDS-RATE-INVERTED-INDEX for f_eco_data in US-FED-FEDERAL-FUNDS-RATE-INVERTED-INDEX
do do
local f_index_performance=$(tail -n 1 asset-histories/${f_eco_data}.history.csv | cut -d, -f2) local f_index_performance=$(tail -n 1 asset-histories/${f_eco_data}.history.csv | cut -d, -f2)
@ -114,19 +117,22 @@ function market_performance {
f_index_performance="-${f_index_performance}" f_index_performance="-${f_index_performance}"
fi fi
fi fi
f_index_performance_txt="${f_index_performance_txt}${f_eco_data}: ${f_index_performance}%; "
f_index_performance_added="$(echo "scale=2; ${f_index_performance_added}+${f_index_performance}" | bc -l | sed -r 's/^(-?)\./\10./')" f_index_performance_added="$(echo "scale=2; ${f_index_performance_added}+${f_index_performance}" | bc -l | sed -r 's/^(-?)\./\10./')"
f_index_performance_csv="${f_index_performance_csv},${f_index_performance}" f_index_performance_csv="${f_index_performance_csv},${f_index_performance}"
done done
# calculate forecast US Unemployment Rate and US Consumer Price Index (CPI) # calculate forecast US Unemployment Rate and US Consumer Price Index (CPI)
local f_economic
for f_eco_data in US-UNEMPLOYMENT-INDEX US-CONSUMER-PRICE-INDEX for f_eco_data in US-UNEMPLOYMENT-INDEX US-CONSUMER-PRICE-INDEX
do do
local f_current=$(tail -n 1 asset-histories/${f_eco_data}.history.csv | cut -d, -f2) local f_current=$(tail -n 1 asset-histories/${f_eco_data}.history.csv | cut -d, -f2)
#local f_forecast=$(tail -n 1 asset-histories/${f_eco_data}.history.csv | cut -d, -f3) local f_forecast=$(tail -n 1 asset-histories/${f_eco_data}.history.csv | cut -d, -f3)
#f_index_performance="$(echo "scale=2; ${f_current}-${f_forecast}" | bc -l | sed -r 's/^(-?)\./\10./')" f_index_performance="$(echo "scale=2; ${f_current}-${f_forecast}" | bc -l | sed -r 's/^(-?)\./\10./')"
f_index_performance_added="$(echo "scale=2; ${f_index_performance_added}+${f_current}" | bc -l | sed -r 's/^(-?)\./\10./')" f_index_performance_txt="${f_index_performance_txt}${f_eco_data}: ${f_index_performance}%; "
f_index_performance_csv="${f_index_performance_csv},${f_current}" f_index_performance_added="$(echo "scale=2; ${f_index_performance_added}+${f_index_performance}" | bc -l | sed -r 's/^(-?)\./\10./')"
f_index_performance_csv="${f_index_performance_csv},${f_index_performance}"
done done
# price performance bitcoin # price performance bitcoin
@ -141,8 +147,9 @@ function market_performance {
## calculate market performance ## calculate market performance
f_market_performance=$(echo "scale=2; (${f_btc_forecast} + ${f_eth_forecast} + ${f_index_performance_added} + ${f_btc_performance} + ${f_eth_performance} + ${f_top250_marketcap_performance})" | bc -l | sed -r 's/^(-?)\./\10./' | xargs printf "%.2f") f_market_performance=$(echo "scale=2; (${f_btc_forecast} + ${f_eth_forecast} + ${f_index_performance_added} + ${f_btc_performance} + ${f_eth_performance} + ${f_top250_marketcap_performance})" | bc -l | sed -r 's/^(-?)\./\10./' | xargs printf "%.2f")
local f_date=$(g_date_print) local f_date=$(g_date_print)
echo "${f_date} Market Performance: ${f_market_performance}%; BTC forecast: ${f_btc_forecast}%; ETH forecast: ${f_eth_forecast}%; ${f_index_performance_txt}BTC: ${f_btc_performance}%; ETH: ${f_eth_performance}%; TOP250 Marketcap: ${f_top250_marketcap_performance}%" >>MARKET_PERFORMANCE
local f_indexlistcsv=$(echo "$f_indexlist" | perl -pe 's/\n/,/g; s/ +/,/g; s/,+/,/g') local f_indexlistcsv=$(echo "$f_indexlist" | perl -pe 's/\n/,/g; s/ +/,/g; s/,+/,/g')
local f_market_csv_headline="date,market performance,btc,eth,btc forecast,eth forecast,top250,${f_indexlistcsv}US-FED-FEDERAL-FUNDS-RATE-INVERTED,US-UNEMPLOYMENT,US-CONSUMER-PRICE" local f_market_csv_headline="date,market performance,btc,eth,btc forecast,eth forecast,top250,${f_indexlistcsv}US-FED-FEDERAL-FUNDS-RATE-INVERTED,US-UNEMPLOYMENT forecast,US-CONSUMER-PRICE forecast"
if [ -s MARKET_PERFORMANCE.csv ] if [ -s MARKET_PERFORMANCE.csv ]
then then
sed -i -e 1c"$f_market_csv_headline" MARKET_PERFORMANCE.csv sed -i -e 1c"$f_market_csv_headline" MARKET_PERFORMANCE.csv