Skip to main content

AppState

Struct AppState 

Source
pub struct AppState {
Show 47 fields pub symbol: String, pub strategy_label: String, pub candles: Vec<Candle>, pub current_candle: Option<CandleBuilder>, pub candle_interval_ms: u64, pub timeframe: String, pub price_history_len: usize, pub position: Position, pub last_signal: Option<Signal>, pub last_order: Option<OrderUpdate>, pub open_order_history: Vec<String>, pub filled_order_history: Vec<String>, pub fast_sma: Option<f64>, pub slow_sma: Option<f64>, pub ws_connected: bool, pub paused: bool, pub tick_count: u64, pub log_messages: Vec<String>, pub balances: HashMap<String, f64>, pub initial_equity_usdt: Option<f64>, pub current_equity_usdt: Option<f64>, pub history_estimated_total_pnl_usdt: Option<f64>, pub fill_markers: Vec<FillMarker>, pub history_trade_count: u32, pub history_win_count: u32, pub history_lose_count: u32, pub history_realized_pnl: f64, pub strategy_stats: HashMap<String, OrderHistoryStats>, pub history_fills: Vec<OrderHistoryFill>, pub last_price_update_ms: Option<u64>, pub last_price_event_ms: Option<u64>, pub last_price_latency_ms: Option<u64>, pub last_order_history_update_ms: Option<u64>, pub last_order_history_event_ms: Option<u64>, pub last_order_history_latency_ms: Option<u64>, pub trade_stats_reset_warned: bool, pub symbol_selector_open: bool, pub symbol_selector_index: usize, pub symbol_items: Vec<String>, pub strategy_selector_open: bool, pub strategy_selector_index: usize, pub strategy_items: Vec<String>, pub account_popup_open: bool, pub history_popup_open: bool, pub history_rows: Vec<String>, pub history_bucket: HistoryBucket, pub last_applied_fee: String,
}

Fields§

§symbol: String§strategy_label: String§candles: Vec<Candle>§current_candle: Option<CandleBuilder>§candle_interval_ms: u64§timeframe: String§price_history_len: usize§position: Position§last_signal: Option<Signal>§last_order: Option<OrderUpdate>§open_order_history: Vec<String>§filled_order_history: Vec<String>§fast_sma: Option<f64>§slow_sma: Option<f64>§ws_connected: bool§paused: bool§tick_count: u64§log_messages: Vec<String>§balances: HashMap<String, f64>§initial_equity_usdt: Option<f64>§current_equity_usdt: Option<f64>§history_estimated_total_pnl_usdt: Option<f64>§fill_markers: Vec<FillMarker>§history_trade_count: u32§history_win_count: u32§history_lose_count: u32§history_realized_pnl: f64§strategy_stats: HashMap<String, OrderHistoryStats>§history_fills: Vec<OrderHistoryFill>§last_price_update_ms: Option<u64>§last_price_event_ms: Option<u64>§last_price_latency_ms: Option<u64>§last_order_history_update_ms: Option<u64>§last_order_history_event_ms: Option<u64>§last_order_history_latency_ms: Option<u64>§trade_stats_reset_warned: bool§symbol_selector_open: bool§symbol_selector_index: usize§symbol_items: Vec<String>§strategy_selector_open: bool§strategy_selector_index: usize§strategy_items: Vec<String>§account_popup_open: bool§history_popup_open: bool§history_rows: Vec<String>§history_bucket: HistoryBucket§last_applied_fee: String

Implementations§

Source§

impl AppState

Source

pub fn new( symbol: &str, strategy_label: &str, price_history_len: usize, candle_interval_ms: u64, timeframe: &str, ) -> Self

Source

pub fn last_price(&self) -> Option<f64>

Get the latest price (from current candle or last finalized candle).

Source

pub fn push_log(&mut self, msg: String)

Source

pub fn refresh_history_rows(&mut self)

Source

pub fn apply(&mut self, event: AppEvent)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more