调用TheRockTrading API时出现FileNotFoundException

时间:2018-09-22 13:59:14

标签: java api bitcoin filenotfoundexception algorithmic-trading

我正在尝试访问TheRockTrading Exchange API,但是当我尝试访问私人余额查询时,出现FileNotFoundException

public static void main(String[] args) throws InterruptedException {
    try {
        //MANNAGGIA ALLA MADONNA

        URL a = null;
        try {
            a = new URL("https://api.therocktrading.com/v1/balance");
        } catch (MalformedURLException ex) {
            Logger.getLogger(Miner.class.getName()).log(Level.SEVERE, null, ex);
        }

        HttpsURLConnection ac = (HttpsURLConnection) a.openConnection();
        ac.setRequestMethod("GET");
        ac.setDoInput(true);
        ac.setAllowUserInteraction(false);
        ac.setRequestProperty("User-Agent", "infofetch");
        ac.setRequestProperty("Connection", "close");


        try(BufferedReader br = new BufferedReader(new InputStreamReader(ac.getInputStream()))) {
            String l = null;

            while ((l=br.readLine())!=null) {
                System.out.println(l);
            }
        } catch(IOException ioex) {
            System.err.println("IOException while reading");
            ioex.printStackTrace();
        }
    } catch (IOException ex) {
        Logger.getLogger(Miner.class.getName()).log(Level.SEVERE, null, ex);
    }
}

缺少APIkey和签名,但我至少应该收到一些东西,而不是FileNotFoundException

java.io.FileNotFoundException: https://api.therocktrading.com/v1/balance
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1890)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at Miner.main(Miner.java:37)

0 个答案:

没有答案