mysql -u"$DB_USER"-p"$DB_PASS"-D"$DB_NAME"-e"SELECT UNIX_TIMESTAMP(timestamp), price FROM bitcoin_and_other_prices WHERE DATE(timestamp) = '$today' ORDER BY timestamp">"$temp_file"
# Format the data for gnuplot (remove the first line containing column names)
tail-n +2 "$temp_file">"formatted_data.txt"
# Create plots using gnuplot
gnuplot <<EOF
set terminal pngcairo size 800,600 enhanced font 'Arial,10'
set output 'price_$today.png'
set title 'Bitcoin Price vs Time ($today)'
set xlabel 'Time'
set ylabel 'Price (USD)'
# Set the time format for the x-axis
set timefmt "%s" # Input format is Unix timestamp (seconds since 1970)
set xdata time # Use time for the x-axis
set format x "%H:%M" # Format x axis as hour:minute
# Use the formatted data
plot 'formatted_data.txt' using 1:2 with linespoints title 'Price'
EOF
# Clean up temporary files
rm"$temp_file""formatted_data.txt"
echo"Price graph for today generated successfully!"