Skip to main content

Action

Enum Action 

Source
pub enum Action {
Show 37 variants MarketOrder(MarketOrder), LimitOrder(LimitOrder), ModifyOrder(ModifyOrder), Cancel(CancelOrder), CancelAll(CancelAll), Stop(StopOrTP), TakeProfit(StopOrTP), Range(Range), Trigger(Trigger), Trailing(Trailing), OnFill(OnFill), Price(Price), Corrs(Matrix), PythOracle(PythOracle), Beacon(Beacon), Join(Join), Faucet(Faucet), AgentWalletCreation(AgentWalletCreation), UpdateUserSettings(UpdateUserSettings), WhitelistFaucet(WhitelistFaucet), AddMarket(AddMarket), ConfigFairPrice(OpaqueAction), ConfigVolatility(OpaqueAction), ConfigSecurity(OpaqueAction), ConfigRegime(OpaqueAction), ConfigRisk(OpaqueAction), ConfigFeePolicy(OpaqueAction), CreateSubAccount(CreateSubAccount), RemoveSubAccount(RemoveSubAccount), Transfer(Transfer), CreateMultisig(CreateMultisig), MultisigPropose(MultisigPropose), MultisigApprove(MultisigApprove), MultisigReject(MultisigReject), MultisigCancel(MultisigCancel), MultisigExecute(MultisigExecute), UpdateMultisigPolicy(UpdateMultisigPolicy),
}

Variants§

§

MarketOrder(MarketOrder)

§

LimitOrder(LimitOrder)

§

ModifyOrder(ModifyOrder)

§

Cancel(CancelOrder)

§

CancelAll(CancelAll)

§

Stop(StopOrTP)

§

TakeProfit(StopOrTP)

§

Range(Range)

§

Trigger(Trigger)

§

Trailing(Trailing)

§

OnFill(OnFill)

§

Price(Price)

§

Corrs(Matrix)

§

PythOracle(PythOracle)

§

Beacon(Beacon)

§

Join(Join)

§

Faucet(Faucet)

§

AgentWalletCreation(AgentWalletCreation)

§

UpdateUserSettings(UpdateUserSettings)

§

WhitelistFaucet(WhitelistFaucet)

§

AddMarket(AddMarket)

§

ConfigFairPrice(OpaqueAction)

§

ConfigVolatility(OpaqueAction)

§

ConfigSecurity(OpaqueAction)

§

ConfigRegime(OpaqueAction)

§

ConfigRisk(OpaqueAction)

§

ConfigFeePolicy(OpaqueAction)

§

CreateSubAccount(CreateSubAccount)

§

RemoveSubAccount(RemoveSubAccount)

§

Transfer(Transfer)

§

CreateMultisig(CreateMultisig)

§

MultisigPropose(MultisigPropose)

§

MultisigApprove(MultisigApprove)

§

MultisigReject(MultisigReject)

§

MultisigCancel(MultisigCancel)

§

MultisigExecute(MultisigExecute)

§

UpdateMultisigPolicy(UpdateMultisigPolicy)

Implementations§

Source§

impl Action

Source

pub fn account(&self) -> &Pubkey

Get account associated with action

Source

pub fn nonce(&self) -> u64

Get nonce associated with action

Source

pub fn seqno(&self) -> u32

Get nonce associated with action

Source

pub fn hash(&mut self) -> Hash

Get or compute hash of action

Examples found in repository?
examples/execute_limit.rs (line 85)
30async fn main() -> eyre::Result<()> {
31    tracing_subscriber::fmt()
32        .with_env_filter(
33            EnvFilter::from_default_env().add_directive(tracing::Level::INFO.into())
34        )
35        .init();
36
37    let args = Args::parse();
38
39    info!("Connecting to {} for execution", args.url);
40    let key = env::var("BULK_PRIVATE_KEY")?;
41    let signer = TransactionSigner::from_private_key(key.as_str())?;
42    let client = BulkHttpClient::new(&HttpConfig {
43        base_url: args.url,
44        signer: Some(signer.clone()),
45        ..Default::default()
46    }).unwrap();
47
48    let account = signer.public_key();
49    let nonce = make_nonce();
50
51    let mut orders = vec![
52        Action::LimitOrder(LimitOrder {
53            symbol: Arc::from("BTC-USD"),
54            is_buy: true,
55            price: 1000.0,
56            size: 0.0001,
57            tif: TimeInForce::IOC,
58            reduce_only: false,
59            iso: false,
60            meta: ActionMeta {
61                account,
62                nonce,
63                seqno: 0,
64                hash: None,
65            }
66        }),
67        Action::LimitOrder(LimitOrder {
68            symbol: Arc::from("ETH-USD"),
69            is_buy: true,
70            price: 1000.0,
71            size: 0.0001,
72            tif: TimeInForce::IOC,
73            reduce_only: false,
74            iso: false,
75            meta: ActionMeta {
76                account,
77                nonce,
78                seqno: 1,
79                hash: None,
80            }
81        }),
82    ];
83
84    let oids = orders.iter_mut()
85        .map(|o| o.hash().to_string())
86        .collect::<Vec<_>>();
87
88    eprintln!("order IDs: {:?}", oids);
89
90    let results = client.place_tx(orders, Some(account), Some(nonce)).await?;
91    eprintln!("results: {:?}\n", results);
92
93    process::exit(0);
94}

Link tx and action meta information in each action

Trait Implementations§

Source§

impl Clone for Action

Source§

fn clone(&self) -> Action

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Action

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Action

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<AgentWalletCreation> for Action

Source§

fn from(o: AgentWalletCreation) -> Self

Converts to this type from the input type.
Source§

impl From<CancelAll> for Action

Source§

fn from(o: CancelAll) -> Self

Converts to this type from the input type.
Source§

impl From<CancelOrder> for Action

Source§

fn from(o: CancelOrder) -> Self

Converts to this type from the input type.
Source§

impl From<Faucet> for Action

Source§

fn from(o: Faucet) -> Self

Converts to this type from the input type.
Source§

impl From<LimitOrder> for Action

Source§

fn from(o: LimitOrder) -> Self

Converts to this type from the input type.
Source§

impl From<MarketOrder> for Action

Source§

fn from(o: MarketOrder) -> Self

Converts to this type from the input type.
Source§

impl From<ModifyOrder> for Action

Source§

fn from(o: ModifyOrder) -> Self

Converts to this type from the input type.
Source§

impl From<Price> for Action

Source§

fn from(o: Price) -> Self

Converts to this type from the input type.
Source§

impl From<PythOracle> for Action

Source§

fn from(o: PythOracle) -> Self

Converts to this type from the input type.
Source§

impl From<UpdateUserSettings> for Action

Source§

fn from(o: UpdateUserSettings) -> Self

Converts to this type from the input type.
Source§

impl From<WhitelistFaucet> for Action

Source§

fn from(o: WhitelistFaucet) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Action

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,