dabo/dabo/restore-coingeckodata-example.sh
2023-05-23 16:03:50 +02:00

17 lines
736 B
Bash

#!/bin/bash
mkdir final
ls -1 *.history.csv | while read x
do
echo $x
echo 'Date and Time,Price,Price Change,EMA12,EMA26,MACD,EMA9 MACD (Signal),MACD Histogram,MACD Signal,RSI5,RSI14,RSI21,RSI720,RSI60,RSI120,RSI240,RSI420,Price Change 24h,Price Change 7d,Price Change 14d,Price Change 30d' >final/$x
grep -A99999999 "2023-05-22 06:15" "$x" | grep ',100,100,100,100$' >>final/$x
egrep "2023.+,.+,.+,.+,.+,.+,.+,.+,.+,.+,.+,.+,.+,.+,.+,.+,.+,.+,.+,.+,.+" $x | grep -v ,100,100,100,100 | egrep ":00:|:15:|:30:|:45:" | while read line
do
date=$(echo $line | cut -d, -f1)
gecko=$(echo $line | cut -d, -f18,19,20,21)
#echo "$x: $date $gecko"
sed -i "s/^\($date,.*\)100,100,100,100$/\1$gecko/" final/$x
done
done