pub struct Architect { /* private fields */ }Implementations§
Source§impl Architect
impl Architect
pub async fn connect( api_key: impl AsRef<str>, api_secret: impl AsRef<str>, paper_trading: bool, ) -> Result<Self>
pub async fn connect_to( endpoint: impl AsRef<str>, api_key: impl AsRef<str>, api_secret: impl AsRef<str>, paper_trading: bool, ) -> Result<Self>
Sourcepub async fn resolve_endpoint(
endpoint: impl AsRef<str>,
paper_trading: bool,
) -> Result<Endpoint>
pub async fn resolve_endpoint( endpoint: impl AsRef<str>, paper_trading: bool, ) -> Result<Endpoint>
Resolve a service gRPC endpoint given its URL.
If localhost or an IP address is given, it will be returned as is.
If a domain name is given, it will be resolved to an IP address and
port using SRV records. If a port is specified in url, it always
takes precedence over the port found in SRV records.
If paper_trading is true and the host is app.architect.co or staging.architect.co, the port will be overridden to PAPER_GRPC_PORT.
Sourcepub async fn refresh_jwt(&self, force: bool) -> Result<()>
pub async fn refresh_jwt(&self, force: bool) -> Result<()>
Refresh the JWT if it’s nearing expiration (within 1 minute) or if force is true
Sourcepub async fn discover_services(&self) -> Result<()>
pub async fn discover_services(&self) -> Result<()>
Discover service endpoints from Architect.
The Architect core is responsible for telling you where to find services like symbology and marketdata as per its configuration. You can also manually set endpoints by calling set_symbology and set_marketdata directly.
Sourcepub async fn set_symbology(&self, endpoint: impl AsRef<str>) -> Result<()>
pub async fn set_symbology(&self, endpoint: impl AsRef<str>) -> Result<()>
Manually set the symbology endpoint.
Sourcepub async fn set_marketdata(
&self,
venue: MarketdataVenue,
endpoint: impl AsRef<str>,
) -> Result<()>
pub async fn set_marketdata( &self, venue: MarketdataVenue, endpoint: impl AsRef<str>, ) -> Result<()>
Manually set the marketdata endpoint for a venue.
Sourcepub async fn set_hmart(&mut self, endpoint: impl AsRef<str>) -> Result<()>
pub async fn set_hmart(&mut self, endpoint: impl AsRef<str>) -> Result<()>
Manually set the hmart (historical marketdata service) endpoint.
Sourcepub async fn list_symbols(
&self,
marketdata: Option<&str>,
) -> Result<Vec<String>>
pub async fn list_symbols( &self, marketdata: Option<&str>, ) -> Result<Vec<String>>
List all symbols.
If marketdata is specified, query the marketdata endpoint directly; this may give different answers than the OMS.
pub async fn get_futures_series( &self, series_symbol: impl AsRef<str>, include_expired: bool, ) -> Result<Vec<Product>>
Sourcepub async fn get_execution_info(
&self,
symbol: impl AsRef<str>,
execution_venue: Option<ExecutionVenue>,
) -> Result<ExecutionInfoResponse>
pub async fn get_execution_info( &self, symbol: impl AsRef<str>, execution_venue: Option<ExecutionVenue>, ) -> Result<ExecutionInfoResponse>
Get execution information for a tradable product at a specific venue.
Returns execution details like tick size, step size, minimum order quantity, margin requirements, and other venue-specific trading parameters.
The symbol must be a TradableProduct (e.g., “ES 20250620 CME Future/USD”). Note that this symbol has the format {base}/{quote}, where the quote will generally be USD.
pub async fn get_market_status( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, ) -> Result<MarketStatus>
pub async fn get_historical_candles( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, candle_width: CandleWidth, start_date: DateTime<Utc>, end_date: DateTime<Utc>, ) -> Result<Vec<Candle>>
pub async fn get_l1_book_snapshot( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, ) -> Result<L1BookSnapshot>
pub async fn get_l1_book_snapshots( &self, symbols: impl IntoIterator<Item = impl AsRef<str>>, venue: impl AsRef<str>, ) -> Result<Vec<L1BookSnapshot>>
pub async fn get_l2_book_snapshot( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, ) -> Result<L2BookSnapshot>
pub async fn get_ticker( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, ) -> Result<Ticker>
pub async fn get_tickers( &self, venue: impl AsRef<str>, options: GetTickersOptions, sort_tickers_by: Option<SortTickersBy>, offset: Option<i32>, limit: Option<i32>, ) -> Result<Vec<Ticker>>
pub async fn stream_l1_book_snapshots( &self, symbols: impl IntoIterator<Item = impl AsRef<str>>, venue: impl AsRef<str>, send_initial_snapshots: bool, ) -> Result<Streaming<L1BookSnapshot>>
pub async fn stream_l2_book_updates( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, ) -> Result<Streaming<L2BookUpdate>>
pub async fn stream_trades( &self, symbol: Option<impl AsRef<str>>, venue: impl AsRef<str>, ) -> Result<Streaming<Trade>>
pub async fn stream_candles( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, candle_widths: Option<impl IntoIterator<Item = &CandleWidth>>, ) -> Result<Streaming<Candle>>
pub async fn list_accounts( &self, trader: Option<TraderIdOrEmail>, ) -> Result<Vec<AccountWithPermissions>>
pub async fn get_account_summary( &self, account: AccountIdOrName, ) -> Result<AccountSummary>
pub async fn get_account_summaries( &self, account: Option<impl IntoIterator<Item = AccountIdOrName>>, trader: Option<TraderIdOrEmail>, ) -> Result<Vec<AccountSummary>>
pub async fn get_account_history( &self, account: AccountIdOrName, from_inclusive: Option<DateTime<Utc>>, to_exclusive: Option<DateTime<Utc>>, granularity: Option<AccountHistoryGranularity>, limit: Option<i32>, time_of_day: Option<NaiveTime>, ) -> Result<Vec<AccountSummary>>
pub async fn get_open_orders( &self, order_ids: Option<impl IntoIterator<Item = &OrderId>>, venue: Option<impl AsRef<str>>, account: Option<AccountIdOrName>, trader: Option<TraderIdOrEmail>, symbol: Option<impl AsRef<str>>, parent_order_id: Option<OrderId>, ) -> Result<Vec<Order>>
pub async fn get_all_open_orders(&self) -> Result<Vec<Order>>
pub async fn get_historical_orders( &self, query: HistoricalOrdersRequest, ) -> Result<Vec<Order>>
pub async fn get_fills( &self, query: HistoricalFillsRequest, ) -> Result<Vec<Fill>>
Sourcepub async fn orderflow<S>(
&self,
request_stream: S,
) -> Result<Streaming<Orderflow>>
pub async fn orderflow<S>( &self, request_stream: S, ) -> Result<Streaming<Orderflow>>
Create a bidirectional orderflow stream.
This returns the raw bidirectional stream from the gRPC service.
You can send OrderflowRequest messages and receive Orderflow updates.
For most use cases, consider using place_order and cancel_order methods
directly on the client instead.
§Example
use tokio_stream::StreamExt;
let (tx, rx) = tokio::sync::mpsc::channel(100);
let request_stream = tokio_stream::wrappers::ReceiverStream::new(rx);
let mut response_stream = client.orderflow(request_stream).await?;
// Send orders through tx
let order = PlaceOrderRequest {
id: None,
parent_id: None,
symbol: "BTC-USD".to_string(),
dir: Dir::Buy,
quantity: "0.01".parse()?,
trader: None,
account: None,
order_type: OrderType::Market,
time_in_force: architect_api::orderflow::TimeInForce::GoodTilCancel,
source: None,
execution_venue: None,
};
tx.send(OrderflowRequest::PlaceOrder(order)).await?;
// Receive updates
while let Some(result) = response_stream.next().await {
match result {
Ok(update) => println!("Update: {:?}", update),
Err(e) => eprintln!("Error: {}", e),
}
}pub async fn place_order(&self, place_order: PlaceOrderRequest) -> Result<Order>
pub async fn cancel_order( &self, cancel_order: CancelOrderRequest, ) -> Result<Cancel>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Architect
impl !RefUnwindSafe for Architect
impl Send for Architect
impl Sync for Architect
impl Unpin for Architect
impl !UnwindSafe for Architect
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request