Class CoinbaseTradeService
- java.lang.Object
-
- org.knowm.xchange.service.BaseExchangeService
-
- org.knowm.xchange.coinbase.service.CoinbaseBaseService
-
- org.knowm.xchange.coinbase.service.CoinbaseTradeService
-
- All Implemented Interfaces:
BaseService,TradeService
public final class CoinbaseTradeService extends CoinbaseBaseService implements TradeService
- 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 CoinbaseTradeService(Exchange exchange)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoinbaseTransferbuy(BigDecimal quantity)Authenticated resource that lets you purchase Bitcoin using the primary bank account that is linked to your account.CoinbaseTransferbuyAndAgreeBTCAmountVaries(BigDecimal quantity)Authenticated resource that lets you purchase Bitcoin using the primary bank account that is linked to your account.booleancancelOrder(String orderId)booleancancelOrder(CancelOrderParams orderParams)OpenOrdersParamscreateOpenOrdersParams()TradeHistoryParamscreateTradeHistoryParams()CoinbaseTransfersgetCoinbaseTransfers()Authenticated resource which returns the user’s Bitcoin purchases and sells.CoinbaseTransfersgetCoinbaseTransfers(Integer page, Integer limit)Authenticated resource which returns the user’s Bitcoin purchases and sells.OpenOrdersgetOpenOrders()OpenOrdersgetOpenOrders(OpenOrdersParams params)UserTradesgetTradeHistory(TradeHistoryParams params)Authenticated resource which returns the user’s Bitcoin purchases and sells.StringplaceLimitOrder(LimitOrder limitOrder)StringplaceMarketOrder(MarketOrder marketOrder)StringplaceStopOrder(StopOrder stopOrder)CoinbaseTransfersell(BigDecimal quantity)Authenticated resource that lets you convert Bitcoin in your account to USD by crediting your primary bank account on Coinbase.-
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.trade.TradeService
changeOrder, getOrder, getOrder, verifyOrder, verifyOrder
-
-
-
-
Constructor Detail
-
CoinbaseTradeService
public CoinbaseTradeService(Exchange exchange)
Constructor- Parameters:
exchange-
-
-
Method Detail
-
getOpenOrders
public OpenOrders getOpenOrders() throws NotAvailableFromExchangeException, IOException
- Specified by:
getOpenOrdersin interfaceTradeService- Throws:
NotAvailableFromExchangeExceptionIOException
-
getOpenOrders
public OpenOrders getOpenOrders(OpenOrdersParams params) throws IOException
- Specified by:
getOpenOrdersin interfaceTradeService- Throws:
IOException
-
placeMarketOrder
public String placeMarketOrder(MarketOrder marketOrder) throws ExchangeException, IOException
- Specified by:
placeMarketOrderin interfaceTradeService- Throws:
ExchangeExceptionIOException
-
placeLimitOrder
public String placeLimitOrder(LimitOrder limitOrder) throws NotAvailableFromExchangeException
- Specified by:
placeLimitOrderin interfaceTradeService- Throws:
NotAvailableFromExchangeException
-
placeStopOrder
public String placeStopOrder(StopOrder stopOrder) throws IOException
- Specified by:
placeStopOrderin interfaceTradeService- Throws:
IOException
-
cancelOrder
public boolean cancelOrder(String orderId) throws NotAvailableFromExchangeException
- Specified by:
cancelOrderin interfaceTradeService- Throws:
NotAvailableFromExchangeException
-
cancelOrder
public boolean cancelOrder(CancelOrderParams orderParams) throws IOException
- Specified by:
cancelOrderin interfaceTradeService- Throws:
IOException
-
getTradeHistory
public UserTrades getTradeHistory(TradeHistoryParams params) throws IOException
Authenticated resource which returns the user’s Bitcoin purchases and sells. Sorted in descending order by creation date.- Specified by:
getTradeHistoryin interfaceTradeService- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/transfers/index.html
-
createTradeHistoryParams
public TradeHistoryParams createTradeHistoryParams()
- Specified by:
createTradeHistoryParamsin interfaceTradeService
-
createOpenOrdersParams
public OpenOrdersParams createOpenOrdersParams()
- Specified by:
createOpenOrdersParamsin interfaceTradeService
-
buy
public CoinbaseTransfer buy(BigDecimal quantity) throws IOException
Authenticated resource that lets you purchase Bitcoin using the primary bank account that is linked to your account. (You must link and verify your bank account through the website before this API call will work). The underlying optional parameter agree_btc_amount_varies is set to false. UsebuyAndAgreeBTCAmountVaries(java.math.BigDecimal)to have it set to true.- Parameters:
quantity- The quantity of Bitcoin you would like to buy.- Returns:
- The
CoinbaseTransferrepresenting the buy. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/buys/create.html
-
buyAndAgreeBTCAmountVaries
public CoinbaseTransfer buyAndAgreeBTCAmountVaries(BigDecimal quantity) throws IOException
Authenticated resource that lets you purchase Bitcoin using the primary bank account that is linked to your account. (You must link and verify your bank account through the website before this API call will work). The underlying optional parameter agree_btc_amount_varies is set to true. UsebuyAndAgreeBTCAmountVaries(java.math.BigDecimal)to have it set to false.- Parameters:
quantity- The quantity of Bitcoin you would like to buy.- Returns:
- A
CoinbaseTransferrepresenting the buy. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/buys/create.html
-
sell
public CoinbaseTransfer sell(BigDecimal quantity) throws IOException
Authenticated resource that lets you convert Bitcoin in your account to USD by crediting your primary bank account on Coinbase. (You must link and verify your bank account through the website before this API call will work).- Parameters:
quantity- The quantity of Bitcoin you would like to sell.- Returns:
- A
CoinbaseTransferrepresenting the sell. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/sells/create.html
-
getCoinbaseTransfers
public CoinbaseTransfers getCoinbaseTransfers() throws IOException
Authenticated resource which returns the user’s Bitcoin purchases and sells. Sorted in descending order by creation date. This is a paged resource and will return the first page by default.- Returns:
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/transfers/index.html
-
getCoinbaseTransfers
public CoinbaseTransfers getCoinbaseTransfers(Integer page, Integer limit) throws IOException
Authenticated resource which returns the user’s Bitcoin purchases and sells. 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.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/transfers/index.html
-
-