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
-
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 -
Method Summary
Modifier and TypeMethodDescriptionbuy
(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 orderParamsCreateOpenOrdersParams
object specific to this exchange.CreateTradeHistoryParams
object specific to this exchange.getBuyTradeHistory
(CoinbaseTradeHistoryParams params, String accountId) The Coinbase is not typical exchange.********************************************************************************************************************************************************getOpenOrders
(OpenOrdersParams params) Gets the open ordersgetSellTradeHistory
(CoinbaseTradeHistoryParams params, String accountId) The Coinbase is not typical exchange.placeLimitOrder
(LimitOrder limitOrder) Place a limit orderplaceStopOrder
(StopOrder stopOrder) Place a stop orderquote
(String accountId, BigDecimal total, Currency currency) Authenticated resource that lets you convert Bitcoin crediting your primary bank account on Coinbase.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
cancelAllOrders, changeOrder, getOpenPositions, getOrder, getOrder, getRequiredCancelOrderParamClasses, getRequiredOrderQueryParamClass, getTradeHistory, placeMarketOrder, verifyOrder, verifyOrder
-
Constructor Details
-
CoinbaseTradeService
-
-
Method Details
-
getOpenOrders
********************************************************************************************************************************************************- 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
Description copied from interface:TradeService
Place a limit orderIf your orders amount or limit price does to meet the restrictions dictated by
InstrumentMetaData
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:
-
placeStopOrder
Description copied from interface:TradeService
Place a stop orderIf your orders amount or spot price does to meet the restrictions dictated by
InstrumentMetaData
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:
-
cancelOrder
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
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
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
-
getBuyTradeHistory
public UserTrades getBuyTradeHistory(CoinbaseTradeHistoryParams params, String accountId) throws IOException The Coinbase is not typical exchange. It has splitted buys and sells into wallets (accounts). To get it is necessary to know the accountId (wallet ID) seeAccountInfo.getWallets()
- Throws:
IOException
-
getSellTradeHistory
public UserTrades getSellTradeHistory(CoinbaseTradeHistoryParams params, String accountId) throws IOException The Coinbase is not typical exchange. It has splitted buys and sells into wallets (accounts). To get it is necessary to know the accountId (wallet ID) fromAccountInfo.getWallets()
- Throws:
IOException
-
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:
-
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:
-
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:
-