instruction stringlengths 15 26.1k |
|---|
*This was too long for a comment, so I'm writing it as an answer.* I have provided some interesting literature that will give you insight into the common pitfalls of backtesting algorithmic trading strategies.
## Marcos Lopéz de Prado on backtesting:
Marcos Lopéz de Prado provides some very [good slides](https:/... |
I am fairly certain I am correct but I just want to double-check on portfolio turnover calculation. I need to annualize the daily turnover rate. To calculate, the daily turnover, I am using the following formula:
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/a0Naq.png
where N is th... |
This seems like a simple concept but I'm a bit lost. How can I calculate the dollar value sensitivity for a yield curve slope or butterfly position? I understand how DV01 can be calculated, but it seems that it's only applicable to a parallel shift in the yield curve.
For example, if I have a 2s10s steepener positio... |
How to measure Steepener/Flattener/Butterfly sensitivity? (in 01) |
Assume stock is 50 dollars. From what I understand, an annualized vol of 20% means there is a ~68% chance the stock will be between 40 and 60 a year from now; a ~95% chance it will be between 30 and 70; and so on.
What if volatility is 100% or higher? Would that mean ~68% of the time it will be between 0 and 100 a y... |
Significance of annualized volatility over 100% on the normal distribution? |
i run gjrgarch model on russia stock market where the gamma coefficient in gjrgarch(1,1) model output is insignificant but positive.
"gamma1 -0.026240 0.033785 -0.77669 0.437340"
how should i interpret this? |
how should i interpret the gjr-garch output where the gamma coefficient comes positives but insignificant? |
**Problem**
I am considering an American call option which gives a domestic investor the right to buy a unit of foreign currency at a strike of $K$ units of domestic currency. I have an exchange rate $S_t$ in units of domestic to foreign currency which follows
$$\frac{\mathrm{d}S_t}{S_t}=\mu\mathrm{d}t+\sigma\mathr... |
Im kinda stuck, I have the following problem.
I am given the terms in Month, a netvalue a residual value and a monthly rate. Now my job is to calculate the interest. Usually I am giving the interest and calculate anything else using the following formula
[![enter image description here][1]][1]
where n is the ... |
I'm kinda stuck with the following problem.
I am given the terms in Month, a net-value, a residual value, and a monthly rate. Now my job is to calculate the interest. Usually I am giving the interest and calculate anything else using the following formula:
[![enter image description here][1]][1]
where $n$ is ... |
Here is the formula of CVA in page 74 in book `Modern Derivatives Pricing and Credit Exposure Analysis`.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/tGwnU.png
Here $t_0 = t<t_1<\cdots<t_n = T;$ $\tau$ is the default; $X(t)$ is any value.
I don't much understand how we get the ... |
The simplest reference would be Derivative Analytics with Python -- simple, concise and to the point about why this works and how to apply it. It also comes with Python code (bad inefficient, but illustrative code).
The key to "when" you apply this? It's useful when you can write the conditional characteristic funct... |
I'm attempting to shift both a discount and projection curve but am having trouble passing through the VanillaSwap() because of the Ibor input requirement -- I'm trying to calculate the dv01 of a US dollar swap, which requires the base and shifted (up, down) 3mL curve and SOFR curve. How do I pass the shifted 3mL curve... |
I'm attempting to shift both a discount and projection curve but am having trouble passing through the VanillaSwap() because of the Ibor input requirement -- I'm trying to calculate the dv01 of a US dollar swap, which requires the base and shifted (up, down) 3mL curve and SOFR curve. How do I pass the shifted 3mL curve... |
Imagine an open term loan with monthly interest payments of [x]% and the principle due when the loan is closed. Both the lender can call the loan, and the borrower can return the loan (with no penalty) at any time.
If its helpful, assume the loan asset has liquid secondary market and mature futures market with a kno... |
How to explain the anticipation effect testing result? |
I have recently implemented MPT in Python, however, when I allow negative weigths (short selling), they do not add up to one. Isn't it suppose not to happen? On the other hand, when I don't allow, they add up to one as usual.
Here's what I did:
1. Defined the return as usual: $\vec{W}^{T} \vec{R}$, where $\vec{W... |
I have recently implemented MPT in Python, however, when I allow negative weigths (short selling), they do not add up to one. Isn't it suppose not to happen? On the other hand, when I don't allow, they add up to one as usual.
Here's what I did:
1. Defined the return as usual: $\vec{W}^{T} \vec{R}$, where $\vec{W... |
We have a barrier call option of European type with strike price ```K>0``` and a barrier value
```0 < b< S0``` ,
where ```S_0``` is the starting price.According to the contract, the times ```0<t_1<...<t_k<T``` the price must be checked ```S(t_k)>b ``` for every ```k```.
Assuming the ```S(t)``` is describe... |
How can I implement the barrier option call model in Python? |
We have a barrier call option of European type with strike price $K>0$ and a barrier value
$0 < b< S_0$,
where $S_0$ is the starting price.According to the contract, the times $0<t_1<...<t_k<T$ the price must be checked $S(t_k)>b$ for every $k$.
The payoff function : $$C_{T} = \max(S(T)-K) \mathbf{1}_{S(t... |
How can I simulate the barrier option call model in Python? |
We have a barrier call option of European type with strike price $K>0$ and a barrier value
$0 < b< S_0$,
where $S_0$ is the starting price.According to the contract, the times $0<t_1<...<t_k<T$ the price must be checked $S(t_k)>b$ for every $k$.
The payoff function : $$C_{T} = \max(S(T)-K) \mathbf{1}_{S(t... |
I have recently implemented MPT in Python, however, when I allow negative weights (short selling), they do not add up to one. Isn't it suppose not to happen? On the other hand, when I don't allow, they add up to one as usual.
Here's what I did:
1. Defined the return as usual: $\vec{W}^{T} \vec{R}$, where $\vec{W... |
Is there any research on how to measure the stability of factor loadings, for example from Fama French/Carhart type factor models?
The goal is to test different ways to construct a risk factor, such as for example a risk factor for climate/carbon risk. One criterion is that the risk factor produces loadings which... |
how to measure the stability of factor loadings? |
Regarding Difference-in-Difference, the main assumption is the parallel trend satisfication. Regarding the parallel trend test, just simply prove the joint null test of leads coefficients equalling to zero.However, there is another assumption of concern is **"no anticipation effect"**.
I read the paper of [Borusyak, 2... |
I am trying to use short rate models (e.g. Vasicek, CIR or Hull-White) to forecast next one or two months yield curve. In this context, is there a way that I can include some exogenous economic or market-related variables in these models? Have you seen any literature in this regard?
If no, do you know any other body... |
I'm interested in manually replicating the bootstrapping procedure that Bloomberg uses to built ICVS179 (RUB vs MosPrime 3M) curve up to a two years tenor as of October 12th 2021.
These are the market instruments that were taken for curve construction, their market rates, zero rates and discounts as they are given i... |
How to explain the " no anticipation effect" testing result in Diff-in-Diff? |
[![enter image description here][1]][1]
Why are quants never ripped off in Bangkok?
They are good at pricing exotics.
---
Why do quants look so happy?
They work on volatility smiles.
---
What is the difference between a used car salesman and a derivatives salesman?
The used car salesman knows ... |
Normally, I exclude a covariate out of the regression equation if there are many missing observations, let's say it is one-fifth less observation compared to other variables' observations in general (saying 80,000 compared to 100,000).
But now, when reflecting back, I am wondering **if there is any reference or expl... |
What is the reference for excluding a covariate if there is many missing observation? |
I've just read the paper on Double Heston model (2009) from Peter Christoffersen. They calibrate the model using market data from every Wednesday in a year period. So in the same calibration the include option (market) prices from 52 different dates. That's the way they test the calibration performance of the Double He... |
Double Heston calibration in Christoffersen's paper uses 52 sets of market data (each set as of a different date). Why? |
Double Heston model calibration in Christoffersen's paper uses 52 sets of market data (each set as of a different date). Why? |
In an interview, I was once told that I should not consider probability when talking about option greeks since from a mathematical point of view greeks have nothing to do with probability. That is of course true, from a mathematical point of view, but the way greeks are taught always takes into account the probability ... |
I've just read the paper on Double Heston model (2009) from Peter Christoffersen. They calibrate the model using market data from every Wednesday in a year period. So in the same calibration they include option (market) prices from 52 different dates. That's the way they test the calibration performance of the Double H... |
I have recently implemented MPT in Python, however, when I allow negative weights (short selling), they do not add up to one. Isn't it suppose not to happen? On the other hand, when I don't allow, they add up to one as usual.
Here's what I did:
1. Defined the return as usual: $\vec{W}^{T} \vec{R}$, where $\vec{W... |
I have recently implemented MPT in Python, however, when I allow negative weights (short selling), they do not add up to one. Isn't it suppose not to happen? On the other hand, when I don't allow, they add up to one as usual.
Here's what I did:
1. Defined the return as usual: $\vec{W}^{T} \vec{R}$, where $\vec{W... |
I am doing my research related to IPOs long term performance. For the BHAR formula, I just want to clarify the formula is that always compare with the first trading day price, or is compared with last month trading price?
For example, (always compare with month 1)
[(Month 2/Month 1) x (Month 3/Month 1) x (Month 4/M... |
How to calculate Buy and Hold Abnorml Retures? |
I'm somewhat confused with regards to calculating the annual standard deviation and Sharpe ratio for my portfolio of daily returns.
I have daily data ranging from 1960-2020 and use Excel to make some calculations. I have attempted 2 ways of doing it and don't know which makes most sense.
1) I calculated the annu... |
How can I calculate the annual Standard Deviation for Sharpe Ratio of Daily Portfolio Returns? |
I'm somewhat confused with regards to calculating the annual standard deviation and Sharpe ratio for my portfolio of daily returns.
I have daily data ranging from 1960-2020 and use Excel to make some calculations. I have attempted 2 ways of doing it and don't know which makes most sense.
1) I calculated the annu... |
I am doing my research related to IPOs long term performance. For the BHAR formula, I just want to clarify the formula is that always compare with the first trading day price, or is compared with last month trading price?
For example, (always compare with month 1)
[(Month 2/Month 1) x (Month 3/Month 1) x (Month 4/M... |
I have recently watched two videos about Kelly Criterion for portfolio optimization, however [one](https://www.youtube.com/watch?v=o7YIa1w58Yc&t=522s) seem not to deduce it correctly (as people commented) and the [another](https://www.youtube.com/watch?v=0temN7hAf2c&t=452s) just don't show any deductions at all. Right ... |
I have recently watched two videos about Kelly Criterion for portfolio optimization, however [one](https://www.youtube.com/watch?v=o7YIa1w58Yc&t=522s) seem not to deduce it correctly (as people commented) and the [another](https://www.youtube.com/watch?v=0temN7hAf2c&t=452s) just don't show any deductions at all. Right ... |
Investor and Software Engineer but very new to quant finance here...
I have the below code (which I'm sure will be helpful for some) and have some questions regarding the function parameters!
1) Is RF Rate your interest rate on treasuries? Basically your no risk competing return?
2) How much will dividends influ... |
I have been experimenting with multiple methods of forecasting the daily high and low for a certain security. I have found a very basic ensemble of several common forecasting approaches is, well, highly imperfect, but better than throwing darts at a dart board. And I have a number of measures of forecast quality on his... |
How to calculate the BHAR (Buy-and-Hold Abnormal Returns)? |
I stumbled across a [site](https://www.portfoliowizards.com/rational-investors-hold-some-volatile-assets/) that claims
>"given a long enough forecast horizon H, all assets with positive volatility have an unbiased expected return that is negative".
They base this on the formula:
>Expected log return over H period... |
Do all risky assets have negative expected return over long enough time horizons? |
You could try "Factor Investing in the Corporate Bond Market" (https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2516322). The value and momentum factors they mention in the paper are also used in government bonds (which are the same thing as sovereign bonds). |
I'm trying to implement a script for portfolio optimization on a sample universe of 3 future contracts.
I have the following inputs:
- current allocation --> number of contracts currently held for each of
the 3 futures
- contracts_size --> the size (in USD) of each of the 3
futures
- ptf_size --> t... |
I stumbled across a [site](https://www.portfoliowizards.com/rational-investors-hold-some-volatile-assets/) that claims
>"given a long enough forecast horizon H, all assets with positive volatility have an unbiased expected return that is negative".
They base this on the formula:
>Expected log return over Horizon ... |
I believe this is a (fairly) simple question for those familiar with quantitative finance and MC/QMC methods of pricing complex options. Or potentially its just a simple Python loop vectorization question, with no knowledge of quantitative finance needed.
So I'm trying to understand the Brownian-Bridge technique. ... |
Efficient method for expanding 1 sim routine to the number of simulations? Brownian Bridge used with multiple underlying assets in a MC simulation, |
In this [question][1], suggestions on algorithms from [Lee and Ready][2] and [Pan and Poteshman][3] address ways to determine trade side without access to bid/ask quotes.
The streaming data I have access to yields data similar to the below:
timestamp mark bid ask last volume
163511... |
What's the best way to determine if trade was buyer (seller) initiated, having access to bid/ask/last quotes? |
Hmm... a not fully checked potential solution based on the comment by *will*, which initially (before I changed the np.random.randn to (underlyings, sims)) all the "random" numbers were identical across the simulations. Anyhow this "appears" to work very fast, although the matrices of random numbers (after fixing the ... |
Is there a standard(ish) way of classifying a pullback?
For example, in a clearnomics report they have: [![clearnomics report][1]][1]
showing 12 pullbacks of 5% (or, presumably, greater), and the same for 2000.
LPL Research have slightly different numbers: [![lpl-research][2]][2] showing around 7 for each of... |
How should I define a pullback in price? |
I'm trying to implement a script for portfolio optimization on a sample universe of 3 future contracts.
I have the following inputs:
- current allocation --> number of contracts currently held for each of
the 3 futures
- contracts_size --> the size (in USD) of each of the 3
futures
- ptf_size --> t... |
I am trying to use Quandl data futures for backtesting some trading scenarios, specifically
[Wiki Continuous Futures][1].
Following the documentation, I understand that the data-set contains continuous contracts named by the following convention CHRIS/{EXCHANGE}_{CODE}{NUMBER}.
For example for crude oil (CL symb... |
Should I take in count future which are used to lower the duration to calculate the portfolio's YTM ?
(Bloomberg calculate portfolio's YTM without Future)
Im currently doing the weighted average. I also take in count future.
![1]
If the calculation change with future, what would be the correct formula ?
... |
You should frame this as an optimization problem.
What are you trying to maximize?
What are your constraints?
Once you set up the problem, you'll need to optimize for the hyperparameters. That's where backtesting comes in.
Check out this for inspiration:
https://web.stanford.edu/~boyd/papers/pdf/cvx_portfo... |
What's the difference between these instruments? I know that the Eurodollar is for dollars outside of the US, but is there any material difference other than contract size when it comes to trading each respective futures (in terms of volatility or profit?) |
I am trying to use Quandl data futures for backtesting some trading scenarios, specifically
[Wiki Continuous Futures][1].
Following the documentation, I understand that the data-set contains continuous contracts named by the following convention CHRIS/{EXCHANGE}_{CODE}{NUMBER}.
For example for crude oil (CL symb... |
I am trying to use Quandl data futures for backtesting some trading scenarios, specifically
[Wiki Continuous Futures][1].
Following the documentation, I understand that the data-set contains continuous contracts named by the following convention CHRIS/{EXCHANGE}_{CODE}{NUMBER}.
For example for crude oil (CL symb... |
I have just been having a read about mcmc for path dependent options.
I am still trying to understand the logic of it, I don’t have the technical background to understand all the formulae etc. behind it.
So my confusion arises from the following. Say I have a set of x1,...,xn and I want to use an MCMC approach ... |
I came across a question that I guess $P$ is lognormally distributed.
[![enter image description here][1]][1]
where $y_n$ is log-normally distributed.
Am I right on the guessing?
Here is the full solution if interested.( my guessing comes from the last two equations)
[![enter image description here][2]]... |
Is this process log normally distributed? |
Let $F_{t,T}$ be the forward price of a stock $S$ at time $T$ and $t$ be the current time. The stock pays a proportional continuous dividend at a rate of $q$ and the risk-free rate is $r$. **How can I prove that the price is given by**
$F_{t,T} = S_{t}e^{(r-q)(T-t)}$, preferably with a no arbitrage argument?
In the... |
Let $F_{t,T}$ be the forward price of a stock $S$ at time $T$ and $t$ be the current time. The stock pays a proportional continuous dividend at a rate of $q$ and the risk-free rate is $r$. **How can I prove that the price is given by**
$F_{t,T} = S_{t}e^{(r-q)(T-t)}$, preferably with a no arbitrage argument?
In the... |
When deriving the LIBOR-based swap rate formula in any interest rate model, expressions of the following types appear naturally:
![formula][5]
Literature tells us that, switching to the ![formula][8] – forward neutral measure, it is equal to:
![formula][6]
where the expressions ![formula][2] and ![formula][... |
Normally, when calculating the firms age in finance, I saw that people usually use
**firm age= log(1+age).**
Apart from the reason documented by [Loderer, 2009][1] that we avoid the ago of zero that log(0) makes no sense, is there any other reason?
[1]: https://www.efmaefm.org/0EFMAMEETINGS/EFMA%20ANNUAL... |
Why we should use log(1+Age) rather than log(Age)? |
I am looking for some historical data on the Credit spread time series for different Credit ratings which typically S&P/Moody's offers.
Is there any possibilities to get such data available on free?
Does Bloomberg offer such data?
Thanks for your feedback. |
Is there an Ops Risk in being short a bond on the redemption date? |
I am looking for some historical data on the Corporate bond yield time series for different Credit ratings and maturities which typically S&P/Moody's offers.
Is there any possibilities to get such data available on free?
Does Bloomberg offer such data?
Thanks for your feedback. |
Does anybody know any details of game theory literature combined with stochastic calculus in finance? If yes, please recommend some papers of any authors who are doing exceptional work on the filed. Thank you in advance! |
I was wondering if someone could help me with something. I've been reading more about equity options, and I'm struggling with skew. Conceptually I understand why it exists, what I'm struggling with is how to put a number to it. At-the-money volatility is a straightforward concept by looking at historical moves, but how... |
Approximating Volatility Skew From historic returns? |
I have recently watched two videos about Kelly Criterion for portfolio optimization, however [one](https://www.youtube.com/watch?v=o7YIa1w58Yc&t=522s) seem not to deduce it correctly (as people commented) and the [another](https://www.youtube.com/watch?v=0temN7hAf2c&t=452s) just don't show any deductions at all. Right ... |
I have recently watched two videos about Kelly Criterion for portfolio optimization, however [one](https://www.youtube.com/watch?v=o7YIa1w58Yc&t=522s) seem not to deduce it correctly (as people commented) and the [another](https://www.youtube.com/watch?v=0temN7hAf2c&t=452s) just don't show any deductions at all. Right ... |
Normally, when calculating the firms age in finance, I saw that people usually use
**firm age= log(1+age).**
Apart from the reason documented by [Loderer, 2009][1] that we avoid the age of zero that log(0) makes no sense, is there any other reason?
[1]: https://www.efmaefm.org/0EFMAMEETINGS/EFMA%20ANNUAL... |
I was wondering if someone could help me with something. I've been reading more about equity options, and I'm struggling with skew. Conceptually I understand why it exists, what I'm struggling with is how to put a number to it. At-the-money volatility is a straightforward concept by looking at historical moves, but how... |
I was wondering if someone could help me with something. I've been reading more about equity options, and I'm struggling with skew. Conceptually I understand why it exists, what I'm struggling with is how to put a number to it. At-the-money volatility is a straightforward concept by looking at historical moves, but how... |
In this working example I'm able to calculate a Sharpe ratio (with rf=0) from a weighted portfolio of 3 securities, but how can I modify the code bellow so it calculates a Sortino ratio ?
import numpy as np
from pandas_datareader import data
tickers = ['AAPL', 'MSFT', '^GSPC']
start_date = '... |
How to calculate Sortino ratio from a weighted portfolio with Python? |
I am using Quantlib python to calibrate HW 1f model parameters from normal swaption vols quoted in the market (following the code in the cookbook - I fit both the mean-reversion & vol to market quotes)
I see the HW 1f vol is an average of the market implied vol term structure (for given expiry and different maturit... |
Can someone please explain Heath Jarrow Morton framework ? Why do we use it ? I understand the logic between equilibrium models and no arbitrage models but i'm struggling to understand the add value of HJM framework... |
Can someone please explain Heath Jarrow Morton framework ? Why do we use it ? I understand the logic between equilibrium models and no arbitrage models but i'm struggling to understand the added value of HJM framework... |
Our team is working with extreme real-time charting technologies. Now we are developing web charts to visualize hundreds or even thousands of data feeds the same time. Using 1000 data points or more / second, each chart. Aiming for lowest-possible latency.
[![100 real-time charts with 1 ms data, programmatically ... |
Disregarding the arguments made against such an idea in the comments to your question, here is what would come to my mind:
1. Calibrate one (or multiple) GARCH model(s) to your daily return data.
2. Generate the return (and hence price) density for your time horizon, say one month forward using the corresponding am... |
Based on the article by [Bertram (2010)][1], I am trying to calculate the variance of the trade length stated in equation [10] of the paper. However, the weights used has a specification that I cannot quite get my head around.
My question is, how do I evaluate the infinite sum for the weights as in this equation:
... |
Our team is working with extreme real-time charting technologies. Now we are developing web charts to visualize hundreds or even thousands of data feeds the same time. Using 1000 data points or more / second, each chart. Aiming for lowest-possible latency.
[![100 real-time charts with 1 ms data, programmatically ... |
I quote *Life Insurance Mathematics* (Gerber, 1997).
_______________________________________
Let $i$ be an annual effective interest rate and $d$ an annual effective discount rate.
In case of interests-in-advance, a person investing an amount of $C$ will be credited interest equal to $dC$ immediately and the inv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.