Download hft_interview_questions.csv from academicquant/hft-interview-questions: direct link, hf CLI and curl.
- Browser
- Download file 84.8 kB
-
https://huggingface.co/datasets/academicquant/hft-interview-questions/resolve/main/hft_interview_questions.csv
- Command line
-
hf download hf://datasets/academicquant/hft-interview-questions/hft_interview_questions.csv
-
curl -L -o hft_interview_questions.csv https://huggingface.co/datasets/academicquant/hft-interview-questions/resolve/main/hft_interview_questions.csv
84.8 kB
| question,type,module_number,module,lesson,lesson_url | |
| Your loop over the day's quotes is O(n). Another team's loop is also O(n) and runs in half the time on the same data. What would you look at first?,lesson opening question,1,Reading hot code,What Big-O leaves out,https://academicquant.co.uk/qd-cost-model?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why might one O(n) loop be several times slower than another?,interview question,1,Reading hot code,What Big-O leaves out,https://academicquant.co.uk/qd-cost-model?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is a hot path?,interview question,1,Reading hot code,What Big-O leaves out,https://academicquant.co.uk/qd-cost-model?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Walk me through how you would review this loop for performance.,interview question,1,Reading hot code,What Big-O leaves out,https://academicquant.co.uk/qd-cost-model?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Is Big-O useless for low-latency work then?,interview question,1,Reading hot code,What Big-O leaves out,https://academicquant.co.uk/qd-cost-model?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "You keep the last few thousand quotes for one contract and walk all of them on every update. Would you store them in a std::vector or a std::list, and why?",lesson opening question,1,Reading hot code,Vector and list: where the data actually sits,https://academicquant.co.uk/qd-memory-layout?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why is iterating over a vector faster than over a linked list when both are O(n)?,interview question,1,Reading hot code,Vector and list: where the data actually sits,https://academicquant.co.uk/qd-memory-layout?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| When would you use std::list?,interview question,1,Reading hot code,Vector and list: where the data actually sits,https://academicquant.co.uk/qd-memory-layout?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Isn't inserting in the middle of a vector O(n)? Doesn't that favour the list?,interview question,1,Reading hot code,Vector and list: where the data actually sits,https://academicquant.co.uk/qd-memory-layout?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| You said the vector is faster because nearby memory is cheaper to read. Why is nearby memory cheaper?,lesson opening question,1,Reading hot code,"Cache lines, locality and pointer chasing",https://academicquant.co.uk/qd-cache-lines?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is a cache line and why does it matter?,interview question,1,Reading hot code,"Cache lines, locality and pointer chasing",https://academicquant.co.uk/qd-cache-lines?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is pointer chasing?,interview question,1,Reading hot code,"Cache lines, locality and pointer chasing",https://academicquant.co.uk/qd-cache-lines?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| You have a std::vector of unique_ptr to orders. Is that cache-friendly?,interview question,1,Reading hot code,"Cache lines, locality and pointer chasing",https://academicquant.co.uk/qd-cache-lines?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| This handler builds an order for every quote it acts on. There is no new anywhere in it. Does it allocate?,lesson opening question,1,Reading hot code,Allocation on the hot path,https://academicquant.co.uk/qd-hot-allocation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why avoid heap allocation on the hot path?,interview question,1,Reading hot code,Allocation on the hot path,https://academicquant.co.uk/qd-hot-allocation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you find hidden allocations?,interview question,1,Reading hot code,Allocation on the hot path,https://academicquant.co.uk/qd-hot-allocation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What would you do instead of allocating per message?,interview question,1,Reading hot code,Allocation on the hot path,https://academicquant.co.uk/qd-hot-allocation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "What is sizeof this struct, and could you make it smaller without removing a field? Then: where in this function is the struct copied?",lesson opening question,1,Reading hot code,"Copies, moves and object layout",https://academicquant.co.uk/qd-copies-layout?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you shrink this struct without removing fields?,interview question,1,Reading hot code,"Copies, moves and object layout",https://academicquant.co.uk/qd-copies-layout?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Should I always pass by const reference?,interview question,1,Reading hot code,"Copies, moves and object layout",https://academicquant.co.uk/qd-copies-layout?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why put a static_assert on sizeof?,interview question,1,Reading hot code,"Copies, moves and object layout",https://academicquant.co.uk/qd-copies-layout?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "This loop has an if inside it. When is that if expensive, and when is it essentially free?",lesson opening question,1,Reading hot code,"Branches, indirect calls and inlining",https://academicquant.co.uk/qd-branches-calls?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is a branch misprediction and what does it cost?,interview question,1,Reading hot code,"Branches, indirect calls and inlining",https://academicquant.co.uk/qd-branches-calls?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you deal with an unpredictable branch in a hot loop?,interview question,1,Reading hot code,"Branches, indirect calls and inlining",https://academicquant.co.uk/qd-branches-calls?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why are indirect calls slower than direct ones?,interview question,1,Reading hot code,"Branches, indirect calls and inlining",https://academicquant.co.uk/qd-branches-calls?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Your strategies all derive from a base class with a virtual on_quote. Someone says virtual calls are slow. Are they right?,lesson opening question,1,Reading hot code,Virtual functions and vtables,https://academicquant.co.uk/qd-virtual-calls?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How expensive is a virtual function call?,interview question,1,Reading hot code,Virtual functions and vtables,https://academicquant.co.uk/qd-virtual-calls?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you avoid virtual dispatch on the hot path?,interview question,1,Reading hot code,Virtual functions and vtables,https://academicquant.co.uk/qd-virtual-calls?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Where does the vptr live and what does it cost in memory?,interview question,1,Reading hot code,Virtual functions and vtables,https://academicquant.co.uk/qd-virtual-calls?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| The feed handler stores its callback as std::function<void(const Quote&)>. Is that a problem on the hot path?,lesson opening question,1,Reading hot code,"std::function, std::any and the cost of type erasure",https://academicquant.co.uk/qd-type-erasure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Is std::function slow?,interview question,1,Reading hot code,"std::function, std::any and the cost of type erasure",https://academicquant.co.uk/qd-type-erasure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What would you use instead of std::function for a hot callback?,interview question,1,Reading hot code,"std::function, std::any and the cost of type erasure",https://academicquant.co.uk/qd-type-erasure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is type erasure?,interview question,1,Reading hot code,"std::function, std::any and the cost of type erasure",https://academicquant.co.uk/qd-type-erasure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| You rewrote a function and your benchmark says it is three times faster. What would make you doubt that number?,lesson opening question,1,Reading hot code,Benchmarking without fooling yourself,https://academicquant.co.uk/qd-benchmarking?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you benchmark a small C++ function?,interview question,1,Reading hot code,Benchmarking without fooling yourself,https://academicquant.co.uk/qd-benchmarking?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is the most common mistake in microbenchmarks?,interview question,1,Reading hot code,Benchmarking without fooling yourself,https://academicquant.co.uk/qd-benchmarking?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Your benchmark shows a speed-up. How do you convince a sceptical colleague?,interview question,1,Reading hot code,Benchmarking without fooling yourself,https://academicquant.co.uk/qd-benchmarking?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Here is our quote handler. Take five minutes, tell me everything that worries you, and tell me what you would fix first.",lesson opening question,1,Reading hot code,"The cost model, all at once",https://academicquant.co.uk/qd-cost-review?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Review this handler for latency. What do you change first?,interview question,1,Reading hot code,"The cost model, all at once",https://academicquant.co.uk/qd-cost-review?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you decide which of several issues matters most?,interview question,1,Reading hot code,"The cost model, all at once",https://academicquant.co.uk/qd-cost-review?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What would you leave alone?,interview question,1,Reading hot code,"The cost model, all at once",https://academicquant.co.uk/qd-cost-review?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Both our loops over the day's quotes are O(n). Ours takes twice as long. Why might that be?,drill prompt,1,Reading hot code,Drill: reading hot code,https://academicquant.co.uk/qd-drill-hot-code?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| We keep the recent quotes for a contract and walk all of them on every update. Vector or list?,drill prompt,1,Reading hot code,Drill: reading hot code,https://academicquant.co.uk/qd-drill-hot-code?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "You keep saying contiguous memory is faster. Explain why, at the level of the hardware.",drill prompt,1,Reading hot code,Drill: reading hot code,https://academicquant.co.uk/qd-drill-hot-code?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "This handler builds a std::string tag, pushes into a local std::vector and creates a shared_ptr for every order. There is no new in it. Does it allocate?",drill prompt,1,Reading hot code,Drill: reading hot code,https://academicquant.co.uk/qd-drill-hot-code?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Your new version benchmarks three times faster. Convince me.,drill prompt,1,Reading hot code,Drill: reading hot code,https://academicquant.co.uk/qd-drill-hot-code?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| This function returns a reference to the best price level. It compiles without a warning and works in the unit test. Why does it crash in production?,lesson opening question,2,Safe C++,When an object's life begins and ends,https://academicquant.co.uk/qd-object-lifetime?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| When is a temporary destroyed?,interview question,2,Safe C++,When an object's life begins and ends,https://academicquant.co.uk/qd-object-lifetime?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you find dangling references in a large codebase?,interview question,2,Safe C++,When an object's life begins and ends,https://academicquant.co.uk/qd-object-lifetime?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "In what order are members destroyed, and why does it matter?",interview question,2,Safe C++,When an object's life begins and ends,https://academicquant.co.uk/qd-object-lifetime?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Explain RAII. Then tell me what is wrong with this function that takes a mutex, writes to a socket and releases the mutex.",lesson opening question,2,Safe C++,RAII: tying every resource to an object,https://academicquant.co.uk/qd-raii?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is RAII?,interview question,2,Safe C++,RAII: tying every resource to an object,https://academicquant.co.uk/qd-raii?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why is RAII important for exception safety?,interview question,2,Safe C++,RAII: tying every resource to an object,https://academicquant.co.uk/qd-raii?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "What is the rule of five, and the rule of zero?",interview question,2,Safe C++,RAII: tying every resource to an object,https://academicquant.co.uk/qd-raii?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Is there a performance cost to RAII?,interview question,2,Safe C++,RAII: tying every resource to an object,https://academicquant.co.uk/qd-raii?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Our order manager stores every live order in a std::shared_ptr and hands copies to the risk checker and the gateway. What does that cost, and would you do it differently?",lesson opening question,2,Safe C++,"unique_ptr, shared_ptr and weak_ptr",https://academicquant.co.uk/qd-smart-pointers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| When would you use shared_ptr versus unique_ptr?,interview question,2,Safe C++,"unique_ptr, shared_ptr and weak_ptr",https://academicquant.co.uk/qd-smart-pointers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What does shared_ptr cost?,interview question,2,Safe C++,"unique_ptr, shared_ptr and weak_ptr",https://academicquant.co.uk/qd-smart-pointers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is weak_ptr for?,interview question,2,Safe C++,"unique_ptr, shared_ptr and weak_ptr",https://academicquant.co.uk/qd-smart-pointers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why prefer make_shared?,interview question,2,Safe C++,"unique_ptr, shared_ptr and weak_ptr",https://academicquant.co.uk/qd-smart-pointers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| A colleague replaced const std::string& parameters with std::string_view across the feed parser and one test started failing intermittently. What would you look for?,lesson opening question,2,Safe C++,Dangling views: string_view and span,https://academicquant.co.uk/qd-views?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| When would you use string_view over const std::string&?,interview question,2,Safe C++,Dangling views: string_view and span,https://academicquant.co.uk/qd-views?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How can a string_view dangle?,interview question,2,Safe C++,Dangling views: string_view and span,https://academicquant.co.uk/qd-views?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is std::span?,interview question,2,Safe C++,Dangling views: string_view and span,https://academicquant.co.uk/qd-views?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What does std::move do? And why can marking a move constructor noexcept make a vector of orders much faster to grow?,lesson opening question,2,Safe C++,Move semantics without the mystery,https://academicquant.co.uk/qd-move-semantics?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What does std::move do?,interview question,2,Safe C++,Move semantics without the mystery,https://academicquant.co.uk/qd-move-semantics?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why should move constructors be noexcept?,interview question,2,Safe C++,Move semantics without the mystery,https://academicquant.co.uk/qd-move-semantics?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What state is an object in after it has been moved from?,interview question,2,Safe C++,Move semantics without the mystery,https://academicquant.co.uk/qd-move-semantics?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is copy elision?,interview question,2,Safe C++,Move semantics without the mystery,https://academicquant.co.uk/qd-move-semantics?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| This code registers a callback that fires when an order is acknowledged. It works for a while and then crashes. What is wrong?,lesson opening question,2,Safe C++,Lambdas and what they capture,https://academicquant.co.uk/qd-lambda-captures?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| When is capturing by reference in a lambda dangerous?,interview question,2,Safe C++,Lambdas and what they capture,https://academicquant.co.uk/qd-lambda-captures?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What does capturing this mean?,interview question,2,Safe C++,Lambdas and what they capture,https://academicquant.co.uk/qd-lambda-captures?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you move a unique_ptr into a lambda?,interview question,2,Safe C++,Lambdas and what they capture,https://academicquant.co.uk/qd-lambda-captures?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Your book keeps a std::vector of orders and an index from order id to Order*. After a burst of new orders, a cancel corrupts memory. Why?",lesson opening question,2,Safe C++,Iterator invalidation and stable handles,https://academicquant.co.uk/qd-invalidation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| When does push_back invalidate iterators?,interview question,2,Safe C++,Iterator invalidation and stable handles,https://academicquant.co.uk/qd-invalidation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you erase elements from a container while iterating over it?,interview question,2,Safe C++,Iterator invalidation and stable handles,https://academicquant.co.uk/qd-invalidation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you refer to orders that may be cancelled or reused?,interview question,2,Safe C++,Iterator invalidation and stable handles,https://academicquant.co.uk/qd-invalidation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| You receive a binary market-data message in a char buffer. Someone wrote reinterpret_cast<const Header*>(buf) to read the header. Is that correct?,lesson opening question,2,Safe C++,"Casts, aliasing and reading bytes safely",https://academicquant.co.uk/qd-casts?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is the difference between static_cast and reinterpret_cast?,interview question,2,Safe C++,"Casts, aliasing and reading bytes safely",https://academicquant.co.uk/qd-casts?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is strict aliasing?,interview question,2,Safe C++,"Casts, aliasing and reading bytes safely",https://academicquant.co.uk/qd-casts?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you parse a binary message from a byte buffer?,interview question,2,Safe C++,"Casts, aliasing and reading bytes safely",https://academicquant.co.uk/qd-casts?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| `const Level& top(const Instrument& i) { auto book = snapshot(i); return book.levels[0]; }` What is wrong with this?,drill prompt,2,Safe C++,Drill: lifetime and ownership,https://academicquant.co.uk/qd-drill-safe-cpp?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "A function creates an order as a local, sends it, and registers `[&](const Ack& a) { order.status = a.status; }` to run when the exchange acknowledges. Problems?",drill prompt,2,Safe C++,Drill: lifetime and ownership,https://academicquant.co.uk/qd-drill-safe-cpp?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Every order is a std::shared_ptr<Order>, copied to the risk checker, the gateway and the logger. Is that a problem?",drill prompt,2,Safe C++,Drill: lifetime and ownership,https://academicquant.co.uk/qd-drill-safe-cpp?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "`std::string_view venue() const { return std::string(venue_code_) + ""-"" + region_; }` Comment.",drill prompt,2,Safe C++,Drill: lifetime and ownership,https://academicquant.co.uk/qd-drill-safe-cpp?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "A book stores orders in a std::vector<Order> and keeps an unordered_map<OrderId, Order*>. Cancels sometimes corrupt memory after a busy period. Why?",drill prompt,2,Safe C++,Drill: lifetime and ownership,https://academicquant.co.uk/qd-drill-safe-cpp?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "You need to keep the active orders for one instrument, look them up by id, and walk them in price order. Which containers would you use?",lesson opening question,3,Containers and memory,Choosing a container by what it does in memory,https://academicquant.co.uk/qd-container-choice?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you choose a container?,interview question,3,Containers and memory,Choosing a container by what it does in memory,https://academicquant.co.uk/qd-container-choice?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why not just use std::map everywhere for ordered data?,interview question,3,Containers and memory,Choosing a container by what it does in memory,https://academicquant.co.uk/qd-container-choice?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is a flat hash map?,interview question,3,Containers and memory,Choosing a container by what it does in memory,https://academicquant.co.uk/qd-container-choice?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "push_back on a vector is amortised O(1). What does amortised hide, and how would you make it O(1) every time on a hot path?",lesson opening question,3,Containers and memory,"vector: size, capacity and growth",https://academicquant.co.uk/qd-vector-growth?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is the difference between size and capacity?,interview question,3,Containers and memory,"vector: size, capacity and growth",https://academicquant.co.uk/qd-vector-growth?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why is push_back amortised constant time?,interview question,3,Containers and memory,"vector: size, capacity and growth",https://academicquant.co.uk/qd-vector-growth?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| When would you use emplace_back?,interview question,3,Containers and memory,"vector: size, capacity and growth",https://academicquant.co.uk/qd-vector-growth?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Most order lookups take a few hundred nanoseconds, but a few take tens of microseconds. The lookup is an unordered_map from order id to order. What might cause the slow ones?",lesson opening question,3,Containers and memory,"Hash maps: buckets, load factor and rehashing",https://academicquant.co.uk/qd-hash-maps?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How does std::unordered_map work internally?,interview question,3,Containers and memory,"Hash maps: buckets, load factor and rehashing",https://academicquant.co.uk/qd-hash-maps?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why might hash map lookups have a long tail?,interview question,3,Containers and memory,"Hash maps: buckets, load factor and rehashing",https://academicquant.co.uk/qd-hash-maps?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is open addressing and what does it trade?,interview question,3,Containers and memory,"Hash maps: buckets, load factor and rehashing",https://academicquant.co.uk/qd-hash-maps?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Give me one situation where std::map is the right choice over std::unordered_map, one for std::deque, and one for std::list.",lesson opening question,3,Containers and memory,"map, list and deque: when nodes and blocks earn their place",https://academicquant.co.uk/qd-map-list-deque?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| When would you use std::map instead of std::unordered_map?,interview question,3,Containers and memory,"map, list and deque: when nodes and blocks earn their place",https://academicquant.co.uk/qd-map-list-deque?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How is std::deque implemented?,interview question,3,Containers and memory,"map, list and deque: when nodes and blocks earn their place",https://academicquant.co.uk/qd-map-list-deque?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Is std::list ever the right choice?,interview question,3,Containers and memory,"map, list and deque: when nodes and blocks earn their place",https://academicquant.co.uk/qd-map-list-deque?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "You have removed the obvious allocations from the hot path, but you still need to create orders and short-lived message objects at a high rate. How do you allocate them without calling malloc?",lesson opening question,3,Containers and memory,"Allocators, pmr and object pools",https://academicquant.co.uk/qd-pools-allocators?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you avoid malloc on the hot path while still creating objects?,interview question,3,Containers and memory,"Allocators, pmr and object pools",https://academicquant.co.uk/qd-pools-allocators?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is std::pmr?,interview question,3,Containers and memory,"Allocators, pmr and object pools",https://academicquant.co.uk/qd-pools-allocators?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What are the risks of custom allocators?,interview question,3,Containers and memory,"Allocators, pmr and object pools",https://academicquant.co.uk/qd-pools-allocators?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Why does std::string(""ESZ6"") not allocate, but a 40-character string does? What is sizeof(std::string)?",lesson opening question,3,Containers and memory,Small buffer optimisation,https://academicquant.co.uk/qd-small-buffer?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is small string optimisation?,interview question,3,Containers and memory,Small buffer optimisation,https://academicquant.co.uk/qd-small-buffer?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Where else is small buffer optimisation used?,interview question,3,Containers and memory,Small buffer optimisation,https://academicquant.co.uk/qd-small-buffer?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What are its downsides?,interview question,3,Containers and memory,Small buffer optimisation,https://academicquant.co.uk/qd-small-buffer?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| You want a feed handler that works with several strategies without virtual function calls on every message. How would you design it?,lesson opening question,3,Containers and memory,"Templates, CRTP and compile-time polymorphism",https://academicquant.co.uk/qd-templates?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you get polymorphism without virtual functions?,interview question,3,Containers and memory,"Templates, CRTP and compile-time polymorphism",https://academicquant.co.uk/qd-templates?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is CRTP?,interview question,3,Containers and memory,"Templates, CRTP and compile-time polymorphism",https://academicquant.co.uk/qd-templates?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What are the downsides of heavy template use?,interview question,3,Containers and memory,"Templates, CRTP and compile-time polymorphism",https://academicquant.co.uk/qd-templates?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| push_back is O(1) amortised. Is that good enough for our order entry path?,drill prompt,3,Containers and memory,Drill: containers and memory,https://academicquant.co.uk/qd-drill-containers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Order lookups in an unordered_map are usually fast, with a few that are a hundred times slower. Where do you look?",drill prompt,3,Containers and memory,Drill: containers and memory,https://academicquant.co.uk/qd-drill-containers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "We need price levels in order for the book, with frequent inserts and deletes near the best price. std::map?",drill prompt,3,Containers and memory,Drill: containers and memory,https://academicquant.co.uk/qd-drill-containers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| We create orders and per-message scratch objects at a high rate. How do we avoid malloc?,drill prompt,3,Containers and memory,Drill: containers and memory,https://academicquant.co.uk/qd-drill-containers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Is std::string a problem in our message structs?,drill prompt,3,Containers and memory,Drill: containers and memory,https://academicquant.co.uk/qd-drill-containers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Two threads increment the same int: one counts fills from the gateway, the other counts them from the drop copy. The total is sometimes short. Why, and is ""sometimes short"" the worst that can happen?",lesson opening question,4,Concurrency,"Threads, shared state and data races",https://academicquant.co.uk/qd-threads-races?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is a data race?,interview question,4,Concurrency,"Threads, shared state and data races",https://academicquant.co.uk/qd-threads-races?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you avoid data races?,interview question,4,Concurrency,"Threads, shared state and data races",https://academicquant.co.uk/qd-threads-races?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you find a race in a large codebase?,interview question,4,Concurrency,"Threads, shared state and data races",https://academicquant.co.uk/qd-threads-races?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Is volatile enough to make a flag thread-safe?,interview question,4,Concurrency,"Threads, shared state and data races",https://academicquant.co.uk/qd-threads-races?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "The strategy thread and the gateway thread share a book protected by one std::mutex. Latency is fine on quiet days and terrible on busy ones. What is going on, and what would you change?",lesson opening question,4,Concurrency,"Mutexes, lock scope and contention",https://academicquant.co.uk/qd-mutexes?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why does lock contention hurt latency so much?,interview question,4,Concurrency,"Mutexes, lock scope and contention",https://academicquant.co.uk/qd-mutexes?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you reduce contention?,interview question,4,Concurrency,"Mutexes, lock scope and contention",https://academicquant.co.uk/qd-mutexes?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you prevent deadlocks?,interview question,4,Concurrency,"Mutexes, lock scope and contention",https://academicquant.co.uk/qd-mutexes?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| When would you use a spinlock?,interview question,4,Concurrency,"Mutexes, lock scope and contention",https://academicquant.co.uk/qd-mutexes?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Write a thread-safe queue where a consumer thread waits until there is something to process. Then tell me why our market-data path does not use it.,lesson opening question,4,Concurrency,Condition variables and producer–consumer queues,https://academicquant.co.uk/qd-condvars?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is a spurious wake-up?,interview question,4,Concurrency,Condition variables and producer–consumer queues,https://academicquant.co.uk/qd-condvars?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is a lost wake-up and how is it prevented?,interview question,4,Concurrency,Condition variables and producer–consumer queues,https://academicquant.co.uk/qd-condvars?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why not use condition variables on the market data path?,interview question,4,Concurrency,Condition variables and producer–consumer queues,https://academicquant.co.uk/qd-condvars?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "The producer writes a quote into a slot and then sets ready to true. The consumer spins until ready is true and then reads the slot. Which memory orders do you need, and why?",lesson opening question,4,Concurrency,Atomics and memory ordering,https://academicquant.co.uk/qd-atomics?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Explain acquire and release.,interview question,4,Concurrency,Atomics and memory ordering,https://academicquant.co.uk/qd-atomics?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| When is relaxed ordering correct?,interview question,4,Concurrency,Atomics and memory ordering,https://academicquant.co.uk/qd-atomics?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What does seq_cst add over acquire-release?,interview question,4,Concurrency,Atomics and memory ordering,https://academicquant.co.uk/qd-atomics?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why can lock-free code that passes tests on x86 fail on ARM?,interview question,4,Concurrency,Atomics and memory ordering,https://academicquant.co.uk/qd-atomics?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Write a queue to pass market-data updates from the feed thread to the strategy thread with as little latency as possible. Exactly one thread pushes and exactly one pops.,lesson opening question,4,Concurrency,The single-producer single-consumer ring buffer,https://academicquant.co.uk/qd-spsc?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How does a lock-free SPSC queue work?,interview question,4,Concurrency,The single-producer single-consumer ring buffer,https://academicquant.co.uk/qd-spsc?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you make it faster?,interview question,4,Concurrency,The single-producer single-consumer ring buffer,https://academicquant.co.uk/qd-spsc?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What should a producer do when the queue is full?,interview question,4,Concurrency,The single-producer single-consumer ring buffer,https://academicquant.co.uk/qd-spsc?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "The SPSC queue works for one producer. Now three strategy threads all send orders to one gateway thread. What changes, and what can go wrong?",lesson opening question,4,Concurrency,"Lock-free queues, ABA and seqlocks",https://academicquant.co.uk/qd-lock-free?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is the difference between lock-free and wait-free?,interview question,4,Concurrency,"Lock-free queues, ABA and seqlocks",https://academicquant.co.uk/qd-lock-free?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is the ABA problem and how do you fix it?,interview question,4,Concurrency,"Lock-free queues, ABA and seqlocks",https://academicquant.co.uk/qd-lock-free?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you let many threads read the latest top of book without slowing the writer?,interview question,4,Concurrency,"Lock-free queues, ABA and seqlocks",https://academicquant.co.uk/qd-lock-free?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Several producers send to one consumer. What design would you use?,interview question,4,Concurrency,"Lock-free queues, ABA and seqlocks",https://academicquant.co.uk/qd-lock-free?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Two threads do ++count on a shared int and the total comes out low. Explain and fix.,drill prompt,4,Concurrency,Drill: concurrency,https://academicquant.co.uk/qd-drill-concurrency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| A worker loops while(!stop) and another thread sets stop = true. At -O2 the worker never exits. Why?,drill prompt,4,Concurrency,Drill: concurrency,https://academicquant.co.uk/qd-drill-concurrency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Strategy and gateway threads share a mutex-protected book. Latency is fine when quiet and bad when busy. What do you investigate?,drill prompt,4,Concurrency,Drill: concurrency,https://academicquant.co.uk/qd-drill-concurrency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| The feed thread writes a quote into a buffer and sets a flag; the strategy thread spins on the flag and reads the quote. Which memory orders?,drill prompt,4,Concurrency,Drill: concurrency,https://academicquant.co.uk/qd-drill-concurrency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Design the queue from the feed thread to the strategy thread. One producer, one consumer, minimum latency.",drill prompt,4,Concurrency,Drill: concurrency,https://academicquant.co.uk/qd-drill-concurrency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| A lookup table used on every message is 4 MB. Someone proposes shrinking it to 256 KB by storing smaller entries. Why might that make the hot path much faster even though the code does the same work?,lesson opening question,5,The CPU,The cache hierarchy,https://academicquant.co.uk/qd-cache-hierarchy?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Describe the cache hierarchy.,interview question,5,The CPU,The cache hierarchy,https://academicquant.co.uk/qd-cache-hierarchy?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why does working-set size matter so much?,interview question,5,The CPU,The cache hierarchy,https://academicquant.co.uk/qd-cache-hierarchy?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you measure memory latency on a machine?,interview question,5,The CPU,The cache hierarchy,https://academicquant.co.uk/qd-cache-hierarchy?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Eight threads each do an atomic increment on one shared counter. Throughput is lower than with one thread. Why?,lesson opening question,5,The CPU,Cache coherency and MESI,https://academicquant.co.uk/qd-coherency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is cache coherency?,interview question,5,The CPU,Cache coherency and MESI,https://academicquant.co.uk/qd-coherency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why is writing shared data expensive on a multicore machine?,interview question,5,The CPU,Cache coherency and MESI,https://academicquant.co.uk/qd-coherency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you implement a counter incremented by many threads?,interview question,5,The CPU,Cache coherency and MESI,https://academicquant.co.uk/qd-coherency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Each worker thread has its own counter in a struct array, so there is no shared state. Yet adding threads makes each one slower. What is happening?",lesson opening question,5,The CPU,False sharing,https://academicquant.co.uk/qd-false-sharing?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is false sharing?,interview question,5,The CPU,False sharing,https://academicquant.co.uk/qd-false-sharing?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you fix and prevent it?,interview question,5,The CPU,False sharing,https://academicquant.co.uk/qd-false-sharing?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you detect it?,interview question,5,The CPU,False sharing,https://academicquant.co.uk/qd-false-sharing?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Summing an array with one accumulator runs at one addition every few cycles. Summing it with four accumulators, then adding them together, is several times faster. The instruction count is almost the same. Why?",lesson opening question,5,The CPU,"The pipeline, out-of-order execution and branch prediction",https://academicquant.co.uk/qd-pipeline?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is out-of-order execution?,interview question,5,The CPU,"The pipeline, out-of-order execution and branch prediction",https://academicquant.co.uk/qd-pipeline?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why can adding more accumulators speed up a loop?,interview question,5,The CPU,"The pipeline, out-of-order execution and branch prediction",https://academicquant.co.uk/qd-pipeline?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do branch predictors work and what defeats them?,interview question,5,The CPU,"The pipeline, out-of-order execution and branch prediction",https://academicquant.co.uk/qd-pipeline?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "A loop walks a vector of order handles and, for each, reads the order from a pool. Walking the handles is fast, but reading the orders is slow. Would adding prefetch instructions help?",lesson opening question,5,The CPU,Prefetching and streaming access,https://academicquant.co.uk/qd-prefetching?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What do hardware prefetchers do?,interview question,5,The CPU,Prefetching and streaming access,https://academicquant.co.uk/qd-prefetching?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| When would you use __builtin_prefetch?,interview question,5,The CPU,Prefetching and streaming access,https://academicquant.co.uk/qd-prefetching?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What are non-temporal stores?,interview question,5,The CPU,Prefetching and streaming access,https://academicquant.co.uk/qd-prefetching?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "How could SIMD speed up finding a price level in a small array of prices, and why might the compiler not vectorise the obvious loop for you?",lesson opening question,5,The CPU,SIMD and vectorisation,https://academicquant.co.uk/qd-simd?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is SIMD and where does it help in a trading system?,interview question,5,The CPU,SIMD and vectorisation,https://academicquant.co.uk/qd-simd?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What prevents auto-vectorisation?,interview question,5,The CPU,SIMD and vectorisation,https://academicquant.co.uk/qd-simd?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Any caveats with AVX-512?,interview question,5,The CPU,SIMD and vectorisation,https://academicquant.co.uk/qd-simd?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| A lookup table used on every message is 8 MB. What would you consider?,drill prompt,5,The CPU,Drill: the machine,https://academicquant.co.uk/qd-drill-cpu?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Eight threads increment one atomic counter. Why does it not scale?,drill prompt,5,The CPU,Drill: the machine,https://academicquant.co.uk/qd-drill-cpu?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Each thread writes its own element of an array of small stats structs. More threads, slower threads. Why?",drill prompt,5,The CPU,Drill: the machine,https://academicquant.co.uk/qd-drill-cpu?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| This loop sums a million doubles with one accumulator. How could it run several times faster on the same core?,drill prompt,5,The CPU,Drill: the machine,https://academicquant.co.uk/qd-drill-cpu?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| A loop walks an array of handles and reads each referenced order from a pool. It is slow. Ideas?,drill prompt,5,The CPU,Drill: the machine,https://academicquant.co.uk/qd-drill-cpu?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Your process has a 2 GB order book and reference data in memory. A colleague suggests huge pages. What problem do they solve, and what are the catches?",lesson opening question,6,The operating system,"Virtual memory, pages and the TLB",https://academicquant.co.uk/qd-virtual-memory?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is the TLB?,interview question,6,The operating system,"Virtual memory, pages and the TLB",https://academicquant.co.uk/qd-virtual-memory?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why use huge pages?,interview question,6,The operating system,"Virtual memory, pages and the TLB",https://academicquant.co.uk/qd-virtual-memory?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is a TLB shootdown?,interview question,6,The operating system,"Virtual memory, pages and the TLB",https://academicquant.co.uk/qd-virtual-memory?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "The first few thousand messages after start-up are slow, and occasionally later in the day a message takes hundreds of microseconds for no visible reason. Could page faults explain either?",lesson opening question,6,The operating system,Page faults and how to avoid them,https://academicquant.co.uk/qd-page-faults?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is a page fault and why does it matter for latency?,interview question,6,The operating system,Page faults and how to avoid them,https://academicquant.co.uk/qd-page-faults?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you avoid page faults on the hot path?,interview question,6,The operating system,Page faults and how to avoid them,https://academicquant.co.uk/qd-page-faults?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why can fork cause latency problems?,interview question,6,The operating system,Page faults and how to avoid them,https://academicquant.co.uk/qd-page-faults?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| The strategy thread has its own process and does nothing but poll a queue. Its latency still has spikes of tens of microseconds. Where could they come from?,lesson opening question,6,The operating system,Context switches and the scheduler,https://academicquant.co.uk/qd-scheduler?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What does a context switch cost?,interview question,6,The operating system,Context switches and the scheduler,https://academicquant.co.uk/qd-scheduler?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you stop a latency-critical thread being descheduled?,interview question,6,The operating system,Context switches and the scheduler,https://academicquant.co.uk/qd-scheduler?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why do trading threads busy-poll instead of sleeping?,interview question,6,The operating system,Context switches and the scheduler,https://academicquant.co.uk/qd-scheduler?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "The feed handler and the strategy are separate processes so that a strategy crash cannot take down the feed. How should they talk to each other, and what does it cost?",lesson opening question,6,The operating system,"Processes, threads and shared memory",https://academicquant.co.uk/qd-processes-ipc?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| When would you use separate processes rather than threads?,interview question,6,The operating system,"Processes, threads and shared memory",https://academicquant.co.uk/qd-processes-ipc?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is the fastest way for two processes on one machine to exchange messages?,interview question,6,The operating system,"Processes, threads and shared memory",https://academicquant.co.uk/qd-processes-ipc?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What are the risks of shared memory IPC?,interview question,6,The operating system,"Processes, threads and shared memory",https://academicquant.co.uk/qd-processes-ipc?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Module 1 said allocations have a fast path and slow paths. What exactly does malloc do, and where do the slow cases come from?",lesson opening question,6,The operating system,"How malloc works, and why it matters on the hot path",https://academicquant.co.uk/qd-malloc?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How does glibc malloc work?,interview question,6,The operating system,"How malloc works, and why it matters on the hot path",https://academicquant.co.uk/qd-malloc?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why is malloc a latency risk if its average is fast?,interview question,6,The operating system,"How malloc works, and why it matters on the hot path",https://academicquant.co.uk/qd-malloc?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Would switching to jemalloc or tcmalloc solve allocation latency?,interview question,6,The operating system,"How malloc works, and why it matters on the hot path",https://academicquant.co.uk/qd-malloc?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| You have a server for the trading system. How would you configure the machine so the strategy thread is never interrupted?,lesson opening question,6,The operating system,"CPU isolation, real-time scheduling and kernel bypass",https://academicquant.co.uk/qd-isolation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you isolate a core for a latency-critical thread on Linux?,interview question,6,The operating system,"CPU isolation, real-time scheduling and kernel bypass",https://academicquant.co.uk/qd-isolation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Would you run the trading thread with SCHED_FIFO?,interview question,6,The operating system,"CPU isolation, real-time scheduling and kernel bypass",https://academicquant.co.uk/qd-isolation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is kernel bypass?,interview question,6,The operating system,"CPU isolation, real-time scheduling and kernel bypass",https://academicquant.co.uk/qd-isolation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you know the isolation works?,interview question,6,The operating system,"CPU isolation, real-time scheduling and kernel bypass",https://academicquant.co.uk/qd-isolation?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| The first few thousand messages after start-up are much slower than the rest. Why?,drill prompt,6,The operating system,Drill: the operating system,https://academicquant.co.uk/qd-drill-os?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Once or twice a day, a message takes hundreds of microseconds. No errors. What would you check?",drill prompt,6,The operating system,Drill: the operating system,https://academicquant.co.uk/qd-drill-os?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "The strategy thread spins on its queue and never blocks, yet it shows spikes of tens of microseconds. Where are they coming from?",drill prompt,6,The operating system,Drill: the operating system,https://academicquant.co.uk/qd-drill-os?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "The feed and the strategy are separate processes. How do they exchange messages fast, and what can go wrong?",drill prompt,6,The operating system,Drill: the operating system,https://academicquant.co.uk/qd-drill-os?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| You are given a new server for the trading system. What do you configure?,drill prompt,6,The operating system,Drill: the operating system,https://academicquant.co.uk/qd-drill-os?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Walk me through the socket setup for a process that receives market data from an exchange and sends orders to it. Which options matter?,lesson opening question,7,The network,Socket programming for trading systems,https://academicquant.co.uk/qd-sockets?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How does a trading system receive market data?,interview question,7,The network,Socket programming for trading systems,https://academicquant.co.uk/qd-sockets?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why is TCP_NODELAY important?,interview question,7,The network,Socket programming for trading systems,https://academicquant.co.uk/qd-sockets?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is the most common bug when reading from a TCP socket?,interview question,7,The network,Socket programming for trading systems,https://academicquant.co.uk/qd-sockets?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why do exchanges publish market data over UDP but take orders over TCP? Would you ever want it the other way round?,lesson opening question,7,The network,TCP versus UDP for trading,https://academicquant.co.uk/qd-tcp-udp?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why is market data distributed over UDP multicast?,interview question,7,The network,TCP versus UDP for trading,https://academicquant.co.uk/qd-tcp-udp?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why are orders sent over TCP?,interview question,7,The network,TCP versus UDP for trading,https://academicquant.co.uk/qd-tcp-udp?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What does TCP's reliability cost?,interview question,7,The network,TCP versus UDP for trading,https://academicquant.co.uk/qd-tcp-udp?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Design the component that receives an exchange's market data and keeps order books up to date for the strategies. What happens when a packet is lost?,lesson opening question,7,The network,The market-data feed handler,https://academicquant.co.uk/qd-feed-handler?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Describe a market data feed handler.,interview question,7,The network,The market-data feed handler,https://academicquant.co.uk/qd-feed-handler?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you handle a sequence gap?,interview question,7,The network,The market-data feed handler,https://academicquant.co.uk/qd-feed-handler?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is the difference between market-by-order and market-by-price feeds?,interview question,7,The network,The market-data feed handler,https://academicquant.co.uk/qd-feed-handler?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "At the open, the strategies see sequence gaps even though the exchange says nothing was lost. Where could the packets be going, and what would you do about it?",lesson opening question,7,The network,Packet drops and backpressure,https://academicquant.co.uk/qd-drops-backpressure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Where can market data packets be lost before your code sees them?,interview question,7,The network,Packet drops and backpressure,https://academicquant.co.uk/qd-drops-backpressure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What would you do about drops at the open?,interview question,7,The network,Packet drops and backpressure,https://academicquant.co.uk/qd-drops-backpressure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How should a market data consumer handle falling behind?,interview question,7,The network,Packet drops and backpressure,https://academicquant.co.uk/qd-drops-backpressure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "A packet arrives at the server's network card. What happens before recv() returns it to your code, and where does the time go?",lesson opening question,7,The network,Where the network stack spends its time,https://academicquant.co.uk/qd-stack-latency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What happens between a packet arriving at the NIC and recv returning?,interview question,7,The network,Where the network stack spends its time,https://academicquant.co.uk/qd-stack-latency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you reduce receive latency without kernel bypass?,interview question,7,The network,Where the network stack spends its time,https://academicquant.co.uk/qd-stack-latency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you measure network latency inside a server?,interview question,7,The network,Where the network stack spends its time,https://academicquant.co.uk/qd-stack-latency?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "The kernel-tuned path is still too slow. What are the options beyond it, and what does each give up?",lesson opening question,7,The network,"Kernel bypass, RDMA and FPGAs",https://academicquant.co.uk/qd-bypass-hardware?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is kernel bypass and what are the main options?,interview question,7,The network,"Kernel bypass, RDMA and FPGAs",https://academicquant.co.uk/qd-bypass-hardware?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Is DPDK the same thing as kernel bypass?,interview question,7,The network,"Kernel bypass, RDMA and FPGAs",https://academicquant.co.uk/qd-bypass-hardware?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is RDMA?,interview question,7,The network,"Kernel bypass, RDMA and FPGAs",https://academicquant.co.uk/qd-bypass-hardware?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why do HFT firms use FPGAs?,interview question,7,The network,"Kernel bypass, RDMA and FPGAs",https://academicquant.co.uk/qd-bypass-hardware?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why is market data UDP multicast and order entry TCP?,drill prompt,7,The network,Drill: the network,https://academicquant.co.uk/qd-drill-network?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Your feed handler sees sequence number 5002 after 5000. What do you do?,drill prompt,7,The network,Drill: the network,https://academicquant.co.uk/qd-drill-network?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "The exchange says it lost nothing, but we see gaps at the open. Where do you look?",drill prompt,7,The network,Drill: the network,https://academicquant.co.uk/qd-drill-network?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Orders sometimes leave tens of milliseconds late, always just after another small order. Why?",drill prompt,7,The network,Drill: the network,https://academicquant.co.uk/qd-drill-network?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| We have tuned the kernel path. How do we go faster?,drill prompt,7,The network,Drill: the network,https://academicquant.co.uk/qd-drill-network?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Your manager asks how fast the trading system is. You have nanosecond timestamps for a day of messages. What do you report, and why not the average?",lesson opening question,8,Measuring latency,"Measuring latency: percentiles, tails and honest numbers",https://academicquant.co.uk/qd-latency-percentiles?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you report the latency of a system?,interview question,8,Measuring latency,"Measuring latency: percentiles, tails and honest numbers",https://academicquant.co.uk/qd-latency-percentiles?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you record latency percentiles in a live system?,interview question,8,Measuring latency,"Measuring latency: percentiles, tails and honest numbers",https://academicquant.co.uk/qd-latency-percentiles?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is coordinated omission?,interview question,8,Measuring latency,"Measuring latency: percentiles, tails and honest numbers",https://academicquant.co.uk/qd-latency-percentiles?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| The p50 of the book update is fine but p99.9 got worse after a release. How would you find out why? Would you run a profiler?,lesson opening question,8,Measuring latency,Profiling the hot path,https://academicquant.co.uk/qd-profiling?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you find the cause of a tail latency regression?,interview question,8,Measuring latency,Profiling the hot path,https://academicquant.co.uk/qd-profiling?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you read a flame graph?,interview question,8,Measuring latency,Profiling the hot path,https://academicquant.co.uk/qd-profiling?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is the difference between sampling and instrumentation?,interview question,8,Measuring latency,Profiling the hot path,https://academicquant.co.uk/qd-profiling?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Two versions of a function run at different speeds. You may only use perf stat. What do you look at to explain the difference?,lesson opening question,8,Measuring latency,Hardware performance counters,https://academicquant.co.uk/qd-perf-counters?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What do you look at first with perf stat?,interview question,8,Measuring latency,Hardware performance counters,https://academicquant.co.uk/qd-perf-counters?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is top-down analysis?,interview question,8,Measuring latency,Hardware performance counters,https://academicquant.co.uk/qd-perf-counters?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Can you use hardware counters in production?,interview question,8,Measuring latency,Hardware performance counters,https://academicquant.co.uk/qd-perf-counters?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Top-down analysis says the book update is back-end memory bound. What would you do next?,lesson opening question,8,Measuring latency,Finding memory bottlenecks,https://academicquant.co.uk/qd-memory-bottlenecks?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you find out why a function is memory bound?,interview question,8,Measuring latency,Finding memory bottlenecks,https://academicquant.co.uk/qd-memory-bottlenecks?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you tell latency-bound from bandwidth-bound code?,interview question,8,Measuring latency,Finding memory bottlenecks,https://academicquant.co.uk/qd-memory-bottlenecks?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What fixes a latency-bound hot path?,interview question,8,Measuring latency,Finding memory bottlenecks,https://academicquant.co.uk/qd-memory-bottlenecks?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "A service's throughput stops growing beyond four threads and CPU use is low. You suspect a lock. How do you confirm which lock, and what do you do about it?",lesson opening question,8,Measuring latency,Debugging lock contention,https://academicquant.co.uk/qd-lock-contention?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you find lock contention?,interview question,8,Measuring latency,Debugging lock contention,https://academicquant.co.uk/qd-lock-contention?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you fix lock contention?,interview question,8,Measuring latency,Debugging lock contention,https://academicquant.co.uk/qd-lock-contention?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Is a spinlock a fix for contention?,interview question,8,Measuring latency,Debugging lock contention,https://academicquant.co.uk/qd-lock-contention?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Tell me about the hardest performance problem you have debugged.,lesson opening question,8,Measuring latency,Telling a debugging story in an interview,https://academicquant.co.uk/qd-debugging-story?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Tell me about a hard performance problem you solved.,interview question,8,Measuring latency,Telling a debugging story in an interview,https://academicquant.co.uk/qd-debugging-story?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What if your first idea had been wrong?,interview question,8,Measuring latency,Telling a debugging story in an interview,https://academicquant.co.uk/qd-debugging-story?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you make sure a performance fix stays fixed?,interview question,8,Measuring latency,Telling a debugging story in an interview,https://academicquant.co.uk/qd-debugging-story?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How fast is our system? Give me a number.,drill prompt,8,Measuring latency,Drill: measuring and debugging,https://academicquant.co.uk/qd-drill-measure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "After a release, p50 is unchanged but p99.9 doubled. How do you find out why?",drill prompt,8,Measuring latency,Drill: measuring and debugging,https://academicquant.co.uk/qd-drill-measure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Two versions of a function. perf stat shows the same instruction count but the new one takes 30% more cycles. What next?,drill prompt,8,Measuring latency,Drill: measuring and debugging,https://academicquant.co.uk/qd-drill-measure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| The book update is memory bound. What do you do?,drill prompt,8,Measuring latency,Drill: measuring and debugging,https://academicquant.co.uk/qd-drill-measure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Throughput stops increasing beyond four threads and CPU use is low. Diagnose.,drill prompt,8,Measuring latency,Drill: measuring and debugging,https://academicquant.co.uk/qd-drill-measure?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "A strategy decides to buy. Walk me through everything that happens to that order until it is done, and what the trading system must keep track of.",lesson opening question,9,Trading systems,The life of an order,https://academicquant.co.uk/qd-trade-lifecycle?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Describe the lifecycle of an order.,interview question,9,Trading systems,The life of an order,https://academicquant.co.uk/qd-trade-lifecycle?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What are the tricky cases in order management?,interview question,9,Trading systems,The life of an order,https://academicquant.co.uk/qd-trade-lifecycle?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is the difference between IOC and FOK?,interview question,9,Trading systems,The life of an order,https://academicquant.co.uk/qd-trade-lifecycle?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Design the order book that a feed handler maintains from a market-by-order feed. What operations does it need, and what data structures would you use?",lesson opening question,9,Trading systems,Designing an order book,https://academicquant.co.uk/qd-order-book?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you implement an order book?,interview question,9,Trading systems,Designing an order book,https://academicquant.co.uk/qd-order-book?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you keep track of the best bid and ask efficiently?,interview question,9,Trading systems,Designing an order book,https://academicquant.co.uk/qd-order-book?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What changes for a market-by-price feed?,interview question,9,Trading systems,Designing an order book,https://academicquant.co.uk/qd-order-book?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Implement the core of a matching engine: an incoming limit order arrives. What happens? Then tell me what makes a real exchange's engine different from your version.,lesson opening question,9,Trading systems,How a matching engine works,https://academicquant.co.uk/qd-matching-engine?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How does a matching engine process a limit order?,interview question,9,Trading systems,How a matching engine works,https://academicquant.co.uk/qd-matching-engine?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What does an exchange need beyond the basic matching loop?,interview question,9,Trading systems,How a matching engine works,https://academicquant.co.uk/qd-matching-engine?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why is determinism so important in a matching engine?,interview question,9,Trading systems,How a matching engine works,https://academicquant.co.uk/qd-matching-engine?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Every order must pass risk checks before it leaves. Which checks would you implement, where do they live, and how do you keep them from adding latency?",lesson opening question,9,Trading systems,The order gateway and pre-trade risk checks,https://academicquant.co.uk/qd-gateway-risk?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What pre-trade risk checks would you implement?,interview question,9,Trading systems,The order gateway and pre-trade risk checks,https://academicquant.co.uk/qd-gateway-risk?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you make risk checks cheap?,interview question,9,Trading systems,The order gateway and pre-trade risk checks,https://academicquant.co.uk/qd-gateway-risk?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What happens to orders if the exchange connection drops?,interview question,9,Trading systems,The order gateway and pre-trade risk checks,https://academicquant.co.uk/qd-gateway-risk?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Sketch how a market-data update becomes an order inside your system: threads, queues, what the strategy sees, and how you would test it.",lesson opening question,9,Trading systems,From market data to a trading decision,https://academicquant.co.uk/qd-md-to-strategy?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How does market data get to your strategy?,interview question,9,Trading systems,From market data to a trading decision,https://academicquant.co.uk/qd-md-to-strategy?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you test a trading strategy's code?,interview question,9,Trading systems,From market data to a trading decision,https://academicquant.co.uk/qd-md-to-strategy?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What should a strategy do when its market data goes stale?,interview question,9,Trading systems,From market data to a trading decision,https://academicquant.co.uk/qd-md-to-strategy?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "If you had five minutes to explain how you would make a C++ trading system fast, what would you say?",lesson opening question,9,Trading systems,"The patterns, in one place",https://academicquant.co.uk/qd-pattern-map?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you make a C++ trading system fast?,interview question,9,Trading systems,"The patterns, in one place",https://academicquant.co.uk/qd-pattern-map?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Which of those matters most?,interview question,9,Trading systems,"The patterns, in one place",https://academicquant.co.uk/qd-pattern-map?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "You send a cancel for a resting order. Next you receive a fill for the full quantity, then a reject of your cancel. What state is the order in, and what must your system have done meanwhile?",drill prompt,9,Trading systems,Drill: trading systems,https://academicquant.co.uk/qd-drill-trading?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Design the order book for a market-by-order feed. Data structures?,drill prompt,9,Trading systems,Drill: trading systems,https://academicquant.co.uk/qd-drill-trading?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| An aggressive buy limit order arrives. Write the core matching logic in words.,drill prompt,9,Trading systems,Drill: trading systems,https://academicquant.co.uk/qd-drill-trading?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Which pre-trade checks would you run, and how do you keep them under a microsecond?",drill prompt,9,Trading systems,Drill: trading systems,https://academicquant.co.uk/qd-drill-trading?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you test a trading strategy before letting it trade?,drill prompt,9,Trading systems,Drill: trading systems,https://academicquant.co.uk/qd-drill-trading?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Why does 0.1 + 0.2 == 0.3 evaluate to false in C++? What would you use to compare two doubles, and is a double safe for prices?",lesson opening question,10,Numbers and time,How floating point really behaves,https://academicquant.co.uk/qd-floating-point?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why can't 0.1 be represented exactly as a double?,interview question,10,Numbers and time,How floating point really behaves,https://academicquant.co.uk/qd-floating-point?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you compare floating-point numbers?,interview question,10,Numbers and time,How floating point really behaves,https://academicquant.co.uk/qd-floating-point?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What are denormals and why do they matter for latency?,interview question,10,Numbers and time,How floating point really behaves,https://academicquant.co.uk/qd-floating-point?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you represent prices in a trading system? What are the pitfalls of your choice?,lesson opening question,10,Numbers and time,Prices as integer ticks,https://academicquant.co.uk/qd-integer-ticks?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you represent prices?,interview question,10,Numbers and time,Prices as integer ticks,https://academicquant.co.uk/qd-integer-ticks?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What can go wrong with integer prices?,interview question,10,Numbers and time,Prices as integer ticks,https://academicquant.co.uk/qd-integer-ticks?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why not just use double?,interview question,10,Numbers and time,Prices as integer ticks,https://academicquant.co.uk/qd-integer-ticks?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "A strategy keeps a running variance of returns over the day with the textbook formula, sum of squares minus square of the sum. Late in the day it sometimes reports a negative variance. Explain.",lesson opening question,10,Numbers and time,Numerically stable calculations,https://academicquant.co.uk/qd-numerical-stability?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is catastrophic cancellation?,interview question,10,Numbers and time,Numerically stable calculations,https://academicquant.co.uk/qd-numerical-stability?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How would you sum millions of doubles accurately?,interview question,10,Numbers and time,Numerically stable calculations,https://academicquant.co.uk/qd-numerical-stability?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| Why does floating-point non-associativity matter for a trading system?,interview question,10,Numbers and time,Numerically stable calculations,https://academicquant.co.uk/qd-numerical-stability?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "You need timestamps for latency measurement inside the process and for regulatory reporting of order events. Which clocks do you use for each, and why?",lesson opening question,10,Numbers and time,"Time, timestamps and clocks",https://academicquant.co.uk/qd-time-clocks?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| What is the difference between steady_clock and system_clock?,interview question,10,Numbers and time,"Time, timestamps and clocks",https://academicquant.co.uk/qd-time-clocks?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you timestamp events on the hot path cheaply?,interview question,10,Numbers and time,"Time, timestamps and clocks",https://academicquant.co.uk/qd-time-clocks?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How are clocks synchronised in a trading firm?,interview question,10,Numbers and time,"Time, timestamps and clocks",https://academicquant.co.uk/qd-time-clocks?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "Why might two prices computed by different code paths compare unequal, and what would you do?",drill prompt,10,Numbers and time,Drill: numbers and time,https://academicquant.co.uk/qd-drill-numbers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| How do you represent prices in the system?,drill prompt,10,Numbers and time,Drill: numbers and time,https://academicquant.co.uk/qd-drill-numbers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "A running variance using sum of squares minus square of sum goes negative. Why, and what's the fix?",drill prompt,10,Numbers and time,Drill: numbers and time,https://academicquant.co.uk/qd-drill-numbers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| We want a timestamp at every stage for every message. clock_gettime costs too much. What do you do?,drill prompt,10,Numbers and time,Drill: numbers and time,https://academicquant.co.uk/qd-drill-numbers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |
| "How do you make timestamps from different machines comparable, and what do regulators require?",drill prompt,10,Numbers and time,Drill: numbers and time,https://academicquant.co.uk/qd-drill-numbers?utm_source=huggingface&utm_medium=post&utm_campaign=hf-hft-interview-questions | |