-
Notifications
You must be signed in to change notification settings - Fork 204
/
Main.java
35 lines (34 loc) · 1.19 KB
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import com.cryptochassis.ccapi.Event;
import com.cryptochassis.ccapi.EventHandler;
import com.cryptochassis.ccapi.MapStringString;
import com.cryptochassis.ccapi.Request;
import com.cryptochassis.ccapi.Session;
import com.cryptochassis.ccapi.SessionConfigs;
import com.cryptochassis.ccapi.SessionOptions;
public class Main {
static class MyEventHandler extends EventHandler {
@Override
public boolean processEvent(Event event, Session session) {
System.out.println(String.format("Received an event:\n%s", event.toStringPretty(2, 2)));
return true;
}
}
public static void main(String[] args) {
System.loadLibrary("ccapi_binding_java");
var eventHandler = new MyEventHandler();
var option = new SessionOptions();
var config = new SessionConfigs();
var session = new Session(option, config, eventHandler);
var request = new Request(Request.Operation.GET_RECENT_TRADES, "okx", "BTC-USDT");
var param = new MapStringString();
param.put("LIMIT", "1");
request.appendParam(param);
session.sendRequest(request);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
}
session.stop();
System.out.println("Bye");
}
}