[][src]Trait nash_protocol::protocol::NashProtocol

pub trait NashProtocol: Sync {
    type Response: Send + Sync;
#[must_use]    fn graphql<'life0, 'async_trait>(
        &'life0 self,
        state: Arc<Mutex<State>>
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn response_from_json(
        &self,
        response: Value
    ) -> Result<ResponseOrError<Self::Response>>; #[must_use] fn process_response<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _response: &'life1 Self::Response,
        _state: Arc<Mutex<State>>
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn run_before<'life0, 'async_trait>(
        &'life0 self,
        _state: Arc<Mutex<State>>
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<ProtocolHook>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn run_after<'life0, 'async_trait>(
        &'life0 self,
        _state: Arc<Mutex<State>>
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<ProtocolHook>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... } }

Trait that all Nash protocol elements implement. Enforces transformation to GraphQL as well as state changes on response processing.

Associated Types

Loading content...

Required methods

#[must_use]fn graphql<'life0, 'async_trait>(
    &'life0 self,
    state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Convert the protocol request to GraphQL from communication with Nash server

fn response_from_json(
    &self,
    response: Value
) -> Result<ResponseOrError<Self::Response>>

Convert JSON response to request to the protocol's associated type

Loading content...

Provided methods

#[must_use]fn process_response<'life0, 'life1, 'async_trait>(
    &'life0 self,
    _response: &'life1 Self::Response,
    _state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 

Any state changes that result from execution of the protocol request The default implementation does nothing to state

#[must_use]fn run_before<'life0, 'async_trait>(
    &'life0 self,
    _state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<ProtocolHook>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

#[must_use]fn run_after<'life0, 'async_trait>(
    &'life0 self,
    _state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<ProtocolHook>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Loading content...

Implementors

impl NashProtocol for DhFillPoolRequest[src]

type Response = DhFillPoolResponse

fn graphql<'life0, 'async_trait>(
    &'life0 self,
    _state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Serialize a SignStates protocol request to a GraphQL string

fn response_from_json(
    &self,
    response: Value
) -> Result<ResponseOrError<Self::Response>>
[src]

Deserialize response to DhFillPool protocol response

fn process_response<'life0, 'life1, 'async_trait>(
    &'life0 self,
    response: &'life1 Self::Response,
    state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Update pool with response from server

impl NashProtocol for NashProtocolRequest[src]

Implement NashProtocol for the enum, threading through to the base implementation for each of the captured types. This could probably be automated wiht a macro.

type Response = NashProtocolResponse

impl NashProtocol for AssetNoncesRequest[src]

Implement protocol bindings for SignStatesRequest

type Response = AssetNoncesResponse

fn graphql<'life0, 'async_trait>(
    &'life0 self,
    state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Serialize a SignStates protocol request to a GraphQL string

fn response_from_json(
    &self,
    response: Value
) -> Result<ResponseOrError<Self::Response>>
[src]

Deserialize response to SignStates protocol request

fn process_response<'life0, 'life1, 'async_trait>(
    &'life0 self,
    response: &'life1 Self::Response,
    state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Asset nonces in state

fn run_before<'life0, 'async_trait>(
    &'life0 self,
    _state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<ProtocolHook>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

If doing an AssetNonces request, insert a ListMarketsRequest before that to store asset list in client

impl NashProtocol for CancelAllOrders[src]

Implement protocol bindings for CancelOrder

type Response = CancelAllOrdersResponse

impl NashProtocol for CancelOrderRequest[src]

Implement protocol bindings for CancelOrder

type Response = CancelOrderResponse

impl NashProtocol for GetAccountOrderRequest[src]

Implement protocol bindings for GetAccountOrderRequest

type Response = GetAccountOrderResponse

impl NashProtocol for TickerRequest[src]

Implement protocol bindings for TickerRequest

type Response = TickerResponse

impl NashProtocol for ListAccountBalancesRequest[src]

type Response = ListAccountBalancesResponse

impl NashProtocol for ListAccountOrdersRequest[src]

type Response = ListAccountOrdersResponse

impl NashProtocol for ListAccountTradesRequest[src]

type Response = ListAccountTradesResponse

impl NashProtocol for ListCandlesRequest[src]

type Response = ListCandlesResponse

impl NashProtocol for ListMarketsRequest[src]

type Response = ListMarketsResponse

impl NashProtocol for ListTradesRequest[src]

type Response = ListTradesResponse

impl NashProtocol for OrderbookRequest[src]

type Response = OrderbookResponse

impl NashProtocol for LimitOrderRequest[src]

type Response = LimitOrderResponse

fn process_response<'life0, 'life1, 'async_trait>(
    &'life0 self,
    response: &'life1 Self::Response,
    state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Update the number of orders remaining before state sync

fn run_before<'life0, 'async_trait>(
    &'life0 self,
    state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<ProtocolHook>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Potentially get more r values or sign states before placing an order

impl NashProtocol for SignStatesRequest[src]

Implement protocol bindings for SignStatesRequest

type Response = SignStatesResponse

fn graphql<'life0, 'async_trait>(
    &'life0 self,
    state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Serialize a SignStates protocol request to a GraphQL string

fn response_from_json(
    &self,
    response: Value
) -> Result<ResponseOrError<Self::Response>>
[src]

Deserialize response to SignStates protocol request

Loading content...