Package com.coinbase.api.exception

Examples of com.coinbase.api.exception.CoinbaseException


    public void deleteRequest(String id) throws CoinbaseException, IOException {
        URL cancelRequestUrl;
        try {
            cancelRequestUrl = new URL(_baseUrl, "transactions/" + id + "/cancel_request");
        } catch (MalformedURLException ex) {
            throw new CoinbaseException("Invalid transaction id");
        }
        delete(cancelRequestUrl, Response.class);
    }
View Full Code Here


    public Transaction completeRequest(String id) throws CoinbaseException, IOException {
        URL completeRequestUrl;
        try {
            completeRequestUrl = new URL(_baseUrl, "transactions/" + id + "/complete_request");
        } catch (MalformedURLException ex) {
            throw new CoinbaseException("Invalid transaction id");
        }
        return put(completeRequestUrl, newAccountSpecificRequest(), TransactionResponse.class).getTransaction();
    }
View Full Code Here

                _baseUrl,
                "transfers?page=" + page +
                (_accountId != null ? "&account_id=" + _accountId : "")
            );
        } catch (MalformedURLException ex) {
            throw new CoinbaseException("Invalid account id");
        }
        return get(transfersUrl, TransfersResponse.class);
    }
View Full Code Here

        return sell(amount, null);
    }

    public Transfer sell(Money amount, String paymentMethodId) throws CoinbaseException, IOException {
        if (!amount.getCurrencyUnit().getCode().equals("BTC")) {
            throw new CoinbaseException(
                "Cannot sell " + amount.getCurrencyUnit().getCode()
                + " Only BTC amounts are supported for sells"
            );
        }
View Full Code Here

        return buy(amount, null);
    }

    public Transfer buy(Money amount, String paymentMethodId) throws CoinbaseException, IOException {
        if (!amount.getCurrencyUnit().getCode().equals("BTC")) {
            throw new CoinbaseException(
                "Cannot buy " + amount.getCurrencyUnit().getCode()
                + " Only BTC amounts are supported for buys"
            );
        }
View Full Code Here

    public Order getOrder(String idOrCustom) throws IOException, CoinbaseException {
        URL orderUrl;
        try {
            orderUrl = new URL(_baseUrl, "orders/" + idOrCustom);
        } catch (MalformedURLException ex) {
            throw new CoinbaseException("Invalid order id/custom");
        }
        return get(orderUrl, OrderResponse.class).getOrder();
    }
View Full Code Here

                _baseUrl,
                "orders?page=" + page +
                (_accountId != null ? "&account_id=" + _accountId : "")
            );
        } catch (MalformedURLException ex) {
            throw new CoinbaseException("Invalid  account id");
        }
        return get(ordersUrl, OrdersResponse.class);
    }
View Full Code Here

                _baseUrl,
                "addresses?page=" + page +
                (_accountId != null ? "&account_id=" + _accountId : "")
            );
        } catch (MalformedURLException ex) {
            throw new CoinbaseException("Invalid account id");
        }
        return get(addressesUrl, AddressesResponse.class);
    }
View Full Code Here

                hp.setTime(DateTime.parse(nextLine[0]));
                hp.setSpotPrice(Money.of(CurrencyUnit.USD, new BigDecimal(nextLine[1])));
                result.add(hp);
            }
        } catch (IOException e) {
            throw new CoinbaseException("Error parsing csv response");
        } finally {
            try {
                reader.close();
            } catch (IOException e) {}
        }
View Full Code Here

    public Order createOrderForButton(String buttonCode) throws CoinbaseException, IOException {
        URL createOrderForButtonUrl;
        try {
            createOrderForButtonUrl = new URL(_baseUrl, "buttons/" + buttonCode + "/create_order");
        } catch (MalformedURLException ex) {
            throw new CoinbaseException("Invalid button code");
        }

        return post(createOrderForButtonUrl, new Request(), OrderResponse.class).getOrder();
    }
View Full Code Here

TOP

Related Classes of com.coinbase.api.exception.CoinbaseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.