Dataset Viewer
Auto-converted to Parquet Duplicate
Question
stringlengths
1.67k
6.9k
Answer
stringlengths
285
6.25k
**Use Case:** Technical Analysis & Trade Identification **Scenario Description and Assumptions:** A trader is analyzing the price chart of a stock. They observe that the 50-day Simple Moving Average (SMA) has crossed above the 200-day SMA (a "golden cross"). **Step 1 – Identify the Real-World Financial Problem:** Dete...
The Python code would implement the symbolic rules from Step 5 using conditional statements. No numerical computation is required as the problem focuses on symbolic representation of the trading rule. The code would look something like this (though without actual numerical data processing): ```python def trading_dec...
**Use Case:** Derivatives Pricing & Valuation **Scenario Description and Assumptions:** A portfolio manager at a large investment bank needs to accurately price a European call option on a non-dividend paying equity index. The manager aims to understand the theoretical fair value under the assumption of continuous tra...
This problem requires using the Black-Scholes-Merton formula. While a full Python implementation with numerical computation is possible, the request is for symbolic computation, so representing the formulas symbolically is sufficient: ```python import sympy S_0, K, T, r_f, sigma = sympy.symbols('S_0 K T r_f sigma') ...
**Use Case:** Dynamic Hedging & Risk Management **Scenario Description and Assumptions:** A market maker holds a significant long position in a European call option on a highly volatile equity. To mitigate the risk exposure to small price movements in the underlying asset, the market maker seeks to construct a dynamic...
The core of this problem is symbolic representation of delta hedging. Numerical implementation would require a method for calculating delta (e.g., using finite differences or a closed-form expression if available for C). The focus here is on the symbolic relationships: ```python import sympy S_t, C, delta = sympy.s...
**Use Case:** Risk Management & Assessment **Scenario Description and Assumptions:** A risk manager at a global asset management firm needs to quantify the potential market risk of a diversified portfolio of equities and fixed-income securities over a specific short-term horizon. The board requires not only a measure ...
The key is representing VaR and ES symbolically. Numerical calculation needs historical data or simulations. The code shows symbolic formulas: ```python import sympy P_t, alpha = sympy.symbols('P_t alpha') portfolio_return_quantile = sympy.Symbol('portfolio_return_quantile') VaR = -P_t * portfolio_return_quantile ...
**Use Case:** Financial Modeling Foundations / Asset Price Forecasting **Scenario Description and Assumptions:** An analyst is tasked with simulating the future paths of a specific stock price for a Monte Carlo option pricing model. The analyst assumes that the stock's price movements are continuous, random, and propo...
The focus is on the symbolic representation of the GBM SDE and its solution. Numerical simulation would require generating random numbers and iterating. ```python import sympy S_t, mu, sigma, dW_t, dt = sympy.symbols('S_t mu sigma dW_t dt') S_0 = sympy.Symbol('S_0') # GBM SDE SDE = sympy.Eq(sympy.Derivative(S_t, t)...
**Use Case:** Credit Risk Modeling & Corporate Valuation **Scenario Description and Assumptions:** A corporate finance analyst is assessing the credit risk of a leveraged firm that has outstanding zero-coupon debt maturing in the future. The analyst views the firm's equity as a contingent claim on its underlying asset...
The Merton model's symbolic representation is the core. Numerical computation requires evaluating the cumulative normal distribution function. ```python import sympy V_A, sigma_A, D, T, r_f = sympy.symbols('V_A sigma_A D T r_f') d1_Merton = (sympy.log(V_A / D) + (r_f + (sigma_A**2 / 2)) * T) / (sigma_A * sympy.sqrt(...
**Use Case:** Quantitative Investment Strategies / Global Macro **Scenario Description and Assumptions:** An asset manager seeks to implement a quantitative global macro strategy to profit from broad macroeconomic trends and market movements across various asset classes (equities, fixed income, currencies, commodities...
This problem focuses on symbolic representation of a generalized model, not on a specific model implementation. ```python import sympy R_future_asset_j = sympy.Symbol('R_future_asset_j') M_k = sympy.Symbol('M_k') # Macroeconomic indicators A_j_historical = sympy.Symbol('A_j_historical') #Historical asset prices/yield...
**Use Case:** Derivatives Pricing / Complex Option Valuation **Scenario Description and Assumptions:** An option desk needs to price a complex, path-dependent exotic option (e.g., an Asian option where the payoff depends on the average underlying price over time). Due to the path-dependent nature and absence of a clos...
The core is the Monte Carlo simulation process described symbolically. Numerical implementation would involve generating random numbers and running the simulations. ```python import sympy S_0, K, T, r_f, sigma, M, N_steps, delta_t = sympy.symbols('S_0 K T r_f sigma M N_steps delta_t') epsilon_ij = sympy.Symbol('eps...
**Use Case:** Portfolio Risk Management / Stress Testing **Scenario Description and Assumptions:** A quantitative hedge fund relies heavily on diversification benefits derived from combining assets with low historical correlations. The risk team is particularly concerned about the robustness of their portfolio during ...
The focus is representing the stress test symbolically; numerical implementation requires specifying asset returns, correlations, and portfolio weights. ```python import sympy R_i, R_j, rho_ij, w_i, P_t, sigma_P = sympy.symbols('R_i R_j rho_{i,j} w_i P_t sigma_P') rho_prime_ij = sympy.Symbol('rho\'_{i,j}') #Stressed...
**Use Case:** High-Frequency Trading (HFT) / Market Microstructure **Scenario Description and Assumptions:** A proprietary trading firm specializes in High-Frequency Trading and aims to profit from minimal, fleeting price discrepancies across different exchange venues for the same security. The firm is willing to inve...
The symbolic representation emphasizes the conditions for arbitrage and the latency components. Numerical implementation requires real-time data feeds and extremely low-latency execution capabilities. ```python import sympy P_venue_A, P_venue_B, C_trade = sympy.symbols('P_venue_A P_venue_B C_trade') # Arbitrage con...
**Use Case:** Risk Management / Market Integrity **Scenario Description and Assumptions:** A market surveillance team at an exchange is investigating unusual trading patterns involving rapid submission and cancellation of large orders on a particular security. These orders appear designed to create false impressions o...
A Python implementation for detecting spoofing and layering in high-frequency trading data is required. The system will analyze order submission and cancellation rates, order lifetime, and order book impact correlated with price movements. The code should include functions to calculate `Ratio_Cancel_to_Submit`, `Volu...
**Use Case:** Derivatives Pricing & Valuation Theory **Scenario Description and Assumptions:** A commodity trading firm needs to determine the theoretical no-arbitrage price for a futures contract on a non-dividend paying stock index. They understand that holding the underlying asset incurs a cost (financing) and pote...
A Python function for calculating the theoretical no-arbitrage price of a futures contract on a non-dividend paying stock index is needed. The function should accept the spot price (`S_0`), risk-free rate (`r_f`), and time to maturity (`T`) as inputs and return the calculated futures price (`F_0`). The function should ...
**Use Case:** Credit Risk Modeling / Debt Valuation **Scenario Description and Assumptions:** A fixed-income portfolio manager needs to assess the credit risk of a large corporate bond portfolio. Unlike structural models, the manager is not interested in modeling the firm's asset-liability structure directly but rathe...
A statistical model for assessing credit risk of a corporate bond portfolio is needed. The model should estimate the probability of default (PD) and loss given default (LGD) using observable market data and macroeconomic factors. It should incorporate a hazard rate (`λ_t`) driven by covariates, enabling the calculatio...
**Use Case:** Quantitative Trading & Investment Strategies **Scenario Description and Assumptions:** A quantitative trading firm aims to profit from short-term mispricings between statistically related securities. They specifically look for pairs of stocks that have historically moved together but have temporarily div...
Python code to implement a pairs trading strategy is needed. The code should calculate the spread between two statistically related securities, determine the Z-score based on historical mean and standard deviation, generate trading signals based on Z-score thresholds, and manage positions until the spread reverts to it...
**Use Case:** Risk Management & Assessment / Model Validation **Scenario Description and Assumptions:** Following a period of unexpected market volatility and losses, a financial institution's risk committee is reviewing its quantitative models. They suspect that some models, which performed well in benign market cond...
A Python framework for assessing model risk is required. This framework should include functions for model validation (testing assumptions), backtesting (comparing model predictions to actual results), stress testing (simulating extreme market scenarios), and sensitivity analysis (evaluating model output changes with ...
**Use Case:** Derivatives Strategy / Portfolio Construction **Scenario Description and Assumptions:** An experienced options trader believes that a particular stock's price will remain relatively stable in the near term but might experience a large move (up or down) after an upcoming earnings announcement, without a s...
A Python function to construct a long straddle or long strangle option strategy is needed. The function should calculate the initial cost of the strategy, determine the payoff at expiration, and calculate the profit/loss. The function should include options for specifying different strike prices for the strangle. The...
**Use Case:** Quantitative Trading & Investment Strategies / Algorithmic Execution **Scenario Description and Assumptions:** An institutional asset manager needs to execute a very large block order for a highly liquid stock, but wishes to minimize market impact and avoid signaling their intentions to other market part...
A Python implementation of a VWAP or TWAP algorithm for executing a large block order while minimizing market impact is required. The code should handle order slicing based on historical volume or time intervals, considering a market impact model to determine optimal order sizes and adapt to the order book conditions. ...
**Use Case:** Market Structure & Dynamics / Trading Strategy Risk **Scenario Description and Assumptions:** An institutional investor frequently trades large blocks of shares and opts to use dark pools to avoid disclosing their intentions and minimize market impact. However, the investor is concerned that their large ...
A Python framework to analyze and mitigate information leakage risk in dark pools during block order executions is needed. The framework should simulate "ping" strategies used by high-frequency traders (HFTs) to probe order flow in dark pools, and simulate HFTs analyzing order flow imbalances between dark and lit venu...
**Use Case:** Risk Management & Assessment / Market Structure **Scenario Description and Assumptions:** Regulators are concerned about the increasing frequency and severity of "flash crashes" in modern financial markets, characterized by rapid, severe, and unexplained price dislocations followed by quick rebounds. The...
Python code to model the dynamics of a flash crash in an algorithm-driven market is required. The code should simulate an initial shock, track the feedback loop between algorithmic strategies and liquidity providers (market makers), the widening bid-ask spread, reduction in order book depth, and the cascading effect of...
**Use Case:** Derivatives Pricing / Option Valuation **Scenario Description and Assumptions:** A junior quant analyst needs to price an American put option, for which no simple closed-form solution exists due to the early exercise feature. The analyst requires a flexible and intuitive numerical method that can handle ...
A Python implementation of the binomial option pricing model (BOPM) for pricing American put options is needed. The implementation should include the calculation of asset prices at each node in the binomial tree, determine the early exercise boundary at each node based on comparing intrinsic value with continuation va...
**Use Case:** Fundamental Principles / Market Design **Scenario Description and Assumptions:** A financial regulator is evaluating the robustness of new financial products and trading mechanisms. Their primary concern is to ensure market integrity and investor confidence. They believe that the fundamental absence of r...
```python import sympy from sympy import symbols, exp, E, Integral, Function, And, GreaterThan, LessThan, Eq from sympy.stats import Normal, density # Requirement 1: No-Arbitrage Principle / Market Completeness # Define symbolic variables P_t_i, CF_t, r_f, T = symbols('P_t_i CF_t r_f T', real=True, positive=True) V_D...
**Use Case:** Derivatives Valuation / Risk-Neutral Pricing **Scenario Description and Assumptions:** A portfolio manager needs to determine the fair, arbitrage-free price of a European call option on a non-dividend-paying stock. The manager aims to understand the theoretical value to identify potential mispricings in ...
```python import sympy from sympy import symbols, exp, sqrt, log, Rational, pi, N as sympy_N from sympy.stats import Normal, cdf # Requirement 2: Derivatives Valuation / Risk-Neutral Pricing (Black-Scholes-Merton) # Define symbolic variables C, S_0, K, T, r_f, sigma = symbols('C S_0 K T r_f sigma', real=True, positiv...
**Use Case:** Risk Management / Capital Allocation **Scenario Description and Assumptions:** A financial institution's risk department needs to quantify the potential maximum loss of a complex derivatives portfolio over a specified time horizon and confidence level. They are debating between using Value-at-Risk (VaR) ...
```python import sympy from sympy import symbols, Eq, Integral, oo, Function, Min, Max, solve # Requirement 3: Risk Management (VaR/ES) # Define symbolic variables VaR_alpha_dt, ES_alpha_dt = symbols('VaR_alpha_dt ES_alpha_dt', real=True) DeltaP = symbols('DeltaP', real=True) # Portfolio profit/loss alpha = symbols('...
**Use Case:** Hedging Strategies / Derivatives Risk Management **Scenario Description and Assumptions:** A proprietary trading desk has taken a significant long position in a call option on a highly volatile equity. The desk's risk manager is concerned about the immediate sensitivity of the option's value to small mov...
```python import sympy from sympy import symbols, Eq, Rational, dsolve, Function # Requirement 4: Hedging Strategies (Delta Hedging) # Define symbolic variables C, S, Delta, Gamma, Theta = symbols('C S Delta Gamma Theta', real=True) Pi = symbols('Pi', real=True) # Value of the hedging portfolio dPi, dC, dS, dT = symb...
**Use Case:** Corporate Finance / Project Valuation under Uncertainty **Scenario Description and Assumptions:** A manufacturing firm is considering a significant capital expenditure project that involves investing in a new production line. The project's future cash flows are highly uncertain, primarily driven by varia...
```python import sympy from sympy import symbols, Eq, Sum, Integral, exp, Rational, Function, dsolve, Derivative # Requirement 5: Corporate Finance / Project Valuation under Uncertainty (Monte Carlo NPV) # Define symbolic variables NPV, CF_t, r, t, I_0, T_proj, N, NPV_j = symbols('NPV CF_t r t I_0 T_proj N NPV_j', re...
**Use Case:** Credit Risk Modeling / Debt Valuation **Scenario Description and Assumptions:** A bank is assessing the creditworthiness of a corporate client that has issued zero-coupon debt. The bank needs to estimate the probability of default for this client, understanding that default typically occurs when the firm...
```python import sympy from sympy import symbols, exp, sqrt, log, Rational, pi, N as sympy_N from sympy.stats import Normal, cdf # Requirement 6: Credit Risk Modeling / Debt Valuation (Merton Model) # Define symbolic variables E, A_0, D, T_D, r_f, sigma_A = symbols('E A_0 D T_D r_f sigma_A', real=True, positive=True)...
**Use Case:** Arbitrage Strategies / Futures Pricing **Scenario Description and Assumptions:** An investment firm observes a discrepancy between the theoretical fair value of a futures contract on a non-dividend-paying stock index and its current market price. The firm's quantitative analysts suspect an arbitrage oppo...
```python import sympy from sympy import symbols, exp, Eq, Abs, Function # Requirement 7: Arbitrage Strategies / Futures Pricing # Define symbolic variables F_T, S_0, r_f, T = symbols('F_T S_0 r_f T', real=True, positive=True) F_0 = symbols('F_0', real=True, positive=True) # Observed market futures price AP = symbols...
**Use Case:** Fixed Income Valuation / Interest Rate Modeling **Scenario Description and Assumptions:** A pension fund manager needs to price a long-term bond, but the current term structure of interest rates is complex and anticipated to change stochastically over time. A constant interest rate assumption is too simp...
```python import sympy from sympy import symbols, Eq, Sum, Integral, exp, sqrt, Function, dsolve, Derivative # Requirement 8: Fixed Income Valuation / Interest Rate Modeling (CIR Model) # Define symbolic variables for CIR model r_t, kappa, theta, sigma_r, dW_t, dt = symbols('r_t kappa theta sigma_r dW_t dt', real=Tru...
**Use Case:** Quantitative Trading / Statistical Arbitrage **Scenario Description and Assumptions:** A quantitative hedge fund wants to implement a statistical arbitrage strategy based on the concept of mean-reversion. They have identified two highly correlated securities (e.g., two stocks in the same industry, or a s...
```python import sympy from sympy import symbols, Eq, sqrt, Rational, Function, Derivative # Requirement 9: Quantitative Trading / Statistical Arbitrage (Mean-Reversion) # Define symbolic variables X_t, kappa_X, mu_X, sigma_X, dW_t, dt = symbols('X_t kappa_X mu_X sigma_X dW_t dt', real=True) Z_t = symbols('Z_t', real...
**Use Case:** Model Risk Management / Stress Testing **Scenario Description and Assumptions:** A large investment bank's risk department uses sophisticated quantitative models (e.g., for VaR, derivatives pricing, portfolio optimization). Following past market crises (e.g., "quant meltdown" of 2007-2008), there's heigh...
```python import sympy from sympy import symbols, Eq, Function, Abs # Requirement 10: Model Risk Management / Stress Testing # Define symbolic variables V_portfolio = symbols('V_portfolio', real=True) # Current portfolio value M_i = Function('M_i') # A specific financial model A_j = Function('A_j') # Key assumption o...
**Use Case:** High-Frequency Trading (HFT) / Market Making **Scenario Description and Assumptions:** A high-frequency trading firm operates a speed-advantaged market-making strategy. Their goal is to profit from the bid-ask spread by continuously quoting prices for a highly liquid stock. The firm needs to optimize its...
```python from sympy import symbols, exp, sqrt, log # Define symbols based on Step 5 P_mid, gamma, q, sigma_p, T_rem_total, T_rem_current = symbols('P_mid gamma q sigma_p T_rem_total T_rem_current') lambda_a, lambda_b = symbols('lambda_a lambda_b') # Arrival rates delta_q, delta_a, delta_b = symbols('delta_q delta_a d...
**Use Case:** Option Trading Strategies / Hedging **Scenario Description and Assumptions:** An investor holds a significant long position in a common stock. While bullish on the long-term prospects of the stock, the investor is concerned about potential short-term downside risk that could significantly erode capital g...
```python from sympy import symbols, Max # Define symbols based on Step 2 and Step 5 S_0, P_L, C_H, S_T = symbols('S_0 P_L C_H S_T') Premium_P, Premium_C = symbols('Premium_P Premium_C') # Define the initial net premium based on Step 5 Net_Premium_expr = Premium_P - Premium_C # Define the payoff symbolically for eac...
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
8