[−][src]Struct cbpro::client::AuthenticatedClient
Private client
Methods
impl<'a> AuthenticatedClient<'a>
[src]
pub fn new(key: &'a str, pass: &'a str, secret: &'a str, url: &str) -> Self
[src]
Create new instance
pub fn public(&self) -> &PublicClient
[src]
Get public client
pub fn list_accounts(&self) -> QueryBuilder<'a, NoOptions<'a>>
[src]
Get a list of trading accounts from the profile of the API key.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let accounts = client.list_accounts().json().await?; println!("{}", serde_json::to_string_pretty(&accounts).unwrap());
pub fn get_account(&self, account_id: &str) -> QueryBuilder<'a, NoOptions<'a>>
[src]
Information for a single account. Use this endpoint when you know the account_id. API key must belong to the same profile as the account.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let account = client.get_account("<account_id>").json().await?; println!("{}", serde_json::to_string_pretty(&account).unwrap());
pub fn get_account_history(
&self,
account_id: &str
) -> QueryBuilder<'a, PaginateOptions<'a>>
[src]
&self,
account_id: &str
) -> QueryBuilder<'a, PaginateOptions<'a>>
List account activity of the API key’s profile. Account activity either increases or decreases your account balance. Items are paginated and sorted latest first.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let history = client.get_account_history("<account_id>").json().await?; println!("{}", serde_json::to_string_pretty(&history).unwrap());
pub fn get_holds(
&self,
account_id: &str
) -> QueryBuilder<'a, PaginateOptions<'a>>
[src]
&self,
account_id: &str
) -> QueryBuilder<'a, PaginateOptions<'a>>
List holds of an account that belong to the same profile as the API key. 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.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let holds = client.get_holds("<account_id>").json().await?; println!("{}", serde_json::to_string_pretty(&holds).unwrap());
pub fn place_limit_order(
&self,
product_id: &'a str,
side: &'a str,
price: f64,
size: f64
) -> QueryBuilder<'a, LimitOrderOptions<'a>>
[src]
&self,
product_id: &'a str,
side: &'a str,
price: f64,
size: f64
) -> QueryBuilder<'a, LimitOrderOptions<'a>>
Orders can only be placed if your account has sufficient funds. Once an order is placed, your account funds will be put on hold for the duration of the order. How much and which funds are put on hold depends on the order type and parameters specified.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let response = client.place_limit_order("BTC-USD", "buy", 7000.00, 10.00).json().await?; println!("{}", serde_json::to_string_pretty(&response).unwrap());
pub fn place_market_order(
&self,
product_id: &'a str,
side: &'a str,
qty: QTY
) -> QueryBuilder<'a, MarketOrderOptions<'a>>
[src]
&self,
product_id: &'a str,
side: &'a str,
qty: QTY
) -> QueryBuilder<'a, MarketOrderOptions<'a>>
Orders can only be placed if your account has sufficient funds. Once an order is placed, your account funds will be put on hold for the duration of the order. How much and which funds are put on hold depends on the order type and parameters specified.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL, QTY}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let response = client.place_market_order("BTC-USD", "buy", QTY::Size(10.00)).json().await?; println!("{}", serde_json::to_string_pretty(&response).unwrap());
pub fn cancel_order(&self, ord: ORD<'a>) -> QueryBuilder<'a, NoOptions<'a>>
[src]
Cancel a previously placed order. Order must belong to the profile that the API key belongs to.
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/
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL, ORD}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let response = client.cancel_order(ORD::OrderID("<order_id>")).json().await?; println!("{}", serde_json::to_string_pretty(&response).unwrap());
pub fn cancel_all(&self) -> QueryBuilder<'a, CancelOptions<'a>>
[src]
With best effort, cancel all open orders from the profile that the API key belongs to. The response is a list of ids of the canceled orders.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let response = client.cancel_all().json().await?; println!("{}", serde_json::to_string_pretty(&response).unwrap());
pub fn list_orders(
&self,
status: &[&str]
) -> QueryBuilder<'a, ListOrderOptions<'a>>
[src]
&self,
status: &[&str]
) -> QueryBuilder<'a, ListOrderOptions<'a>>
List your current open orders from the profile that the API key belongs to. 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.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let orders = client.list_orders(&["open"]).json().await?; println!("{}", serde_json::to_string_pretty(&orders).unwrap());
pub fn get_order(&self, ord: ORD<'a>) -> QueryBuilder<'a, NoOptions<'a>>
[src]
Get a single order by order id from the profile that the API key belongs to.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL, ORD}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let order = client.get_order(ORD::OrderID("<order_id>")).json().await?; println!("{}", serde_json::to_string_pretty(&order).unwrap());
pub fn get_fills(&self, fill: FILL<'a>) -> QueryBuilder<'a, NoOptions<'a>>
[src]
Get a list of recent fills of the API key’s profile.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL, FILL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let fills = client.get_fills(FILL::ProductID("BTC-USD")).json().await?; println!("{}", serde_json::to_string_pretty(&fills).unwrap());
pub fn deposit(
&self,
amount: f64,
currency: &'a str,
dep: DEP<'a>
) -> QueryBuilder<'a, NoOptions<'a>>
[src]
&self,
amount: f64,
currency: &'a str,
dep: DEP<'a>
) -> QueryBuilder<'a, NoOptions<'a>>
Deposit funds from a payment method.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL, DEP}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let response = client.deposit(10.00, "BTC", DEP::CBAccountID("<account_id>")).json().await?; println!("{}", serde_json::to_string_pretty(&response).unwrap());
pub fn withdraw(
&self,
amount: f64,
currency: &'a str,
wdl: WDL<'a>
) -> QueryBuilder<'a, NoOptions<'a>>
[src]
&self,
amount: f64,
currency: &'a str,
wdl: WDL<'a>
) -> QueryBuilder<'a, NoOptions<'a>>
Deposit funds from a coinbase account. You can move funds between your Coinbase accounts and your Coinbase Pro trading accounts within your daily limits. Moving funds between Coinbase and Coinbase Pro is instant and free.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL, WDL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let response = client.withdraw(10.00, "BTC", WDL::CBAccountID("<account_id>")).json().await?; println!("{}", serde_json::to_string_pretty(&response).unwrap());
pub fn convert(
&self,
from: &'a str,
to: &'a str,
amount: f64
) -> QueryBuilder<'a, NoOptions<'a>>
[src]
&self,
from: &'a str,
to: &'a str,
amount: f64
) -> QueryBuilder<'a, NoOptions<'a>>
Convert $10,000.00 to 10,000.00 USDC.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let response = client.convert("USD", "USDC", 100.00).json().await?; println!("{}", serde_json::to_string_pretty(&response).unwrap());
pub fn list_payment_methods(&self) -> QueryBuilder<'a, NoOptions<'a>>
[src]
Get a list of your payment methods.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let payment_methods = client.list_payment_methods().json().await?; println!("{}", serde_json::to_string_pretty(&payment_methods).unwrap());
pub fn list_coinbase_accounts(&self) -> QueryBuilder<'a, NoOptions<'a>>
[src]
Get a list of your coinbase accounts.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let coinbase_accounts = client.list_coinbase_accounts().json().await?; println!("{}", serde_json::to_string_pretty(&coinbase_accounts).unwrap());
pub fn get_current_fees(&self) -> QueryBuilder<'a, NoOptions<'a>>
[src]
This request will return your current maker & taker fee rates, as well as your 30-day trailing volume. Quoted rates are subject to change.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let current_fees = client.get_current_fees().json().await?; println!("{}", serde_json::to_string_pretty(¤t_fees).unwrap());
pub fn create_report<Tz: TimeZone>(
&self,
start_date: DateTime<Tz>,
end_date: DateTime<Tz>,
rpt: RPT<'a>
) -> QueryBuilder<'a, ReportOptions<'a>> where
Tz::Offset: Display,
[src]
&self,
start_date: DateTime<Tz>,
end_date: DateTime<Tz>,
rpt: RPT<'a>
) -> QueryBuilder<'a, ReportOptions<'a>> where
Tz::Offset: Display,
Reports provide batches of historic information about your profile in various human and machine readable forms.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL, RPT}; use chrono::{ TimeZone, Utc }; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let start_date = Utc.ymd(2018, 8, 10).and_hms(0, 0, 0); let end_date = Utc.ymd(2018, 8, 28).and_hms(0, 0, 0); let rates = client.create_report(start_date, end_date, RPT::Fills { product_id: "BTC-USD" }).json().await?; println!("{}", serde_json::to_string_pretty(&rates).unwrap());
pub fn get_report_status(
&self,
report_id: &'a str
) -> QueryBuilder<'a, NoOptions<'a>>
[src]
&self,
report_id: &'a str
) -> QueryBuilder<'a, NoOptions<'a>>
Once a report request has been accepted for processing, the status is available by polling the report resource endpoint.
The final report will be uploaded and available at file_url once the status indicates ready
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let report_status = client.get_report_status("<report_id>").json().await?; println!("{}", serde_json::to_string_pretty(&report_status).unwrap());
pub fn list_profiles(&self) -> QueryBuilder<'a, NoOptions<'a>>
[src]
List your profiles.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let profiles = client.list_profiles().json().await?; println!("{}", serde_json::to_string_pretty(&profiles).unwrap());
pub fn get_profile(
&self,
profile_id: &'a str
) -> QueryBuilder<'a, NoOptions<'a>>
[src]
&self,
profile_id: &'a str
) -> QueryBuilder<'a, NoOptions<'a>>
Get a single profile by profile id.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let profile = client.get_profile("<profile_id>").json().await?; println!("{}", serde_json::to_string_pretty(&profile).unwrap());
pub fn transfer_profile(
&self,
from: &'a str,
to: &'a str,
currency: &'a str,
amount: f64
) -> QueryBuilder<'a, NoOptions<'a>>
[src]
&self,
from: &'a str,
to: &'a str,
currency: &'a str,
amount: f64
) -> QueryBuilder<'a, NoOptions<'a>>
Transfer funds from API key’s profile to another user owned profile.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let response = client.transfer_profile("<from_profile_id>", "<to_profile_id>", "BTC-USD", 10.00).json().await?; println!("{}", serde_json::to_string_pretty(&response).unwrap());
pub fn get_trailing_volume(&self) -> QueryBuilder<'a, NoOptions<'a>>
[src]
This endpoint requires either the “view” or “trade” permission.
This request will return your 30-day trailing volume for all products of the API key’s profile. This is a cached value that’s calculated every day at midnight UTC.
Example
use cbpro::client::{AuthenticatedClient, SANDBOX_URL}; let client = AuthenticatedClient::new("key", "pass", "secret", SANDBOX_URL); let trailing_volume = client.get_trailing_volume().json().await?; println!("{}", serde_json::to_string_pretty(&trailing_volume).unwrap());
Auto Trait Implementations
impl<'a> !RefUnwindSafe for AuthenticatedClient<'a>
impl<'a> Send for AuthenticatedClient<'a>
impl<'a> Sync for AuthenticatedClient<'a>
impl<'a> Unpin for AuthenticatedClient<'a>
impl<'a> !UnwindSafe for AuthenticatedClient<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,