use of org.knowm.xchange.gemini.v1.dto.GeminiException in project XChange by knowm.
the class GeminiAccountServiceRaw method getGeminiAccountInfo.
public GeminiBalancesResponse[] getGeminiAccountInfo() throws IOException {
try {
GeminiBalancesRequest request = new GeminiBalancesRequest(String.valueOf(exchange.getNonceFactory().createValue()));
GeminiBalancesResponse[] balances = gemini.balances(apiKey, payloadCreator, signatureCreator, request);
return balances;
} catch (GeminiException e) {
throw handleException(e);
}
}
use of org.knowm.xchange.gemini.v1.dto.GeminiException in project XChange by knowm.
the class GeminiAccountServiceRaw method Get30DayTrailingVolumeDescription.
public GeminiTrailingVolumeResponse Get30DayTrailingVolumeDescription() throws IOException {
try {
GeminiTrailingVolumeRequest request = new GeminiTrailingVolumeRequest(String.valueOf(exchange.getNonceFactory().createValue()));
GeminiTrailingVolumeResponse trailingVolResp = gemini.TrailingVolume(apiKey, payloadCreator, signatureCreator, request);
return trailingVolResp;
} catch (GeminiException e) {
throw handleException(e);
}
}
use of org.knowm.xchange.gemini.v1.dto.GeminiException in project XChange by knowm.
the class GeminiAccountServiceRaw method withdraw.
public String withdraw(Currency currency, BigDecimal amount, String address) throws IOException {
try {
String ccy = convertToGeminiCcyName(currency.getCurrencyCode());
GeminiWithdrawalRequest request = new GeminiWithdrawalRequest(String.valueOf(exchange.getNonceFactory().createValue()), ccy, amount, address);
GeminiWithdrawalResponse withdrawRepsonse = gemini.withdraw(apiKey, payloadCreator, signatureCreator, ccy, request);
return withdrawRepsonse.txHash;
} catch (GeminiException e) {
throw handleException(e);
}
}
use of org.knowm.xchange.gemini.v1.dto.GeminiException in project XChange by knowm.
the class GeminiTradeServiceRaw method placeGeminiLimitOrder.
public GeminiOrderStatusResponse placeGeminiLimitOrder(LimitOrder limitOrder, GeminiOrderType GeminiOrderType) throws IOException {
String pair = GeminiUtils.toPairString(limitOrder.getCurrencyPair());
String type = limitOrder.getType().equals(Order.OrderType.BID) ? "buy" : "sell";
String orderType = GeminiOrderType.toString();
Set<IOrderFlags> flags = limitOrder.getOrderFlags();
Object[] options;
if (flags.isEmpty()) {
options = null;
} else {
ArrayList<String> list = new ArrayList<String>();
if (flags.contains(GeminiOrderFlags.IMMEDIATE_OR_CANCEL)) {
list.add("immediate-or-cancel");
}
if (flags.contains(GeminiOrderFlags.POST_ONLY)) {
list.add("maker-or-cancel");
}
if (flags.contains(GeminiOrderFlags.FILL_OR_KILL)) {
list.add("fill-or-kill");
}
if (flags.contains(GeminiOrderFlags.AUCTION_ONLY)) {
list.add("auction-only");
}
if (flags.contains(GeminiOrderFlags.INDICATION_OF_INTEREST)) {
list.add("indication-of-interest");
}
options = list.toArray();
}
GeminiNewOrderRequest request = new GeminiNewOrderRequest(String.valueOf(exchange.getNonceFactory().createValue()), limitOrder.getUserReference(), pair, limitOrder.getOriginalAmount(), limitOrder.getLimitPrice(), "Gemini", type, orderType, options);
try {
GeminiOrderStatusResponse newOrder = gemini.newOrder(apiKey, payloadCreator, signatureCreator, request);
return newOrder;
} catch (GeminiException e) {
throw handleException(e);
}
}
use of org.knowm.xchange.gemini.v1.dto.GeminiException in project XChange by knowm.
the class GeminiAccountServiceRaw method requestDepositAddressRaw.
public GeminiDepositAddressResponse requestDepositAddressRaw(Currency currency) throws IOException {
try {
String ccy = convertToGeminiCcyName(currency.getCurrencyCode());
GeminiDepositAddressRequest exchange = new GeminiDepositAddressRequest(String.valueOf(this.exchange.getNonceFactory().createValue()), ccy, null);
GeminiDepositAddressResponse requestDepositAddressResponse = gemini.requestNewAddress(apiKey, payloadCreator, signatureCreator, ccy, exchange);
if (requestDepositAddressResponse != null) {
return requestDepositAddressResponse;
} else {
return null;
}
} catch (GeminiException e) {
throw handleException(e);
}
}
Aggregations