Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CryptoCurrencyTracker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rs11g21
CryptoCurrencyTracker
Commits
43f57359
Commit
43f57359
authored
May 2, 2023
by
rs11g21
Browse files
Options
Downloads
Patches
Plain Diff
Implemented graphs
parent
2083e02e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cryptoGraphs.sh
+384
-0
384 additions, 0 deletions
cryptoGraphs.sh
with
384 additions
and
0 deletions
cryptoGraphs.sh
0 → 100644
+
384
−
0
View file @
43f57359
#! /usr/bin/bash
function
plot_changeInValue
(){
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM changeInValue WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
changeInValue.dat
#WORKING
gnuplot
<<
EOF
set title "Change In Value for Bitcoin in 24 Hours"
set xlabel "Time"
set ylabel "Value"
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set format x "%Y-%m-%d
\n
%H:%M"
set datafile separator '*'
set ytics 100
set terminal png size 800,600
set style line 1 linecolor rgb '#5e9606' linetype 1 linewidth 2 pointtype 7 pointsize 1.5
set output 'changeInValue_plot.png'
set terminal pngcairo enhanced font 'Arial,10'
plot 'changeInValue.dat' using 1:2 with linespoints ls 1
EOF
echo
"Change In Value graph has been generated."
}
function
plot_bitCoinPrice
(){
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM cryptoPrice WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
bitCoinPriceData.dat
#WORKING
gnuplot
<<
EOF
set title "Change In Bitcoin Price in 24 Hours"
set xlabel "Time"
set ylabel "Value"
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set format x "%Y-%m-%d
\n
%H:%M"
set datafile separator '*'
set ytics 100
set terminal png size 800,600
set style line 1 linecolor rgb '#5e9606' linetype 1 linewidth 2 pointtype 7 pointsize 1.5
set output 'bitCoinPrice_plot.png'
set terminal pngcairo enhanced font 'Arial,10'
plot 'bitCoinPriceData.dat' using 1:2 with linespoints ls 1
EOF
echo
"Bitcoin Price graph has been generated."
}
function
plot_24HourHigh
(){
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM highPrice WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
highPrice.dat
#WORKING
gnuplot
<<
EOF
set title "Change In Bitcoin High Price in 24 Hours"
set xlabel "Time"
set ylabel "Value"
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set format x "%Y-%m-%d
\n
%H:%M"
set datafile separator '*'
set ytics 100
set terminal png size 800,600
set style line 1 linecolor rgb '#5e9606' linetype 1 linewidth 2 pointtype 7 pointsize 1.5
set output 'highPrice_plot.png'
set terminal pngcairo enhanced font 'Arial,10'
plot 'highPrice.dat' using 1:2 with linespoints ls 1
EOF
echo
"Bitcoin High Price graph has been generated."
}
function
plot_24HourLow
(){
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM lowPrice WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
lowPrice.dat
#WORKING
gnuplot
<<
EOF
set title "Change In Bitcoin Low Price in 24 Hours"
set xlabel "Time"
set ylabel "Value"
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set format x "%Y-%m-%d
\n
%H:%M"
set datafile separator '*'
set ytics 100
set terminal png size 800,600
set style line 1 linecolor rgb '#5e9606' linetype 1 linewidth 2 pointtype 7 pointsize 1.5
set output 'lowPrice_plot.png'
set terminal pngcairo enhanced font 'Arial,10'
plot 'lowPrice.dat' using 1:2 with linespoints ls 1
EOF
echo
"Bitcoin Low Price graph has been generated."
}
function
plot_24HourOpen
(){
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM openPrice WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
openPrice.dat
#WORKING
gnuplot
<<
EOF
set title "Change In Bitcoin Open Price in 24 Hours"
set xlabel "Time"
set ylabel "Value"
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set format x "%Y-%m-%d
\n
%H:%M"
set datafile separator '*'
set ytics 100
set terminal png size 800,600
set style line 1 linecolor rgb '#5e9606' linetype 1 linewidth 2 pointtype 7 pointsize 1.5
set output 'openPrice_plot.png'
set terminal pngcairo enhanced font 'Arial,10'
plot 'openPrice.dat' using 1:2 with linespoints ls 1
EOF
echo
"Bitcoin Open Price graph has been generated."
}
function
plot_marketCap
(){
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM marketCap WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
marketCap.dat
#WORKING
gnuplot
<<
EOF
set title "Change In Bitcoin Market Cap in 24 Hours"
set xlabel "Time"
set ylabel "Value"
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set format x "%Y-%m-%d
\n
%H:%M"
set datafile separator '*'
set ytics 100
set terminal png size 800,600
set style line 1 linecolor rgb '#5e9606' linetype 1 linewidth 2 pointtype 7 pointsize 1.5
set output 'marketCap_plot.png'
set terminal pngcairo enhanced font 'Arial,10'
plot 'marketCap.dat' using 1:2 with linespoints ls 1
EOF
echo
"Bitcoin Market Cap graph has been generated."
}
function
plot_returnPercentage
(){
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM returnPercentage WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
returnPercentage.dat
#WORKING
gnuplot
<<
EOF
set title "Change In Bitcoin Return Percentage in 24 Hours"
set xlabel "Time"
set ylabel "Value"
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set format x "%Y-%m-%d
\n
%H:%M"
set datafile separator '*'
set ytics 100
set terminal png size 800,600
set style line 1 linecolor rgb '#5e9606' linetype 1 linewidth 2 pointtype 7 pointsize 1.5
set output 'returnPercentage_plot.png'
set terminal pngcairo enhanced font 'Arial,10'
plot 'returnPercentage.dat' using 1:2 with linespoints ls 1
EOF
echo
"Bitcoin Return Percentage graph has been generated."
}
function
plot_transactionCount
(){
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM transactionCount WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
transactionCount.dat
#WORKING
gnuplot
<<
EOF
set title "Change In Bitcoin Transaction Count in 24 Hours"
set xlabel "Time"
set ylabel "Value"
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set format x "%Y-%m-%d
\n
%H:%M"
set datafile separator '*'
set ytics 25000
set terminal png size 800,600
set style line 1 linecolor rgb '#5e9606' linetype 1 linewidth 2 pointtype 7 pointsize 1.5
set output 'transactionCount_plot.png'
set terminal pngcairo enhanced font 'Arial,10'
plot 'transactionCount.dat' using 1:2 with linespoints ls 1
EOF
echo
"Bitcoin Transaction Count graph has been generated."
}
function
plot_transactionFee
(){
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM transactionFee WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
transactionFee.dat
#WORKING
gnuplot
<<
EOF
set title "Change In Bitcoin Transaction Fee in 24 Hours"
set xlabel "Time"
set ylabel "Value"
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set format x "%Y-%m-%d
\n
%H:%M"
set datafile separator '*'
set ytics 0.1
set terminal png size 800,600
set style line 1 linecolor rgb '#5e9606' linetype 1 linewidth 2 pointtype 7 pointsize 1.5
set output 'transactionFee_plot.png'
set terminal pngcairo enhanced font 'Arial,10'
plot 'transactionFee.dat' using 1:2 with linespoints ls 1
EOF
echo
"Bitcoin Transaction Fee graph has been generated."
}
function
plot_volatility
(){
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM volatility WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
volatility.dat
#WORKING
gnuplot
<<
EOF
set title "Change In Bitcoin Volatility in 24 Hours"
set xlabel "Time"
set ylabel "Value"
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set format x "%Y-%m-%d
\n
%H:%M"
set datafile separator '*'
set ytics 0.025
set terminal png size 800,600
set style line 1 linecolor rgb '#5e9606' linetype 1 linewidth 2 pointtype 7 pointsize 1.5
set output 'volatility_plot.png'
set terminal pngcairo enhanced font 'Arial,10'
plot 'volatility.dat' using 1:2 with linespoints ls 1
EOF
echo
"Bitcoin Volatility graph has been generated."
}
function
function_priceMultiPlot
(){
#check whats the problem here
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM lowPrice WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
lowPrice.dat
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM highPrice WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
highPrice.dat
/opt/lampp/bin/mysql
-u
root
-e
"use cryptoTracker; SELECT collected,value FROM cryptoPrice WHERE collected BETWEEN '2023-04-30 14:00:00' AND '2023-05-01 14:01:00';"
|
sed
's/\([0-9.-]\+\)$/* \1/'
|
tail
-n
+2
>
bitCoinPriceData.dat
gnuplot
<<
EOF
set title "Change In Bitcoin Current , Low and High Price in 24 Hours"
set xlabel "Time"
set y1label "BitCoin Price"
set y2label "BitCoin High"
set y3label "BitCoin Low"
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set format x "%Y-%m-%d
\n
%H:%M"
set datafile separator '*'
set ytics 100
set output 'multiplotBitcoinPrice.png'
set terminal pngcairo enhanced font 'Arial,10'
set multiplot
plot "lowPrice.dat" using 1:2 with lines lw 2 title "Low Price"
set ylabel "Y2-axis Label" offset 2
plot "bitCoinPriceData.dat" using 1:2 axes x1y2 with lines lw 2 title "Current Price"
set y1label "Y2-axis Label" offset 2
plot "highPrice.dat" using 1:2 axes x1y2 with lines lw 2 title "High Price"
unset multiplot
EOF
}
choice
=
0
while
[
"
$choice
"
-ne
11
]
;
do
printf
"
\n
"
echo
"Which Bitcoin graph do you want to generate ? Choose a number :
1) BitCoinPrice
2) 24 Hour High Price
3) 24 Hour Low Price
4) 24 Hour Open Price
5) Market Cap
6) Change In Value
7) Return Percentage
8) Volatility
9) Transaction Count
10) Transaction Fee
11) BitCoin Multiplot (Current,High and Low)
12) End
"
read
choice
case
$choice
in
1
)
plot_bitCoinPrice
;;
2
)
plot_24HourHigh
;;
3
)
plot_24HourLow
;;
4
)
plot_24HourOpen
;;
5
)
plot_marketCap
;;
6
)
plot_changeInValue
;;
7
)
plot_returnPercentage
;;
8
)
plot_volatility
;;
9
)
plot_transactionCount
;;
10
)
plot_transactionFee
;;
11
)
function_priceMultiPlot
;;
12
)
echo
"Program ended"
;;
*
)
echo
"Invalid choice"
;;
esac
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment