instruction
stringlengths
15
26.1k
I've downloaded intraday price histories from alphavantage for a dozen or so symbols, with the same parameters (1 minute interval) for each. Presumably this data represents prices in one minute intervals over a constant intraday window (9:30AM - 4:00PM ET). Why then do the sample counts all vary, from a low of ~3000 to...
Why do 1min intraday price histories from AlphaVantage have different sample counts?
I've downloaded intraday price histories from alphavantage for a dozen or so symbols, with the same parameters (1 minute interval) for each. Presumably this data represents prices in one minute intervals over a constant intraday window (9:30AM - 4:00PM ET). Why then do the number of quotes returned in the API responses...
I need to calculate log excess returns. I'm given market level monthly total return index, price index and a risk-free rate (from Fama/French 3/5/etc. factors). I'm not sure whether I'm calculating the log excess returns correctly. $log\ excess\ return = log\ gross\ return - log\ risk\ free\ rate$ $log\ gros...
I need to calculate log excess returns. I'm given market level monthly total return index, price index and a risk-free rate (from Fama/French 3/5/etc. factors). I'm not sure whether I'm calculating the log excess returns correctly. $log\ excess\ return = log\ gross\ return - log\ risk\ free\ rate$ $log\ gros...
Eduardo, what did you decide? I think I share your understanding of the dilemma: I for instance am using a 200 day simple moving average to signal when to buy/sell. I add an envelope to the SMA to avoid whiplash. Yet, if I use adjusted prices, I do better if I use a wider envelope than if I used unadjusted. On the ...
I am trying to implement a strategy that exploits potential misspecifications in density predictions (e.g.: long states with too-low probability; short states with too-high probability). In particular, I am looking for an option-based strategy that exploits: 1) The **location** of the forecast density (i.e.: m...
Exact replicating portfolio for constant product AMM here: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3550601 It's irritating that people use a new term 'impermanent loss' for something that happens with any option and has been well understood for decades!
If I have two financial time series and I want to calculate the correlation between them when series1 gives me a negative returns, would that be as simple as picking only those periods where series1 returns are negative and calculating the Pearsons correlation between them? Sorry if its a very basic question as I come ...
I am trying to simulate the IR for G2 Process using the following code. However, the initial value of the simulation starts with zero. I want to initialize the simulation using a starting value. Is there any way that I can do this? Also, in this code, the final value of the simulation is 0 (Starting value). However, ...
Why is providing liquidity on Uniswap a "negative gamma" trading strategy?
I take implied volatility as the positive floating point number which lets the BS formula match an observed option price (assuming we have some useful interest rate, some underlying, etc). How useful is that information really? I know all about the mathematical side of things but through the recent events with GameS...
Is implied volatility really all that usefull?
Noticed today that hedging the MSCI World (NTR, div reinvested) by shorting it's very own future (same underlying index, also NTR) leaves a lot of active risk. This is explained by low correlation between the index and the future. You can check with correl on BBG the correlation between ZWP1 and NDDUWI is only 80% o...
MSCI World and MSCI World future: low correlation, how come?
it seems non convertible (eg CNY) or partially convertible (eg BRL) may be due to capital controls or a currency only used domestically. I was then wondering what is the difference between a non-convertible and a non deliverable currency?
What is the difference between a non-convertible and a non deliverable currency?
What are some advanced methods for bond risk transformations?
it seems non convertible (eg CNY) or partially convertible (eg BRL) may be due to capital controls or a currency only used domestically. I was then wondering what is the difference between a non-convertible and a non-deliverable currency?
What is the difference between a non-convertible and a non-deliverable currency?
I'm currently studying Luenberg's Article "Projection Pricing" and there is a claim that I can't prove. Shortly, I'm trying to find the maximum Sharpe Ratio portfolio, so: $$ \text{maximize } \frac{\omega^T(\bar{y}-R_f p)}{\sqrt{\omega^TV \omega}} $$ Where $\omega$ is the weights vector, $\bar{y}$ expected pay...
I'm currently studying Luenberg's Article "Projection Pricing" (*Jrl of Optimization Theory and Applications*, Vol. 109, No. 1, pp. 1–25, April 2001) and there is a claim that I can't prove. In brief, I'm trying to find the maximum Sharpe Ratio portfolio, so: $$ \text{maximize } \frac{\omega^T(\bar{y}-R_f p)}{\sq...
I'm trying to come up with a metric to value and compare spreads. One way that I was doing this was to compute the Expected Value of the spread. To calculate the expected value I used the following from [omnieq][1] $$ E = C \left(1 - \mathrm{N}\left(d_{2_{s}}\right)\right) - L \cdot \mathrm{N}\left(d_{2_{l}}\r...
I'm trying to come up with a metric to value and compare spreads. One way that I was doing this was to compute the Expected Value of the spread. To calculate the expected value I used the following from [omnieq][1] $$ E = C \left(1 - \mathrm{N}\left(d_{2_{s}}\right)\right) - L \cdot \mathrm{N}\left(d_{2_{l}}\r...
I'm trying to come up with a metric to value and compare spreads. One way that I was doing this was to compute the Expected Value of the spread. To calculate the expected value I used the following from [omnieq][1] $$ E = C \left(1 - \mathrm{N}\left(d_{2_{s}}\right)\right) - L \cdot \mathrm{N}\left(d_{2_{l}}\r...
Suppose that we have the following time-dependent partial differential equation: \begin{equation} \frac{\partial V(t, x)}{\partial t} = \frac{1}{2}\frac{\partial^2 V(t, x)}{\partial x^2} - wxV(t, x), \quad t> 0, x\in \mathbb{R} \\ V(0, x ) = f(x) = e^{-ux}, \quad x\in \mathbb{R} \end{equation} How can I come u...
A Cauchy Problem: How can I find the following solution?
I have an access to the order book dataset, which was sampled with resolution that is too high for my sandbox experiments with it. Because of that, I was wondering, what would be the correct way to downsample the order book, say for example, from 1s to 1m? For now I'm just taking snapshots that are separated by some co...
What are the proper ways for order book downsampling?
What are the proper ways to do order book downsampling?
Take a look at compilations such as [151 Trading Strategies](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3247865). I wouldn't expect this information to be widely disclosed. After all, a non-profitable strategy is a supermartingale which means there is an opposing set of algos that is profitable as we speak....
A price gap is defined as any day when the high / low / close price bar for that day does not overlap the previous day’s high / low / close price bar. I am interested in studying stock price gaps given that gaps represent the availability of new information and that price jumps to a new level to reflect that informati...
How can we apply Girsanov's theorem to a stochastic volatility model? In Heston's model the dynamics are given by \begin{align*} dS_t &= \mu S_t dt + \sqrt{v_t}S_t d\widehat{W}^\mathbb{P}_{1,t}, \\ dv_t &= \kappa ( \theta - v_t) dt + \sigma \sqrt{v_t} \left( \rho d \widehat{W}_{1,t}^\mathbb{P} +\sqrt{1- \rho^2}...
Let's say I'm an investment bank and I want to create a derivative whose value tracks that of gold. I don't want this derivative to in any way trade in the underlying security, so no futures or options contract. I just want an abstract investment I can sell (as a bank) whose price has (ideally) 100% correlation with th...
How does one actually create a derivative of a given underlying security?
Consider the Heston (1993) model under the **real world measure** ($\mathbb{P}$) \begin{align*} \mathrm{d}S_t&=\mu^\mathbb{P} S_t\mathrm{d}t+\sqrt{v_t}S_t\mathrm{d}B_{S,t}^\mathbb{P}, \\ \mathrm{d}v_t&=\kappa^\mathbb{P} (\bar{v}^\mathbb{P}-v_t)\mathrm{d}t+\xi^\mathbb{P}\sqrt{v_t}\mathrm{d}B_{v,t}^\mathbb{P}, \end{a...
What is the general solution to Geometric Brownian Motion with time dependent volatility and drift?
I am able to compute the general solution of a standard geometric brownian motion, but I'm struggling to find the general solution for a GBM where volatility and mean depend on time. That is $dS_t = \mu(t) S_t+\sigma(t) S_tdW_t$ The general solution for a standard Geometric Brownian, $dS_t = \mu S_t+\sigma S_tdW_t$...
Solution to geometric Brownian motion with time dependent volatility and drift?
I need to calculate the weighted median, average, sd of PE funds' returns. I weighted the sample according to the amount of committed capital of a fund, but I should consider negative products to analyse underperforming funds. However, I'm not sure if I can use neg/zero values to derivate these statistic measures. ...
Consider the Heston (1993) model under the **real world measure** ($\mathbb{P}$) \begin{align*} \mathrm{d}S_t&=\mu^\mathbb{P} S_t\mathrm{d}t+\sqrt{v_t}S_t\mathrm{d}B_{S,t}^\mathbb{P}, \\ \mathrm{d}v_t&=\kappa^\mathbb{P} (\bar{v}^\mathbb{P}-v_t)\mathrm{d}t+\xi^\mathbb{P}\sqrt{v_t}\mathrm{d}B_{v,t}^\mathbb{P}, \end{a...
Two chief reasons for subsampling or using a different event space are (i) computational or spatial tractability and (ii) bias-variance trade-off. Sergei's response seems to focus on the first issue, I'll focus more on the latter. Typical methods used by trading practitioners include: - **Trade (tick) space.** Ta...
Two chief reasons for subsampling or using a different event space are (i) computational or spatial tractability and (ii) denoising/signal extraction. Sergei's response seems to focus on the first issue, I'll focus more on the latter. Typical methods used by trading practitioners include: - **Trade (tick) space.*...
Two chief reasons for subsampling or using a different event space are (i) computational or spatial tractability and (ii) denoising/signal extraction. Sergei's response seems to focus on the first issue, I'll focus more on the latter. Typical methods used by trading practitioners include: - **Trade (tick) space.*...
Two chief reasons for subsampling or using a different event space are (i) computational or spatial tractability and (ii) denoising/signal extraction. Sergei's response seems to focus on the first issue, and I'll focus more on the latter. The two objectives can diverge. For example, options and OTC data can exhibit ...
Consider three European call options with strikes $K_1<K_2<K_3$ all at the same expiration time T. If we assume the absence of arbitrage at all earlier times t, there is a derived equation from the properties of option $$C(K_2)<\frac{K_3-K_2}{K_3-K_1}C(K_1)<\frac{K_2-K_1}{K_3-K_1}C(K_3)$$ Could someone explain how ...
How is calculated the futures/forward convexity adjustment for FX?
Hey gamma process is a Levy process $X$, where $X_t$ has gamma distribution with parameters $at,b>0$ and density $$f\left(x\right)=\frac{b^{at}}{\Gamma\left(at\right)}x^{at-1}e^{-bx}$$ I want to simulate gamma process by increments but what is the distribution of $X_t - X_s$? Of course gamma but with what parameter...
I am looking to increase the robustness of some equity strategies that I am working on. Apart (maybe) from brokers is there anywhere online (and preferably for free) that has historic stock borrow percentages or abosulte borrow costs available for borrowing stocks? I want to factor the cost of borrowing a stock into w...
Market data for professional users is generally much more expensive than retail so Bloomberg might not be a bad deal in the end. As for alternatives consisting of both data and data store: * `$0` for [Axibase TSD](https://axibase.com/docs/atsd/finance/?qse=10379) on single node (my affiliation) * `$699 + exch. fees...
Consider three European call options with strikes $K_1<K_2<K_3$ all at the same expiration time T. If we assume the absence of arbitrage at all earlier times t, there is a derived equation from the properties of option $$C(K_2)<\frac{K_3-K_2}{K_3-K_1}C(K_1)+\frac{K_2-K_1}{K_3-K_1}C(K_3)$$ Could someone explain how ...
I am new in this blog and first of all I want to apologise for my english. I have to calculate, for a university project, the weekly returns and daily scaled returns to weekly for few stocks For weekly returns, no problem i calculated them by: ln(Pt+1/Pt). I have difficulties to understand what daily returns sca...
Market data for professional users is generally much more expensive than retail so Bloomberg might not be a bad deal in the end. As for alternatives consisting of both data and data store: * `$0` for [Axibase TSD](https://axibase.com/docs/atsd/finance/?qse=10379) on single node (my affiliation) * `$699 + exch. fees...
I am struggling with understanding the difference in yields between nominal bonds and inflation-adjusted bonds. With inflation adjusted bond like TIPS, every coupon payment in addition to the face value is adjusted for inflation in accordance with increases in CPI. With nominal bonds like treasuries inflation is no...
Nominal bond yields vs. TIPS yields?
I am trying to price an index CDS option using QuantlibXL. Anyone aware of an existing template sheet or sample formula for creation of CDS and CDS objects? The sample template sheets provided with QuantlibXL do not cover creation of CDS and CDS option objects. Also, I tried adapting the procedure described in the p...
By considering the parametrised formulation of the mean-variance criterion by Markowitz, the risk aversion coefficient $\lambda$ can be derived as follow. 1. As suggested by Arrow and Pratt, given the utility function of the investor $U(x)$, $\lambda$ for a specific level of initial wealth $x$ can be approximated b...
By considering the parametrised formulation of the mean-variance criterion by Markowitz, the risk aversion coefficient $\lambda$ can be derived as follow. 1. As suggested by Arrow and Pratt, given the utility function of the investor $U(x)$, $\lambda$ for a specific level of initial wealth $x$ can be approximated b...
By considering the parametrised formulation of the mean-variance criterion by Markowitz, the risk aversion coefficient $\lambda$ can be derived as follow. 1. As suggested by Arrow and Pratt, given the utility function of the investor $U(x)$, $\lambda$ for a specific level of initial wealth $x$ can be approximated b...
By considering the parametrised formulation of the mean-variance criterion by Markowitz, the risk aversion coefficient $\lambda$ can be derived as follow. 1. As suggested by Arrow and Pratt, given the utility function of the investor $U(x)$, $\lambda$ for a specific level of initial wealth $x$ can be approximated b...
I am trying to find a list of US companies that have defaulted in the recent past .Any link for this?
I understand that you want to derive some form of risk preference parameter from portfolios that you can observe 'in the wild', and I will discuss that accordingly. As a side note, there is a whole [thread in the literature that discusses elicitability][1] of risk preferences using cleverly designed choice experiments ...
What is the best way to impute missing values for financial data?
Suppose that we have the following time-dependent partial differential equation: \begin{equation} \frac{\partial V(t, x)}{\partial t} = \frac{1}{2}\sigma^2 x\frac{\partial^2 V(t, x)}{\partial x^2}+ \theta(m-x)\frac{\partial V(t,x)}{\partial x} - wxV(t, x), \quad t> 0, x\in \mathbb{R} \\ V(0, x ) = f(x) = e^{-ux}, ...
A Cauchy problem (another version): How can I find the following solution?
Is it possible to justify $\lambda=\frac{\mu_B}{\sigma^2_B}$ as follow? Let $x$ be the available investor's wealth. Given a benchmark $B$ which can be considered as a proxy to the market portfolio, let $x_B$ the amount of wealth invested. Let also $\mu_b$ and $\sigma^2_B$ be respectively the expected return and vari...
In https://quant.stackexchange.com/questions/19344/how-to-calibrate-a-volatility-surface-using-svi, is said: "(log-moneyness would be more accurate) ". First, why do we talk about "moneyness", is it a reference of "being in the money"? Second, why moneyness instead of strike ? Is it in order to remind that we are...
I'm not sure why you tagged your question equities. Do you mean that you don't care for corporation that don't have publicly traded equity, but have defaulted on their debt? A good start would be the [Credit Derivatives Determinations Committees][1] (spun off from former ISDA Credit Derivatives Determinations Commit...
As you suspect, you have a mistake. You say that: > $$R_{average} = W^{1/n} = (\prod_{i = 1..n}R_{i})^{1/n} = {1\over n} \sum_{i = 1..n}log(R_{i}).$$ Notice that you took a log and kept the equation sign. What you really meant is $$\log R_{average} = {1\over n} \sum_{i = 1..n}log(R_{i}).$$ So you don't really ...
Given a Brownian motion $B_t$ on a filtered probability space, how can I prove that $W_t=B_t+\alpha t$ is still a Brownian motion, with $\alpha \in \mathbb{R}$? Is it always true? Do I need necessarly to use Girsanov Theorem?
I have been trying to use the rugarch package but I find it sometimes limiting. After certain amount of data points the package doesn't converge and it becomes kind of annoying. Is there any R/Python/Matlab alternative to it? I am trying to fit an apARCH model but it seems like there's not too many options. I also thou...
Is there an alternative to the rugarch package for GARCH modelling?
I understand that you want to derive some form of risk preference parameter from portfolios that you can observe 'in the wild', and I will discuss that accordingly. As a side note, there is a whole [thread in the literature that discusses elicitability][1] of risk preferences using cleverly designed choice experiments ...
I am trying to implement a strategy that exploits potential misspecifications in density predictions (e.g.: long states with too-low probability; short states with too-high probability). In particular, I am looking for an option-based strategy that exploits: 1) The **location** of the forecast density (i.e.: m...
Assume a portfolio that contains some asset A and that I am contemplating hedging my delta in A by taking a position in asset B. I would determine how much of B to buy/sell based on the linear correlation between the returns of the two assets. But, from a risk management perspective, the actual relationship between the...
In principle, an ISIN is issued by one entity (which can, of course, issue multiple ISINs). However, can an ISIN have a mixed issuance?
Can an ISIN have a mixed issuance?
A Cauchy problem 2: How can I find the following solution?
Two chief reasons for subsampling or using a different event space are (i) computational or spatial tractability and (ii) denoising/signal extraction. Sergei's response seems to focus on the first issue, and I'll focus more on the latter. The two objectives can diverge. For example, options and OTC data can exhibit ...
How do settlement dates for non-TBA MBS work? Thanks, VVKK
I have been trying to use the rugarch package but I find it sometimes limiting. After certain amount of data points the package doesn't converge and it becomes kind of annoying. Is there any R/Python/Matlab alternative to it? I am trying to fit an apARCH model but it seems like there are not too many options. I also th...
I'm trying to learn more about the QuantLib python package and as an exercise I'm trying to replicate some swaps on Bloomberg. However, when I do so, it seems like my swaps are consistently underpriced compared to what Bloomberg thinks. I'm wondering if anyone who has more familiarity with both QuantLib and Bloombe...
Suppose that we have the following time-dependent partial differential equation: \begin{equation} \frac{\partial V(t, x)}{\partial t} = \frac{1}{2}\sigma^2 x\frac{\partial^2 V(t, x)}{\partial x^2}+ \theta(m-x)\frac{\partial V(t,x)}{\partial x} - wxV(t, x), \quad t> 0, x>0\\ V(0, x ) = f(x) = e^{-ux}, \quad x>0 \e...
Maybe this is too simple, but here’s what I think of when you ask for option strategies given a view on forecasted price densities: -Think returns are going to be higher than expected? Buy a call. -Think returns are going to be lower than expected? Buy a put -Think scale is going to be higher than than expecte...
I'm somewhat new to interest rate models and am interested in obtaining ATM cap prices and volatilities for calibration purposes (Black-Derman-Toy, Hull-White, etc.). Ideally, this would enable me to generate implied volatilities for different interest rate tenors over a relatively long time horizon (5-10 yrs.). I do n...
Where can (current) interest rate cap prices be found?
Good question! I think there's some semantics to be thought about first: The word **Hedging** commonly implies that you want to hedge the changes in the present value of your total position ($\Pi=PV(A) +wPV(B)$), with $w$ the hedging weight. This statement can be understood **locally**: I want to hedge ('i...
For the purposes of MPT, to compute return of an asset, one typically uses the daily log return of the assets and then anualizes it and the same goes for stddev mean = mean(daily log returns)*252 stddev = stddev(daily log returns)*sqrt(252) Now, I've several years worth of data. So I also compute this in a diffe...
I have two questions regarding the terminology used on the practitioner side regarding asset swap spreads. Asset swaps are mainly used to retain the credit exposure of a bond while minimizing the interest rate risk on it. Thus, the asset swap spread depends crucially on the bond involved and its credit risk. *Questi...
For the purposes of MPT, to compute return of an asset, one typically uses the daily log return of the assets and then anualizes it and the same goes for stddev mean = mean(daily log returns)*252 stddev = stddev(daily log returns)*sqrt(252) Now, I've several years worth of data. So I also compute...
For the purposes of MPT, to compute return of an asset, one typically uses the daily log return of the assets and then anualizes it and the same goes for stddev mean = mean(daily log returns)*252 stddev = stddev(daily log returns)*sqrt(252) Now, I've several years worth of data. So I also compute...
Good question! I think there's some semantics to be thought about first: The word **Hedging** commonly implies that you want to hedge the changes in the present value of your total position ($\Pi=PV(A) +wPV(B)$), with $w$ the hedging weight. This statement can be understood **locally**: I want to hedge ('i...
let $M_t$ be the following stochastic integral $$ M_t = \int_0^t \sigma_s dW_s $$ where $\sigma_t$ is a sufficiently regular deterministic function and $W_t$ is a standard Wiener process (that is $W_t \sim \mathcal{N}(0,t)$ with independent increments). It can be shown that $M_t$ is martingale with distrib...
Consider an OTC derivative traded with no CSA agreement, i.e. the trade is uncollateralised. My understanding is that a Libor swap curve is used in this case to discount the cashflows for this derivative as that reflects the funding, see Fuji et al 2010. This discount curve is constructed in the usual multicurve paradi...
As proven in [Gatheral][1] notes (or in [this][2] discussion) The equations of the local volatility as a function of the vanilla calls can be written as $$ \sigma^2(T,K) = \frac{\frac{\partial C}{\partial T} + (r - q)K \frac{\partial C}{\partial K} + qC}{ \frac{1}{2} K^2 \frac{\partial^2C}{\partial K^2}} $$ ...
this is my first post in this forum, so if I'm doing any kind of mistake please let me know. My situation is as follows: I'm currently writing my Thesis and I'm looking into the discrepancies of ETF NAV and their underlying assets (-> NAV premium/discount). I compare the ESG ETF premium/discount to the market premi...
Good question! I think there's some semantics to be thought about first: The word **Hedging** commonly implies that you want to hedge the changes in the present value of your total position ($\Pi=PV(A) +wPV(B)$), with $w$ the hedging weight. This statement can be understood **locally**: I want to hedge ('i...
For the purposes of MPT, to compute return of an asset, one typically uses the daily log return of the assets and then anualizes it and the same goes for stddev mean = mean(daily log returns)*252 stddev = stddev(daily log returns)*sqrt(252) Now, I've several years worth of data. So I also compute...
In order to explain systematic risk we use risk factors and I've learned that since they try to explain 'systematic' risk, risk factors are relatively well-known. However, what happens if the risk factors I got from PCA (Statistical Risk Model) turn out to be really different from other PM's risk factors who also used...
What happens if my risk factor caught by statistical risk model using PCA turns out to be totally different from other PM's risk factor?