Skip to main content

HedgeRecoveryWorker

Struct HedgeRecoveryWorker 

Source
pub struct HedgeRecoveryWorker<'a, R: VenueRouterPort, P: ExecutionEventPort> { /* private fields */ }
Expand description

Restart-safe single-node hedge recovery worker.

Compensation client ids are deterministic for (group_id, leg_id), so a retry after a process restart reuses the same order identity. The event port remains the source of truth for the compensation order status; the group snapshot only records that all confirmed exposure has been hedged.

Implementations§

Source§

impl<'a, R: VenueRouterPort, P: ExecutionEventPort> HedgeRecoveryWorker<'a, R, P>

Source

pub fn new( group: SpreadOrderGroup, store: &'a mut dyn SpreadOrderGroupStore, router: &'a mut R, events: &'a mut P, worker_id: &'a str, now: u64, source_seq: &'a mut u64, ) -> QxResult<Self>

Source

pub fn for_account_venue( self, account_id: &str, venue_id: &str, ) -> Result<Self, String>

Scope a live recovery pass to the exact account and venue served by this worker.

Source

pub fn for_account(self, account_id: &str) -> Result<Self, String>

Source

pub fn execute(self) -> Result<HedgeRecoveryOutcome, String>

Execute all confirmed compensation targets once, then persist Hedged only when the event port confirms every deterministic hedge order is Filled. Active orders are left pending and are never submitted twice.

Source

pub fn execute_with_validator( self, validator: Option<&dyn HedgeOrderValidator>, ) -> Result<HedgeRecoveryOutcome, String>

在实际补偿单提交前注入账户级风控校验。恢复 worker 本身不依赖 qx-risk 的具体快照来源,由运行时按当前 Venue/账户提供校验器; 未提供时仍保留库级 Order::validate 和 reduce-only 约束。

Auto Trait Implementations§

§

impl<'a, R, P> !RefUnwindSafe for HedgeRecoveryWorker<'a, R, P>

§

impl<'a, R, P> !Send for HedgeRecoveryWorker<'a, R, P>

§

impl<'a, R, P> !Sync for HedgeRecoveryWorker<'a, R, P>

§

impl<'a, R, P> !UnwindSafe for HedgeRecoveryWorker<'a, R, P>

§

impl<'a, R, P> Forget for HedgeRecoveryWorker<'a, R, P>

§

impl<'a, R, P> Freeze for HedgeRecoveryWorker<'a, R, P>

§

impl<'a, R, P> Move for HedgeRecoveryWorker<'a, R, P>

§

impl<'a, R, P> Unpin for HedgeRecoveryWorker<'a, R, P>

§

impl<'a, R, P> UnsafeUnpin for HedgeRecoveryWorker<'a, R, P>

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.