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

Method initRestRateLimiter

java/lib/src/main/java/io/github/ccxt/Exchange.java:5690–5716  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5688 }
5689
5690 public void initRestRateLimiter()
5691 {
5692 if (Helpers.isTrue(Helpers.isTrue(Helpers.isEqual(this.rateLimit, null)) || Helpers.isTrue((Helpers.isTrue(!Helpers.isEqual(this.id, null)) && Helpers.isTrue(Helpers.isEqual(this.rateLimit, Helpers.opNeg(1)))))))
5693 {
5694 throw new ExchangeError((String)Helpers.add(this.id, ".rateLimit property is not configured")) ;
5695 }
5696 Object refillRate = this.MAX_VALUE;
5697 if (Helpers.isTrue(Helpers.isGreaterThan(this.rateLimit, 0)))
5698 {
5699 refillRate = Helpers.divide(1, this.rateLimit);
5700 }
5701 Object useLeaky = Helpers.isTrue((Helpers.isEqual(this.rollingWindowSize, 0))) || Helpers.isTrue((Helpers.isEqual(this.rateLimiterAlgorithm, "leakyBucket")));
5702 Object algorithm = ((Helpers.isTrue(useLeaky))) ? "leakyBucket" : "rollingWindow";
5703 final Object finalRefillRate = refillRate;
5704 Object defaultBucket = new java.util.HashMap<String, Object>() {{
5705 put( "delay", 0.001 );
5706 put( "capacity", 1 );
5707 put( "cost", 1 );
5708 put( "refillRate", finalRefillRate );
5709 put( "algorithm", algorithm );
5710 put( "windowSize", Exchange.this.rollingWindowSize );
5711 put( "rateLimit", Exchange.this.rateLimit );
5712 }};
5713 Object existingBucket = ((Helpers.isTrue((Helpers.isEqual(this.tokenBucket, null))))) ? new java.util.HashMap<String, Object>() {{}} : this.tokenBucket;
5714 this.tokenBucket = this.extend(defaultBucket, existingBucket);
5715 this.initThrottler();
5716 }
5717
5718 public void featuresGenerator()
5719 {

Callers 1

afterConstructMethod · 0.95

Calls 8

isTrueMethod · 0.95
isEqualMethod · 0.95
opNegMethod · 0.95
addMethod · 0.95
isGreaterThanMethod · 0.95
divideMethod · 0.95
extendMethod · 0.95
initThrottlerMethod · 0.95

Tested by

no test coverage detected