[−][src]Trait nash_protocol::protocol::NashProtocol
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,
&'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>>
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
Convert JSON response to request to the protocol's associated type
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,
&'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,
&'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,
&'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,
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]
&'life0 self,
_state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Serialize a SignStates protocol request to a GraphQL string
fn response_from_json(
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
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]
&'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,
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
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]
&'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>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::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]
&'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,
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]
&'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,
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, [src]
&'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,
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]
&'life0 self,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Serialize a SignStates protocol request to a GraphQL string
fn response_from_json(
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
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]
&'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,
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]
&'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,
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
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]
&'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>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
impl NashProtocol for CancelOrderRequest[src]
Implement protocol bindings for CancelOrder
type Response = CancelOrderResponse
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]
&'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>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
impl NashProtocol for GetAccountOrderRequest[src]
Implement protocol bindings for GetAccountOrderRequest
type Response = GetAccountOrderResponse
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]
&'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>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
impl NashProtocol for TickerRequest[src]
Implement protocol bindings for TickerRequest
type Response = TickerResponse
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]
&'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>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
impl NashProtocol for ListAccountBalancesRequest[src]
type Response = ListAccountBalancesResponse
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]
&'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>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
impl NashProtocol for ListAccountOrdersRequest[src]
type Response = ListAccountOrdersResponse
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]
&'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>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
impl NashProtocol for ListAccountTradesRequest[src]
type Response = ListAccountTradesResponse
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]
&'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>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
impl NashProtocol for ListCandlesRequest[src]
type Response = ListCandlesResponse
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]
&'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>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
impl NashProtocol for ListMarketsRequest[src]
type Response = ListMarketsResponse
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]
&'life0 self,
_state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
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]
&'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,
fn response_from_json(
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
impl NashProtocol for ListTradesRequest[src]
type Response = ListTradesResponse
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]
&'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>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
impl NashProtocol for OrderbookRequest[src]
type Response = OrderbookResponse
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]
&'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>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
impl NashProtocol for LimitOrderRequest[src]
type Response = LimitOrderResponse
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]
&'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>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::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]
&'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,
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]
&'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,
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]
&'life0 self,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Serialize a SignStates protocol request to a GraphQL string
fn response_from_json(
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>[src]
&self,
response: Value
) -> Result<ResponseOrError<Self::Response>>
Deserialize response to SignStates protocol request