Architect

Struct Architect 

Source
pub struct Architect { /* private fields */ }

Implementations§

Source§

impl Architect

Source

pub async fn connect( api_key: impl AsRef<str>, api_secret: impl AsRef<str>, paper_trading: bool, ) -> Result<Self>

Source

pub async fn connect_to( endpoint: impl AsRef<str>, api_key: impl AsRef<str>, api_secret: impl AsRef<str>, paper_trading: bool, ) -> Result<Self>

Source

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.

Source

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

Source

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.

Source

pub async fn set_symbology(&self, endpoint: impl AsRef<str>) -> Result<()>

Manually set the symbology endpoint.

Source

pub async fn set_marketdata( &self, venue: MarketdataVenue, endpoint: impl AsRef<str>, ) -> Result<()>

Manually set the marketdata endpoint for a venue.

Source

pub async fn set_hmart(&mut self, endpoint: impl AsRef<str>) -> Result<()>

Manually set the hmart (historical marketdata service) endpoint.

Source

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.

Source

pub async fn get_futures_series( &self, series_symbol: impl AsRef<str>, include_expired: bool, ) -> Result<Vec<Product>>

Source

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.

Source

pub async fn get_market_status( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, ) -> Result<MarketStatus>

Source

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>>

Source

pub async fn get_l1_book_snapshot( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, ) -> Result<L1BookSnapshot>

Source

pub async fn get_l1_book_snapshots( &self, symbols: impl IntoIterator<Item = impl AsRef<str>>, venue: impl AsRef<str>, ) -> Result<Vec<L1BookSnapshot>>

Source

pub async fn get_l2_book_snapshot( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, ) -> Result<L2BookSnapshot>

Source

pub async fn get_ticker( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, ) -> Result<Ticker>

Source

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>>

Source

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>>

Source

pub async fn stream_l2_book_updates( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, ) -> Result<Streaming<L2BookUpdate>>

Source

pub async fn stream_trades( &self, symbol: Option<impl AsRef<str>>, venue: impl AsRef<str>, ) -> Result<Streaming<Trade>>

Source

pub async fn stream_candles( &self, symbol: impl AsRef<str>, venue: impl AsRef<str>, candle_widths: Option<impl IntoIterator<Item = &CandleWidth>>, ) -> Result<Streaming<Candle>>

Source

pub async fn list_accounts( &self, trader: Option<TraderIdOrEmail>, ) -> Result<Vec<AccountWithPermissions>>

Source

pub async fn get_account_summary( &self, account: AccountIdOrName, ) -> Result<AccountSummary>

Source

pub async fn get_account_summaries( &self, account: Option<impl IntoIterator<Item = AccountIdOrName>>, trader: Option<TraderIdOrEmail>, ) -> Result<Vec<AccountSummary>>

Source

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>>

Source

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>>

Source

pub async fn get_all_open_orders(&self) -> Result<Vec<Order>>

Source

pub async fn get_historical_orders( &self, query: HistoricalOrdersRequest, ) -> Result<Vec<Order>>

Source

pub async fn get_fills( &self, query: HistoricalFillsRequest, ) -> Result<Vec<Fill>>

Source

pub async fn orderflow<S>( &self, request_stream: S, ) -> Result<Streaming<Orderflow>>
where S: Stream<Item = OrderflowRequest> + Send + 'static,

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),
    }
}
Source

pub async fn place_order(&self, place_order: PlaceOrderRequest) -> Result<Order>

Source

pub async fn cancel_order( &self, cancel_order: CancelOrderRequest, ) -> Result<Cancel>

Trait Implementations§

Source§

impl Clone for Architect

Source§

fn clone(&self) -> Architect

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Architect

Source§

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

Formats the value using the given formatter. 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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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> ErasedDestructor for T
where T: 'static,