# Last edited on 2020-11-18 01:32:33 by jstolfi FITTING A POLYNOMIAL TO BITCOIN'S REF PRICE AND SUCOASMA'S SHARE PRICE Obtaining the bitcoin ref price file, trimmed : dtini="2010-07-17" dtfin="2020-11-17" fname="${dtini}--${dtfin}-PREF-USD-01d.txt" cp ../00-DATA/series/fix/${fname} ./ ln -s ${fname} price-01d-bitcoin.txt Creating the bogus SuCoAsMa share price file. Copy the bitcoin price file skipping every 10 days up to 2018-10-20, then copy with no skip from "2018-10-21" until 2019-04-29, then copy skipping every 3 days up to end. tfile="/tmp/$$.prices.txt" dfile="/tmp/$$.dates.txt" cat ${fname} \ | sample-btc-price.gawk -v dtini="${dtini}" -v dtfin="${dtfin}" \ > ${tfile} nr=`cat ${tfile} | wc -l` echo "sampled ${nr} records" tail -n ${nr} ${fname} > ${dfile} head -n 1 ${dfile} tail -n 1 ${dfile} Manually inserted the dates from ${dfile} into ${tfile} to produce the file "price-01d-sucoasma.txt". Hacked the last few records by hand to end at about 15000 USD price on the same final date (2020-11-17). Preparing a file with date and price, padded with two years of zeros, and computing a first-degree fit on data up to the present: for asset in bitcoin sucoasma ; do cat price-01d-${asset}.txt \ | create_data_file.gawk \ -v dtfin="${dtfin}" \ > data-${asset}.txt compute_deg1_fit.sh ${asset} done Plotting separate graphs: plot_deg1_fit.sh \ bitcoin "Bitcoin Price" \ 2010-07-12 2022-06-31 0.04 600000000.00 2400 plot_deg1_fit.sh \ sucoasma "SuCoAsMa Share Price" \ 2018-07-12 2022-06-31 0.04 600000000.00 1200