Class CoinbaseTradeService
- java.lang.Object
-
- org.knowm.xchange.service.BaseExchangeService
-
- org.knowm.xchange.coinbase.v2.service.CoinbaseBaseService
-
- org.knowm.xchange.coinbase.v2.service.CoinbaseTradeService
-
- All Implemented Interfaces:
BaseService
,TradeService
public final class CoinbaseTradeService extends CoinbaseBaseService implements TradeService
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.knowm.xchange.coinbase.v2.service.CoinbaseBaseService
CoinbaseBaseService.HttpMethod
-
-
Field Summary
-
Fields inherited from class org.knowm.xchange.coinbase.v2.service.CoinbaseBaseService
coinbase, signatureCreator2
-
Fields inherited from class org.knowm.xchange.service.BaseExchangeService
exchange
-
-
Constructor Summary
Constructors Constructor Description CoinbaseTradeService(Exchange exchange)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoinbaseBuyData.CoinbaseBuy
buy(String accountId, BigDecimal total, Currency currency, boolean commit)
Authenticated resource that lets you purchase Bitcoin using the primary bank account that is linked to your account.boolean
cancelOrder(String orderId)
cancels order with matching orderId (conveniance method, typical just delegate to cancelOrder(CancelOrderByIdParams))boolean
cancelOrder(CancelOrderParams orderParams)
cancels order with matching orderParamsOpenOrdersParams
createOpenOrdersParams()
CreateOpenOrdersParams
object specific to this exchange.TradeHistoryParams
createTradeHistoryParams()
CreateTradeHistoryParams
object specific to this exchange.OpenOrders
getOpenOrders()
********************************************************************************************************************************************************OpenOrders
getOpenOrders(OpenOrdersParams params)
Gets the open ordersString
placeLimitOrder(LimitOrder limitOrder)
Place a limit orderString
placeStopOrder(StopOrder stopOrder)
Place a stop orderCoinbaseSellData.CoinbaseSell
quote(String accountId, BigDecimal total, Currency currency)
Authenticated resource that lets you convert Bitcoin crediting your primary bank account on Coinbase.CoinbaseSellData.CoinbaseSell
sell(String accountId, BigDecimal total, Currency currency, boolean commit)
Authenticated resource that lets you convert Bitcoin crediting your primary bank account on Coinbase.-
Methods inherited from class org.knowm.xchange.coinbase.v2.service.CoinbaseBaseService
getCoinbaseCurrencies, getCoinbaseTime, getSignature, showCurl
-
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.trade.TradeService
changeOrder, getOrder, getOrder, getTradeHistory, placeMarketOrder, verifyOrder, verifyOrder
-
-
-
-
Constructor Detail
-
CoinbaseTradeService
public CoinbaseTradeService(Exchange exchange)
-
-
Method Detail
-
getOpenOrders
public OpenOrders getOpenOrders() throws NotAvailableFromExchangeException, IOException
********************************************************************************************************************************************************- Specified by:
getOpenOrders
in interfaceTradeService
- Returns:
- the open orders, null if some sort of error occurred. Implementers should log the error.
- Throws:
NotAvailableFromExchangeException
- - Indication that the exchange does not support the requested function or dataIOException
- - Indication that a networking error occurred while fetching JSON data
-
getOpenOrders
public OpenOrders getOpenOrders(OpenOrdersParams params) throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException
Description copied from interface:TradeService
Gets the open orders- Specified by:
getOpenOrders
in interfaceTradeService
- Parameters:
params
- The parameters describing the filter. Note thatOpenOrdersParams
is an empty interface. Exchanges should implement its own params object. Params should be create withTradeService.createOpenOrdersParams()
.- Returns:
- the open orders, null if some sort of error occurred. Implementers should log the error.
- Throws:
ExchangeException
- - Indication that the exchange reported some kind of error with the request or responseNotAvailableFromExchangeException
- - Indication that the exchange does not support the requested function or dataNotYetImplementedForExchangeException
- - Indication that the exchange supports the requested function or data, but it has not yet been implementedIOException
- - Indication that a networking error occurred while fetching JSON data
-
placeLimitOrder
public String placeLimitOrder(LimitOrder limitOrder) throws NotAvailableFromExchangeException
Description copied from interface:TradeService
Place a limit orderIf your orders amount or limit price does to meet the restrictions dictated by
CurrencyPairMetaData
then the exchange will reject your order. UseOrderValuesHelper
to validate and / or adjust those values while you'r building an order.- Specified by:
placeLimitOrder
in interfaceTradeService
- Returns:
- the order ID
- Throws:
NotAvailableFromExchangeException
- - Indication that the exchange does not support the requested function or data- See Also:
OrderValuesHelper
-
placeStopOrder
public String placeStopOrder(StopOrder stopOrder) throws IOException
Description copied from interface:TradeService
Place a stop orderIf your orders amount or spot price does to meet the restrictions dictated by
CurrencyPairMetaData
then the exchange will reject your order. UseOrderValuesHelper
to validate and / or adjust those values while you'r building an order.- Specified by:
placeStopOrder
in interfaceTradeService
- Returns:
- the order ID
- Throws:
IOException
- - Indication that a networking error occurred while fetching JSON data- See Also:
OrderValuesHelper
-
cancelOrder
public boolean cancelOrder(String orderId) throws NotAvailableFromExchangeException
Description copied from interface:TradeService
cancels order with matching orderId (conveniance method, typical just delegate to cancelOrder(CancelOrderByIdParams))- Specified by:
cancelOrder
in interfaceTradeService
- Returns:
- true if order was successfully cancelled, false otherwise.
- Throws:
NotAvailableFromExchangeException
- - Indication that the exchange does not support the requested function or data
-
cancelOrder
public boolean cancelOrder(CancelOrderParams orderParams) throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException
Description copied from interface:TradeService
cancels order with matching orderParams- Specified by:
cancelOrder
in interfaceTradeService
- Returns:
- true if order was successfully cancelled, false otherwise.
- Throws:
ExchangeException
- - Indication that the exchange reported some kind of error with the request or responseNotAvailableFromExchangeException
- - Indication that the exchange does not support the requested function or dataNotYetImplementedForExchangeException
- - Indication that the exchange supports the requested function or data, but it has not yet been implementedIOException
- - Indication that a networking error occurred while fetching JSON data
-
createTradeHistoryParams
public TradeHistoryParams createTradeHistoryParams()
Description copied from interface:TradeService
CreateTradeHistoryParams
object specific to this exchange. Object created by this method may be used to discover supported and requiredTradeService.getTradeHistory(TradeHistoryParams)
parameters and should be passed only to the method in the same class as the createTradeHistoryParams that created the object.- Specified by:
createTradeHistoryParams
in interfaceTradeService
-
createOpenOrdersParams
public OpenOrdersParams createOpenOrdersParams()
Description copied from interface:TradeService
CreateOpenOrdersParams
object specific to this exchange. Object created by this method may be used to discover supported and requiredTradeService.getOpenOrders(OpenOrdersParams)
parameters and should be passed only to the method in the same class as the createOpenOrdersParams that created the object.- Specified by:
createOpenOrdersParams
in interfaceTradeService
-
buy
public CoinbaseBuyData.CoinbaseBuy buy(String accountId, BigDecimal total, Currency currency, boolean commit) 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.- Throws:
IOException
- See Also:
- developers.coinbase.com/api/v2#place-buy-order
-
sell
public CoinbaseSellData.CoinbaseSell sell(String accountId, BigDecimal total, Currency currency, boolean commit) throws IOException
Authenticated resource that lets you convert Bitcoin crediting your primary bank account on Coinbase. (You must link and verify your bank account through the website before this API call will work).- Throws:
IOException
- See Also:
- developers.coinbase.com/api/v2#place-sell-order
-
quote
public CoinbaseSellData.CoinbaseSell quote(String accountId, BigDecimal total, Currency currency) throws IOException
Authenticated resource that lets you convert Bitcoin crediting your primary bank account on Coinbase. (You must link and verify your bank account through the website before this API call will work).- Throws:
IOException
- See Also:
- developers.coinbase.com/api/v2#place-sell-order
-
-