putter and getter for assets from preferences
This commit is contained in:
parent
3fece7c044
commit
c426a5bb3e
@ -109,6 +109,7 @@ public class Globals {
|
|||||||
public static final String SESIMVERSION = "version";
|
public static final String SESIMVERSION = "version";
|
||||||
public static final String STRATEGIES = "strategies";
|
public static final String STRATEGIES = "strategies";
|
||||||
public static final String TRADERS = "traders";
|
public static final String TRADERS = "traders";
|
||||||
|
public static final String ASSETS = "assets";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,6 +336,16 @@ public class Globals {
|
|||||||
|
|
||||||
static public final Logger LOGGER = Logger.getLogger("com.cauwersin.sesim");
|
static public final Logger LOGGER = Logger.getLogger("com.cauwersin.sesim");
|
||||||
|
|
||||||
|
static public final JSONObject getAssets() {
|
||||||
|
String assets_json = prefs.get(PrefKeys.ASSETS, "{}");
|
||||||
|
return new JSONObject(assets_json);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public final void putAssets(JSONObject assets){
|
||||||
|
prefs.put(PrefKeys.ASSETS, assets.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static public final JSONArray getTraders() {
|
static public final JSONArray getTraders() {
|
||||||
|
|
||||||
String traders_json = Globals.prefs.get(PrefKeys.TRADERS, "[]");
|
String traders_json = Globals.prefs.get(PrefKeys.TRADERS, "[]");
|
||||||
@ -342,6 +353,8 @@ public class Globals {
|
|||||||
return traders;
|
return traders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static public final JSONObject getStrategies() {
|
static public final JSONObject getStrategies() {
|
||||||
String cfglist = Globals.prefs.get(PrefKeys.STRATEGIES, "{}");
|
String cfglist = Globals.prefs.get(PrefKeys.STRATEGIES, "{}");
|
||||||
JSONObject cfgs = new JSONObject(cfglist);
|
JSONObject cfgs = new JSONObject(cfglist);
|
||||||
|
Loading…
Reference in New Issue
Block a user