Multi-financial data websocket client on Golang
Task
- Connect to the Coinbase cryptocurrency exchange via WebSocket
- Subscribe to prices for three instruments: ETH-BTC, BTC-USD, BTC-EUR (data will come in through the WebSocket as they appear on the exchange)
- Create an order table in MySql
- Connect to MySql and write data received through WebSocket to the
order
table
- Write data from the three instruments (ETH-BTC, BTC-USD, BTC-EUR) to the database
in three threads (each instrument has its own write thread)
- Publish the project repository on Github
- Use good development practices to enable further application functionality expansion
Setup for AWS
- Create a new IAM user with programmatic access
- Create a new secret in AWS Secrets Manager
- Add the following keys to the secret:
- COINBASE_WS_API_KEY
- COINBASE_WS_API_SECRET
- COINBASE_WS_API_PASSPHRASE
- SUPABASE_URL
- SERVICE_ROLE_KEY
- Create image to push to ECR
make build-app
creates the coinbase-app image
make build-analysis
creates the analysis-app image
- Push images to ECR
aws ecs register-task-definition --cli-input-json file://task-definition.json
creates a task definition (task-definition.json is in the root of the project)
aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 886436943186.dkr.ecr.us-east-2.amazonaws.com
logs in to AWS ECR to push images
docker push 886436943186.dkr.ecr.us-east-2.amazonaws.com/bz-findata-analysis
pushes the analysis-app image to ECR
docker push 886436943186.dkr.ecr.us-east-2.amazonaws.com/bz-findata-coinbase
pushes the coinbase-app image to ECR
Security Roles and Policies
-
Add the the following roles to the IAM user:
- ecsTaskExecutionRole
- ecsTaskRole
-
Add the following policies to the ecsTaskExecutionRole:
- AmazonECSTaskExecutionRolePolicy
- AmazonElasticFileSystemClientFullAccess
- CloudWatchLogsFullAccess
- ecsTaskExecutionPolicy
- SecretsManagerReadWrite
-
Add the following policies to the ecsTaskRole:
- ecsTaskPolicy
- SecretsManagerReadWrite
How to use
Project based on Clean architecture principles.
Requirements:
TODO
- [x] Logger points
- [ ] Rate limiter
- [ ] Prometheus metrics
- [ ] Testing
Resources