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

Method setSandboxMode

java/lib/src/main/java/io/github/ccxt/Exchange.java:4634–4669  ·  view source on GitHub ↗

@method @name Exchange#setSandboxMode @description set the sandbox mode for the exchange @param {boolean} enabled true to enable sandbox mode, false to disable it

(Object enabled)

Source from the content-addressed store, hash-verified

4632 * @param {boolean} enabled true to enable sandbox mode, false to disable it
4633 */
4634 public void setSandboxMode(Object enabled)
4635 {
4636 if (Helpers.isTrue(enabled))
4637 {
4638 if (Helpers.isTrue(Helpers.inOp(this.urls, "test")))
4639 {
4640 if (Helpers.isTrue((Helpers.GetValue(this.urls, "api") instanceof String)))
4641 {
4642 Helpers.addElementToObject(this.urls, "apiBackup", Helpers.GetValue(this.urls, "api"));
4643 Helpers.addElementToObject(this.urls, "api", Helpers.GetValue(this.urls, "test"));
4644 } else
4645 {
4646 Helpers.addElementToObject(this.urls, "apiBackup", this.clone(Helpers.GetValue(this.urls, "api")));
4647 Helpers.addElementToObject(this.urls, "api", this.clone(Helpers.GetValue(this.urls, "test")));
4648 }
4649 } else
4650 {
4651 throw new NotSupported((String)Helpers.add(this.id, " does not have a sandbox URL")) ;
4652 }
4653 // set flag
4654 this.isSandboxModeEnabled = true;
4655 } else if (Helpers.isTrue(Helpers.inOp(this.urls, "apiBackup")))
4656 {
4657 if (Helpers.isTrue((Helpers.GetValue(this.urls, "api") instanceof String)))
4658 {
4659 Helpers.addElementToObject(this.urls, "api", ((Object)Helpers.GetValue(this.urls, "apiBackup")));
4660 } else
4661 {
4662 Helpers.addElementToObject(this.urls, "api", this.clone(Helpers.GetValue(this.urls, "apiBackup")));
4663 }
4664 Object newUrls = this.omit(this.urls, "apiBackup");
4665 this.urls = newUrls;
4666 // set flag
4667 this.isSandboxModeEnabled = false;
4668 }
4669 }
4670
4671 /**
4672 * @method

Callers 5

afterConstructMethod · 0.95
helperTestInitSandboxMethod · 0.95
InitOptionsMethod · 0.45
startTestMethod · 0.45
testUnWatchPositionsMethod · 0.45

Calls 7

isTrueMethod · 0.95
inOpMethod · 0.95
GetValueMethod · 0.95
addElementToObjectMethod · 0.95
cloneMethod · 0.95
addMethod · 0.95
omitMethod · 0.95

Tested by 3

helperTestInitSandboxMethod · 0.76
startTestMethod · 0.36
testUnWatchPositionsMethod · 0.36