Application uses Redis as a storage of candlesticks.
- Build an image (two options)
/gradlew bootBuildImage
— Gradle task bootBuildImage builds an image builds much faster (recommended).docker-compose build app
— there is a Dockerfile
- Set proper value to
TICKS_SOURCE_URL
environment variable in docker-compose.yml. I left it empty in the repository in order to hide it from the society. =) - Run
docker-compose — docker-compose up
- Start receiving ticks with
curl -v http://127.0.0.1:8080/start
- Wait for it...
- Request candles with
curl -v http://127.0.0.1:8080/candles?stock=AAPL&from=1652331300&to=1662331300
- Enjoy ^_^
- You can stop receiving ticks with
curl -v http://127.0.0.1:8080/stop
There is an intermediate solution in the repository in files:
class CandlesServiceRealtimeImpl
.class TicksProcessorRealtime
It was my first solution. In this case application builds candles in realtime for every request.
Works pretty fast. You can check it by switching @Primary
annotations to these classes.