fts_solver/types/
outcome.rs

1/// Solution data for an individual portfolio, containing
2/// the trade rate and effective price.
3#[derive(Debug)]
4#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
5#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6pub struct PortfolioOutcome {
7    /// The effective price for this portfolio
8    pub price: f64,
9    /// The rate of trade of this portfolio (negative for sell, positive for buy)
10    pub rate: f64,
11    // TODO:
12    // consider reporting the dual information for the box constraint
13}
14
15impl Default for PortfolioOutcome {
16    fn default() -> Self {
17        Self {
18            price: f64::NAN,
19            rate: 0.0,
20        }
21    }
22}
23
24/// Solution data for an individual product, containing
25/// the market-clearing price and total volume traded.
26#[derive(Debug)]
27#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
28#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
29pub struct ProductOutcome {
30    /// The market-clearing price for this product
31    pub price: f64,
32    /// The rate of trade of this product
33    pub rate: f64,
34}
35
36impl Default for ProductOutcome {
37    fn default() -> Self {
38        Self {
39            price: f64::NAN,
40            rate: 0.0,
41        }
42    }
43}