Full Code for this Quickstart
api_key
and api_secret
with your own API key and Secret.
limit
= A pagination limit with default of 49 and maximum of 250cursor
= Cursor used for pagination.get_accounts
to your code, using the same client you just created. This retrieves the accounts associated with the user account and immediately prints them in formatted JSON.
product_id
(i.e., “BTC-USD”), side
(i.e. “BUY”/“SELL”), and other parameters listed in the API docs.
In this example, we use the same client to place a $10 market-buy order on BTC-USD. Then, if the order was executed successfully, we retrieve the order’s specific fill information using the order_id
. If the order failed to execute, then we print the error information.
Required parameters:
client_order_id
: UUID for the order, generated by the client. Must be unique for each order.product_id
: The product this order was created for.quote_size
: Amount of quote currency to spend on order.client_order_id
. For learning purposes, we’ve pre-filled it to an arbitrary string.order_id
.product_id
is required as a parameter. In this case, it’s “BTC-USD”.
Later, we’ll calculate and obtain the price 5% below the current price. This will be stored in adjusted_btc_usd_price
to later indicate our limit price.
base_size
: Amount of base currency to spend on order.limit_price
: Ceiling price for which the order should get filled.client_order_id
to “00000002” to differentiate it from the previous order we placed. In this example, we will keep it simple and only store the order_id
if the order executed successfully; otherwise, we print the error information.