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
- 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
-
Method Summary
Modifier and TypeMethodDescriptioncancelCoinbaseRequest
(String transactionId) Authenticated resource which lets a user cancel a money request.completeCoinbaseRequest
(String transactionId) Authenticated resource which lets a user complete a money request.createCoinbaseButton
(CoinbaseButton button) Authenticated resource that creates a payment button, page, or iFrame to accept Bitcoin on your website.createCoinbaseOrder
(String code) Authenticated resource which lets you generate an order associated with a button.createCoinbaseOrder
(CoinbaseButton button) Authenticated resource which returns an order for a new button.CreateTradeHistoryParams
object specific to this exchange.Authenticated resource that generates a new Bitcoin receive address for the user.generateCoinbaseReceiveAddress
(String callbackUrl, String label) Authenticated resource that generates a new Bitcoin receive address for the user.Get account infoAuthenticated resource which returns all related changes to an account.Authenticated resource which returns all related changes to an account.Authenticated resource that returns Bitcoin addresses a user has associated with their account.getCoinbaseAddresses
(Integer page, Integer limit, String filter) Authenticated resource that returns Bitcoin addresses a user has associated with their account.Authenticated resource that returns the user’s current account balance in BTC.Authenticated resource that returns contacts the user has previously sent to or received from.getCoinbaseContacts
(Integer page, Integer limit, String filter) Authenticated resource that returns contacts the user has previously sent to or received from.getCoinbaseOrder
(String orderIdOrCustom) Authenticated resource which returns order details for a specific order id or merchant custom.Authenticated resource which returns a merchant’s orders that they have received.getCoinbaseOrders
(Integer page) Authenticated resource which returns a merchant’s orders that they have received.Authenticated resource that returns the user’s current Bitcoin receive address.getCoinbaseRecurringPayment
(String recurringPaymentId) Authenticated resource that lets you show an individual recurring payment.Authenticated resource that lets you list all your recurring payments (scheduled buys, sells, and subscriptions you’ve created with merchants).getCoinbaseRecurringPayments
(Integer page, Integer limit) Authenticated resource that lets you list all your recurring payments (scheduled buys, sells, and subscriptions you’ve created with merchants).getCoinbaseSubscription
(String subscriptionId) Authenticated resource that lets you (as a merchant) show an individual subscription than a customer has created with you.Authenticated resource that lets you (as a merchant) list all the subscriptions customers have made with you.getCoinbaseSubscriptions
(Integer page, Integer limit) Authenticated resource that lets you (as a merchant) list all the subscriptions customers have made with you.getCoinbaseTransaction
(String transactionIdOrIdemField) Authenticated resource which returns the details of an individual transaction.Authenticated resource which returns the user’s most recent transactions.Authenticated resource which returns the user’s most recent transactions.Authenticated resource that shows the current user and their settings.boolean
redeemCoinbaseToken
(String tokenId) Authenticated resource which claims a redeemable token for its address and Bitcoin.requestDepositAddress
(Currency currency, String... arguments) Request a digital currency address to fund this account.requestMoneyCoinbaseRequest
(CoinbaseTransaction.CoinbaseRequestMoneyRequest transactionRequest) Authenticated resource which lets the user request money from a Bitcoin address.resendCoinbaseRequest
(String transactionId) Authenticated resource which lets the user resend a money request.sendMoneyCoinbaseRequest
(CoinbaseTransaction.CoinbaseSendMoneyRequest transactionRequest) Authenticated resource which lets you send money to an email or Bitcoin address.Authenticated resource that lets you update account settings for the current user.withdrawFunds
(Currency currency, BigDecimal amount, String address) Convenience method, typically just delegates to withdrawFunds(WithdrawFundsParams params)withdrawFunds
(WithdrawFundsParams params) Withdraw funds from this account.Methods inherited from class org.knowm.xchange.coinbase.service.CoinbaseBaseService
createCoinbaseToken, createCoinbaseUser, createCoinbaseUser, getCoinbaseCurrencies, handleResponse
Methods inherited from class org.knowm.xchange.service.BaseExchangeService
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
getDynamicTradingFeesByInstrument, getFundingHistory, requestDepositAddressData, withdrawFunds
-
Constructor Details
-
CoinbaseAccountService
Constructor- Parameters:
exchange
-
-
-
Method Details
-
getAccountInfo
Description copied from interface:AccountService
Get account info- Specified by:
getAccountInfo
in interfaceAccountService
- Returns:
- the AccountInfo object, null if some sort of error occurred. Implementers should log the error.
- Throws:
IOException
- - Indication that a networking error occurred while fetching JSON data
-
withdrawFunds
public String withdrawFunds(Currency currency, BigDecimal amount, String address) throws IOException Description copied from interface:AccountService
Convenience method, typically just delegates to withdrawFunds(WithdrawFundsParams params)- Specified by:
withdrawFunds
in interfaceAccountService
- Parameters:
currency
- The currency to withdrawamount
- The amount to withdrawaddress
- The destination address- 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
- - Indication that a networking error occurred while fetching JSON data
-
withdrawFunds
Description copied from interface:AccountService
Withdraw funds from this account. Allows to withdraw digital currency funds from the exchange account to an external address- Specified by:
withdrawFunds
in interfaceAccountService
- Parameters:
params
- The withdrawl details- Returns:
- The result of the withdrawal (usually a transaction ID)
- Throws:
IOException
- - Indication that a networking error occurred while fetching JSON data
-
requestDepositAddress
Description copied from interface:AccountService
Request a digital currency address to fund this account. Allows to fund the exchange account with digital currency from an external address- Specified by:
requestDepositAddress
in interfaceAccountService
- Parameters:
currency
- The digital currency that corresponds to the desired deposit address.arguments
- Necessary argument(s) as aString
- Returns:
- the internal deposit address to send funds to
- Throws:
IOException
- - Indication that a networking error occurred while fetching JSON data
-
createFundingHistoryParams
Description copied from interface:AccountService
CreateTradeHistoryParams
object specific to this exchange. Object created by this method may be used to discover supported and requiredAccountService.getFundingHistory(TradeHistoryParams)
parameters and should be passed only to the method in the same class as the createFundingHistoryParams that created the object.- Specified by:
createFundingHistoryParams
in interfaceAccountService
-
getCoinbaseUsers
Authenticated resource that shows the current user and their settings.- Returns:
- A
CoinbaseUsers
wrapper around the currentCoinbaseUser
containing account settings. - Throws:
IOException
- See Also:
-
updateCoinbaseUser
Authenticated resource that lets you update account settings for the current user. UsegetCoinbaseUsers()
to retrieve the current user first.- Parameters:
user
-CoinbaseUser
with new information to be updated.- Returns:
- The current
CoinbaseUser
with the requested updated account settings. - Throws:
IOException
- See Also:
-
redeemCoinbaseToken
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:
-
getCoinbaseBalance
Authenticated resource that returns the user’s current account balance in BTC.- Returns:
- A
CoinbaseAmount
wrapper around aCoinbaseMoney
object representing the current user's balance. - Throws:
IOException
- See Also:
-
getCoinbaseReceiveAddress
Authenticated resource that returns the user’s current Bitcoin receive address.- Returns:
- The user’s current
CoinbaseAddress
. - Throws:
IOException
- See Also:
-
getCoinbaseAddresses
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
CoinbaseAddresses
wrapper around a collection ofCoinbaseAddress's
associated with the current user's account. - Throws:
IOException
- See Also:
-
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 iffilter
is null or empty.- Returns:
- A
CoinbaseAddresses
wrapper around a collection ofCoinbaseAddress's
associated with the current user's account. - Throws:
IOException
- See Also:
-
generateCoinbaseReceiveAddress
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:
-
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:
-
getCoinbaseAccountChanges
Authenticated resource which returns all related changes to an account. This is an alternative to thegetCoinbaseTransactions
API 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:
-
getCoinbaseAccountChanges
Authenticated resource which returns all related changes to an account. This is an alternative to thegetCoinbaseTransactions
API 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:
-
getCoinbaseContacts
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:
CoinbaseContacts
the user has previously sent to or received from.- Throws:
IOException
- See Also:
-
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 iffilter
is null or empty.- Returns:
CoinbaseContacts
the user has previously sent to or received from.- Throws:
IOException
- See Also:
-
getCoinbaseTransactions
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:
-
getCoinbaseTransactions
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:
-
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:
-
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
CoinbaseTransaction
representing the desiredCoinbaseRequestMoneyRequest
. - Throws:
IOException
- See Also:
-
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
CoinbaseTransaction
representing the desiredCoinbaseSendMoneyRequest
. - Throws:
IOException
- See Also:
-
resendCoinbaseRequest
Authenticated resource which lets the user resend a money request.- Parameters:
transactionId
-- Returns:
- true if resending the request was successful.
- Throws:
IOException
- See Also:
-
completeCoinbaseRequest
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
CoinbaseTransaction
representing the completedCoinbaseSendMoneyRequest
. - Throws:
IOException
- See Also:
-
cancelCoinbaseRequest
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:
-
createCoinbaseButton
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
- ACoinbaseButton
containing the desired button configuration for Coinbase to create.- Returns:
- newly created
CoinbaseButton
. - Throws:
IOException
- See Also:
-
getCoinbaseOrders
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:
-
getCoinbaseOrders
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:
-
getCoinbaseOrder
Authenticated resource which returns order details for a specific order id or merchant custom.- Parameters:
orderIdOrCustom
-- Returns:
- Throws:
IOException
- See Also:
-
createCoinbaseOrder
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:
-
createCoinbaseOrder
Authenticated resource which returns an order for a new button.- Parameters:
button
- ACoinbaseButton
containing information to create a one time order.- Returns:
- The newly created
CoinbaseOrder
. - Throws:
IOException
- See Also:
-
getCoinbaseRecurringPayments
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:
-
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:
-
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:
-
getCoinbaseSubscriptions
Authenticated resource that lets you (as a merchant) list all the subscriptions customers have made with you. This call returnsCoinbaseSubscription
objects where you are the merchant. This is a paged resource and will return the first page by default.- Returns:
- Throws:
IOException
- See Also:
-
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 returnsCoinbaseSubscription
objects 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:
-
getCoinbaseSubscription
Authenticated resource that lets you (as a merchant) show an individual subscription than a customer has created with you. This call returns aCoinbaseSubscription
object where you are the merchant.- Parameters:
subscriptionId
-- Returns:
- Throws:
IOException
- See Also:
-