Difficulty: Medium
Category: Code Analysis
Practice quant interview questions from top firms including Jane Street, Citadel, Two Sigma, DE Shaw, and other leading quantitative finance companies.
Topics: integer overflow, position sizing, C++, numerical stability
A trading firm uses a C++ program to calculate the number of shares to buy for a given stock. The program takes a portfolio size (in dollars) and calculates the number of shares by dividing the allocated capital for the stock by the current price of the stock. Critically, the number of shares is stored as a signed 32-bit integer (int). Specifically, the code does the following: Assume the portfolio size is 1 billion dollars (1,000,000,000). The allocation_percentage for a particular stock is 5%
Practice this medium trader interview question on MyntBit - the all-in-one quant learning platform with 200+ quant interview questions for Jane Street, Citadel, Two Sigma, and other top quantitative finance firms.