See Shell script to calculate daily point totals from CSV for more instructions
#!/bin/bash
#pointcalc, Chris Tucker & Myke H., April 2024.
#This program calculates daily points total using a TopStep Tradovate "Performance" account report in comma-seperate values (CSV) file as the data source.
#usage: type ./pointcalc filename.csv
total=0
tradeCount=0
#Read column data (f1-13)
while IFS=',' read -r f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13
do
((tradeCount+=1))
echo "Trade No. $tradeCount: $f8 / $f9"
delta=$(echo "$f9 - $f8" | bc)
echo "Delta: $delta"
total=$(echo "$total + $delta" | bc)
echo "Running total: $total"
echo ""
#Use tail command to ignore first line of CSV data, which are just labels.
done < <(tail -n +2 $1)