This repository contains my solution to a Rust test assignment I completed for a trading company in October 2025. The assignment consisted of two tasks focused on API request signing and order book processing. I’m publishing it here as part of my personal portfolio.
There are two assignments, that highlight different parts of the work we have to do to onboard with the apis of new exchanges.
We want to respect your time, so please don't spend more than a few hours on this assessment.
A lot of exchanges require users to sign the requests that they send, as a security measure.
These implementations are always slightly different, and so we need to carefully read their documentation.
The documentation can be found in huobi_signature.md or at https://www.huobi.com/en-us/opend/newApiPages/?id=419
You will need to implement the details of the following functions:
format_for_signatureon the structParamssign_hmac_sha256_base64generate_signature
Then the following tests should all succeed:
test_formatchecks thatformat_for_signatureresults in the correct parameter output, which is crucial forgenerate_signature.test_signingchecks thatsign_hmac_sha256_base64works correctly.test_hashandtest_hashescheck thatgenerate_signaturehas the right output.
You should not modify the tests.
When building a strategy to trade on an exchange we want to locally keep track of the current price levels in the orderbook.
In this assignment you should implement some parsing in get_best_bids_and_asks_from_stream and keep track of the levels in the book.
Once all the messages in the stream are processed the 5 best bids and 5 best asks should be returned.
You can have a look at data_generator.rs to see what messages you will receive in the stream.
You will need to implement the details of the following function:
get_best_bids_and_asks_from_stream
Then the following test should succeed:
test_datachecks that the 5 bids and 5 asks on the top of the book are correctly stored.
You should not modify the tests, or data_generator.rs.