Crates.io | ftauction |
lib.rs | ftauction |
version | 0.2.1 |
created_at | 2025-04-21 15:37:34.535803+00 |
updated_at | 2025-07-03 15:00:22.86169+00 |
description | Tools for analyzing flow trading auctions |
homepage | |
repository | |
max_upload_size | |
id | 1642862 |
size | 35,208 |
ftauction
This crate is a light wrapper around fts-solver
, providing a binary that can
read flow trading-based auctions from a standardized JSON input format and writes
their solution to stdout or a file. This binary also makes available other useful operations,
such as exporting the intermediate quadratic program to a standardized output format
for analysis in other tools.
The JSON format is very simple. Given the following type definitions:
type ProductId = string;
type PortfolioId = string;
type DemandGroup = Record<DemandId, number> | Array<DemandId> | DemandId;
type ProductGroup = Record<ProductId, number> | Array<ProductId> | ProductId;
// The canonical types in DemandGroup and ProductGroup are Records, but we implicitly
// transform arrays and values for convenience according to:
// X => { X: 1.0 },
// [X, Y, ...] => { X: 1.0, Y: 1.0, ...}
type Portfolio = { demand_group: DemandGroup, product_group: ProductGroup };
type Point = {
rate: number,
price: number,
}
type DemandCurve = Array<Point> | { min_rate?: null | number, max_rate?: null | number, price: number };
type Auction = {
demand_curves: Record<DemandId, DemandCurve>,
portfolios: Record<PortfolioId, Portfolio>,
}
The JSON input format is simply anything that deserializes as
Auction
. Examples can be found in the fts-solver
test suite.
To install, simply run cargo install ftauction
.
To build from source, cargo build --release --bin ftauction
.
All options are documented in ftauction --help
and ftauction [SUBCOMMAND] --help
.
Some examples:
# Solve an auction given a file
ftauction solve -o solution.json input.json
# Solve an auction over stdin
curl http://some.remote/file.json | ftauction solve -o solution.json -
# Read an auction over stdin, export to stdout
cat input.json | ftauction export - --format mps
The ordering between the input (a path, or "-") and the flags ("--format", for example) is not important.