Skip to content
/ stk Public

[WIP] Collection of libraries and microservice application for financial data analysis

License

Notifications You must be signed in to change notification settings

qoala101/stk

Repository files navigation

[WIP] STK

Build And Deployment Static Analysis And Tests CodeFactor License: MIT

Description

STK is a collection of libraries and microservice application for financial data analysis. See STK-UI for the client app.

Libraries

  • cpp - concepts, templates, aliases, synchronization, and other C++ utils
  • di - extended and adapted wrapper of [Boost::ext].DI for dependency injection
  • cli - command-line argument parsing, interruption handling, and lifecycle logging
  • network - async REST, WebSocket, and JSON interfaces
  • networkx - mapping of C++ entities to REST client-serves with TMP
  • restsdk - network implementation with C++ Rest SDK
  • sqldb - SQL DB interface and query building API with TMP
  • sqlite - sqldb implementation with SQLite
  • kvdb - async key-value DB interface
  • aws - kvdb implementation as a client to AWS Dynamo DB
  • log - multi level logger interface
  • spdlog - log implementation with spdlog
  • binance - async REST client to Binance
  • ngrok - async REST client to ngrok

Application

STK consists of the following services running in Docker containers deployed on the local Kubernetes cluster, which is exposed to the public via ngrok:

  • sdb - stores market data in SQL DB
  • sps - streams symbol prices from Binance
  • spf - filters out insignificant price changes
  • siu - updates market info
  • ospd - deletes old symbol prices
  • aue - exposes public cluster URI to clients
  • [WIP] - analyzes market data

Each service is a C++ class with a coroutine API, which is wrapped in a REST client-server for interservice communication and in command-line interface for lifecycle management.

Build

Requirements

  • Conan 1.60 - downloads C++ dependencies
  • Clang 15
conan config set general.revisions_enabled=True
conan install . -if ./build --build=missing -pr=./conanprofile.txt -s build_type=Release

cmake -B ./build
cmake --build ./build --config Release

See docker images and .github/workflows for additional dependencies and ways to build from scratch.

Deployment

Requirements

  • Docker
  • Kubernetes
bash ./script/build_images_release.sh

kubectl apply -f ./kubernetes/app-persistent-volume.yaml
kubectl apply -f ./kubernetes/app-deployment.yaml

See script/development_environment for environment setup.

Third-party components

C++

  • C++ REST SDK - async REST, WebSocket, and JSON
  • CppCoro - wrapping of async code in coroutine tasks
  • range-v3 - algorithms, transformations, views, etc.
  • SQLite - management of file-based SQL DB
  • AWS SDK for C++ - management of Dynamo DB in the cloud
  • [Boost::ext].DI - dependency injection and construction of complex objects
  • CLI11 - command-line arguments parsing
  • Abseil - time API and flat containers
  • GSL - Expects/Ensures asserts and explicit casts
  • function2 - movable and const-correct callbacks
  • callable.hpp - function traits for concepts and mapping of C++ entities to REST endpoints
  • Nameof - mapping names of C++ entities to REST endpoints and SQL queries
  • not_null - type-safe not-null for pointers
  • {fmt} - string formatting and SQL query building
  • spdlog - thread-safe logging to standard output
  • Magic Enum - enum-string conversion
  • polymorphic_value - "copyable" unique_ptr for JSON interface
  • GoogleTest - unit tests

Deployment

  • Docker - containers for services
  • Kubernetes - deployment of containers to the local cluster
  • ngrok - exposing local cluster to the public
  • NGINX - mapping client requests to services and CORS

License

MIT