pub struct CoinbaseIntxWebSocketClient { /* private fields */ }
Expand description
Provides a WebSocket client for connecting to Coinbase International.
Implementations§
Source§impl CoinbaseIntxWebSocketClient
impl CoinbaseIntxWebSocketClient
Sourcepub fn new(
url: Option<String>,
api_key: Option<String>,
api_secret: Option<String>,
api_passphrase: Option<String>,
heartbeat: Option<u64>,
) -> Result<Self>
pub fn new( url: Option<String>, api_key: Option<String>, api_secret: Option<String>, api_passphrase: Option<String>, heartbeat: Option<u64>, ) -> Result<Self>
Creates a new CoinbaseIntxWebSocketClient
instance.
§Errors
Returns an error if required environment variables are missing or invalid.
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Creates a new authenticated CoinbaseIntxWebSocketClient
using environment variables and
the default Coinbase International production websocket url.
§Errors
Returns an error if required environment variables are missing or invalid.
Sourcepub async fn connect(&mut self, instruments: Vec<InstrumentAny>) -> Result<()>
pub async fn connect(&mut self, instruments: Vec<InstrumentAny>) -> Result<()>
Connects the client to the server and caches the given instruments.
§Errors
Returns an error if the WebSocket connection or initial subscription fails.
Sourcepub fn stream(&mut self) -> impl Stream<Item = PoseiWsMessage> + 'static
pub fn stream(&mut self) -> impl Stream<Item = PoseiWsMessage> + 'static
Provides the internal data stream as a channel-based stream.
§Panics
This function panics if:
- The websocket is not connected.
- If
stream_data
has already been called somewhere else (stream receiver is then taken).
Sourcepub async fn subscribe_instruments(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn subscribe_instruments( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Subscribes to instrument definition updates for the given instrument IDs. Subscribes to instrument updates for the specified instruments.
§Errors
Returns an error if the subscription fails.
Sourcepub async fn subscribe_funding(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn subscribe_funding( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Subscribes to funding message streams for the given instrument IDs. Subscribes to funding rate updates for the specified instruments.
§Errors
Returns an error if the subscription fails.
Sourcepub async fn subscribe_risk(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn subscribe_risk( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Subscribes to risk message streams for the given instrument IDs. Subscribes to risk updates for the specified instruments.
§Errors
Returns an error if the subscription fails.
Sourcepub async fn subscribe_order_book(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn subscribe_order_book( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Subscribes to order book (level 2) streams for the given instrument IDs. Subscribes to order book snapshots and updates for the specified instruments.
§Errors
Returns an error if the subscription fails.
Sourcepub async fn subscribe_quotes(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn subscribe_quotes( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Subscribes to quote (level 1) streams for the given instrument IDs. Subscribes to top-of-book quote updates for the specified instruments.
§Errors
Returns an error if the subscription fails.
Sourcepub async fn subscribe_trades(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn subscribe_trades( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Subscribes to trade (match) streams for the given instrument IDs. Subscribes to trade updates for the specified instruments.
§Errors
Returns an error if the subscription fails.
Sourcepub async fn subscribe_mark_prices(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn subscribe_mark_prices( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Subscribes to risk streams (for mark prices) for the given instrument IDs. Subscribes to mark price updates for the specified instruments.
§Errors
Returns an error if the subscription fails.
Sourcepub async fn subscribe_index_prices(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn subscribe_index_prices( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Subscribes to risk streams (for index prices) for the given instrument IDs. Subscribes to index price updates for the specified instruments.
§Errors
Returns an error if the subscription fails.
Sourcepub async fn subscribe_bars(
&self,
bar_type: BarType,
) -> Result<(), CoinbaseIntxWsError>
pub async fn subscribe_bars( &self, bar_type: BarType, ) -> Result<(), CoinbaseIntxWsError>
Subscribes to bar (candle) streams for the given instrument IDs. Subscribes to candlestick bar updates for the specified bar type.
§Errors
Returns an error if the subscription fails.
Sourcepub async fn unsubscribe_instruments(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn unsubscribe_instruments( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Unsubscribes from instrument definition streams for the given instrument IDs. Unsubscribes from instrument updates for the specified instruments.
§Errors
Returns an error if the unsubscription fails.
Sourcepub async fn unsubscribe_risk(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn unsubscribe_risk( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Unsubscribes from risk message streams for the given instrument IDs. Unsubscribes from risk updates for the specified instruments.
§Errors
Returns an error if the unsubscription fails.
Sourcepub async fn unsubscribe_funding(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn unsubscribe_funding( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Unsubscribes from funding message streams for the given instrument IDs. Unsubscribes from funding updates for the specified instruments.
§Errors
Returns an error if the unsubscription fails.
Sourcepub async fn unsubscribe_order_book(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn unsubscribe_order_book( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Unsubscribes from order book (level 2) streams for the given instrument IDs. Unsubscribes from order book updates for the specified instruments.
§Errors
Returns an error if the unsubscription fails.
Sourcepub async fn unsubscribe_quotes(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn unsubscribe_quotes( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Unsubscribes from quote (level 1) streams for the given instrument IDs. Unsubscribes from quote updates for the specified instruments.
§Errors
Returns an error if the unsubscription fails.
Sourcepub async fn unsubscribe_trades(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn unsubscribe_trades( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Unsubscribes from trade (match) streams for the given instrument IDs. Unsubscribes from trade updates for the specified instruments.
§Errors
Returns an error if the unsubscription fails.
Sourcepub async fn unsubscribe_mark_prices(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn unsubscribe_mark_prices( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Unsubscribes from risk streams (for mark prices) for the given instrument IDs. Unsubscribes from mark price updates for the specified instruments.
§Errors
Returns an error if the unsubscription fails.
Sourcepub async fn unsubscribe_index_prices(
&self,
instrument_ids: Vec<InstrumentId>,
) -> Result<(), CoinbaseIntxWsError>
pub async fn unsubscribe_index_prices( &self, instrument_ids: Vec<InstrumentId>, ) -> Result<(), CoinbaseIntxWsError>
Unsubscribes from risk streams (for index prices) for the given instrument IDs. Unsubscribes from index price updates for the specified instruments.
§Errors
Returns an error if the unsubscription fails.
Sourcepub async fn unsubscribe_bars(
&self,
bar_type: BarType,
) -> Result<(), CoinbaseIntxWsError>
pub async fn unsubscribe_bars( &self, bar_type: BarType, ) -> Result<(), CoinbaseIntxWsError>
Unsubscribes from bar (candle) streams for the given instrument IDs. Unsubscribes from bar updates for the specified bar type.
§Errors
Returns an error if the unsubscription fails.
Trait Implementations§
Source§impl Clone for CoinbaseIntxWebSocketClient
impl Clone for CoinbaseIntxWebSocketClient
Source§fn clone(&self) -> CoinbaseIntxWebSocketClient
fn clone(&self) -> CoinbaseIntxWebSocketClient
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CoinbaseIntxWebSocketClient
impl Debug for CoinbaseIntxWebSocketClient
Source§impl IntoPy<Py<PyAny>> for CoinbaseIntxWebSocketClient
impl IntoPy<Py<PyAny>> for CoinbaseIntxWebSocketClient
Source§impl<'py> IntoPyObject<'py> for CoinbaseIntxWebSocketClient
impl<'py> IntoPyObject<'py> for CoinbaseIntxWebSocketClient
Source§type Target = CoinbaseIntxWebSocketClient
type Target = CoinbaseIntxWebSocketClient
Source§type Output = Bound<'py, <CoinbaseIntxWebSocketClient as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <CoinbaseIntxWebSocketClient as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for CoinbaseIntxWebSocketClient
impl PyClass for CoinbaseIntxWebSocketClient
Source§impl PyClassImpl for CoinbaseIntxWebSocketClient
impl PyClassImpl for CoinbaseIntxWebSocketClient
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§type ThreadChecker = SendablePyClass<CoinbaseIntxWebSocketClient>
type ThreadChecker = SendablePyClass<CoinbaseIntxWebSocketClient>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature<CoinbaseIntxWebSocketClient> for PyClassImplCollector<CoinbaseIntxWebSocketClient>
impl PyClassNewTextSignature<CoinbaseIntxWebSocketClient> for PyClassImplCollector<CoinbaseIntxWebSocketClient>
fn new_text_signature(self) -> Option<&'static str>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a CoinbaseIntxWebSocketClient
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a CoinbaseIntxWebSocketClient
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut CoinbaseIntxWebSocketClient
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut CoinbaseIntxWebSocketClient
Source§impl PyMethods<CoinbaseIntxWebSocketClient> for PyClassImplCollector<CoinbaseIntxWebSocketClient>
impl PyMethods<CoinbaseIntxWebSocketClient> for PyClassImplCollector<CoinbaseIntxWebSocketClient>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for CoinbaseIntxWebSocketClient
impl PyTypeInfo for CoinbaseIntxWebSocketClient
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
PyTypeInfo::type_object
PyTypeInfo::type_object
].§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type or a subclass of this type.§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_type_of
PyTypeInfo::is_type_of
].§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type.§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_exact_type_of
PyTypeInfo::is_exact_type_of
].impl DerefToPyAny for CoinbaseIntxWebSocketClient
Auto Trait Implementations§
impl Freeze for CoinbaseIntxWebSocketClient
impl !RefUnwindSafe for CoinbaseIntxWebSocketClient
impl Send for CoinbaseIntxWebSocketClient
impl Sync for CoinbaseIntxWebSocketClient
impl Unpin for CoinbaseIntxWebSocketClient
impl !UnwindSafe for CoinbaseIntxWebSocketClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FromPyObject<'_> for Twhere
T: PyClass + Clone,
impl<T> FromPyObject<'_> for Twhere
T: PyClass + Clone,
§fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>
fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>
§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
§fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>
fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self
into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self
into an owned Python object, dropping type information and unbinding it
from the 'py
lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self
into a Python object. Read more