Created
August 2, 2019 14:30
-
-
Save coinscious-io/c30838e1eb319cad6a7ba7ff44c517d9 to your computer and use it in GitHub Desktop.
Get OHLCV data for a cryptocurrency trading pair at a specific exchange
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import okhttp3.Dispatcher; | |
import okhttp3.OkHttpClient; | |
import okhttp3.Request; | |
import okhttp3.Response; | |
import java.io.IOException; | |
public class Example { | |
public static void main(String[] args) throws IOException { | |
Request request = new Request.Builder() | |
.get() | |
.url("https://api.coinscious.org/ohlcv/binance/eth_btc?start=1563593400000&end=1563598800000") | |
.addHeader("Authorization", "bearer <token>") | |
.build(); | |
Dispatcher dispatcher = new Dispatcher(); | |
OkHttpClient client = new OkHttpClient.Builder() | |
.dispatcher(dispatcher) | |
.build(); | |
Response response = client.newCall(request).execute(); | |
String body = response.body().string(); | |
System.out.println(body); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment