pub struct CoinbaseRestClient { /* private fields */ }Expand description
Coinbase REST API client
Implementations§
Source§impl CoinbaseRestClient
impl CoinbaseRestClient
Sourcepub fn new(
auth: Arc<CoinbaseAuth>,
sandbox: bool,
) -> Result<Self, Box<dyn Error>>
pub fn new( auth: Arc<CoinbaseAuth>, sandbox: bool, ) -> Result<Self, Box<dyn Error>>
Create a new Coinbase REST client
Sourcepub async fn get_accounts(&self) -> Result<Vec<CoinbaseAccount>>
pub async fn get_accounts(&self) -> Result<Vec<CoinbaseAccount>>
Get all accounts
Sourcepub async fn get_account(&self, account_uuid: &str) -> Result<CoinbaseAccount>
pub async fn get_account(&self, account_uuid: &str) -> Result<CoinbaseAccount>
Get account by UUID
Sourcepub async fn place_order(
&self,
order_request: &CoinbaseOrderRequest,
) -> Result<CoinbaseOrderResponse>
pub async fn place_order( &self, order_request: &CoinbaseOrderRequest, ) -> Result<CoinbaseOrderResponse>
Place a new order
Sourcepub async fn cancel_order(
&self,
order_id: &str,
) -> Result<CoinbaseOrderResponse>
pub async fn cancel_order( &self, order_id: &str, ) -> Result<CoinbaseOrderResponse>
Cancel an order
Sourcepub async fn get_order(&self, order_id: &str) -> Result<CoinbaseOrder>
pub async fn get_order(&self, order_id: &str) -> Result<CoinbaseOrder>
Get order by ID
Sourcepub async fn list_orders(
&self,
product_id: Option<&str>,
order_status: Option<&str>,
limit: Option<u32>,
start_date: Option<&str>,
end_date: Option<&str>,
) -> Result<Vec<CoinbaseOrder>>
pub async fn list_orders( &self, product_id: Option<&str>, order_status: Option<&str>, limit: Option<u32>, start_date: Option<&str>, end_date: Option<&str>, ) -> Result<Vec<CoinbaseOrder>>
List orders with optional filters
Sourcepub async fn get_fills(
&self,
order_id: Option<&str>,
product_id: Option<&str>,
) -> Result<Vec<CoinbaseFill>>
pub async fn get_fills( &self, order_id: Option<&str>, product_id: Option<&str>, ) -> Result<Vec<CoinbaseFill>>
Get fills for an order
Sourcepub async fn get_products(&self) -> Result<Vec<CoinbaseProduct>>
pub async fn get_products(&self) -> Result<Vec<CoinbaseProduct>>
Get all products
Sourcepub async fn get_product(&self, product_id: &str) -> Result<CoinbaseProduct>
pub async fn get_product(&self, product_id: &str) -> Result<CoinbaseProduct>
Get product by ID
Sourcepub async fn get_order_book(
&self,
product_id: &str,
limit: Option<u32>,
) -> Result<CoinbaseOrderBook>
pub async fn get_order_book( &self, product_id: &str, limit: Option<u32>, ) -> Result<CoinbaseOrderBook>
Get order book for a product
Sourcepub async fn get_candles(
&self,
product_id: &str,
start: &str,
end: &str,
granularity: &str,
) -> Result<Vec<CoinbaseCandle>>
pub async fn get_candles( &self, product_id: &str, start: &str, end: &str, granularity: &str, ) -> Result<Vec<CoinbaseCandle>>
Get candles for a product
Sourcepub async fn get_trades(
&self,
product_id: &str,
limit: Option<u32>,
) -> Result<Vec<CoinbaseTrade>>
pub async fn get_trades( &self, product_id: &str, limit: Option<u32>, ) -> Result<Vec<CoinbaseTrade>>
Get recent trades for a product
Sourcepub async fn get_portfolios(&self) -> Result<Vec<CoinbasePortfolio>>
pub async fn get_portfolios(&self) -> Result<Vec<CoinbasePortfolio>>
Get portfolios
Sourcepub async fn create_portfolio(&self, name: &str) -> Result<CoinbasePortfolio>
pub async fn create_portfolio(&self, name: &str) -> Result<CoinbasePortfolio>
Create a new portfolio
Sourcepub async fn get_transaction_summary(
&self,
product_id: Option<&str>,
product_type: Option<&str>,
) -> Result<CoinbaseFeeStructure>
pub async fn get_transaction_summary( &self, product_id: Option<&str>, product_type: Option<&str>, ) -> Result<CoinbaseFeeStructure>
Get transaction summary including fees
Sourcepub fn order_side_to_string(side: OrderSide) -> SmartString
pub fn order_side_to_string(side: OrderSide) -> SmartString
Convert OrderSide to Coinbase side string
Sourcepub fn string_to_order_side(side: &str) -> Result<OrderSide>
pub fn string_to_order_side(side: &str) -> Result<OrderSide>
Convert Coinbase side string to OrderSide
Sourcepub fn string_to_order_status(status: &str) -> OrderStatus
pub fn string_to_order_status(status: &str) -> OrderStatus
Convert Coinbase order status to OrderStatus
Sourcepub fn create_market_order_request(
client_order_id: SmartString,
product_id: SmartString,
side: OrderSide,
quote_size: Option<SmartString>,
base_size: Option<SmartString>,
) -> CoinbaseOrderRequest
pub fn create_market_order_request( client_order_id: SmartString, product_id: SmartString, side: OrderSide, quote_size: Option<SmartString>, base_size: Option<SmartString>, ) -> CoinbaseOrderRequest
Create a market order request
Sourcepub fn create_limit_order_request(
client_order_id: SmartString,
product_id: SmartString,
side: OrderSide,
base_size: SmartString,
limit_price: SmartString,
post_only: Option<bool>,
) -> CoinbaseOrderRequest
pub fn create_limit_order_request( client_order_id: SmartString, product_id: SmartString, side: OrderSide, base_size: SmartString, limit_price: SmartString, post_only: Option<bool>, ) -> CoinbaseOrderRequest
Create a limit order request
Sourcepub fn create_stop_limit_order_request(
client_order_id: SmartString,
product_id: SmartString,
side: OrderSide,
base_size: SmartString,
limit_price: SmartString,
stop_price: SmartString,
stop_direction: SmartString,
) -> CoinbaseOrderRequest
pub fn create_stop_limit_order_request( client_order_id: SmartString, product_id: SmartString, side: OrderSide, base_size: SmartString, limit_price: SmartString, stop_price: SmartString, stop_direction: SmartString, ) -> CoinbaseOrderRequest
Create a stop limit order request
Sourcepub const fn is_sandbox(&self) -> bool
pub const fn is_sandbox(&self) -> bool
Check if the client is using sandbox mode
Sourcepub fn get_base_url(&self) -> &str
pub fn get_base_url(&self) -> &str
Get the base URL being used
Sourcepub fn get_advanced_api_url(&self) -> &str
pub fn get_advanced_api_url(&self) -> &str
Get the advanced API URL being used
Auto Trait Implementations§
impl Freeze for CoinbaseRestClient
impl !RefUnwindSafe for CoinbaseRestClient
impl Send for CoinbaseRestClient
impl Sync for CoinbaseRestClient
impl Unpin for CoinbaseRestClient
impl !UnwindSafe for CoinbaseRestClient
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