public NewLimitOrderSingle(BigDecimal size, BigDecimal price, Boolean post_only, String product_id) { this.size = size; this.price = price; this.post_only = post_only; setProduct_id(product_id); }
public NewMarketOrderSingle(){ setType("market"); }
public NewLimitOrderSingle(BigDecimal size, BigDecimal price, Boolean post_only, String clientOid, String type, String side, String product_id, String stp, String funds) { this.size = size; this.price = price; this.post_only = post_only; setClient_oid(clientOid); setType(type); setSide(side); setProduct_id(product_id); setStp(stp); setFunds(funds); }
private NewLimitOrderSingle getNewLimitOrderSingle(String productId, BigDecimal price, BigDecimal size) { NewLimitOrderSingle limitOrder = new NewLimitOrderSingle(); limitOrder.setProduct_id(productId); if (productId.contains("-BTC")) { limitOrder.setSide("sell"); } else { limitOrder.setSide("buy"); } limitOrder.setType("limit"); limitOrder.setPrice(price); limitOrder.setSize(size); return limitOrder; }
private NewMarketOrderSingle createNewMarketOrder(String product, String action, BigDecimal size){ NewMarketOrderSingle marketOrder = new NewMarketOrderSingle(); marketOrder.setProduct_id(product); marketOrder.setSide(action); marketOrder.setSize(size); return marketOrder; }
BigDecimal withdrawAmount = new BigDecimal(100); PaymentResponse response = withdrawalsService.makeWithdrawalToCoinbase(withdrawAmount, mainType.getCurrency(), account.getId()); assertTrue(response.getId().length() > 0 && response.getAmount().compareTo(withdrawAmount) == 0); log.info("Returned: " + response.getId()); gdaxAccount = accountService.getAccount(gdaxAccount.getId()); assertTrue(gdaxUSDValue.subtract(withdrawAmount).compareTo(gdaxAccount.getBalance()) == 0);
/** * @param amount * @param currency * @param paymentMethodId * @return PaymentResponse */ public PaymentResponse depositViaPaymentMethod(BigDecimal amount, String currency, final String paymentMethodId) { CoinbasePaymentRequest coinbasePaymentRequest = new CoinbasePaymentRequest(amount, currency, paymentMethodId); return exchange.post(DEPOSIT_ENDPOINT + PAYMENTS, new ParameterizedTypeReference<PaymentResponse>(){}, coinbasePaymentRequest); }
@Test public void canGetProducts() { List<Product> products = productService.getProducts(); products.forEach(item->System.out.println(item.getId())); assertTrue(products.size() >= 0); } }
public PaymentResponse makeWithdrawalToPaymentMethod(BigDecimal amount, String currency, String paymentMethodId) { PaymentRequest request = new PaymentRequest(amount, currency, paymentMethodId); return makeWithdrawal(request, PAYMENT_METHOD); }
public PaymentResponse makeWithdrawalToCryptoAccount(BigDecimal amount, String currency, String cryptoAccountAddress) { CryptoPaymentRequest request = new CryptoPaymentRequest(amount.setScale(8, BigDecimal.ROUND_DOWN), currency, cryptoAccountAddress); return makeWithdrawal(request, CRYPTO); }
@Test public void canGetAccountHolds() { List<Account> accounts = accountService.getAccounts(); List<Hold> holds = accountService.getHolds(accounts.get(0).getId()); assertTrue(holds != null); // only check the holds if they exist if (holds.size()>0) { assertTrue(holds.get(0).getAmount().floatValue() >= 0.0f); } }
log.info("Returned: " + response.getId());
/** * @param amount * @param currency * @param coinbaseAccountId * @return PaymentResponse */ public PaymentResponse depositViaCoinbase(BigDecimal amount, String currency, String coinbaseAccountId) { CoinbasePaymentRequest coinbasePaymentRequest = new CoinbasePaymentRequest(amount, currency, coinbaseAccountId); return exchange.post(DEPOSIT_ENDPOINT + COINBASE_PAYMENT, new ParameterizedTypeReference<PaymentResponse>(){}, coinbasePaymentRequest); } }
@Test public void canGetLevel1DataForAllProducts(){ List<Product> products = productService.getProducts(); for(Product product : products){ System.out.print("\nTesting: " + product.getId()); MarketData data = marketDataService.getMarketDataOrderBook(product.getId(), "1"); assertNotNull(data); if(data.getBids().size() > 0 && data.getAsks().size() > 0) System.out.print(" B: " + data.getBids().get(0).getPrice() + " A: " + data.getAsks().get(0).getPrice()); else System.out.print(" NO DATA "); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } }
public PaymentResponse makeWithdrawalToCoinbase(BigDecimal amount, String currency, String coinbaseAccountId) { CoinbasePaymentRequest request = new CoinbasePaymentRequest(amount.setScale(8, BigDecimal.ROUND_DOWN), currency, coinbaseAccountId); return makeWithdrawal(request, COINBASE); }