Exchange intrface extended to support selling crypto

This commit is contained in:
b00lean 2015-01-20 23:55:46 +01:00
parent 73c4578deb
commit 89d7674b75
3 changed files with 36 additions and 0 deletions

View File

@ -69,6 +69,18 @@ public interface IExchange {
*/
public String purchaseCoins(BigDecimal amount, String cryptoCurrency, String fiatCurrencyToUse, String description);
/**
* This method is used for selling coins on the exchange for specified fiat currency.
* If something fails this method should return NULL otherwise it should return orderId or any other identifier that exchange provides for later tracking
*
* @param cryptoAmount
* @param cryptoCurrency
* @param fiatCurrencyToUse
* @param description
* @return
*/
public String sellCoins(BigDecimal cryptoAmount, String cryptoCurrency, String fiatCurrencyToUse, String description);
/**
* This method is used for withdrawing coins from the exchange by sending them to specified address
*
@ -86,4 +98,5 @@ public interface IExchange {
* @return
*/
public String getDepositAddress(String cryptoCurrency);
}

View File

@ -32,4 +32,16 @@ public interface IExchangeAdvanced extends IExchange{
* @return
*/
public ITask createPurchaseCoinsTask(BigDecimal amount, String cryptoCurrency, String fiatCurrencyToUse, String description);
/**
* This method is used for instantiating task that is later called to sell coins on the exchange for specified fiat currency.
* If something fails this method should return NULL otherwise it should return orderId or any other identifier that exchange provides for later tracking
*
* @param amount
* @param cryptoCurrency
* @param fiatCurrencyToUse
* @param description
* @return
*/
public ITask createSellCoinsTask(BigDecimal amount, String cryptoCurrency, String fiatCurrencyToUse, String description);
}

View File

@ -276,6 +276,17 @@ public class BitfinexExchange implements IExchangeAdvanced, IRateSource {
return null;
}
@Override
public String sellCoins(BigDecimal cryptoAmount, String cryptoCurrency, String fiatCurrencyToUse, String description) {
//TODO: NOT SUPPORTED YET
return null;
}
@Override
public ITask createSellCoinsTask(BigDecimal amount, String cryptoCurrency, String fiatCurrencyToUse, String description) {
//TODO: NOT SUPPORTED YET
return null;
}
class PurchaseCoinsTaks implements ITask {
private long MAXIMUM_TIME_TO_WAIT_FOR_ORDER_TO_FINISH = 5 * 60 * 60 * 1000; //5 hours