use of org.knowm.xchange.client.ResilienceRegistries in project XChange by knowm.
the class OkexResilience method createRegistries.
public static ResilienceRegistries createRegistries() {
final ResilienceRegistries registries = new ResilienceRegistries();
Okex.publicPathRateLimits.forEach((path, limit) -> {
registries.rateLimiters().rateLimiter(path, RateLimiterConfig.from(registries.rateLimiters().getDefaultConfig()).limitRefreshPeriod(Duration.ofSeconds(limit.get(1))).limitForPeriod(limit.get(0)).drainPermissionsOnResult(e -> ResilienceUtils.matchesHttpCode(e, TOO_MANY_REQUESTS)).build());
});
OkexAuthenticated.privatePathRateLimits.forEach((path, limit) -> {
registries.rateLimiters().rateLimiter(path, RateLimiterConfig.from(registries.rateLimiters().getDefaultConfig()).limitRefreshPeriod(Duration.ofSeconds(limit.get(1))).limitForPeriod(limit.get(0)).drainPermissionsOnResult(e -> ResilienceUtils.matchesHttpCode(e, TOO_MANY_REQUESTS)).build());
});
return registries;
}
use of org.knowm.xchange.client.ResilienceRegistries in project XChange by knowm.
the class BinanceResilience method createRegistries.
public static ResilienceRegistries createRegistries() {
ResilienceRegistries registries = new ResilienceRegistries();
registries.rateLimiters().rateLimiter(REQUEST_WEIGHT_RATE_LIMITER, RateLimiterConfig.from(registries.rateLimiters().getDefaultConfig()).timeoutDuration(Duration.ofMinutes(1)).limitRefreshPeriod(Duration.ofMinutes(1)).limitForPeriod(1200).build());
registries.rateLimiters().rateLimiter(ORDERS_PER_SECOND_RATE_LIMITER, RateLimiterConfig.from(registries.rateLimiters().getDefaultConfig()).limitRefreshPeriod(Duration.ofSeconds(1)).limitForPeriod(10).build());
registries.rateLimiters().rateLimiter(ORDERS_PER_DAY_RATE_LIMITER, RateLimiterConfig.from(registries.rateLimiters().getDefaultConfig()).timeoutDuration(Duration.ZERO).limitRefreshPeriod(Duration.ofDays(1)).limitForPeriod(200000).build());
return registries;
}
use of org.knowm.xchange.client.ResilienceRegistries in project XChange by knowm.
the class CoinbaseProResilience method createRegistries.
public static ResilienceRegistries createRegistries() {
final ResilienceRegistries registries = new ResilienceRegistries();
registries.rateLimiters().rateLimiter(PUBLIC_REST_ENDPOINT_RATE_LIMITER, RateLimiterConfig.from(registries.rateLimiters().getDefaultConfig()).limitRefreshPeriod(Duration.ofSeconds(1)).limitForPeriod(10).drainPermissionsOnResult(e -> ResilienceUtils.matchesHttpCode(e, TOO_MANY_REQUESTS)).build());
registries.rateLimiters().rateLimiter(PRIVATE_REST_ENDPOINT_RATE_LIMITER, RateLimiterConfig.from(registries.rateLimiters().getDefaultConfig()).limitRefreshPeriod(Duration.ofSeconds(1)).limitForPeriod(15).drainPermissionsOnResult(e -> ResilienceUtils.matchesHttpCode(e, TOO_MANY_REQUESTS)).build());
return registries;
}
use of org.knowm.xchange.client.ResilienceRegistries in project XChange by knowm.
the class BitfinexResilience method createRegistries.
public static ResilienceRegistries createRegistries() {
ResilienceRegistries registries = new ResilienceRegistries();
registries.rateLimiters().rateLimiter(BITFINEX_RATE_LIMITER, RateLimiterConfig.from(registries.rateLimiters().getDefaultConfig()).limitRefreshPeriod(Duration.ofMinutes(1)).limitForPeriod(90).build());
return registries;
}
use of org.knowm.xchange.client.ResilienceRegistries in project XChange by knowm.
the class KucoinResilience method createRegistries.
public static ResilienceRegistries createRegistries() {
final ResilienceRegistries registries = new ResilienceRegistries();
registries.rateLimiters().rateLimiter(PUBLIC_REST_ENDPOINT_RATE_LIMITER, RateLimiterConfig.from(registries.rateLimiters().getDefaultConfig()).limitRefreshPeriod(Duration.ofSeconds(10)).limitForPeriod(30).drainPermissionsOnResult(e -> ResilienceUtils.matchesHttpCode(e, TOO_MANY_REQUESTS)).build());
registries.rateLimiters().rateLimiter(PRIVATE_REST_ENDPOINT_RATE_LIMITER, RateLimiterConfig.from(registries.rateLimiters().getDefaultConfig()).limitRefreshPeriod(Duration.ofSeconds(3)).limitForPeriod(30).drainPermissionsOnResult(e -> ResilienceUtils.matchesHttpCode(e, TOO_MANY_REQUESTS)).build());
return registries;
}
Aggregations