Search in sources :

Example 1 with BitstampAuthenticatedV2

use of org.knowm.xchange.bitstamp.BitstampAuthenticatedV2 in project XChange by knowm.

the class BitstampTradeService method placeMarketOrder.

@Override
public String placeMarketOrder(MarketOrder order) throws IOException, BitstampException {
    BitstampAuthenticatedV2.Side side = order.getType().equals(BID) ? BitstampAuthenticatedV2.Side.buy : BitstampAuthenticatedV2.Side.sell;
    BitstampOrder bitstampOrder = placeBitstampMarketOrder(order.getCurrencyPair(), side, order.getOriginalAmount());
    if (bitstampOrder.getErrorMessage() != null) {
        throw new ExchangeException(bitstampOrder.getErrorMessage());
    }
    return Long.toString(bitstampOrder.getId());
}
Also used : BitstampOrder(org.knowm.xchange.bitstamp.dto.trade.BitstampOrder) ExchangeException(org.knowm.xchange.exceptions.ExchangeException) BitstampAuthenticatedV2(org.knowm.xchange.bitstamp.BitstampAuthenticatedV2)

Example 2 with BitstampAuthenticatedV2

use of org.knowm.xchange.bitstamp.BitstampAuthenticatedV2 in project XChange by knowm.

the class BitstampTradeService method placeLimitOrder.

@Override
public String placeLimitOrder(LimitOrder order) throws IOException, BitstampException {
    BitstampAuthenticatedV2.Side side = order.getType().equals(BID) ? BitstampAuthenticatedV2.Side.buy : BitstampAuthenticatedV2.Side.sell;
    BitstampOrder bitstampOrder = placeBitstampOrder(order.getCurrencyPair(), side, order.getOriginalAmount(), order.getLimitPrice());
    if (bitstampOrder.getErrorMessage() != null) {
        throw new ExchangeException(bitstampOrder.getErrorMessage());
    }
    return Long.toString(bitstampOrder.getId());
}
Also used : BitstampOrder(org.knowm.xchange.bitstamp.dto.trade.BitstampOrder) ExchangeException(org.knowm.xchange.exceptions.ExchangeException) BitstampAuthenticatedV2(org.knowm.xchange.bitstamp.BitstampAuthenticatedV2)

Aggregations

BitstampAuthenticatedV2 (org.knowm.xchange.bitstamp.BitstampAuthenticatedV2)2 BitstampOrder (org.knowm.xchange.bitstamp.dto.trade.BitstampOrder)2 ExchangeException (org.knowm.xchange.exceptions.ExchangeException)2