Skip to content

Instantly share code, notes, and snippets.

@shesek
Last active December 15, 2017 13:33
Show Gist options
  • Save shesek/f967d27183345337bc717460615c89d8 to your computer and use it in GitHub Desktop.
Save shesek/f967d27183345337bc717460615c89d8 to your computer and use it in GitHub Desktop.
Bitcoin ATH
$ curl 'https://bitcoincharts.com/charts/chart.json?m=bitstampUSD&r=360&c=1&s=2017-01-01&e=2017-12-16' | jq -c '.[] | [(.[0]|strftime("%Y-%m-%d")),.[7]]' | tr -d '"[]' | awk -F, 'BEGIN{ath=0;total=0;aths=0;in20p=0}{total++;if ($2>ath*0.8) in20p++; if ($2>ath){print $1 " " $2; ath=$2; aths++ } } END { print "\nTotal "total" days\nATH in "aths" days (" (aths/total*100) "%)\n20% range from ATH in "in20p" days ("(in20p/total*100)"%)" }'
2017-01-01 987.468055790686
2017-01-02 1013.002448970431
2017-01-03 1020.555479651876
2017-01-04 1088.449474525684
2017-02-21 1104.602728943062
2017-02-22 1126.242226009392
2017-02-23 1153.559162275172
2017-02-24 1174.774405556085
2017-02-27 1187.583662607291
2017-02-28 1192.345573902127
2017-03-01 1210.05499395395
2017-03-02 1246.924273317521
2017-03-03 1274.359216972924
2017-03-06 1275.581650939489
2017-04-26 1293.831899505894
2017-04-27 1320.851193179126
2017-04-28 1321.613096694935
2017-04-29 1330.656947524979
2017-04-30 1334.375909559713
2017-05-01 1385.699355247332
2017-05-02 1438.92568524711
2017-05-03 1478.68512930227
2017-05-04 1540.546679796545
2017-05-05 1554.611842204292
2017-05-08 1591.302070911332
2017-05-09 1710.015874558012
2017-05-10 1748.504093424541
2017-05-11 1831.538765516598
2017-05-19 1927.046544598314
2017-05-20 1969.827778573432
2017-05-21 2020.044156997642
2017-05-22 2113.720763468679
2017-05-23 2202.415195358104
2017-05-24 2383.526411517812
2017-05-25 2518.717062018664
2017-06-03 2524.85054503166
2017-06-05 2611.738041110128
2017-06-06 2818.775646851039
2017-06-09 2824.822108577415
2017-06-10 2859.765786886274
2017-06-11 2911.892917832523
2017-08-05 3169.043337112247
2017-08-06 3236.124519051346
2017-08-07 3339.320970980931
2017-08-08 3413.549765168221
2017-08-11 3511.923462256277
2017-08-12 3789.127641308361
2017-08-13 4007.097891948377
2017-08-14 4210.154943360601
2017-08-17 4338.694675288759
2017-08-25 4358.326081628094
2017-08-29 4502.758977297319
2017-08-30 4564.263672681847
2017-08-31 4682.33410575206
2017-09-01 4808.168193503037
2017-10-12 5149.56562717961
2017-10-13 5600.529057120265
2017-10-14 5680.622839247283
2017-10-16 5681.028650240163
2017-10-20 5891.450452302294
2017-10-21 6050.005941335356
2017-10-30 6124.204958809462
2017-10-31 6284.179318219806
2017-11-01 6546.616271369549
2017-11-02 6976.49239202149
2017-11-03 7252.44450926716
2017-11-04 7253.20066003512
2017-11-05 7445.076814345895
2017-11-16 7562.033954268197
2017-11-17 7797.297110056994
2017-11-19 7863.96416851209
2017-11-20 8113.741768868151
2017-11-22 8196.453478670033
2017-11-25 8407.830676633426
2017-11-26 9027.857088688674
2017-11-27 9527.863617071009
2017-11-28 9852.64790114562
2017-11-29 10377.66314278946
2017-12-02 10927.843358362512
2017-12-03 11249.499549741362
2017-12-04 11314.695288242745
2017-12-05 11652.183796714973
2017-12-06 12664.26042427477
2017-12-07 14840.190945188633
2017-12-08 15285.203654441837
2017-12-11 16293.316148191207
2017-12-12 16854.872561398395
2017-12-15 17206.468966500684
Total 349 days
ATH in 88 days (25.2149%)
20% range from ATH in 321 days (91.9771%)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment