pub struct LevelClient<T: HttpClient + Clone> {
pub level: Level,
pub base_url: String,
/* private fields */
}Expand description
Stockfighter client for a specific level. The stock api is defined here It’s wrapper around an http client. As such it can return errors for parsing or for network issues.
Fields§
§level: Level§base_url: StringImplementations§
Source§impl<T: HttpClient + Clone> LevelClient<T>
impl<T: HttpClient + Clone> LevelClient<T>
Sourcepub fn heart_beat(&self) -> Result<HeartBeatResponse>
pub fn heart_beat(&self) -> Result<HeartBeatResponse>
See if this Level is up.
This should really only be used to sanity check that the level hasn’t been torn down.
Sourcepub fn venue_heart_beat(&self, venue: &str) -> Result<VenueHeartBeatResponse>
pub fn venue_heart_beat(&self, venue: &str) -> Result<VenueHeartBeatResponse>
Check if a venue is ok.
Sourcepub fn stock_list(&self, venue: &str) -> Result<StockListResponse>
pub fn stock_list(&self, venue: &str) -> Result<StockListResponse>
Get a list of all the stocks this venue can accept trades for.
§Errors
Errors out when: http fails parsing fails
Sourcepub fn orderbook(&self, venue: &str, stock: &str) -> Result<OrderbookResponse>
pub fn orderbook(&self, venue: &str, stock: &str) -> Result<OrderbookResponse>
Get a copy of the venue’s order book. Stockfighter suggests that this will be a slow operation that should be done as little as possible.
Sourcepub fn quote(&self, venue: &str, stock: &str) -> Result<QuoteResponse>
pub fn quote(&self, venue: &str, stock: &str) -> Result<QuoteResponse>
Ask a venue about the current state of a stock.
Sourcepub fn order(&self, o: &Order) -> Result<OrderResponse>
pub fn order(&self, o: &Order) -> Result<OrderResponse>
Send in an order, and get back a response.
Sourcepub fn order_status(
&self,
venue: &str,
stock: &str,
id: u64,
) -> Result<OrderResponse>
pub fn order_status( &self, venue: &str, stock: &str, id: u64, ) -> Result<OrderResponse>
Find out how a specific order on a specific venue is doing.
Sourcepub fn delete_order(
&self,
venue: &str,
stock: &str,
id: u64,
) -> Result<OrderResponse>
pub fn delete_order( &self, venue: &str, stock: &str, id: u64, ) -> Result<OrderResponse>
Try and cancel an order.
Sourcepub fn new(http_client: T, level: Level, base_url: &str) -> LevelClient<T>
pub fn new(http_client: T, level: Level, base_url: &str) -> LevelClient<T>
Constructs a new level client.
Trait Implementations§
Source§impl<T: Clone + HttpClient + Clone> Clone for LevelClient<T>
impl<T: Clone + HttpClient + Clone> Clone for LevelClient<T>
Source§fn clone(&self) -> LevelClient<T>
fn clone(&self) -> LevelClient<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for LevelClient<T>where
T: Freeze,
impl<T> RefUnwindSafe for LevelClient<T>where
T: RefUnwindSafe,
impl<T> Send for LevelClient<T>where
T: Send,
impl<T> Sync for LevelClient<T>where
T: Sync,
impl<T> Unpin for LevelClient<T>where
T: Unpin,
impl<T> UnwindSafe for LevelClient<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)