Aguante Python
This commit is contained in:
parent
bff178991f
commit
b695ed1121
|
|
@ -11,7 +11,6 @@ import com.google.gson.JsonSyntaxException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
|
|
@ -181,8 +180,30 @@ public class InstanceInterface {
|
||||||
pausedTraders.add(pausedTradersJsonArray.get(i).getAsString());
|
pausedTraders.add(pausedTradersJsonArray.get(i).getAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assuming jsonObject is already defined and represents the root JSON object
|
||||||
|
JsonObject generalDataObject = jsonObject.getAsJsonObject("config");
|
||||||
|
JsonArray pairJsonArray = generalDataObject.get("pairs").getAsJsonArray();
|
||||||
|
List<String> pairsInConfig = new ArrayList<>();
|
||||||
|
for (int i = 0; i < pairJsonArray.size(); i++) {
|
||||||
|
pairsInConfig.add(pairJsonArray.get(i).getAsString());
|
||||||
|
}
|
||||||
|
|
||||||
//Extract BrokerConfigData from the JSON response
|
//Extract BrokerConfigData from the JSON response
|
||||||
BrokerConfigData brokerConfigData = null;
|
BrokerConfigData brokerConfigData = new BrokerConfigData(
|
||||||
|
jsonObject.get("broker_name").getAsString(),
|
||||||
|
jsonObject.get("is_sandbox").getAsBoolean(),
|
||||||
|
jsonObject.get("simulate_market_orders").getAsBoolean(),
|
||||||
|
pairsInConfig,
|
||||||
|
jsonObject.get("laptime").getAsDouble(),
|
||||||
|
jsonObject.get("cooldown_multiplier").getAsDouble(),
|
||||||
|
jsonObject.get("wait_before_new_safety_order").getAsDouble(),
|
||||||
|
jsonObject.get("telegram").getAsBoolean(),
|
||||||
|
jsonObject.get("bot_token").getAsString(),
|
||||||
|
jsonObject.get("chat_id").getAsString(),
|
||||||
|
jsonObject.get("attempt_to_restart").getAsBoolean(),
|
||||||
|
jsonObject.get("default_order_size").getAsDouble(),
|
||||||
|
jsonObject.get("unifiedOrderQuery").getAsBoolean());
|
||||||
|
|
||||||
|
|
||||||
return new InstanceGlobalStatsData(
|
return new InstanceGlobalStatsData(
|
||||||
jsonObject.get("name").getAsString(),
|
jsonObject.get("name").getAsString(),
|
||||||
|
|
@ -196,9 +217,6 @@ public class InstanceInterface {
|
||||||
} catch (JsonSyntaxException e) {
|
} catch (JsonSyntaxException e) {
|
||||||
System.err.println("The JSON response is not valid.");
|
System.err.println("The JSON response is not valid.");
|
||||||
return null;
|
return null;
|
||||||
} catch (IOException e) {
|
|
||||||
System.err.println("There was an error reading the JSON response.");
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue