MCPcopy Index your code
hub / github.com/ccxt/ccxt / expandSettings

Method expandSettings

java/tests/src/main/java/tests/exchange/TestMain.java:197–262  ·  view source on GitHub ↗
(Exchange exchange)

Source from the content-addressed store, hash-verified

195 }
196
197 public void expandSettings(Exchange exchange)
198 {
199 Object exchangeId = exchange.id;
200 Object keysGlobal = Helpers.add(getRootDir(), "keys.json");
201 Object keysLocal = Helpers.add(getRootDir(), "keys.local.json");
202 Object keysGlobalExists = ioFileExists(keysGlobal);
203 Object keysLocalExists = ioFileExists(keysLocal);
204 Object globalSettings = new java.util.HashMap<String, Object>() {{}};
205 if (Helpers.isTrue(keysGlobalExists))
206 {
207 globalSettings = ioFileRead(keysGlobal);
208 }
209 Object localSettings = new java.util.HashMap<String, Object>() {{}};
210 if (Helpers.isTrue(keysLocalExists))
211 {
212 localSettings = ioFileRead(keysLocal);
213 }
214 Object allSettings = exchange.deepExtend(globalSettings, localSettings);
215 Object exchangeSettings = exchange.safeValue(allSettings, exchangeId, new java.util.HashMap<String, Object>() {{}});
216 if (Helpers.isTrue(exchangeSettings))
217 {
218 Object settingKeys = Helpers.objectKeys(exchangeSettings);
219 for (var i = 0; Helpers.isLessThan(i, Helpers.getArrayLength(settingKeys)); i++)
220 {
221 Object key = Helpers.GetValue(settingKeys, i);
222 if (Helpers.isTrue(Helpers.GetValue(exchangeSettings, key)))
223 {
224 Object finalValue = null;
225 if (Helpers.isTrue(exchange.isDictionary(Helpers.GetValue(exchangeSettings, key))))
226 {
227 Object existing = getExchangeProp(exchange, key, new java.util.HashMap<String, Object>() {{}});
228 finalValue = exchange.deepExtend(existing, Helpers.GetValue(exchangeSettings, key));
229 } else
230 {
231 finalValue = Helpers.GetValue(exchangeSettings, key);
232 }
233 setExchangeProp(exchange, key, finalValue);
234 }
235 }
236 }
237 // credentials
238 if (Helpers.isTrue(this.loadKeys))
239 {
240 this.loadCredentialsFromEnv(exchange);
241 }
242 // skipped tests
243 Object skippedFile = Helpers.add(getRootDir(), "skip-tests.json");
244 Object skippedSettings = ioFileRead(skippedFile);
245 this.skippedSettingsForExchange = exchange.safeValue(skippedSettings, exchangeId, new java.util.HashMap<String, Object>() {{}});
246 Object skippedSettingsForExchange = this.skippedSettingsForExchange;
247 // others
248 Object timeout = exchange.safeValue(skippedSettingsForExchange, "timeout");
249 if (Helpers.isTrue(!Helpers.isEqual(timeout, null)))
250 {
251 exchange.timeout = exchange.parseToInt(timeout);
252 }
253 if (Helpers.isTrue(getCliArgValue("--useProxy")))
254 {

Callers 1

initInnerMethod · 0.95

Calls 15

addMethod · 0.95
isTrueMethod · 0.95
objectKeysMethod · 0.95
isLessThanMethod · 0.95
getArrayLengthMethod · 0.95
GetValueMethod · 0.95
isEqualMethod · 0.95
getRootDirMethod · 0.80
ioFileExistsMethod · 0.80
ioFileReadMethod · 0.80
getExchangePropMethod · 0.80

Tested by

no test coverage detected