https://github.com/fintecy/cbr-client
Async java client for fx rates from Central Bank of Russia (CBR)
https://github.com/fintecy/cbr-client
currency fintecy fx-rates java-client market-data market-data-feeds
Last synced: about 1 month ago
JSON representation
Async java client for fx rates from Central Bank of Russia (CBR)
- Host: GitHub
- URL: https://github.com/fintecy/cbr-client
- Owner: fintecy
- License: apache-2.0
- Created: 2021-12-12T17:26:15.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-01T23:30:24.000Z (over 3 years ago)
- Last Synced: 2023-07-06T17:44:53.001Z (over 2 years ago)
- Topics: currency, fintecy, fx-rates, java-client, market-data, market-data-feeds
- Language: Java
- Homepage: https://fintecy.github.io/cbr-client/
- Size: 105 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/fintecy/cbr-client/actions/workflows/gradle.yml)
# Central Bank of Russia (CBR) Client
Java client based on new HttpClient (java 11+)
## Dependency
https://mvnrepository.com/artifact/org.fintecy.md/cbr-client/1.0.1
### Gradle
```
implementation 'org.fintecy.md:cbr-client:1.0.1'
```
### Maven
```
org.fintecy.md
cbr-client
1.0.1
```
## Usage
### Simple client creation
```
CbrApi client = CbrClient.api();
```
### Complex client configuration
```
var client = cbrClient()
.useClient(HttpClient.newBuilder()
.followRedirects(HttpClient.Redirect.ALWAYS)
.priority(10)
.connectTimeout(Duration.ofMillis(500))
.executor(Executors.newSingleThreadExecutor())
.build())
.with(CircuitBreaker.ofDefaults())
.with(RateLimiter.smoothBuilder(Duration.ofMillis(100))
.build())
.with(RetryPolicy.ofDefaults())
.with(Timeout.of(Duration.ofMillis(400)))
.rootPath("https://www.cbr.ru/scripts") -- just to use stub in tests
.build();
```
### Get latest rates
```
var client = CbrClient.api();
int rates = client.rates();
```
### Get supported currencies
```
var client = CbrClient.api();
var ccurrencies = client.supportedCurrencies();
```
## Dependencies
- Java 11+
- FailSafe
- Slf4j api
- Jaxb (api)
- WireMock (tests)
- Junit5 (tests)
## Author
Anton Batiaev