pub trait VertexQuery: VertexBase + Sync {
Show 30 methods
// Required methods
fn query<'life0, 'async_trait>(
&'life0 self,
query: Query,
) -> Pin<Box<dyn Future<Output = Result<QueryResponseData>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn query_trigger<'life0, 'async_trait>(
&'life0 self,
query: Query,
) -> Pin<Box<dyn Future<Output = Result<QueryResponseData>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn query_v2<'life0, 'life1, 'async_trait, R>(
&'life0 self,
path: &'life1 str,
query: QueryV2,
) -> Pin<Box<dyn Future<Output = Result<R>> + Send + 'async_trait>>
where R: 'async_trait + DeserializeOwned + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn get_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<EngineStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ContractsResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_nonces<'life0, 'async_trait>(
&'life0 self,
address: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<NoncesResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn next_tx_nonce<'life0, 'async_trait>(
&'life0 self,
address: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_linked_signer<'life0, 'async_trait>(
&'life0 self,
subaccount: [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<LinkedSignerResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_subaccount_info<'life0, 'async_trait>(
&'life0 self,
subaccount: [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<SubaccountInfoResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_subaccount_info_with_txns<'life0, 'async_trait>(
&'life0 self,
subaccount: [u8; 32],
txns: Vec<Txn>,
) -> Pin<Box<dyn Future<Output = Result<SubaccountInfoResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_all_products<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AllProductsResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_token_address<'life0, 'async_trait>(
&'life0 self,
product_id: u32,
) -> Pin<Box<dyn Future<Output = Result<[u8; 20]>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_market_price<'life0, 'async_trait>(
&'life0 self,
product_id: u32,
) -> Pin<Box<dyn Future<Output = Result<MarketPriceResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_market_prices<'life0, 'async_trait>(
&'life0 self,
product_ids: Vec<u32>,
) -> Pin<Box<dyn Future<Output = Result<MarketPricesResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_order<'life0, 'async_trait>(
&'life0 self,
product_id: u32,
digest: [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<OrderResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_fee_rates<'life0, 'async_trait>(
&'life0 self,
sender: [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<FeeRatesResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_subaccount_orders<'life0, 'async_trait>(
&'life0 self,
sender: [u8; 32],
product_id: u32,
) -> Pin<Box<dyn Future<Output = Result<SubaccountOrdersResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_market_liquidity<'life0, 'async_trait>(
&'life0 self,
product_id: u32,
depth: u32,
) -> Pin<Box<dyn Future<Output = Result<MarketLiquidityResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_max_order_size<'life0, 'async_trait>(
&'life0 self,
max_order_size_query: Query,
) -> Pin<Box<dyn Future<Output = Result<MaxOrderSizeResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_max_withdrawable<'life0, 'async_trait>(
&'life0 self,
max_withdrawable_query: Query,
) -> Pin<Box<dyn Future<Output = Result<MaxWithdrawableResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_max_lp_mintable<'life0, 'async_trait>(
&'life0 self,
max_lp_mintable_query: Query,
) -> Pin<Box<dyn Future<Output = Result<MaxLpMintableResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_max_vlp_mintable<'life0, 'async_trait>(
&'life0 self,
max_vlp_mintable_query: Query,
) -> Pin<Box<dyn Future<Output = Result<MaxVlpMintableResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_health_groups<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthGroupsResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_insurance<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<InsuranceResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_symbols<'life0, 'async_trait>(
&'life0 self,
product_ids: Option<Vec<u32>>,
product_type: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<SymbolsResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn list_trigger_orders<'life0, 'async_trait>(
&'life0 self,
list_trigger_orders: Query,
) -> Pin<Box<dyn Future<Output = Result<ListTriggerOrdersResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_orderbook<'life0, 'async_trait>(
&'life0 self,
ticker_id: String,
depth: u32,
) -> Pin<Box<dyn Future<Output = Result<OrderbookResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_pairs<'life0, 'async_trait>(
&'life0 self,
market: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<MarketPairsResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_assets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AssetsResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_isolated_positions<'life0, 'async_trait>(
&'life0 self,
subaccount: [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<IsolatedPositionsResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Required Methods§
fn query<'life0, 'async_trait>(
&'life0 self,
query: Query,
) -> Pin<Box<dyn Future<Output = Result<QueryResponseData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn query_trigger<'life0, 'async_trait>(
&'life0 self,
query: Query,
) -> Pin<Box<dyn Future<Output = Result<QueryResponseData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn query_v2<'life0, 'life1, 'async_trait, R>(
&'life0 self,
path: &'life1 str,
query: QueryV2,
) -> Pin<Box<dyn Future<Output = Result<R>> + Send + 'async_trait>>where
R: 'async_trait + DeserializeOwned + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
fn get_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<EngineStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_contracts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ContractsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_nonces<'life0, 'async_trait>(
&'life0 self,
address: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<NoncesResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn next_tx_nonce<'life0, 'async_trait>(
&'life0 self,
address: [u8; 20],
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_linked_signer<'life0, 'async_trait>(
&'life0 self,
subaccount: [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<LinkedSignerResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_subaccount_info<'life0, 'async_trait>(
&'life0 self,
subaccount: [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<SubaccountInfoResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_subaccount_info_with_txns<'life0, 'async_trait>(
&'life0 self,
subaccount: [u8; 32],
txns: Vec<Txn>,
) -> Pin<Box<dyn Future<Output = Result<SubaccountInfoResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_all_products<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AllProductsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_token_address<'life0, 'async_trait>(
&'life0 self,
product_id: u32,
) -> Pin<Box<dyn Future<Output = Result<[u8; 20]>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_market_price<'life0, 'async_trait>(
&'life0 self,
product_id: u32,
) -> Pin<Box<dyn Future<Output = Result<MarketPriceResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_market_prices<'life0, 'async_trait>(
&'life0 self,
product_ids: Vec<u32>,
) -> Pin<Box<dyn Future<Output = Result<MarketPricesResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_order<'life0, 'async_trait>(
&'life0 self,
product_id: u32,
digest: [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<OrderResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_fee_rates<'life0, 'async_trait>(
&'life0 self,
sender: [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<FeeRatesResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn get_subaccount_orders<'life0, 'async_trait>(
&'life0 self,
sender: [u8; 32],
product_id: u32,
) -> Pin<Box<dyn Future<Output = Result<SubaccountOrdersResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_subaccount_orders<'life0, 'async_trait>(
&'life0 self,
sender: [u8; 32],
product_id: u32,
) -> Pin<Box<dyn Future<Output = Result<SubaccountOrdersResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Examples found in repository?
examples/place_and_cancel.rs (line 31)
6async fn main() {
7 // paste private key or set RUST_SDK_PRIVATE_KEY in .env file
8 let private_key = private_key();
9
10 let client = VertexClient::new(ClientMode::SepoliaTest)
11 .with_signer(private_key)
12 .await
13 .unwrap();
14
15 const BTC_PERP: u32 = 2;
16
17 // sell 1 BTC_PERP
18 let response = client
19 .place_order_builder()
20 .product_id(BTC_PERP)
21 .amount(to_i128_x18(-1))
22 .price_x18(to_i128_x18(35_000))
23 .execute()
24 .await
25 .unwrap();
26
27 let digest = response.unwrap().digest;
28
29 // check subaccount open orders
30 let open_orders = client
31 .get_subaccount_orders(client.subaccount().unwrap(), BTC_PERP)
32 .await
33 .unwrap();
34 println!("open orders: {:?}", open_orders);
35
36 // cancel order
37 let cancellation_response = client
38 .cancellation_builder()
39 .digests(vec![digest])
40 .product_ids(vec![BTC_PERP])
41 .execute()
42 .await
43 .unwrap();
44
45 let canceled_digest = cancellation_response.unwrap().cancelled_orders[0].digest;
46 assert_eq!(digest, canceled_digest)
47}Sourcefn get_market_liquidity<'life0, 'async_trait>(
&'life0 self,
product_id: u32,
depth: u32,
) -> Pin<Box<dyn Future<Output = Result<MarketLiquidityResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_market_liquidity<'life0, 'async_trait>(
&'life0 self,
product_id: u32,
depth: u32,
) -> Pin<Box<dyn Future<Output = Result<MarketLiquidityResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Examples found in repository?
examples/no_signer.rs (line 11)
5async fn main() {
6 // a client without a signer can make queries
7 let client = VertexClient::new(ClientMode::SepoliaTest);
8
9 const ARB_PERP: u32 = 6;
10 let depth = 10;
11 let order_book = client.get_market_liquidity(ARB_PERP, depth).await.unwrap();
12 println!("orderbook: {:?}", order_book);
13
14 let liquidation_feed = client.get_liquidation_feed().await.unwrap();
15 print!("liquidateable accounts: {:?}", liquidation_feed);
16
17 // anything requiring a private key fails
18 assert!(client.subaccount().is_err());
19 assert!(client
20 .deposit_collateral_builder()
21 .product_id(0)
22 .amount(to_u128_x6(10))
23 .execute()
24 .await
25 .is_err());
26}fn get_max_order_size<'life0, 'async_trait>(
&'life0 self,
max_order_size_query: Query,
) -> Pin<Box<dyn Future<Output = Result<MaxOrderSizeResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_max_withdrawable<'life0, 'async_trait>(
&'life0 self,
max_withdrawable_query: Query,
) -> Pin<Box<dyn Future<Output = Result<MaxWithdrawableResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_max_lp_mintable<'life0, 'async_trait>(
&'life0 self,
max_lp_mintable_query: Query,
) -> Pin<Box<dyn Future<Output = Result<MaxLpMintableResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_max_vlp_mintable<'life0, 'async_trait>(
&'life0 self,
max_vlp_mintable_query: Query,
) -> Pin<Box<dyn Future<Output = Result<MaxVlpMintableResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_health_groups<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthGroupsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_insurance<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<InsuranceResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn get_symbols<'life0, 'async_trait>(
&'life0 self,
product_ids: Option<Vec<u32>>,
product_type: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<SymbolsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_symbols<'life0, 'async_trait>(
&'life0 self,
product_ids: Option<Vec<u32>>,
product_type: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<SymbolsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Examples found in repository?
examples/product_ids_and_symbols.rs (line 11)
6async fn main() {
7 let client = VertexClient::new(ClientMode::SepoliaTest);
8
9 // optionally specify product type or specific symbol
10 let spot_symbols = client
11 .get_symbols(None, Some("spot".to_string()))
12 .await
13 .unwrap();
14
15 let symbols_to_product_info: HashMap<String, SymbolsResponseData> = spot_symbols.symbols;
16
17 // get product info like product id
18 let btc = symbols_to_product_info.get("BTC").unwrap();
19 println!("BTC product_id: {}", btc.product_id);
20
21 let perp_symbols = client
22 .get_symbols(None, Some("perp".to_string()))
23 .await
24 .unwrap();
25
26 let symbols_to_product_info: HashMap<String, SymbolsResponseData> = perp_symbols.symbols;
27
28 let sol_perp = symbols_to_product_info.get("SOL-PERP").unwrap();
29 println!("SOL-PERP product_id: {}", sol_perp.product_id);
30}fn list_trigger_orders<'life0, 'async_trait>(
&'life0 self,
list_trigger_orders: Query,
) -> Pin<Box<dyn Future<Output = Result<ListTriggerOrdersResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_orderbook<'life0, 'async_trait>(
&'life0 self,
ticker_id: String,
depth: u32,
) -> Pin<Box<dyn Future<Output = Result<OrderbookResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_pairs<'life0, 'async_trait>(
&'life0 self,
market: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<MarketPairsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_assets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AssetsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_isolated_positions<'life0, 'async_trait>(
&'life0 self,
subaccount: [u8; 32],
) -> Pin<Box<dyn Future<Output = Result<IsolatedPositionsResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".