Struct architect_api::client::Client
source · pub struct Client(_);Expand description
Managed client for Architect.
Implements some default behavior for setup and provides a simple and clean interface + convenient helpers for getting started without obfuscating the actual core API–that is, it should be easy to graduate from this interface as the user requirements become more complex. Think “training wheels” and not “opaque re-skin”.
That being said, the interface should be sufficient for all kinds of low-frequency, discretionary trading. Probably around >1000 open orders at any given time is the cutoff for setting things up more manually.
The lower level oms api is in orderflow, lower level qf
functionality is direct from netidx.
Implementations§
source§impl Client
impl Client
sourcepub async fn new(common: &Common) -> Result<(Self, JoinHandle<Result<()>>)>
pub async fn new(common: &Common) -> Result<(Self, JoinHandle<Result<()>>)>
This will initialize every api, in some cases it can take a while. It should not be necessary to have more than one of these in a process.
sourcepub async fn initialize(
common: Option<&Common>
) -> Result<(Self, JoinHandle<Result<()>>)>
pub async fn initialize( common: Option<&Common> ) -> Result<(Self, JoinHandle<Result<()>>)>
This is a wrapper around new that will load the default api configuration if you don’t already have one. If you do have one, then it is the same as calling new.
sourcepub fn orderflow(&self) -> &Client
pub fn orderflow(&self) -> &Client
Return a reference to the low level orderflow client. If you are using simple_orderflow directly, or ManagedOrder then it isn’t safe to receive messages directly from this client.
sourcepub fn simple_orderflow(&self) -> &OmsQueryApi
pub fn simple_orderflow(&self) -> &OmsQueryApi
Return a reference to the simple orderflow client. Normally
you would call send_limit_order, however if you want a
somewhat lower level interface you can use simple_orderflow
directly.
sourcepub fn limits(&self) -> &OmsLimitsApi
pub fn limits(&self) -> &OmsLimitsApi
Return a reference to the limits api
sourcepub fn secrets(&self) -> &SecretsQueryApi
pub fn secrets(&self) -> &SecretsQueryApi
Return a reference to the secrets db api
sourcepub fn alerts(&self) -> Receiver<Pooled<Vec<Alert>>>
pub fn alerts(&self) -> Receiver<Pooled<Vec<Alert>>>
Return a reference to the alerts channel. You must also call
subscribe_to_alerts if you want to receive system alerts.
sourcepub fn subscribe_to_alerts(&self, path: Path, seek: Seek)
pub fn subscribe_to_alerts(&self, path: Path, seek: Seek)
Subscribe to system alerts. To use the alerts call alerts
and use the returned broadcast channel.
sourcepub fn default_account(&self) -> Account
pub fn default_account(&self) -> Account
Return the default account
sourcepub fn managed_product(
&self,
base: &str,
quote: &str,
venue: Venue,
route: Route
) -> Result<ManagedProduct>
pub fn managed_product( &self, base: &str, quote: &str, venue: Venue, route: Route ) -> Result<ManagedProduct>
Subscribe to the specified product by name. Base is the product, e.g. BTC, quote is the quote currency, e.g. USD. Venue and Route are the exchange the product trades on and qf route to use for the data. For most exchanges this will be Route::get(“DIRECT”).
sourcepub async fn managed_order(&self, order_id: OrderId) -> Arc<ManagedOrder>
pub async fn managed_order(&self, order_id: OrderId) -> Arc<ManagedOrder>
Wrap an order in a managed order
sourcepub async fn send_limit_order(
&self,
product: TradableProduct,
account: Account,
dir: Dir,
price: Decimal,
quantity: Decimal
) -> Result<Arc<ManagedOrder>>
pub async fn send_limit_order( &self, product: TradableProduct, account: Account, dir: Dir, price: Decimal, quantity: Decimal ) -> Result<Arc<ManagedOrder>>
Send a limit order, returning the managed order
sourcepub async fn list_open_orders(
&self,
set: LimitSet,
scope: LimitScope
) -> Result<Pooled<Vec<Order>>>
pub async fn list_open_orders( &self, set: LimitSet, scope: LimitScope ) -> Result<Pooled<Vec<Order>>>
Return a list of open orders in the specified set and scope. E.G. to return all open orders, you’d use LimitSet::Firm, LimitScope::Global.
sourcepub async fn list_fills(
&self,
set: LimitSet,
scope: LimitScope
) -> Result<Pooled<Vec<Result<NormalFill, AberrantFill>>>>
pub async fn list_fills( &self, set: LimitSet, scope: LimitScope ) -> Result<Pooled<Vec<Result<NormalFill, AberrantFill>>>>
return a list of fills in the specified set and scope.
However be aware that because the OMS is designed to support very high frequency trading applications it is not possible for it to keep every order forever. Filled orders are dropped after 1 day by default.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
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
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where &'a Self: for<'a> IntoIterator,
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>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,
self, then passes self.as_mut() into the pipe
function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
.tap_ref_mut() only in debug builds, and is erased in release
builds.