Challenge program gives interested individuals a chance to prove themselves and learn a bit about the company & products. Our challenges are extremely independent and will require you to manage your own time and work process.
- Submit your challenge as described in Workflow.
- In case your submission is approved, one of our team members will reach out to set up 30-minute Google Meet orientation call. Successful candidates will be offered 1.5 hrs technical interview.
- Candidates that made it to the final stage will be offered a contract with Inca Digital.
- Java/Kotlin programming language
- understanding of stream and reactive programming approaches
This application requests order books for all Binance symbols (financial instruments) and calculates the average volumes for asks and bids.
You can find a short description of order book here.
We use the following technologies:
- Kotlin lang
- Spring Boot WebFlux framework
- Maven for dependency management and build
This app has a standard structure for Spring Boot:
application.yml
configuration fileChallengeApplication
application entry point- Spring configuration in
com.inca.challenge.config
package - Binance REST API client and model in
com.inca.challenge.api
package OrderBookMetricsCalculator
order book metrics calculator jobOrderBookMetricsCalculatorTest
Spring Boot test to start application locally
In OrderBookMetricsCalculator
implemented the following algorithm:
- retrieve all symbols and rate limits from Binance API
- for all symbols one by one retrieve order books
- calculate the average volume for asks and bids
- once above is done, print metrics and statistics to log and finish the application
The application works correctly, except for timeout in OrderBookMetricsCalculator
.
We expect the order book metrics calculator to be improved to fit app timeout and reduce memory consumption.
The first problem that it takes too long to retrieve order books one by one. This
can be optimized if you make calls in parallel. But be careful to not exceed Binance
API rate limits. You can find how heavy is every API call in
docs. You can also use
BinanceApiClient#getRateLimits
to track currently available limits. In general, you
can't rely on it being the only application that uses the Binance API on an instance
(other applications can use the same IP).
Even after fixing the first problem, the calculator is not ready to become a real world streaming application as it keeps all the state in memory to compute the average volumes. Therefore, as a next step we want you to optimize memory consumption.
Please make minimal changes to the OrderBookMetricsCalculator
class only. If you prefer
Java lang, feel free to convert calculator class from Kotlin to Java.
- Clone this repository and push it to your private repository named
<OWNER>/inca-backend-challenge
- From
Settings
menu create Actions secretPROXY_SETTINGS
with proxy settings (e.q-DsocksProxyHost=158.69.225.110 -DsocksProxyPort=59166
). See free proxies list - Create a Pull Request with all your changes into the
main
branch in your new repository - Make sure the Pull Request
Run tests
GitHub Action check successfully passed - From
Settings
menu add @alekseypolukeev and @iliagon to collaborators, we will review your code and get back to you
Application only requires the JVM to be installed and can be launched with
./mvnw test
For the testing purposes you can decrease the number of handled symbols using dry-run mode:
./mvnw test -Dbinance.api.order-book.dry-run=true
As Binance API can't be accessed from US (451 Unavailable For Legal Reasons), you can use any free HTTP/HTTP/SOCKS proxy:
./mvnw test -DsocksProxyHost=158.69.225.110 -DsocksProxyPort=59166
More options can be found here.