com.xeiam.xchange.bitstamp.service.polling.BitstampTradeServiceRaw Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xchange-bitstamp Show documentation
Show all versions of xchange-bitstamp Show documentation
XChange implementation for the Bitstamp Exchange
package com.xeiam.xchange.bitstamp.service.polling;
import java.io.IOException;
import java.math.BigDecimal;
import si.mazi.rescu.RestProxyFactory;
import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.bitstamp.BitstampAuthenticated;
import com.xeiam.xchange.bitstamp.dto.trade.BitstampOrder;
import com.xeiam.xchange.bitstamp.dto.trade.BitstampUserTransaction;
import com.xeiam.xchange.bitstamp.service.BitstampDigest;
/**
* @author gnandiga
*/
public class BitstampTradeServiceRaw extends BitstampBasePollingService {
private final BitstampAuthenticated bitstampAuthenticated;
private final BitstampDigest signatureCreator;
/**
* @param exchange
*/
public BitstampTradeServiceRaw(Exchange exchange) {
super(exchange);
this.bitstampAuthenticated = RestProxyFactory.createProxy(BitstampAuthenticated.class, exchange.getExchangeSpecification().getSslUri());
this.signatureCreator = BitstampDigest.createInstance(exchange.getExchangeSpecification().getSecretKey(), exchange.getExchangeSpecification()
.getUserName(), exchange.getExchangeSpecification().getApiKey());
}
public BitstampOrder[] getBitstampOpenOrders() throws IOException {
return bitstampAuthenticated.getOpenOrders(exchange.getExchangeSpecification().getApiKey(), signatureCreator, exchange.getNonceFactory());
}
public BitstampOrder sellBitstampOrder(BigDecimal tradableAmount, BigDecimal price) throws IOException {
return bitstampAuthenticated.sell(exchange.getExchangeSpecification().getApiKey(), signatureCreator, exchange.getNonceFactory(), tradableAmount,
price);
}
public BitstampOrder buyBitStampOrder(BigDecimal tradableAmount, BigDecimal price) throws IOException {
return bitstampAuthenticated.buy(exchange.getExchangeSpecification().getApiKey(), signatureCreator, exchange.getNonceFactory(), tradableAmount,
price);
}
public boolean cancelBitstampOrder(int orderId) throws IOException {
return bitstampAuthenticated.cancelOrder(exchange.getExchangeSpecification().getApiKey(), signatureCreator, exchange.getNonceFactory(), orderId);
}
public BitstampUserTransaction[] getBitstampUserTransactions(Long numberOfTransactions) throws IOException {
return bitstampAuthenticated.getUserTransactions(exchange.getExchangeSpecification().getApiKey(), signatureCreator, exchange.getNonceFactory(),
numberOfTransactions);
}
public BitstampUserTransaction[] getBitstampUserTransactions(Long numberOfTransactions, Long offset, String sort) throws IOException {
return bitstampAuthenticated.getUserTransactions(exchange.getExchangeSpecification().getApiKey(), signatureCreator, exchange.getNonceFactory(),
numberOfTransactions, offset, sort);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy