ftauction

Crates.ioftauction
lib.rsftauction
version0.2.1
created_at2025-04-21 15:37:34.535803+00
updated_at2025-07-03 15:00:22.86169+00
descriptionTools for analyzing flow trading auctions
homepage
repository
max_upload_size
id1642862
size35,208
Jason Dark (asymptoticgroup)

documentation

README

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.

Installation

To install, simply run cargo install ftauction. To build from source, cargo build --release --bin ftauction.

Usage

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.

Commit count: 0

cargo fmt