Struct coinbase_pro_rs::private::Private
source · pub struct Private<Adapter> { /* private fields */ }
Implementations
sourceimpl<A> Private<A>
impl<A> Private<A>
pub fn sign(
secret: &str,
timestamp: u64,
method: Method,
uri: &str,
body_str: &str
) -> String
sourcepub fn new(uri: &str, key: &str, secret: &str, passphrase: &str) -> Self
pub fn new(uri: &str, key: &str, secret: &str, passphrase: &str) -> Self
Creates a new Private struct
sourcepub fn get_accounts(&self) -> A::Resultwhere
A: Adapter<Vec<Account>> + 'static,
pub fn get_accounts(&self) -> A::Resultwhere
A: Adapter<Vec<Account>> + 'static,
Get an Account
Get a list of trading accounts
API Key Permissions
This endpoint requires either the “view” or “trade” permission.
sourcepub fn get_account(&self, account_id: Uuid) -> A::Resultwhere
A: Adapter<Account> + 'static,
pub fn get_account(&self, account_id: Uuid) -> A::Resultwhere
A: Adapter<Account> + 'static,
Get Account History
Information for a single account. Use this endpoint when you know the account_id.
API Key Permissions
This endpoint requires either the “view” or “trade” permission.
Account Fields
Field | Description |
---|---|
id | Account ID |
balance | total funds in the account |
holds | funds on hold (not available for use) |
available | funds available to withdraw or trade |
sourcepub fn get_account_hist(&self, id: Uuid) -> A::Resultwhere
A: Adapter<Vec<AccountHistory>> + 'static,
pub fn get_account_hist(&self, id: Uuid) -> A::Resultwhere
A: Adapter<Vec<AccountHistory>> + 'static,
Get Account History List account activity. Account activity either increases or decreases your account balance. Items are paginated and sorted latest first. See the Pagination section for retrieving additional entries after the first page.
API Key Permissions
This endpoint requires either the “view” or “trade” permission.
Entry Types
Field | Description |
---|---|
type | Entry type indicates the reason for the account change. |
transfer | Funds moved to/from Coinbase to Coinbase Pro |
match | Funds moved as a result of a trade |
fee | Fee as a result of a trade |
rebate | Fee rebate as per our fee schedule |
Details
If an entry is the result of a trade (match, fee), the details field will contain additional information about the trade.
sourcepub fn get_account_holds(&self, id: Uuid) -> A::Resultwhere
A: Adapter<Vec<AccountHolds>> + 'static,
pub fn get_account_holds(&self, id: Uuid) -> A::Resultwhere
A: Adapter<Vec<AccountHolds>> + 'static,
Get Holds Holds are placed on an account for any active orders or pending withdraw requests. As an order is filled, the hold amount is updated. If an order is canceled, any remaining hold is removed. For a withdraw, once it is completed, the hold is removed.
API Key Permissions
This endpoint requires either the “view” or “trade” permission.
Type
The type of the hold will indicate why the hold exists. The hold type is order for holds related to open orders and transfer for holds related to a withdraw.
Ref
The ref field contains the id of the order or transfer which created the hold.
sourcepub fn set_order(&self, order: Order<'_>) -> A::Resultwhere
A: Adapter<Order> + 'static,
pub fn set_order(&self, order: Order<'_>) -> A::Resultwhere
A: Adapter<Order> + 'static,
Make Order
General function. Can be used to use own generated Order
structure for order
sourcepub fn buy_limit(
&self,
product_id: &str,
size: f64,
price: f64,
post_only: bool,
time_in_force: Option<OrderTimeInForce>
) -> A::Resultwhere
A: Adapter<Order> + 'static,
pub fn buy_limit(
&self,
product_id: &str,
size: f64,
price: f64,
post_only: bool,
time_in_force: Option<OrderTimeInForce>
) -> A::Resultwhere
A: Adapter<Order> + 'static,
Buy limit Makes Buy limit order
sourcepub fn sell_limit(
&self,
product_id: &str,
size: f64,
price: f64,
post_only: bool,
time_in_force: Option<OrderTimeInForce>
) -> A::Resultwhere
A: Adapter<Order> + 'static,
pub fn sell_limit(
&self,
product_id: &str,
size: f64,
price: f64,
post_only: bool,
time_in_force: Option<OrderTimeInForce>
) -> A::Resultwhere
A: Adapter<Order> + 'static,
Sell limit Makes Sell limit order
sourcepub fn buy_market(&self, product_id: &str, size: f64) -> A::Resultwhere
A: Adapter<Order> + 'static,
pub fn buy_market(&self, product_id: &str, size: f64) -> A::Resultwhere
A: Adapter<Order> + 'static,
Buy market Makes Buy marker order
sourcepub fn sell_market(&self, product_id: &str, size: f64) -> A::Resultwhere
A: Adapter<Order> + 'static,
pub fn sell_market(&self, product_id: &str, size: f64) -> A::Resultwhere
A: Adapter<Order> + 'static,
Sell market Makes Sell marker order
sourcepub fn cancel_order(&self, id: Uuid) -> A::Resultwhere
A: Adapter<Uuid> + 'static,
pub fn cancel_order(&self, id: Uuid) -> A::Resultwhere
A: Adapter<Uuid> + 'static,
Cancel an Order
Cancel a previously placed order.
If the order had no matches during its lifetime its record may be purged. This means the order details will not be available with GET /orders/
API Key Permissions
This endpoint requires the “trade” permission.
sourcepub fn cancel_all(&self, product_id: Option<&str>) -> A::Resultwhere
A: Adapter<Vec<Uuid>> + 'static,
pub fn cancel_all(&self, product_id: Option<&str>) -> A::Resultwhere
A: Adapter<Vec<Uuid>> + 'static,
Cancel all
With best effort, cancel all open orders. The response is a list of ids of the canceled orders.
API Key Permissions
This endpoint requires the “trade” permission.
Query Parameters
Param | Default | Description |
---|---|---|
product_id | optional | Only cancel orders open for a specific product |
sourcepub fn get_orders(
&self,
status: Option<OrderStatus>,
product_id: Option<&str>
) -> A::Resultwhere
A: Adapter<Vec<Order>> + 'static,
pub fn get_orders(
&self,
status: Option<OrderStatus>,
product_id: Option<&str>
) -> A::Resultwhere
A: Adapter<Vec<Order>> + 'static,
List Orders
List your current open orders. Only open or un-settled orders are returned. As soon as an order is no longer open and settled, it will no longer appear in the default request.
API Key Permissions
This endpoint requires either the “view” or “trade” permission.
Query Parameters
| Param Default Description | | —— | –––– | ———— | | status | open, pending, active | Limit list of orders to these statuses. Passing all returns orders of all statuses. | | product_id | optional | Only list orders for a specific product |
sourcepub fn get_order(&self, id: Uuid) -> A::Resultwhere
A: Adapter<Order> + 'static,
pub fn get_order(&self, id: Uuid) -> A::Resultwhere
A: Adapter<Order> + 'static,
Get an Order
Get a single order by order id.
API Key Permissions
This endpoint requires either the “view” or “trade” permission.
If the order is canceled the response may have status code 404 if the order had no matches.
sourcepub fn get_fills(
&self,
order_id: Option<Uuid>,
product_id: Option<&str>
) -> A::Resultwhere
A: Adapter<Vec<Fill>> + 'static,
pub fn get_fills(
&self,
order_id: Option<Uuid>,
product_id: Option<&str>
) -> A::Resultwhere
A: Adapter<Vec<Fill>> + 'static,
List Fills
Get a list of recent fills.
API Key Permissions
This endpoint requires either the “view” or “trade” permission. DEPRECATION NOTICE - Requests without either order_id or product_id will be rejected after 8/23/18.
sourcepub fn get_trailing_volume(&self) -> A::Resultwhere
A: Adapter<Vec<TrailingVolume>> + 'static,
pub fn get_trailing_volume(&self) -> A::Resultwhere
A: Adapter<Vec<TrailingVolume>> + 'static,
Trailing Volume
This request will return your 30-day trailing volume for all products. This is a cached value that’s calculated every day at midnight UTC.
#API Key Permissions This endpoint requires either the “view” or “trade” permission.