Class CoinbaseAccountService
- java.lang.Object
-
- org.knowm.xchange.service.BaseExchangeService
-
- org.knowm.xchange.coinbase.service.CoinbaseBaseService
-
- org.knowm.xchange.coinbase.service.CoinbaseAccountService
-
- All Implemented Interfaces:
AccountService,BaseService
public final class CoinbaseAccountService extends CoinbaseBaseService implements AccountService
- Author:
- jamespedwards42
-
-
Field Summary
-
Fields inherited from class org.knowm.xchange.coinbase.service.CoinbaseBaseService
coinbase, signatureCreator
-
Fields inherited from class org.knowm.xchange.service.BaseExchangeService
exchange
-
-
Constructor Summary
Constructors Constructor Description CoinbaseAccountService(Exchange exchange)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoinbaseBaseResponsecancelCoinbaseRequest(String transactionId)Authenticated resource which lets a user cancel a money request.CoinbaseTransactioncompleteCoinbaseRequest(String transactionId)Authenticated resource which lets a user complete a money request.CoinbaseButtoncreateCoinbaseButton(CoinbaseButton button)Authenticated resource that creates a payment button, page, or iFrame to accept Bitcoin on your website.CoinbaseOrdercreateCoinbaseOrder(String code)Authenticated resource which lets you generate an order associated with a button.CoinbaseOrdercreateCoinbaseOrder(CoinbaseButton button)Authenticated resource which returns an order for a new button.TradeHistoryParamscreateFundingHistoryParams()CoinbaseAddressgenerateCoinbaseReceiveAddress()Authenticated resource that generates a new Bitcoin receive address for the user.CoinbaseAddressgenerateCoinbaseReceiveAddress(String callbackUrl, String label)Authenticated resource that generates a new Bitcoin receive address for the user.AccountInfogetAccountInfo()CoinbaseAccountChangesgetCoinbaseAccountChanges()Authenticated resource which returns all related changes to an account.CoinbaseAccountChangesgetCoinbaseAccountChanges(Integer page)Authenticated resource which returns all related changes to an account.CoinbaseAddressesgetCoinbaseAddresses()Authenticated resource that returns Bitcoin addresses a user has associated with their account.CoinbaseAddressesgetCoinbaseAddresses(Integer page, Integer limit, String filter)Authenticated resource that returns Bitcoin addresses a user has associated with their account.CoinbaseMoneygetCoinbaseBalance()Authenticated resource that returns the user’s current account balance in BTC.CoinbaseContactsgetCoinbaseContacts()Authenticated resource that returns contacts the user has previously sent to or received from.CoinbaseContactsgetCoinbaseContacts(Integer page, Integer limit, String filter)Authenticated resource that returns contacts the user has previously sent to or received from.CoinbaseOrdergetCoinbaseOrder(String orderIdOrCustom)Authenticated resource which returns order details for a specific order id or merchant custom.CoinbaseOrdersgetCoinbaseOrders()Authenticated resource which returns a merchant’s orders that they have received.CoinbaseOrdersgetCoinbaseOrders(Integer page)Authenticated resource which returns a merchant’s orders that they have received.CoinbaseAddressgetCoinbaseReceiveAddress()Authenticated resource that returns the user’s current Bitcoin receive address.CoinbaseRecurringPaymentgetCoinbaseRecurringPayment(String recurringPaymentId)Authenticated resource that lets you show an individual recurring payment.CoinbaseRecurringPaymentsgetCoinbaseRecurringPayments()Authenticated resource that lets you list all your recurring payments (scheduled buys, sells, and subscriptions you’ve created with merchants).CoinbaseRecurringPaymentsgetCoinbaseRecurringPayments(Integer page, Integer limit)Authenticated resource that lets you list all your recurring payments (scheduled buys, sells, and subscriptions you’ve created with merchants).CoinbaseSubscriptiongetCoinbaseSubscription(String subscriptionId)Authenticated resource that lets you (as a merchant) show an individual subscription than a customer has created with you.CoinbaseSubscriptionsgetCoinbaseSubscriptions()Authenticated resource that lets you (as a merchant) list all the subscriptions customers have made with you.CoinbaseSubscriptionsgetCoinbaseSubscriptions(Integer page, Integer limit)Authenticated resource that lets you (as a merchant) list all the subscriptions customers have made with you.CoinbaseTransactiongetCoinbaseTransaction(String transactionIdOrIdemField)Authenticated resource which returns the details of an individual transaction.CoinbaseTransactionsgetCoinbaseTransactions()Authenticated resource which returns the user’s most recent transactions.CoinbaseTransactionsgetCoinbaseTransactions(Integer page)Authenticated resource which returns the user’s most recent transactions.CoinbaseUsersgetCoinbaseUsers()Authenticated resource that shows the current user and their settings.booleanredeemCoinbaseToken(String tokenId)Authenticated resource which claims a redeemable token for its address and Bitcoin.StringrequestDepositAddress(Currency currency, String... arguments)CoinbaseTransactionrequestMoneyCoinbaseRequest(CoinbaseTransaction.CoinbaseRequestMoneyRequest transactionRequest)Authenticated resource which lets the user request money from a Bitcoin address.CoinbaseBaseResponseresendCoinbaseRequest(String transactionId)Authenticated resource which lets the user resend a money request.CoinbaseTransactionsendMoneyCoinbaseRequest(CoinbaseTransaction.CoinbaseSendMoneyRequest transactionRequest)Authenticated resource which lets you send money to an email or Bitcoin address.CoinbaseUserupdateCoinbaseUser(CoinbaseUser user)Authenticated resource that lets you update account settings for the current user.StringwithdrawFunds(Currency currency, BigDecimal amount, String address)StringwithdrawFunds(WithdrawFundsParams params)-
Methods inherited from class org.knowm.xchange.coinbase.service.CoinbaseBaseService
createCoinbaseToken, createCoinbaseUser, createCoinbaseUser, getCoinbaseCurrencies, handleResponse
-
Methods inherited from class org.knowm.xchange.service.BaseExchangeService
getClientConfig, verifyOrder, verifyOrder, verifyOrder
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.knowm.xchange.service.account.AccountService
getDynamicTradingFees, getFundingHistory
-
-
-
-
Constructor Detail
-
CoinbaseAccountService
public CoinbaseAccountService(Exchange exchange)
Constructor- Parameters:
exchange-
-
-
Method Detail
-
getAccountInfo
public AccountInfo getAccountInfo() throws IOException
- Specified by:
getAccountInfoin interfaceAccountService- Throws:
IOException
-
withdrawFunds
public String withdrawFunds(Currency currency, BigDecimal amount, String address) throws IOException
- Specified by:
withdrawFundsin interfaceAccountService- Returns:
- The Coinbase transaction id for the newly created withdrawal. See
CoinbaseAccountServiceRaw.getCoinbaseTransaction(String transactionIdOrIdemField)to retrieve more information about the transaction, including the blockchain transaction hash. - Throws:
IOException
-
withdrawFunds
public String withdrawFunds(WithdrawFundsParams params) throws IOException
- Specified by:
withdrawFundsin interfaceAccountService- Throws:
IOException
-
requestDepositAddress
public String requestDepositAddress(Currency currency, String... arguments) throws IOException
- Specified by:
requestDepositAddressin interfaceAccountService- Throws:
IOException
-
createFundingHistoryParams
public TradeHistoryParams createFundingHistoryParams()
- Specified by:
createFundingHistoryParamsin interfaceAccountService
-
getCoinbaseUsers
public CoinbaseUsers getCoinbaseUsers() throws IOException
Authenticated resource that shows the current user and their settings.- Returns:
- A
CoinbaseUserswrapper around the currentCoinbaseUsercontaining account settings. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/users/index.html
-
updateCoinbaseUser
public CoinbaseUser updateCoinbaseUser(CoinbaseUser user) throws IOException
Authenticated resource that lets you update account settings for the current user. UsegetCoinbaseUsers()to retrieve the current user first.- Parameters:
user-CoinbaseUserwith new information to be updated.- Returns:
- The current
CoinbaseUserwith the requested updated account settings. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/users/update.html
-
redeemCoinbaseToken
public boolean redeemCoinbaseToken(String tokenId) throws IOException
Authenticated resource which claims a redeemable token for its address and Bitcoin.- Parameters:
tokenId-- Returns:
- True if the redemption was successful.
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/tokens/redeem.html
-
getCoinbaseBalance
public CoinbaseMoney getCoinbaseBalance() throws IOException
Authenticated resource that returns the user’s current account balance in BTC.- Returns:
- A
CoinbaseAmountwrapper around aCoinbaseMoneyobject representing the current user's balance. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/accounts/balance.html
-
getCoinbaseReceiveAddress
public CoinbaseAddress getCoinbaseReceiveAddress() throws IOException
Authenticated resource that returns the user’s current Bitcoin receive address.- Returns:
- The user’s current
CoinbaseAddress. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/accounts/receive_address.html
-
getCoinbaseAddresses
public CoinbaseAddresses getCoinbaseAddresses() throws IOException
Authenticated resource that returns Bitcoin addresses a user has associated with their account. This is a paged resource and will return the first page by default.- Returns:
- A
CoinbaseAddresseswrapper around a collection ofCoinbaseAddress'sassociated with the current user's account. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/addresses/index.html
-
getCoinbaseAddresses
public CoinbaseAddresses getCoinbaseAddresses(Integer page, Integer limit, String filter) throws IOException
Authenticated resource that returns Bitcoin addresses a user has associated with their account.- Parameters:
page- Optional parameter to request a desired page of results. Will return page 1 if the supplied page is null or less than 1.limit- Optional parameter to limit the maximum number of results to return. Will return up to 25 results by default if null or less than 1.filter- Optional String match to filter addresses. Matches the address itself and also if the use has set a ‘label’ on the address. No filter is applied iffilteris null or empty.- Returns:
- A
CoinbaseAddresseswrapper around a collection ofCoinbaseAddress'sassociated with the current user's account. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/addresses/index.html
-
generateCoinbaseReceiveAddress
public CoinbaseAddress generateCoinbaseReceiveAddress() throws IOException
Authenticated resource that generates a new Bitcoin receive address for the user.- Returns:
- The user’s newly generated and current
CoinbaseAddress. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/accounts/generate_receive_address .html
-
generateCoinbaseReceiveAddress
public CoinbaseAddress generateCoinbaseReceiveAddress(String callbackUrl, String label) throws IOException
Authenticated resource that generates a new Bitcoin receive address for the user.- Parameters:
callbackUrl- Optional Callback URL to receive instant payment notifications whenever funds arrive to this address.label- Optional text label for the address which can be used to filter against when callinggetCoinbaseAddresses().- Returns:
- The user’s newly generated and current
CoinbaseAddress. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/accounts/generate_receive_address .html
-
getCoinbaseAccountChanges
public CoinbaseAccountChanges getCoinbaseAccountChanges() throws IOException
Authenticated resource which returns all related changes to an account. This is an alternative to thegetCoinbaseTransactionsAPI call. It is designed to be faster and provide more detail so you can generate an overview/summary of individual account changes. This is a paged resource and will return 30 results representing the first page by default.- Returns:
- The current user, balance, and the most recent account changes.
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/account_changes/index.html
-
getCoinbaseAccountChanges
public CoinbaseAccountChanges getCoinbaseAccountChanges(Integer page) throws IOException
Authenticated resource which returns all related changes to an account. This is an alternative to thegetCoinbaseTransactionsAPI call. It is designed to be faster and provide more detail so you can generate an overview/summary of individual account changes.- Parameters:
page- Optional parameter to request a desired page of results. Will return page 1 if the supplied page is null or less than 1.- Returns:
- The current user, balance, and the most recent account changes.
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/account_changes/index.html
-
getCoinbaseContacts
public CoinbaseContacts getCoinbaseContacts() throws IOException
Authenticated resource that returns contacts the user has previously sent to or received from. This is a paged resource and will return the first page by default.- Returns:
CoinbaseContactsthe user has previously sent to or received from.- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/contacts/index.html
-
getCoinbaseContacts
public CoinbaseContacts getCoinbaseContacts(Integer page, Integer limit, String filter) throws IOException
Authenticated resource that returns contacts the user has previously sent to or received from.- Parameters:
page- Optional parameter to request a desired page of results. Will return page 1 if the supplied page is null or less than 1.limit- Optional parameter to limit the maximum number of results to return. Will return up to 25 results by default if null or less than 1.filter- Optional String match to filter addresses. Matches the address itself and also if the use has set a ‘label’ on the address. No filter is applied iffilteris null or empty.- Returns:
CoinbaseContactsthe user has previously sent to or received from.- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/contacts/index.html
-
getCoinbaseTransactions
public CoinbaseTransactions getCoinbaseTransactions() throws IOException
Authenticated resource which returns the user’s most recent transactions. Sorted in descending order by creation date. This is a paged resource and will return the first page by default.- Returns:
- The current user's most recent
CoinbaseTransactions. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/transactions/index.html
-
getCoinbaseTransactions
public CoinbaseTransactions getCoinbaseTransactions(Integer page) throws IOException
Authenticated resource which returns the user’s most recent transactions. Sorted in descending order by creation date.- Parameters:
page- Optional parameter to request a desired page of results. Will return page 1 if the supplied page is null or less than 1.- Returns:
- The current user's most recent
CoinbaseTransactions. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/transactions/index.html
-
getCoinbaseTransaction
public CoinbaseTransaction getCoinbaseTransaction(String transactionIdOrIdemField) throws IOException
Authenticated resource which returns the details of an individual transaction.- Parameters:
transactionIdOrIdemField-- Returns:
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/transactions/show.html
-
requestMoneyCoinbaseRequest
public CoinbaseTransaction requestMoneyCoinbaseRequest(CoinbaseTransaction.CoinbaseRequestMoneyRequest transactionRequest) throws IOException
Authenticated resource which lets the user request money from a Bitcoin address.- Parameters:
transactionRequest-- Returns:
- A pending
CoinbaseTransactionrepresenting the desiredCoinbaseRequestMoneyRequest. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/transactions/request_money.html
-
sendMoneyCoinbaseRequest
public CoinbaseTransaction sendMoneyCoinbaseRequest(CoinbaseTransaction.CoinbaseSendMoneyRequest transactionRequest) throws IOException
Authenticated resource which lets you send money to an email or Bitcoin address.- Parameters:
transactionRequest-- Returns:
- A completed
CoinbaseTransactionrepresenting the desiredCoinbaseSendMoneyRequest. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/transactions/send_money.html
-
resendCoinbaseRequest
public CoinbaseBaseResponse resendCoinbaseRequest(String transactionId) throws IOException
Authenticated resource which lets the user resend a money request.- Parameters:
transactionId-- Returns:
- true if resending the request was successful.
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/transactions/resend_request.html
-
completeCoinbaseRequest
public CoinbaseTransaction completeCoinbaseRequest(String transactionId) throws IOException
Authenticated resource which lets a user complete a money request. Money requests can only be completed by the sender (not the recipient). Remember that the sender in this context is the user who is sending money (not sending the request itself).- Parameters:
transactionId-- Returns:
- The
CoinbaseTransactionrepresenting the completedCoinbaseSendMoneyRequest. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/transactions/complete_request.html
-
cancelCoinbaseRequest
public CoinbaseBaseResponse cancelCoinbaseRequest(String transactionId) throws IOException
Authenticated resource which lets a user cancel a money request. Money requests can be canceled by the sender or the recipient.- Parameters:
transactionId-- Returns:
- true if canceling the request was successful.
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/transactions/cancel_request.html
-
createCoinbaseButton
public CoinbaseButton createCoinbaseButton(CoinbaseButton button) throws IOException
Authenticated resource that creates a payment button, page, or iFrame to accept Bitcoin on your website. This can be used to accept Bitcoin for an individual item or to integrate with your existing shopping cart solution. For example, you could create a new payment button for each shopping cart on your website, setting the total and order number in the button at checkout.- Parameters:
button- ACoinbaseButtoncontaining the desired button configuration for Coinbase to create.- Returns:
- newly created
CoinbaseButton. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/buttons/create.html
-
getCoinbaseOrders
public CoinbaseOrders getCoinbaseOrders() throws IOException
Authenticated resource which returns a merchant’s orders that they have received. Sorted in descending order by creation date. This is a paged resource and will return the first page by default, usegetCoinbaseOrders(Integer page)to retrieve additional pages.- Returns:
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/orders/index.html
-
getCoinbaseOrders
public CoinbaseOrders getCoinbaseOrders(Integer page) throws IOException
Authenticated resource which returns a merchant’s orders that they have received. Sorted in descending order by creation date.- Parameters:
page- Optional parameter to request a desired page of results. Will return page 1 if the supplied page is null or less than 1.- Returns:
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/orders/index.html
-
getCoinbaseOrder
public CoinbaseOrder getCoinbaseOrder(String orderIdOrCustom) throws IOException
Authenticated resource which returns order details for a specific order id or merchant custom.- Parameters:
orderIdOrCustom-- Returns:
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/orders/show.html
-
createCoinbaseOrder
public CoinbaseOrder createCoinbaseOrder(String code) throws IOException
Authenticated resource which lets you generate an order associated with a button. After generating an order, you can send Bitcoin to the address associated with the order to complete the order. The status of this newly created order will be ‘new’.- Parameters:
code- The code of the button for which you wish to create an order.- Returns:
- The newly created
CoinbaseOrder. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/buttons/create_order.html
-
createCoinbaseOrder
public CoinbaseOrder createCoinbaseOrder(CoinbaseButton button) throws IOException
Authenticated resource which returns an order for a new button.- Parameters:
button- ACoinbaseButtoncontaining information to create a one time order.- Returns:
- The newly created
CoinbaseOrder. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/orders/create.html
-
getCoinbaseRecurringPayments
public CoinbaseRecurringPayments getCoinbaseRecurringPayments() throws IOException
Authenticated resource that lets you list all your recurring payments (scheduled buys, sells, and subscriptions you’ve created with merchants). This is a paged resource and will return the first page by default.- Returns:
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/recurring_payments/index.html
-
getCoinbaseRecurringPayments
public CoinbaseRecurringPayments getCoinbaseRecurringPayments(Integer page, Integer limit) throws IOException
Authenticated resource that lets you list all your recurring payments (scheduled buys, sells, and subscriptions you’ve created with merchants).- Parameters:
page- Optional parameter to request a desired page of results. Will return page 1 if the supplied page is null or less than 1.limit- Optional parameter to limit the maximum number of results to return. Will return up to 25 results by default if null or less than 1.- Returns:
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/recurring_payments/index.html
-
getCoinbaseRecurringPayment
public CoinbaseRecurringPayment getCoinbaseRecurringPayment(String recurringPaymentId) throws IOException
Authenticated resource that lets you show an individual recurring payment.- Parameters:
recurringPaymentId-- Returns:
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/recurring_payments/show.html
-
getCoinbaseSubscriptions
public CoinbaseSubscriptions getCoinbaseSubscriptions() throws IOException
Authenticated resource that lets you (as a merchant) list all the subscriptions customers have made with you. This call returnsCoinbaseSubscriptionobjects where you are the merchant. This is a paged resource and will return the first page by default.- Returns:
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/subscribers/index.html
-
getCoinbaseSubscriptions
public CoinbaseSubscriptions getCoinbaseSubscriptions(Integer page, Integer limit) throws IOException
Authenticated resource that lets you (as a merchant) list all the subscriptions customers have made with you. This call returnsCoinbaseSubscriptionobjects where you are the merchant.- Parameters:
page- Optional parameter to request a desired page of results. Will return page 1 if the supplied page is null or less than 1.limit- Optional parameter to limit the maximum number of results to return. Will return up to 25 results by default if null or less than 1.- Returns:
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/subscribers/index.html
-
getCoinbaseSubscription
public CoinbaseSubscription getCoinbaseSubscription(String subscriptionId) throws IOException
Authenticated resource that lets you (as a merchant) show an individual subscription than a customer has created with you. This call returns aCoinbaseSubscriptionobject where you are the merchant.- Parameters:
subscriptionId-- Returns:
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/subscribers/show.html
-
-