public final class CoinbaseTradeService extends CoinbaseBasePollingService implements PollingTradeService
coinbase, signatureCreator
exchange
Constructor and Description |
---|
CoinbaseTradeService(Exchange exchange)
Constructor
|
Modifier and Type | Method and Description |
---|---|
CoinbaseTransfer |
buy(BigDecimal quantity)
Authenticated resource that lets you purchase Bitcoin using the primary bank account that is linked to your account.
|
CoinbaseTransfer |
buyAndAgreeBTCAmountVaries(BigDecimal quantity)
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
|
TradeHistoryParams |
createTradeHistoryParams()
Create
TradeHistoryParams object specific to this exchange. |
CoinbaseTransfers |
getCoinbaseTransfers()
Authenticated resource which returns the user’s Bitcoin purchases and sells.
|
CoinbaseTransfers |
getCoinbaseTransfers(Integer page,
Integer limit)
Authenticated resource which returns the user’s Bitcoin purchases and sells.
|
OpenOrders |
getOpenOrders()
Gets the open orders
|
UserTrades |
getTradeHistory(Object... arguments)
Authenticated resource which returns the user’s Bitcoin purchases and sells.
|
UserTrades |
getTradeHistory(TradeHistoryParams params)
Fetch the history of user trades.
|
String |
placeLimitOrder(LimitOrder limitOrder)
Place a limit order
|
String |
placeMarketOrder(MarketOrder marketOrder)
Place a market order
|
CoinbaseTransfer |
sell(BigDecimal quantity)
Authenticated resource that lets you convert Bitcoin in your account to USD by crediting your primary bank account on Coinbase.
|
createCoinbaseToken, createCoinbaseUser, createCoinbaseUser, getCoinbaseCurrencies, handleResponse
getExchangeSymbols, verifyOrder, verifyOrder, verifyOrder
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
verifyOrder, verifyOrder
getExchangeSymbols
public CoinbaseTradeService(Exchange exchange)
exchange
- public OpenOrders getOpenOrders() throws NotAvailableFromExchangeException
PollingTradeService
getOpenOrders
in interface PollingTradeService
NotAvailableFromExchangeException
- - Indication that the exchange does not support the requested function or datapublic String placeMarketOrder(MarketOrder marketOrder) throws ExchangeException, IOException
PollingTradeService
placeMarketOrder
in interface PollingTradeService
ExchangeException
- - Indication that the exchange reported some kind of error with the request or responseIOException
- - Indication that a networking error occurred while fetching JSON datapublic String placeLimitOrder(LimitOrder limitOrder) throws NotAvailableFromExchangeException
PollingTradeService
placeLimitOrder
in interface PollingTradeService
NotAvailableFromExchangeException
- - Indication that the exchange does not support the requested function or datapublic boolean cancelOrder(String orderId) throws NotAvailableFromExchangeException
PollingTradeService
cancelOrder
in interface PollingTradeService
NotAvailableFromExchangeException
- - Indication that the exchange does not support the requested function or datapublic UserTrades getTradeHistory(Object... arguments) throws ExchangeException, IOException
getTradeHistory
in interface PollingTradeService
arguments
- Optional Integer arguments page (arg[0]) and limit (arg[1]). If no arguments are given then page 1 will be returned and the
results are limited to 25 per page by coinbase by default.ExchangeException
- - Indication that the exchange reported some kind of error with the request or responseIOException
- - Indication that a networking error occurred while fetching JSON datapublic UserTrades getTradeHistory(TradeHistoryParams params) throws IOException
PollingTradeService
PollingTradeService.createTradeHistoryParams()
and check which parameters are required or supported using instanceof operator. See subinterfaces of
TradeHistoryParams
. Note that whether an interface is required or supported will vary from exchange to exchange and it's described only
through the javadoc.
There is also implementation of all the common interfaces, TradeHistoryParamsAll
, that,
with all properties set non-null, should work with any exchange.
Some exchanges allow extra parameters, not covered by any common interface. To access them, you will have to use the object returned by
PollingTradeService.createTradeHistoryParams()
and cast it to the exchange-specific type.getTradeHistory
in interface PollingTradeService
params
- The parameters describing the filter. Note that TradeHistoryParams
is an empty interface. Exact set of interfaces that are
required or supported by this method is described by the type of object returned from PollingTradeService.createTradeHistoryParams()
and the javadoc
of the method.IOException
- - Indication that a networking error occurred while fetching JSON dataPollingTradeService.getTradeHistory(Object...)
,
PollingTradeService.createTradeHistoryParams()
,
TradeHistoryParamsAll
public TradeHistoryParams createTradeHistoryParams()
PollingTradeService
TradeHistoryParams
object specific to this exchange. Object created by this method may be used to discover supported and required
PollingTradeService.getTradeHistory(TradeHistoryParams)
parameters and should be passed only to the method in the same class as the createTradeHistoryParams
that created the object.createTradeHistoryParams
in interface PollingTradeService
public CoinbaseTransfer buy(BigDecimal quantity) throws IOException
buyAndAgreeBTCAmountVaries(java.math.BigDecimal)
to have it set to true.quantity
- The quantity of Bitcoin you would like to buy.CoinbaseTransfer
representing the buy.IOException
public CoinbaseTransfer buyAndAgreeBTCAmountVaries(BigDecimal quantity) throws IOException
buyAndAgreeBTCAmountVaries(java.math.BigDecimal)
to have it set to false.quantity
- The quantity of Bitcoin you would like to buy.CoinbaseTransfer
representing the buy.IOException
public CoinbaseTransfer sell(BigDecimal quantity) throws IOException
quantity
- The quantity of Bitcoin you would like to sell.CoinbaseTransfer
representing the sell.IOException
public CoinbaseTransfers getCoinbaseTransfers() throws IOException
IOException
public CoinbaseTransfers getCoinbaseTransfers(Integer page, Integer limit) throws IOException
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.IOException
Copyright © 2012–2018 Xeiam, LLC. All rights reserved.