!7 import com.bitget.openapi.dto.request.ws.SubscribeReq; p { var cred = new BitGetCredentials() .apiKey("bg_f9f9afe578ea7846b3c09b731a46c7a8") .passphrase("begchtflmktd") .secretKey("0c23ff045774f555371c5663219e2163e3aec42c6f6884bee18f529b4fb8f70f"); var client = bitGetWSClientBuilder(cred) .listener(response -> { JSONObject json = JSONObject.parseObject(response); print("got: " + json); appendToTextFile(javaxDataDir("Crypto/btc-candles.log"), json + "\n"); }) .errorListener(response -> { JSONObject json = JSONObject.parseObject(response); print("error:" + json); }) .build(); print("Subscribing to BitCoin 1m candles!"); client.subscribe(ll( SubscribeReq.builder().instType("SP").channel("candle1m").instId("BTCUSDT").build() )); print("Subscribed!"); } svoid closeBitGetWebSocket(BitgetWsClient client) { // Trick client into closing connection without reconnect set(client, reconnectStatus := true); call(get(client, "webSocket"), "close", 1000, "Closing voluntarily"); }