#sqlite #reference #trading #auction #fts #sqlite-back-end #web-server #fts-core

fts-sqlite

A simple, reference backend for fts implemented with SQLite

4 releases

Uses new Rust 2024

0.2.1 Jul 3, 2025
0.2.0 Jun 30, 2025
0.1.6 May 5, 2025
0.1.5 Apr 28, 2025

#1170 in Database interfaces

Download history 2/week @ 2025-10-21

284 downloads per month
Used in 2 crates

MIT license

64KB
1.5K SLoC

Rust 1K SLoC // 0.0% comments SQL 471 SLoC // 0.1% comments

crates.io version docs.rs documentation crates.io downloads crates.io license getting started

Flow Trading Service (FTS)

This crate is part of a collection of crates that together implement flow trading as proposed by Budish, Cramton, et al, in which trade occurs continuously over time via regularly-scheduled batch auctions.

The different crates in this workspace are as follows:

  • fts_core: Defines a set of data primitives and operations but defers the implementations of these operations, consistent with a so-called "hexagonal architecture" approach to separating responsibilities.
  • fts_solver: Provides a reference solver for the flow trading quadratic program.
  • fts_axum: A REST API HTTP server for interacting with the solver and persisting state across auctions.
  • fts_sqlite: An implementation of the core data operations using SQLite, suitable for exploration of flow trading-based marketplaces such as a forward market.

FTS SQLite

This crate provides a SQLite-based implementation of all the repository traits defined in fts-core, enabling persistent storage and retrieval of flow trading data. It's designed to be efficient for both development/testing scenarios and production use cases with moderate data volumes.

Architecture

The implementation leverages SQLite's strengths while working around its limitations:

  • Dual connection pools: Separate reader and writer pools optimize for SQLite's concurrency model
  • WAL mode: Write-Ahead Logging enables concurrent reads while maintaining consistency
  • Temporal data model: Built-in support for historical queries and audit trails
  • JSON storage: Flexible application data storage using SQLite's JSON functions

Dependencies

~42–58MB
~846K SLoC