This programs query Coinpaprika API (https://api-pro.coinpaprika.com/v1/tickers) every 10 seconds and saves the results to a csv file. It also prints the results to the console.
ticker_id
- Coinpaprika API_IDlast_update
-last_updated
field from the API (date/time format)last_update_timestamp
- same as above but as a timestampnow
- current date/time of loop run from local machinenow_timestamp
- same as above but as a timestampprice
-quotes.USD.Price
field from the APIprice_changed
-true
if the price changed since the last run,false
otherwise
-
all parameters besides
key
are optional -
default output file is
result.csv
-
go run main.go -key=your_api_key
- this will run the program, print the results to the console and save them to a file calledresult.csv
-
go run main.go -key=your_api_key -file=filename.csv
- if you wish to change the output location -
go run main.go -key=your_api_key -file=filename.csv -ticker=eth-ethereum
- if you wish to change the ticker
If you don't have Go installed, you can use the provided main.sh
file to run the shell script, which produces similar results.
- edit
main.sh
and add your API key sh main.sh | tee result.csv
clickhouse local
is used for analysis, just because it's our database of choice at the moment. You can work with Python/Pandas, DuckDB or any other database of your choice, using the CSV file as input.- You should run the program for a while (hour+) and use default output file
result.csv
- Example file with 1 hour of data (UTC: 2023-08-02 10:26 - 2023-08-02 11:26) is provided in the repository result.csv
curl https://clickhouse.com/ | sh
- this will install a local version of Clickhouse in current directory
- query_1.sql - show
max
,avg
,stdDev
time between price changes based on local timenow_timestamp
(in seconds)./clickhouse local < query_1.sql
- query_2.sql - show
max
,avg
,stdDev
time between price changes based on Paprika timelast_update_timestamp
(in seconds)./clickhouse local < query_2.sql
Running these queries on the provided result.csv
file should give you the following results:
(with the following average response time around 90 seconds)