this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore(adr) init first adr design

eagleusb 8293104e

+109
+109
doc/adr/design.md
··· 1 + # proxycon 2 + 3 + ## Overview 4 + 5 + proxycon is a performant Golang proxy service that returns the bitcoin 6 + historical data as fast as possible. This proxy service is used by a machine 7 + learning blackbox to do bitcoin trading. It is mission critical. 8 + 9 + ## Datasource 10 + 11 + The data is available at 12 + [https://europe-west1-bitstack-test.cloudfunctions.net/coding-challenge-v2](https://europe-west1-bitstack-test.cloudfunctions.net/coding-challenge-v2) 13 + 14 + The data format is a JSON payload, with the price and timestamp in RFC3339 15 + format. 16 + 17 + ```bash 18 + curl -fsS https://europe-west1-bitstack-test.cloudfunctions.net/coding-challenge-v2 | jq . 19 + ``` 20 + 21 + ```json 22 + { 23 + "data": [ 24 + { 25 + "price": "8773698", 26 + "timestamp": "2021-11-19T12:22:51Z" 27 + }, 28 + { 29 + "price": "6920238", 30 + "timestamp": "2021-11-19T12:26:11Z" 31 + }, 32 + { 33 + "price": "5218360", 34 + "timestamp": "2021-11-19T12:29:31Z" 35 + } 36 + ] 37 + } 38 + ``` 39 + 40 + ## API 41 + 42 + > GET `/list` endpoint to get min and max prices with pagination 43 + 44 + ```json 45 + { 46 + "start": "timestamp", 47 + "end": "timestamp", 48 + "max": "2108300", 49 + "min": "2108300", 50 + "data": [ 51 + { 52 + "amount": "2108300", 53 + "timestamp": "timestamp", 54 + }, 55 + ... 56 + ], 57 + } 58 + ``` 59 + 60 + > `/price?at=<timestamp>` endpoint to get a price at the given timestamp 61 + 62 + ```json 63 + { 64 + "data": [ 65 + { 66 + "amount": "2108300", 67 + "timestamp": "timestamp" 68 + } 69 + ] 70 + } 71 + ``` 72 + 73 + > GET `/average?start=<timestamp>&end=<timestamp>` endpoint that computes the 74 + > average price over a certain arbitrary period 75 + 76 + ```json 77 + { 78 + "start": "timestamp", 79 + "end": "timestamp", 80 + "avg": "2108300", 81 + "data": [ 82 + { 83 + "amount": "2108300", 84 + "timestamp": "timestamp", 85 + }, 86 + ... 87 + ], 88 + } 89 + ``` 90 + 91 + > GET `/prices` endpoint that returns a websocket to subscribe to price updates 92 + 93 + ## CLI 94 + 95 + ```bash 96 + proxycon --port 8080 --verbose --page 10 97 + ``` 98 + 99 + > proxycon args 100 + 101 + - port: define the HTTP listening port (TCP/8080 default) 102 + - verbose: manage slog verbosity (INFO default) 103 + - page: page size for listing endpoint (10 default) 104 + 105 + ### Build 106 + 107 + ```bash 108 + go build -ldflags="-s -w -X main.version=$(git describe --tags --always) -X main.buildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)" -trimpath -o bin/proxycon . 109 + ```