!7 import com.bitget.openapi.dto.request.ws.SubscribeReq; p { File credFile = javaxSecretDir("BitGet/trade-credentials.txt"); var cred = BitGetCredentials.fromFile(credFile); 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"); }