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
impl Action
Sourcepub fn hash(&mut self) -> Hash
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}Sourcepub fn link(&mut self, meta: ActionMeta)
pub fn link(&mut self, meta: ActionMeta)
Link tx and action meta information in each action
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Action
impl<'de> Deserialize<'de> for Action
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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
impl From<AgentWalletCreation> for Action
Source§fn from(o: AgentWalletCreation) -> Self
fn from(o: AgentWalletCreation) -> Self
Converts to this type from the input type.
Source§impl From<CancelOrder> for Action
impl From<CancelOrder> for Action
Source§fn from(o: CancelOrder) -> Self
fn from(o: CancelOrder) -> Self
Converts to this type from the input type.
Source§impl From<LimitOrder> for Action
impl From<LimitOrder> for Action
Source§fn from(o: LimitOrder) -> Self
fn from(o: LimitOrder) -> Self
Converts to this type from the input type.
Source§impl From<MarketOrder> for Action
impl From<MarketOrder> for Action
Source§fn from(o: MarketOrder) -> Self
fn from(o: MarketOrder) -> Self
Converts to this type from the input type.
Source§impl From<ModifyOrder> for Action
impl From<ModifyOrder> for Action
Source§fn from(o: ModifyOrder) -> Self
fn from(o: ModifyOrder) -> Self
Converts to this type from the input type.
Source§impl From<PythOracle> for Action
impl From<PythOracle> for Action
Source§fn from(o: PythOracle) -> Self
fn from(o: PythOracle) -> Self
Converts to this type from the input type.
Source§impl From<UpdateUserSettings> for Action
impl From<UpdateUserSettings> for Action
Source§fn from(o: UpdateUserSettings) -> Self
fn from(o: UpdateUserSettings) -> Self
Converts to this type from the input type.
Source§impl From<WhitelistFaucet> for Action
impl From<WhitelistFaucet> for Action
Source§fn from(o: WhitelistFaucet) -> Self
fn from(o: WhitelistFaucet) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Action
impl RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl UnsafeUnpin for Action
impl UnwindSafe for Action
Blanket Implementations§
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
Mutably borrows from an owned value. Read more