pub struct JsSimulator { /* private fields */ }js only.Expand description
A JS binding for Simulator.
Implementations§
Source§impl JsSimulator
impl JsSimulator
Sourcepub fn get_market(&self, market_token: &str) -> Result<Option<JsMarketModel>>
pub fn get_market(&self, market_token: &str) -> Result<Option<JsMarketModel>>
Get market by its market token.
Sourcepub fn insert_price(&mut self, token: &str, price: Value) -> Result<()>
pub fn insert_price(&mut self, token: &str, price: Value) -> Result<()>
Upsert the prices for the given token.
Sourcepub fn insert_glv(&mut self, glv: &JsGlvModel) -> Result<()>
pub fn insert_glv(&mut self, glv: &JsGlvModel) -> Result<()>
Upsert a GLV model.
Sourcepub fn insert_vi(
&mut self,
vi_address: &str,
vi: &JsVirtualInventoryModel,
) -> Result<()>
pub fn insert_vi( &mut self, vi_address: &str, vi: &JsVirtualInventoryModel, ) -> Result<()>
Insert a virtual inventory model.
Sourcepub fn get_vi(
&self,
vi_address: &str,
) -> Result<Option<JsVirtualInventoryModel>>
pub fn get_vi( &self, vi_address: &str, ) -> Result<Option<JsVirtualInventoryModel>>
Get virtual inventory model by address.
Sourcepub fn set_disable_vis(&mut self, disable: bool)
pub fn set_disable_vis(&mut self, disable: bool)
Set whether to disable virtual inventories for simulations.
Sourcepub fn disable_vis(&self) -> bool
pub fn disable_vis(&self) -> bool
Get whether virtual inventories are disabled.
Sourcepub fn simulate_order(
&mut self,
args: SimulateOrderArgs,
position: Option<JsPosition>,
) -> Result<JsOrderSimulationOutput>
pub fn simulate_order( &mut self, args: SimulateOrderArgs, position: Option<JsPosition>, ) -> Result<JsOrderSimulationOutput>
Simulate an order execution.
Sourcepub fn simulate_deposit(
&mut self,
args: SimulateDepositArgs,
) -> Result<JsDepositSimulationOutput>
pub fn simulate_deposit( &mut self, args: SimulateDepositArgs, ) -> Result<JsDepositSimulationOutput>
Simulate a deposit execution.
Sourcepub fn simulate_withdrawal(
&mut self,
args: SimulateWithdrawalArgs,
) -> Result<JsWithdrawalSimulationOutput>
pub fn simulate_withdrawal( &mut self, args: SimulateWithdrawalArgs, ) -> Result<JsWithdrawalSimulationOutput>
Simulate a withdrawal execution.
Sourcepub fn simulate_shift(
&mut self,
args: SimulateShiftArgs,
) -> Result<JsShiftSimulationOutput>
pub fn simulate_shift( &mut self, args: SimulateShiftArgs, ) -> Result<JsShiftSimulationOutput>
Simulate a shift execution.
Sourcepub fn simulate_glv_deposit(
&mut self,
args: SimulateGlvDepositArgs,
) -> Result<JsGlvDepositSimulationOutput>
pub fn simulate_glv_deposit( &mut self, args: SimulateGlvDepositArgs, ) -> Result<JsGlvDepositSimulationOutput>
Simulate a GLV deposit execution.
Sourcepub fn simulate_glv_withdrawal(
&mut self,
args: SimulateGlvWithdrawalArgs,
) -> Result<JsGlvWithdrawalSimulationOutput>
pub fn simulate_glv_withdrawal( &mut self, args: SimulateGlvWithdrawalArgs, ) -> Result<JsGlvWithdrawalSimulationOutput>
Simulate a GLV withdrawal execution.
Sourcepub fn get_glv_status(&self, args: GetGlvStatusArgs) -> Result<GlvStatus>
pub fn get_glv_status(&self, args: GetGlvStatusArgs) -> Result<GlvStatus>
Calculates GLV status.
Sourcepub fn get_glv_token_value(&self, args: GetGlvTokenValueArgs) -> Result<u128>
pub fn get_glv_token_value(&self, args: GetGlvTokenValueArgs) -> Result<u128>
Calculates GLV token value.
Methods from Deref<Target = Simulator>§
Sourcepub fn get_market(&self, market_token: &Pubkey) -> Option<&MarketModel>
Available on simulation only.
pub fn get_market(&self, market_token: &Pubkey) -> Option<&MarketModel>
simulation only.Get market by its market token.
Sourcepub fn get_price(&self, token: &Pubkey) -> Option<Price<u128>>
Available on simulation only.
pub fn get_price(&self, token: &Pubkey) -> Option<Price<u128>>
simulation only.Get prices for the given token.
Sourcepub fn get_prices(&self, meta: &MarketMeta) -> Option<Prices<u128>>
Available on simulation only.
pub fn get_prices(&self, meta: &MarketMeta) -> Option<Prices<u128>>
simulation only.Get prices for the given market meta.
Sourcepub fn get_glv(&self, glv_token: &Pubkey) -> Option<&GlvModel>
Available on simulation only.
pub fn get_glv(&self, glv_token: &Pubkey) -> Option<&GlvModel>
simulation only.Get GLV by GLV token address.
Sourcepub fn tokens(&self) -> impl Iterator<Item = (&Pubkey, &TokenState)>
Available on simulation only.
pub fn tokens(&self) -> impl Iterator<Item = (&Pubkey, &TokenState)>
simulation only.Get token states.
Sourcepub fn markets(&self) -> impl Iterator<Item = (&Pubkey, &MarketModel)>
Available on simulation only.
pub fn markets(&self) -> impl Iterator<Item = (&Pubkey, &MarketModel)>
simulation only.Get market states.
Sourcepub fn glvs(&self) -> impl Iterator<Item = (&Pubkey, &GlvModel)>
Available on simulation only.
pub fn glvs(&self) -> impl Iterator<Item = (&Pubkey, &GlvModel)>
simulation only.Get GLV states.
Sourcepub fn get_vi(&self, vi_address: &Pubkey) -> Option<&VirtualInventoryModel>
Available on simulation only.
pub fn get_vi(&self, vi_address: &Pubkey) -> Option<&VirtualInventoryModel>
simulation only.Get virtual inventory model by address.
Sourcepub fn vis(&self) -> impl Iterator<Item = (&Pubkey, &VirtualInventoryModel)>
Available on simulation only.
pub fn vis(&self) -> impl Iterator<Item = (&Pubkey, &VirtualInventoryModel)>
simulation only.Get all virtual inventory states.
Trait Implementations§
Source§impl Clone for JsSimulator
impl Clone for JsSimulator
Source§fn clone(&self) -> JsSimulator
fn clone(&self) -> JsSimulator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Deref for JsSimulator
impl Deref for JsSimulator
Source§impl From<JsSimulator> for JsValue
impl From<JsSimulator> for JsValue
Source§fn from(value: JsSimulator) -> Self
fn from(value: JsSimulator) -> Self
Source§impl From<Simulator> for JsSimulator
impl From<Simulator> for JsSimulator
Source§impl FromWasmAbi for JsSimulator
impl FromWasmAbi for JsSimulator
Source§impl IntoWasmAbi for JsSimulator
impl IntoWasmAbi for JsSimulator
Source§impl LongRefFromWasmAbi for JsSimulator
impl LongRefFromWasmAbi for JsSimulator
Source§impl OptionFromWasmAbi for JsSimulator
impl OptionFromWasmAbi for JsSimulator
Source§impl OptionIntoWasmAbi for JsSimulator
impl OptionIntoWasmAbi for JsSimulator
Source§impl RefFromWasmAbi for JsSimulator
impl RefFromWasmAbi for JsSimulator
Source§type Anchor = RcRef<JsSimulator>
type Anchor = RcRef<JsSimulator>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for JsSimulator
impl RefMutFromWasmAbi for JsSimulator
Source§impl TryFromJsValue for JsSimulator
impl TryFromJsValue for JsSimulator
Source§impl VectorFromWasmAbi for JsSimulator
impl VectorFromWasmAbi for JsSimulator
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[JsSimulator]>
Source§impl VectorIntoJsValue for JsSimulator
impl VectorIntoJsValue for JsSimulator
fn vector_into_jsvalue(vector: Box<[JsSimulator]>) -> JsValue
Source§impl VectorIntoWasmAbi for JsSimulator
impl VectorIntoWasmAbi for JsSimulator
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[JsSimulator]>) -> Self::Abi
Source§impl WasmDescribeVector for JsSimulator
impl WasmDescribeVector for JsSimulator
impl SupportsConstructor for JsSimulator
impl SupportsInstanceProperty for JsSimulator
impl SupportsStaticProperty for JsSimulator
Auto Trait Implementations§
impl Freeze for JsSimulator
impl RefUnwindSafe for JsSimulator
impl Send for JsSimulator
impl Sync for JsSimulator
impl Unpin for JsSimulator
impl UnwindSafe for JsSimulator
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.