A PoC for an example financial data stream service. It's based on public cryptocurrency data.
This project is the upstream part of the tick data stream.
- Using Binance Public API (websocket) to listen to ticker stream of configurable symbols.
- FeedSupplier stores the raw data into a RingBuffer (a naive implementation by utilizing a fixed size ArrayList)
- Incoming data is consumed and encoded by FeedConsumers (only basic encoding (US_ASCII), doesn't compress) and is redirected to Registry.
- Registry makes a TCP fan-out to the connected RegistryClients via FeedDataStream (per client instance) which uses Vertx's Pipe for TCP write backpressure (in case of slow clients).
- A unit test demonstrates also client connection which can be found in RegistrySpec
For possible configurations, application.yml
app:
vertx:
event-loop-pool-size: 8
registry:
host: localhost
port: 7000
tcp_server_thread_pool: 4
source:
binance:
buffer-size: 1024
symbols: btcusdt,ethusdt
Via Gradle:
# profile local or dev enables console logging
./gradlew bootRun --args='--spring.profiles.active=local'
Many thanks to these awesome projects:
Otherwise, it wouldn't be possible to make this project, at least in a reasonable time :)