!7 import com.bitget.openapi.dto.request.ws.SubscribeReq; p { SS props = parseColonPropertyCIMap(loadTextFileMandatory(javaxSecretDir("bitget-credentials.txt"))); var cred = new BitGetCredentials() .apiKey(props.get("apikey")) .passphrase(props.get("passphrase")) .secretKey(props.get("secretkey")); 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"); }