arvo-api 0.4.0

The types of Arvo's engine API, generated from its protobuf contract. Messages only, no transport, so it builds for WebAssembly.
Documentation
// This file is @generated by prost-build.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StartRequest {
    /// The finding whose rule runs: its selected experiment, warmed on the
    /// library from the finding's own start to today.
    #[prost(string, tag = "1")]
    pub finding: ::prost::alloc::string::String,
    /// `alpaca-paper`, `alpaca-live`, or `robinhood-<last four>`.
    #[prost(string, tag = "2")]
    pub executor: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SessionId {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
}
/// The kill switch (#127): arm the gate, then flatten everything the session
/// holds. The halt is in force either way; what the venue would not exit is
/// named in the session record.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HaltRequest {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// Why, for the record. Empty means "a person pressed it".
    #[prost(string, tag = "2")]
    pub reason: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SessionStatus {
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub finding: ::prost::alloc::string::String,
    #[prost(string, tag = "3")]
    pub executor: ::prost::alloc::string::String,
    #[prost(string, tag = "4")]
    pub instrument: ::prost::alloc::string::String,
    #[prost(string, tag = "5")]
    pub strategy: ::prost::alloc::string::String,
    #[prost(string, tag = "6")]
    pub started_at: ::prost::alloc::string::String,
    /// starting, running, frozen, halted, stopped or failed.
    #[prost(string, tag = "7")]
    pub state: ::prost::alloc::string::String,
    #[prost(uint32, tag = "8")]
    pub signals: u32,
    #[prost(uint32, tag = "9")]
    pub submitted: u32,
    #[prost(uint32, tag = "10")]
    pub refused: u32,
    #[prost(uint32, tag = "11")]
    pub fills: u32,
    /// Why the gate halted, when it did.
    #[prost(string, optional, tag = "12")]
    pub halted: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "13")]
    pub last_error: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(string, optional, tag = "14")]
    pub last_bar: ::core::option::Option<::prost::alloc::string::String>,
    /// What the gate and the venue disagreed about, while frozen (#187).
    #[prost(string, optional, tag = "15")]
    pub frozen: ::core::option::Option<::prost::alloc::string::String>,
    /// Whether a frozen session has been reconciled, so ResumeSession is allowed.
    #[prost(bool, tag = "16")]
    pub reconciled: bool,
    /// Whether the rule is still the rule its finding described: holding,
    /// diverging or inconclusive, judged from the session's own trades against
    /// the finding's out-of-sample expectation (#221). Never a risk limit.
    #[prost(string, tag = "17")]
    pub verdict: ::prost::alloc::string::String,
    /// Why it is diverging, when it is: what was seen against what was expected.
    #[prost(string, optional, tag = "18")]
    pub verdict_reason: ::core::option::Option<::prost::alloc::string::String>,
    /// The gate's limits this session is within four fifths of (#191), in the
    /// gate's words: "drawdown 8.1% of a 10.0% limit". Empty while halted.
    #[prost(string, repeated, tag = "19")]
    pub warnings: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// What the fills cost against the decision prices (#18): the divergence a
    /// paper session exists to measure. Absent until something filled.
    #[prost(message, optional, tag = "20")]
    pub divergence: ::core::option::Option<Divergence>,
}
/// Measured against assumed, over a session's fills so far (#18).
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Divergence {
    #[prost(uint32, tag = "1")]
    pub fills: u32,
    /// Approved orders that never filled. Never averaged into the slippage: a
    /// backtest assumes every order fills, so this has nothing to compare to.
    #[prost(uint32, tag = "2")]
    pub unfilled: u32,
    /// Mean adverse slippage across the fills, in basis points; positive is
    /// worse than the decision price, whichever way the order went.
    #[prost(double, tag = "3")]
    pub mean_slippage_bps: f64,
    #[prost(double, tag = "4")]
    pub worst_slippage_bps: f64,
    /// Signal to fill.
    #[prost(double, tag = "5")]
    pub mean_latency_ms: f64,
    #[prost(int64, tag = "6")]
    pub worst_latency_ms: i64,
    /// What the finding's cost model assumed, so the difference is readable.
    #[prost(double, optional, tag = "7")]
    pub assumed_slippage_bps: ::core::option::Option<f64>,
}
/// The promotion gate's answer for one finding and one executor (#194).
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PromotionView {
    #[prost(bool, tag = "1")]
    pub allowed: bool,
    /// Every reason it is not, in the gate's words. Empty when allowed.
    #[prost(string, repeated, tag = "2")]
    pub reasons: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// The finding's own verdict: Supported, NotSupported or Inconclusive.
    /// Empty when the finding cannot be opened.
    #[prost(string, tag = "3")]
    pub verdict: ::prost::alloc::string::String,
    /// Days the finding has run on paper, by its paper record; absent when it
    /// has not.
    #[prost(int64, optional, tag = "4")]
    pub paper_days: ::core::option::Option<i64>,
    /// The paper session's last verdict against the finding (holding,
    /// diverging, inconclusive), when it has one.
    #[prost(string, optional, tag = "5")]
    pub paper_verdict: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SessionList {
    #[prost(message, repeated, tag = "1")]
    pub sessions: ::prost::alloc::vec::Vec<SessionStatus>,
}