instruction
stringlengths
15
26.1k
Downloaded all historical data for Oslo Stock Exchange from Yahoo Finance (yfinance), and picked a random stock to check if the data corresponds with what I see on different newssites. If I look at NAS.OL from Yahoo at 2015-10-21, the close price is about 19911 with a volume of 4232. But if I look at the data fro...
Big differences in Yahoo data contra Euronext, why?
Downloaded all historical data for Oslo Stock Exchange from Yahoo Finance (yfinance), and picked a random stock to check if the data corresponds with what I see on different newssites. If I look at NAS.OL from Yahoo at 2015-10-21, the close price is about 19911 with a volume of 4232. But if I look at the data fro...
Downloaded all historical data for Oslo Stock Exchange from Yahoo Finance (yfinance), and picked a random stock to check if the data corresponds with what I see on different newssites. If I look at NAS.OL from Yahoo at 2015-10-21, the close price is about 19911 with a volume of 4232. But if I look at the data fro...
Downloaded all historical data for Oslo Stock Exchange from Yahoo Finance (yfinance), and picked a random stock to check if the data corresponds with what I see on different newssites. If I look at NAS.OL from Yahoo at 2015-10-21, the close price is about 19911 with a volume of 4232. But if I look at the data fro...
Did you try the differences? You can check out logarithmic properties in [this answer](https://quant.stackexchange.com/a/64041/54838). Specifically, > Reason 2: The log difference is independent of the direction of change If you code it, you see that the logarithmic return for $$ -1*log(p_1/p_0) = log(p_0/p_...
To my understanding, market makers (mm) in the options market dynamically delta-hedge their portfolios by buying/shorting the underlying, thus eliminating directional risk and profiting from providing liquidity. For example, if a mm buys long a 0.5 delta call, they hedge by shorting (0.5 * spot) worth of the underlying...
To my understanding, market makers (mm) in the options market dynamically delta-hedge their portfolios by buying/shorting the underlying, thus eliminating directional risk and profiting from providing liquidity. For example, if a mm buys long a 0.5 delta call, they hedge by shorting (0.5 * spot) worth of the underlying...
Did you try the differences? You can check out logarithmic properties in [this answer](https://quant.stackexchange.com/a/64041/54838). Specifically, > Reason 2: The log difference is independent of the direction of change If you code it, you see that the logarithmic return for $$ -1*log(p_1/p_0) = log(p_0/p_...
Is there a "correct" way of determining a moving average window/smoothing parameter (or at least a **starting guess** for a financial time-series? I understand of course that in some sense, this could be considered a "hyperparameter" for let's say - a trading strategy - and that one could use some kind of cross-v...
Why are T-bills yielding lower than the reverse repo rate?
Let's say we have 1 month OIS Rate and a 2 month OIS rate. How can I construct a 1m1d rate? Bloomberg computes a lot of these one day rates for several months ahead. Thank you
How to get a one day forward rate from OIS curve?
With another US debt ceiling debacle looming, I just realized something that runs against my intuition: **Many of the Treasury bills maturing in 6 months (with the exception of the ones maturing near and right after the debt ceiling becomes binding) are yielding *lower* than reverse repo (RRP) rate set by the Fed.**...
With another US debt ceiling debacle looming, I just realized something that runs against my intuition: **Many of the Treasury bills maturing in 6 months (with the exception of the ones maturing near and right after the debt ceiling becomes binding) are yielding *lower* than reverse repo (RRP) rate set by the Fed.**...
I'm doing a research on estimating the probability of a bond being called and found Sarkar's (2001) paper where a formula for this was derived using Ito's lemma as seen below: [![probability of call][1]][1] I have very little background in partial differential equations so I don't understand or could not find in...
You never know for sure what will be the next market move. You assuming that underlying will continue to decline and in this case additional hedge will eat your collected premium. But what if underlying will reverse? In this case you delta risk will eat you premiun even faster. You should always try to find right balan...
Why calibrate vol based on consensus?
I'm trying to price an Overnight Index Swap referencing SONIA. The swap will have a 5 day fixing lag (i.e using compounded SONIA over the current interest period but with the last rate set 5 days before the end of the period). Can I simply do this using the MakeOIS function?
**Re close votes**: I believe this is a fair kind of opinion-based question because it's like those ethics questions in academia se or workplace se or because it's [pedagogical][1]. --- Context: I'm actually asking this in the context of this [maths education se question][2] I have. --- I have a pedagogical...
In Sec. 3.2 [here](https://www.math.fsu.edu/~dmandel/Primers/Understanding%20Market%20Price%20of%20Risk.pdf), Mandel deduces the price $P$ of a derivative on an interest rate $r$ obeys a PDE of the form$$\frac{\partial P}{\partial t}+\frac{1}{2}\beta^{2}\frac{\partial^{2}P}{\partial r^{2}}+\left(\alpha-\beta\lambda\rig...
In Sec. 3.2 [here](https://www.math.fsu.edu/~dmandel/Primers/Understanding%20Market%20Price%20of%20Risk.pdf), Mandel deduces the price $P$ of a derivative on an interest rate $r$ obeys a PDE of the form$$\frac{\partial P}{\partial t}+\frac{1}{2}\beta^{2}\frac{\partial^{2}P}{\partial r^{2}}+\left(\alpha-\beta\lambda\rig...
This is a very deep and interesting question. Actually I think the answer depends on the cashflows for your asset and how they will be reinvested. For example, if your asset is held for 10 years but will be returned to you at one lump sum with all the principal and interest at the end of the 10 years, then a differ...
In order to model some volatility smiles I'm using the python's [pySABR][1] package. I ran into a situation when I have two almost identical pieces of code for two different volatility smiles missing the ATM quotes and the pySABR can properly fit the ATM volatility in one case and can't in another. This...
In order to model some volatility smiles I'm using the python's [pySABR][1] package. I ran into a situation when I have two almost identical pieces of code for two different volatility smiles missing the ATM quotes and the pySABR can properly fit the ATM volatility in one case and can't in another. This...
In order to model some volatility smiles I'm using the python's [pySABR][1] package. I ran into a situation when I have two almost identical pieces of code for two different volatility smiles missing the ATM quotes and the pySABR can properly fit the ATM volatility in one case and can't in another. This...
How to compute this current value using no arbitrage condition?
Suppose we have two stocks following GBMs. Drift and volatility are calculated based on historical data. Furthermore the stocks are assumed to be correlated (i.e. they move together, if stock 1 goes up, stock does also). How can I actually simulate their future stock prices so that they stay together? For return I woul...
I am preparing for Quantitative Trading interviews and I know that they basically require you to solve problems on the probability of winning in a given game and then they would ask you: > How much would you bet in this game? What would you strategy be if you had 100$? Now, I know that the Kelly criterion gives...
I am preparing for Quantitative Trading interviews and I know that they basically require you to solve problems on the probability of winning in a given game and then they would ask you: > How much would you bet in this game? What would you strategy be if you had 100$? Now, I know that the Kelly criterion gives...
I am preparing for Quantitative Trading interviews and I know that they basically require you to solve problems on the probability of winning in a given game and then they would ask you: > How much would you bet in this game? What would you strategy be if you had 100$? Now, I know that the Kelly criterion gives...
I've googled extensively for an answer to this question. Very similar (if not identical) questions have popped up in this same website ([example][1]) but I never find the answers to be clear and/or precise. I've played around with the equation for theta (for puts), and indeed it becomes positive for S << K [ie. deep...
What is the intuition behind a positive delta for European long puts?
What is the intuition behind a positive theta for European long puts?
Example: The trading range (in points) for each of the last 5 trading days for asset A is: **5,21,2,15,32** and for asset B is: **5,6,5,5,5**. Is there an ***indicator*** that ranks assets based on ***variation*** of trading ranges over a certain time period? (I don’t mean average). *P.S: Not for predictive purposes...
I'm interested in the existence of the solution for a non-Ito SDE. Sloppy notation but assume a SDE given by $\dot{x}=f(x),\quad f(x)\sim GP(0,k(x,x')),$ where $f$ is a Gaussian Process with kernel $k$. It's quite easy to show that for some kernels (Lipschitz, etc.) all realizations of $f$ lead to ODEs with uniqu...
How to make a schedule for amortizing bonds in python quantlib?
First, let's go back to basics to answer why theta can be both positive and negative, and why it's referred to as *time decay*? At it's core, an option's value is composed of two components: 1. intrinsic value, and 2. time value. As time passes, the proportion of the 'time value' gradually decreases until the op...
I am interested about greeks with Black-Scholes. In this case, I have the python formula to compute the greek called "Vanna", that is: $\frac{\partial^2 P}{\partial \sigma \partial S}$ the sensitivity of option value P with respect to a joint movement in underlying and volatility. Now, let's consider the following e...
Something like this? from mpl_toolkits import mplot3d from itertools import product S = np.linspace(100,120) vols = np.linspace(0.05,0.7) combs = list(product(S, vols)) values = [Vanna_(underlying, K, T, r, sigma) for underlying, sigma in combs] x, y = np.hsplit(np.array...
I got SPX option prices from three different market data sources. In all of them, I can see bid and ask quotes. However, there is only one implied volatility. Does this implied volatility correspond to the bid or to the ask quote? or maybe the mid? As a side note: the most logical thing to do, would be to ask the s...
is implied volatility derived from the option bid quote or the option ask quote?
I am currently reading the book Term-Structure Model, chapter 3, by Damir Filipovic and I have the following problem: The Libor rate for the maturities: Over night, 1 week, 1 month, 2 months and 3 months are taken from the yen data from the date 9/1/1996. However, the spot date is 11/1/1996. So my first question i...
Let $W_t$ be a Brownian motion. How to calculate the following integral $$ I:=\int_0^t\left( \int_0^u(u-s)dW_s\right) du? $$ My attempt so far is: First note that $$ \int_0 ^u (u-s)dW_s = \int_0^u udW_s - \int_0^u sdW_s =uW_u - \int_0^u sdW_s, $$ so the integral $I$ becomes \begin{equation} I= \int_0...
How to integrate Itô integral w.r.t time?
Not sure try to fit $\phi(X,f)$ makes sense: **how would you define $X$?** For a linear model $X$ is naturally defined as the beta of a linear regression. Probably you would rather need to go "one layer deeper in the definition of factors", i.e. to use characteristics of the stock (like its market cap, P/E, dividen...
I want to bootstrap OIS zero-coupon bonds to the OIS rate but unfortunately I don't have any data. Does anyone know where I can find the Libor rates and OIS rates?
Does anyone know of any good papers that build sector-specific (utilities, financials, energy, etc.) versions of factor models like the Fama French 3-factor or Carhart 4-factor models? For example, Fama and French (1992) said "We exclude financial firms because the high leverage that is normal for these firms probab...
are there any good papers on sector-specific versions of factor models?
Im having a problem getting the right price for a simple T-Bond, maybe a Mischievous Pricing Conventions like Luigi says in his book. Im tying to price "912810SZ Govt" ``` def t_bond(iss, mat, coup): calendar = ql.UnitedStates() busconv = ql.Unadjusted sett = 1 face = 100. freq = ql.Period(...
The purpose of anything "implied" is to help you compare the market's pricing versus something else--your expectations, historical experience, other market instruments. For example you can trade options based on implied volatility versus what you think volatility will be. Or you can trade 2 options (different strik...
Since the seminal paper by Fama and French(1993) that uses size, market, and value factors to explain extra market returns on the equity market, people have conducted tons of research on equity factor investing. Many factors such as growth, quality, ROE, etc., were discovered and used in actual trading. I want to te...
How can I use the value of WACC(weighted average cost of capital)? I have calculated the WACC of company to be 7%. What if the company had a smaller or bigger WACC? Which one would attract investment?
I have a bond that was issued on the 30th of April with 30/360 European day convention basis and semiannual compounding. As far as I understand payments should be every 180 days according to the day convention, but with quantlib schedule, I got payments on every 30th of October and April, which are not 180 days from ea...
You have x red cards and y black cards. I flip them over one at a time. The probability of flipping a particular colour is proportional to the amount of those coloured cards left. You start with 1 and for every flip you can bet some proportion of your money on red or blue. If you win the bet, you gain twice your bet, b...
# Question - If the spot price of commodity or equity changes due to the changes in supply and demand, the future price would change as well. It is described in the following formula, which shows how the theoretical price of futures is decided. So it is the **spot price** that drives the change of futures price (spot ...
Does change of futures price influence spot price to change as well?
- There is no problem in understanding how the changes in spot price can cause the future price to change. For example, if we have a big changes in supply and demand (e.g. war breakout, unexpected heavy rainfall, etc), the spot market would be affected the first. It results in the changes of spot price of commodity or...
Or do I get to keep them for the duration of the repo transaction?
When I borrow a bond, do I pay owner the coupons?
In a market with 3 stocks: 1. Stock A with price 25.00 USD; 2. Stock B with price 32.50 USD; 3. Stock C with price 50.75 USD; Any portfolio optimization technique results in a vector of asset weights $\textbf{w}$ such that $0 \leq w_i \leq 1$ and $\sum_{i=1}^N w_i =1$. If I consider an equally weighted portf...
Why techniques for portfolio optimization do not take into account the non-fractionability of stock prices?
I have an amortized bond with maturity at 30.04.2023, a semiannual frequency, 10% coupon rate, 30Е/360 day convention, and a clean price of 104.9367. Also, there are two amortization payments: 300 at 30.04.2018 and 300 at 30.04.2021. Assuming that today is 02.12.2019, what is yield to maturity? My attempt: I know...
I am working on the Bachelier Model with r not equal to 0 as described in the first and most upvoted answer in following link: https://quant.stackexchange.com/questions/32863/bachelier-model-call-option-pricing-formula This is fairly easy to code and to derive delta, vega and gamma. I want to derive however other...
I have some confusion regarding pricing a Bermudan Swaption using LSMC. Let's say the underlying swap has payment dates $T_0 < T_1 < \ldots < T_n$ and for simplicity, assuming the exercise dates are $T_1 < \ldots < T_{n-1}$. Here is the pricing mechanism that I have found from some reference: 1. At the last exer...
From reading Hull OFOD (among other references), I understand that early exercise makes sense for an American call option at time $t_n$ when $$D_n > K\Big[1-e^{-r\big(T-t_n\big)}\Big]$$ for a call option with strike $K$ paying dividend $D_n$ at time $t_n$. What I'm struggling with is why, in a sense, does this requ...
I have some confusion regarding pricing a Bermudan Swaption using LSMC. Let's say the underlying swap has payment dates $T_0 < T_1 < \ldots < T_n$ and for simplicity, assuming the exercise dates are $T_1 < \ldots < T_{n-1}$. Here is the pricing mechanism that I have found from some reference: 1. At the last exer...
I'm trying to make a payment schedule for different bonds in quantlib. For example, I made such a schedule: schedule = ql.Schedule(effective_date, maturity_date, ql.Period(ql.Semiannual), ql.India(), ql.ModifiedFollowing, ql.Actual365Fixed.Standard, ql.DateGeneration.Backward, False) However, when I tryi...
**Problem** I am given the following function to minimize (w.r.t. $\theta$) $$f= \sum_{k=1}^5 \Big [ \sum_{i=1}^{N_k} CF_{k, i} \cdot e^{-r(t_{k, i}, \theta)\cdot t_{k, i}} - P_k^* \Big]^2$$ where $\theta = (\beta_0, \beta_1, \beta_2, \lambda)$ and $$ r(t, \theta) = \beta_0 + \beta_1 \big(\frac{1-e^{-\frac{t}{...
When we worked with that model several years go, we used Differential Evolution and it worked very well. See [Calibrating the Nelson-Siegel-Svensson Model][1]. At least in the standard version, a best-of-many gradient searches (with random initial values) also worked well. See [A Note on 'Good Starting Values' in Numer...
Take a standard Markov setting (with assumptions as needed) $$ dX_t = \mu(t,X_t)dt + \sigma(t,X_t) dW_t $$ Assume, you can get the distribution (i.e. option prices) for $t_1$ (the early expiry) and $t_2$. What I am really after is what can be said about $X$ in in that interval. I was thinking we can get the dis...
You have $x$ red cards and $y$ black cards. I flip them over one at a time. The probability of flipping a particular colour is proportional to the amount of those coloured cards left. You start with $1$ and for every flip you can bet some proportion of your money on red or blue. If you win the bet, you gain twice your ...
I am considering an investor facing a discrete-time multi-period minimization problem $$ \min_{\{v_t\}_{t=0}^\infty}\Bigg[\sum_{t=0}^\infty(1-\rho)^{t+1}\bigg(\frac{1}{2}v_{t}\Omega_{t+1}v_{t}'\bigg)+\frac{(1-\rho)^t}{2}\bigg(\frac{1}{2}\Delta v_t'\Lambda\Delta v_t\bigg) \Bigg] \quad \text{s.t.} \quad v_t'\tex...
As the problem is currently formulated, you have a binary decision (whether to buy the cards or not) and a [single state variable](https://en.wikipedia.org/wiki/State_variable) (your current wealth). I'm assuming the deck is reshuffled every play. A policy function will be a function $f: \mathbb{R} \rightarrow \{0, ...
Im having a problem getting the right price for a simple T-Bond, maybe a Mischievous Pricing Conventions like Luigi says in his book. Im tying to price "912810SZ Govt" ``` def t_bond(iss, mat, coup): calendar = ql.UnitedStates() busconv = ql.Unadjusted sett = 1 face = 100. freq = ql.Period(...
I am interested in a one-time download of GICS sector (e.g. XL- etfs) historical fundamentals data (in particular, point-in-time price/book ratios). Does anyone know where this can be found? I am willing to pay of course, assuming things are priced reasonably. I was considering reconstructing this using individual equi...
What is the source of classify the developed and emerging market worldwide?
How about the [MSCI Emerging Markets index](https://www.msci.com/documents/10199/c0db0a48-01f2-4ba9-ad01-226fd5678111)?
A very broad question but nevertheless a important and difficult one. Within private markets (Private Equity funds, infrastructure funds and private credit funds) how should one do a risk-based PCA analysis in order to identify the uncorrelated factors? Within Private Credit should you take some liquid index as a re...
Suppose I have a loan where the cash flows and the discount rate are calculated using LIBOR + 100 bps If I wanted to calculate how much a unit of risk (1 bp) is worth in USD, I understand that I should only shift 1bp in the discounting curve - and NOT in the projected cash flows + discounting curve -, is this correc...
Calculate how much 1 bp is worth in USD?
What is Vega for a derivative when the volatility of the underlying asset stochastic process itself? When the value of the derivative is $V_d$ vegais $\partial V_d/\partial\sigma$. Consider for instance SABR or Heston where $\sigma$ is a stochastic process, and **then I don't understand the mathematics and intuitio...
Vega of derivative when volatility is stochastic?
I am looking at Stefan Jansen's machine learning for trading, specifically, rebuilding Nasdaq order book from Nasdaq itch data. In his [jupyter-notebook][1], he says > Throughout the day, new orders are added, and orders that are executed and canceled are removed from the order book. The proper accounting for messages...
do prior day orders carry over to next day pre market order in Nasdaq?
I am currently working on this paper which derives the Sharpe ratio distribution of uniformly random porfolios: https://www.researchgate.net/publication/271833345_A_Uniformly_Distributed_Random_Portfolio \ I'll give a rough summary of the second chapter, but you probably have to read this yourself to answer the que...
On the BTP curve, we have the following Bonds (just showing you an extract) [![enter image description here][1]][1] I want to calculate z-spreads my self therefore I need the zero-coupon curve. How do I go about doing this? Do I look at the yields on the strip curve on Bloomberg? For instance, if we take th...
How to calculate zero-coupon curve for Italian BTPs?
I am looking for a way to compute YTD return and I found this question (https://quant.stackexchange.com/questions/18085/calculate-ytd-return-find-first-available-datapoint-of-a-year-in-python), however, it seems that it does not include the paid dividend in the year. How can I compute YTD return including the paid divi...
I have the options data for a stock - ``` structure(list(Curr_Date = structure(c(18904L, 18904L, 18904L, 18904L, 18904L, 18904L, 18904L, 18904L, 18904L), class = c("IDate", "Date")), ticker = c("GOLD", "GOLD", "GOLD", "GOLD", "GOLD", "GOLD", "GOLD", "GOLD", "GOLD"), ExpDate = structure(c(18915L, 18915L, 19013...
I am looking for a way to compute YTD return and I found this question (https://quant.stackexchange.com/questions/18085/calculate-ytd-return-find-first-available-datapoint-of-a-year-in-python), however, it seems that it does not include the paid dividend in the year. How can I compute YTD return including the paid divi...
is there any theory behind the covariance matrix shrinkage paper, why it works? I am talking about this [stats exchange thread][1] [1]: https://quant.stackexchange.com/questions/11564/why-shrink-the-covariance-matrix
I stumbled across an expression and I wonder how to evaluate this: $-\int_ {0} ^ {\infty} {v(x)} dw(1-p(x))$ where $v(x)$ is some utility function and $w(p(x)) $ is a decision weighting function, dependent on some cumulative probability $p(x)$? Perhaps it's obvious but I am too blind to see it. Thanks a lot for any i...
How to evaluate the following integral?
Yes, indeed an important and difficult question! It's really like asking what happens in a forest where nobody is around to see it? You would have to start with a fundamental analysis of the assets to calculate its key risk factors, and then find one or more liquid indices as a reference. For example, if you have ...
LAST CHG BID &nbsp;&nbsp;ASK VOL OPEN INT. STRIKE ------------------------------------- 363.15&nbsp;&nbsp;&nbsp;1.35&nbsp;&nbsp;&nbsp;&nbsp;359.80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;361.40&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&...
What is the cause of this option chain anomaly?
What is the time-complexity of Markowitz mean-variance portfolio optimization (MVO)? I am unable to find any clear explanation of this on the internet and in academic papers. These are my questions: 1. What is the time and space-complexity of a standard MVO algorithm? Please explain why. 2. Are there specia...
How to derive the weights of tangency portfolio?
I was wondering if there is any way to trade on whether or not one asset would earn a higher return than another in some predetermined time period. It would be sort of like gambling on horses except for shares in companies. For example, I could make a trade today that in one months time, apple's share will have yielded...