This is a lightweight dex aggregator. It exposes a simple REST based API service to get trade quotes for a token pair and manage the underlying datastore.
To compile cargo build --release (using rust version 1.80.0)
To run cargo run --release - dex_config.toml holds configurable values
Server will be available at http://localhost:3000
Sample query to get trade quotes -
The getLatest query parameter lets you use pre indexed data (if false or not present) and get latest reserves data (if true)
Open Api Docs available at http://localhost:3000/api-docs/openapi.json
Swagger UI available at http://localhost:3000/swagger-ui/
The basic idea is to find all possible paths to trade between a token pair and then do gradient optimisation to optimise an objective function - maximise output when given an input amount and minimise input when given an output amount. Ref here for some math notes.