Skip to content
Snippets Groups Projects
Commit 3bb1f430 authored by sj5e24's avatar sj5e24
Browse files

Update 1h.sh

parent c1dfe26c
No related branches found
No related tags found
No related merge requests found
......@@ -34,8 +34,21 @@ function analysis()
quote_volume=$(printf "%.8f" $quote_volume)
tim=$(jq -r '.Data[0].TIMESTAMP' "$FILE")
real_tim=$(date -d @$tim '+%Y-%m-%d %H:%M:%S')
SQL_QUERY="INSERT INTO \`hour\`(price, time, highest_price, lowest_price, trading_volume, total_quoted_quantity) VALUES($open, '$real_tim', $high, $low, $volume ,$quote_volume)"
mysql -u "$DB_USER" -h "$DB_HOST" -D "$DB_NAME" -e "$SQL_QUERY"
if echo "SQL_INSERT" | SQL_QUERY="INSERT INTO \`hour\`(price, time, highest_price, lowest_price, trading_volume, total_quoted_quantity) VALUES($open, '$real_tim', $high, $low, $volume ,$quote_volume)";
then
echo "Insert successful."
else
echo "Insert fail."
exit 1
fi
if mysql -u "$DB_USER" -h "$DB_HOST" -D "$DB_NAME" -e "$SQL_QUERY";
then
echo "Connection sucessful."
else
echo "Connection fail."
exit 1
fi
}
fetch
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment