instruction stringlengths 15 26.1k |
|---|
I have read such codes as below in [buyandsell strategy][1]
from backtesting import Backtest, Strategy
class BuyAndSellSwitch(Strategy):
def init(self):
pass
def next(self):
if self.position.size == 0:
self.buy(size=1)
else:
... |
What is the buyandsell strategy? |
Does anyone have information on eoddata.com? I have been trying to access data for several days without success. I usually receive a download every evening. I have sent multiple support messages with no rely. I keep getting error message that the site is not available.
Thanks.
John |
Is EODDATA.com down? Are they still in business? |
I have a simple question on US stock market: what is the purpose of listing a stock to a specific exchange given that it can be traded on multiple exchanges?
For example, apple stock (AAPL) is listed on NASDAQ, but according to https://chartexchange.com/symbol/nasdaq-aapl/exchange-volume/, it is also traded on NYSE ... |
Purpose of equity listing? |
In the paper of [jacod et al][1] the authors used the pre-averaging function to deal with microstructure noise. They suggest the easiest function which is $$Z_i = \frac{1}{kn} \left( \sum_{j=kn/2}^{kn-1} \Delta_{i+j}-\sum_{j=0}^{kn/2-1}\Delta_{i+j} \right)$$
What is not really clear, why it is used a "minus" inside th... |
In the paper of [jacod et al][1] the authors used the pre-averaging function to deal with microstructure noise. They suggest the easiest function which is $$Z_i = \frac{1}{kn} \left( \sum_{j=kn/2}^{kn-1} Z_{i+j}-\sum_{j=0}^{kn/2-1}Z_{i+j} \right) \tag{3.13}$$
What is not really clear, why it is used a "minus" inside t... |
In the paper of [jacod et al][1] the authors used the pre-averaging function to deal with microstructure noise. They suggest the easiest function which is $$\bar{Z_i} = \frac{1}{kn} \left( \sum_{j=kn/2}^{kn-1} Z_{i+j}-\sum_{j=0}^{kn/2-1}Z_{i+j} \right) \tag{3.13}$$
What is not really clear, why it is used a "minus" in... |
Soybean future on Bloomberg's security description, I see
Contract size = 5,000 bushels
price = 1,200 usd/bushel
contract value = $60,000
How is the contract value of $60,000 derived?
Isn't the contract:
value = contract size * price which in this case = 5,000 bushels * price of 1 bushel of 1,200 = $6,... |
I was wondering whether anyone can improve on the following arbitrage finding scheme in the currencies market.
The following is modified from the book of Capinaki and Zastawniak called [Mathematics for Finance - An Introduction to Financial Engineering][1]
pages 263, Solution 1.3:
"
I think a brief descript... |
With the following process:
$$dS_t = r S_t dt + σ(t) St dW_t \tag1$$
and
$$ \sigma (t) = 0.1 \ \ \ if \ \ t < 0.5 \\ \sigma (t) = 0.21 \ \ \ otherwise$$
I know the general solution should be :
$$S_t = S_0 e^{rt − \frac{1}{2} \int_0^t \sigma (s)^2 ds +\int_0^t \sigma (s) dW_s} \tag2 $$
and if $log(S_t)... |
I am wondering if someone knows relevant literature on the *joint* temporary price impact. The temporary price impact here refers to the difference between the best ask/bid price and transaction price at a specific time. For example, a large order may consume layers of liquidity within the limit order book.
Here are... |
I am currently working on rates model. I would like to understand, mathematically, what does it mean to have an inverted yield curve?
And I am asking myself for a certain model, how can I generate an inverted yield curve?
Any content/document is welcome.
Thank you |
I am reading the book by Haug, 2007 on the pages 186-188 one can find the Turnbull and Wakeman approximation for arithmetic avarage rate option.
> The approximation adjusts the mean and variance so that they are
> consistent with the exact moments of the arithmetic average. The
> adjusted mean, $b_a$ and variance... |
In the [Open Gamma paper describing the ISDA CDS pricing model][1], it is mentioned that given the time notes of the credit curve $T^c=\{t_{1}^{c},...,t_{n_{c}}^{c}\}$ and that the survival probability for the time node $i$ is $Q_{i}=e^{-t_{i}^{c}\Lambda_{i}}$, then for a time point $t\in(t_{i}^{c},t_{i+1}^{c})$ the co... |
Should i convert monthly data into yearly, for CAPM? |
I am currently reading the paper [Computation of Break-Even for LV and LSV Models][1]. This paper defines the vol-vol breakeven
\begin{align*}\tag{1}
B_t(T,K,T',K') &\ :=\ d\langle \ln \sigma^{T,K}_., \ln \sigma^{T',K'}_. \rangle_t
\end{align*}
where $\sigma^{T,K}_t$ is the implied volatility for ex... |
I am reading the book by Haug, 2007 on the pages 186-188 one can find the Turnbull and Wakeman approximation for arithmetic avarage rate option.
> The approximation adjusts the mean and variance so that they are
> consistent with the exact moments of the arithmetic average. The
> adjusted mean, $b_a$ and variance... |
I am trying to use the CAPM. I gathered monthly data on German government bonds and DAX40 (it's an index that contains top 40 German firm). Then based on only one company like Volkswagen monthly stock return in the last 60 months I calculated the $\beta$ by regressing the return of the stock on the market.
Should I... |
Should I convert monthly data into yearly for CAPM? |
I am reading the book by Haug, 2007 on the pages 186-188 one can find the Turnbull and Wakeman approximation for arithmetic avarage rate option.
> The approximation adjusts the mean and variance so that they are
> consistent with the exact moments of the arithmetic average. The
> adjusted mean, $b_a$ and variance... |
Take a hypothetical model that takes a stock as input and outputs "up" or "down" indicating if the stock price will increase or decrease in a fixed time interval T.
Assuming the model is correct >50% of the time, what are the strategies to trade given this information? No indication of how much the stock increases/... |
Trading strategy with only knowledge of price increase/decrease? |
Why is there a minimum size on TIPS trades for retail? |
Is there a stochastic model for describing how equities behave in markets with trading fees, and if so what model is most commonly used? I'm envisioning something similar to the Black Scholes model, except that the differential of the equity should include some term that captures these fees. |
TL;DR: I have an incomplete set of swap rates and want to bootstrap the zero-rate curve, what can I do?
I'm trying to construct a spot-rate/zero-rate curve from a swap curve (i.e. par-rate quotes) based on ESTR OIS swaps for tenors (OverNight; 1week; 2w; 1month; 2m; 3m, 6m; 1year; 2y; 3y; 4y; 5y; 6y; 7y; 8y; 9y; 10y... |
As widely shown in this forum and in the literature, the order book imbalance is empirically a good predictor of the market move.
However, even though the calculation of the imbalance is very straight forward, I'd like to ask: how does one model the order book imbalance to try to guess the time (in seconds) at which... |
How to model the imbalance to predict in different timeframes? |
TL;DR: I have an incomplete set of swap rates and want to bootstrap the zero-rate curve, what can I do?
I'm trying to construct a spot-rate/zero-rate curve from a swap curve (i.e. par-rate quotes) based on ESTR OIS swaps for tenors (OverNight; 1week; 2w; 1month; 2m; 3m, 6m; 1year; 2y; 3y; 4y; 5y; 6y; 7y; 8y; 9y; 10y... |
I am reading the book "Principles of Corporate Finance" 12th edition by Brealey, Myers and Allen. In the 21st chapter on Option pricing, they discussed the General binomial method for option pricing. The authors posed the question " How do we pick sensible values for the up and down changes in value?" and went on to gi... |
I've some inquiries that may be naive related to ZDF.
I have got a look at those two resources for zero discount factors:
- [Oracle - Zero Discount Factors][1]
- [Wallstreetprep - Discount Factor][2]
Unfortunately, I'm still confused about ZDF.
Here is what I get:
The second approach (for calculating... |
How Zero Discount factors are calculated in Oracle and Wellstreetprep? |
I am reading section section 14.6 of John Cochrane's [lectures notes][1] for the course *Business 35150 Advanced Investments*. On p. 239-240, he discusses testing one asset pricing model against another. I have quite some trouble following his arguments. Here is the essence:
> 1. Example. FF3F.
$$
E(R^{ei}) = \alp... |
I've been trying to bootstrap the zero-curve from a swap curve composed of ESTR OIS swaps.
Theory says when the par-curve is upward sloping, the zero-curve will be above the par-curve and vice-versa. Moreover, I would imagine when the par-curve is perfectly flat, so would the zero-curve.
However, applying different m... |
In the context of the Fama-French 3-factor model, we have six portfolios used for creating the SMB and HML factors: SL, SM, SH, BL, BM, BH. (The notation is: S~small, B~big, L~low, M~medium, H~high). If I use the six portfolios as test assets in the GRS test (with the three factors: market, SMB and HML), I get the foll... |
There is abundant literature on pricing interest rate derivatives, but it is a struggle to find much on the science and methods behind practical Profit Attribution Analysis (PnL explain) on fixed income portfolios, or portfolios in any asset class in general.
Is there a comprehensive book which covers this topic? |
In the Fama-French 3-factor model, is there a point in looking at the relationship between the estimated alphas for the 25 test portfolios and the size-rank or value-rank of these portfolios? Or will there be no linear relationship by design?
(I have done the looking, found nothing interesting and am wondering if th... |
To get a complete list tickers, you can use `LISTING_STATUS`:
```python
import requests
def get_listing_status(api_key):
base_url = "https://www.alphavantage.co/query"
function = "LISTING_STATUS"
# Construct the API request URL
api_url = f"{base_url}?function={function}&apikey={api_key}"
... |
Im basically looking for a further/non mathematical explanation for following answer https://quant.stackexchange.com/questions/42854/atm-call-option-delta-with-low-volatility
what is meant with a positive drift? does that mean we assume the stock will grow by r? could somebody please give an example how the option is... |
I am required to simulate the trajectory of the Euribor3M rate as it is crucial for determining the future cash flows of my derivative instrument. I've received guidance to employ the Hull-White model. How can I transition from the short rate to Euribor? Is it accomplished through the forward zero-coupon bond?
I am ... |
Could someone help with any relevant literature about building an Execution Algo and things to consider and keep in mind for optimal passive order placements? There are basic algos like TWAP/VWAP/POV etc, but how does one gain edge on the micro structure level? does it also involve understanding the microstructure bett... |
Guidance on Execution Algo Passive order placer? |
I have clients who take loans (Advances) weekly. The way that they repay the advance is after 3 weeks when their goods are sold by using the sales proceeds of the goods. But if the goods don't sell upon the estimated amount these clients may have arrears but still in the next week they can take a loan. These Advances a... |
How should I create a Risk measurement Variable? |
I have clients who take loans (Advances) weekly. The way that they repay the advance is after 3 weeks when their goods are sold, using the sales proceeds of the goods. But if the goods don't sell for the estimated amount these clients may have arrears, but still in the next week they can take a loan. These Advances are... |
In addition to Wikipedia, YouTube and other internet sources, I'm reading Timothy Crack's "Basic Black-Scholes: Option pricing and trading". Most of these sources suggest that it is fairly obvious that an option has time-value. But I am not yet convinced -- could someone please clarify the following reasoning.
To me... |
Our professor calculated the present value of a bond with $T=10$ years, $FV=10,000$€, $C=700$€ p.a. and an expected rate of return $r$. He wrote $$\begin{align}PV&=C\cdot\sum_{n=1}^{10}\frac{1}{(1+r)^n}+\frac{FV}{(1+r)^n}\\&=700\cdot\color{red}{\frac{1-\frac{1}{(1+r)^n}}{(1+r)^n}}+\frac{FV}{(1+r)^n}\end{align}$$ I don'... |
In Chapter 9 of Shreve's book Stochastic Calculus for Finance II, the main theorem is the 9.2.1.
Defining the discounting process $D(t)=\mathrm{e}^{-\int_0^t du r(u)}$ and $r(u)$ the, possibly stochastic, interest rate process; the theorem states that any positive price process $N$, under the risk neutral measure with... |
Our professor calculated the present value of a bond with $T=10$ years, $FV=10,000$€, $C=700$€ p.a. and an expected rate of return $r$. He wrote $$\begin{align}PV&=C\cdot\sum_{n=1}^{10}\frac{1}{(1+r)^n}+\frac{FV}{(1+r)^n}\\&=700\cdot\color{red}{\frac{1-\frac{1}{(1+r)^n}}{(1+r)^n}}+\frac{FV}{(1+r)^n}\end{align}$$ I don'... |
When coming to calculate Gamma exposure (or Greek exposure), it's common to assume that traders are buying puts and selling calls to hedge underlining positions. Brokers are doing the opposite: selling puts and buying calls. However, by looking at volume and open interests, this assumption may not be always true becaus... |
Same underlying, same strike, same expiration. One is a covered call, the other is cash secured put.
These are screenshots taken from a website. As you can see, they are similar, but the max win levels are different.
[![enter image description here][1]][1]
[![enter image description here][2]][2]
[1]: https:... |
What accounts for the difference between these two option strategies? |
A call price is bounded when $\sigma\sqrt{T}$ goes to $0$ and $\infty $ by:
$$C_{inf} = e^{-rT}[F-K] \leq C \leq C_{sup}=S $$
Now a simple rearrangement of Black-Scholes formula gives:
$$ C = N_1S - e^{-rT}N_2K = e^{-rT}N_2[F-K] + [N_1-N_2]S$$
$$ = \frac{N_2}{N_1}N_1e^{-rT}[F-K] + [1-\frac{N_2}{N_1}]N_... |
I am doing my research related to IPOs long term performance. For the $\text{BHAR}$ (Buy-and-Hold Abnormal Returns) formula, I just want to clarify the formula is that always compare with the first month trading price, or is compared with last month trading price?
The following two ways are listed
1. Always compa... |
It's tough trying to figure this out myself and I after a few hours I thought I'd ask for help:
I'm trying to do tick imbalance bars from 'Advances in Financial Machine Learning', using equations:
- $b_t = \begin{cases}
b_{t-1}, & \text{if } \Delta p_t = 0 \\
\\
\dfrac{|\Delta p_t |}{\Delta p_t }, & \text{i... |
I tried simulating GBM using both the SDE definition and the closed form solution. The paths I get through these methods are very different. Can someone help me figure my mistake?
```python3
import numpy as np
import matplotlib.pyplot as mp
import statsmodels.api as sm
time_step = 1e-6
N = 30000
np.random.... |
Sorry if this has been asked before. Thought this is a standard question but searching on web didn't give me too much useful links.
Assuming a series of stock prices, how to detect and potentially remove big jumps in this series? We want to keep round humps but detect/remove sudden jumps.
For one example, assumin... |
EDIT
based on the answer provided, I have followed, but still I cant match the bbg data with my calculations, could some advise how to match the bloomberg Price given the data?
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/BXEiU.png
import numpy as np
import scipy.sta... |
I want to calibrate US treasury bonds to get a benchmark curve as an exercise. I know that choice of bonds may be discretionary. But
1. can you point me to any good public data source where I can get UST data?
2. should I only choose bonds at par?
3. should I choose zero coupons (STRIPS) only or okay to have coup... |
In theory, Calls and Puts should have the same IV via Put-Call Parity. However, sometimes they do not exactly obey:
- Are the options American? American options do not obey PCP (https://quant.stackexchange.com/questions/17483/why-is-iv-different-between-put-and-call-of-same-strike)
- Perhaps just due to demand and ... |
I'm going through the MAR - Calculation of RWA for market risk sections on tps://www.bis.org basel framework page, but not quite understand the reduced set of risk factors. Is it subset of modellable rfs, or non-modellable rf's or is it unrelated and chosen upfront and contains both modellable and non modellable rfs? |
what is reduced set of risk factors in the context of basel III? |
I think there are many ways you could do this! It will depend on what tools and skills you already have in the bag, and maybe areas of knowledge such as risk assessment (like KaiSqDist suggested).
**First, think about it conceptually.** What do you want to create? (model? Formula? Metric?) Do you want to use existin... |
What would be a good reference to understand how the interest rate (r) or dividend yield (q), and I guess the differential between the two, affect the implied volatility of the options?
If I look at a snapshot of a wide range of European Call (cash) prices on a US name, an approximate 2 month interest rate would be ... |
How does the interest rate affect the implied volatility of options, especially ITM? |
There's no way to know the *exact* relationship because there isn't an analytical solution for implied volatility. Intuitively, fromthe Black-Scholes equation:
$$
\begin{aligned}
C\left(S_t, t\right) & =N\left(d_{+}\right) S_t-N\left(d_{-}\right) K e^{-r(T-t)} \\
d_{+} & =\frac{1}{\sigma \sqrt{T-t}}\left[\ln \left... |
There's no way to know the *exact* relationship because there isn't an analytical solution for implied volatility. Intuitively, fromthe Black-Scholes equation:
$$
\begin{aligned}
C\left(S_t, t\right) & =N\left(d_{+}\right) S_t-N\left(d_{-}\right) K e^{-r(T-t)} \\
d_{+} & =\frac{1}{\sigma \sqrt{T-t}}\left[\ln \left... |
In Chapter 9 of Shreve's book Stochastic Calculus for Finance II, the main theorem is the 9.2.1.
Defining the discounting process $D(t)=\mathrm{e}^{-\int_0^t du r(u)}$ and $r(u)$ the, possibly stochastic, interest rate process; the theorem states that any positive price process $N$, under the risk neutral measure with... |
Suppose I have a volatility surface (matrix in time and strike) but it might have butterfly arbitrage in it. I want to remove nodes from the surface so that the Vol surface is butterfly arbitrage free. I understand that I can check the butterfly arbitrage condition as follows -
for any maturity $T$ and for any given ... |
If we compare the form of the original model:
https://edisciplinas.usp.br/pluginfile.php/3180059/mod_resource/content/0/Nelson%2C%20Siegel%20%281987%29%20-%20Parsimonious%20Modeling%20of%20Yield%20Curves.pdf
To the form of the model developed in this paper (which was 'inspired' by the original NS):
https://www.res... |
Why isn't the volatility version of the Nelson-Siegel model in the same shape as the original yield model? |
A market maker needs to quote a bid and ask whatever its vision on the stock is. But what happens in the case of panic-selling on a particular stock?
The market maker is thus going to buy a lot of this stock. To offset its loss it's going to hedge its position. Yet if the stock never recovers, what does the market ... |
How market makers exit their position? |
At the beginning of his well known book, Gatheral writes the following
> [...] Moreover, unlike alternative models that can fit the smile (such as local
volatility models, for example), SV models assume realistic dynamics for
the underlying. Although SV price processes are sometimes accused of being
ad hoc, on th... |
I was reading about compounded Hawkes process and came across diffusive limit theorems.
Where can I find diffusive limit theorems for Poisson processes.
I am new to this area, is there a nice introductory book where I can read about compound processes and their limits? |
Can someone suggests readings regarding the dependence between sampling schemes and prices at which they are sampled in high frequencies context ? Is there a relationship between prices and times? |
Let's say in one day time, underlying price S goes up by $2.4. Then the gamma PnL should be
$\frac{1}{2}\gamma_0 (2.4)^2$. Let's assume that in every hour the underlying goes up by $0.1. Then how do we breakdown this gamma PnL by hour? |
Let's say in one day time, underlying price S goes up by $2.4. Then the gamma PnL should be
$\frac{1}{2}\gamma_0 (2.4)^2$. Let's assume that in every hour the underlying goes up by $0.1. Then how do we breakdown this gamma PnL by hour? Or how much gamma PnL are we making every hour? |
Suppose we have a portfolio $V$, we are only allowed to invest in one stock $S$, its price movement follows the geometric brownian motion, i.e. $dS=S(\mu dt+\sigma dW)$. We are allowed to choose different gearing ratio $\lambda(V,S,t)$ which depends on portfolio value, stock price and time. Suppose risk free rate is 0... |
Suppose we have a portfolio $V$, we are only allowed to invest in one stock $S$, its price movement follows the geometric brownian motion, i.e. $dS=S(\mu dt+\sigma dW)$. We are allowed to choose different gearing ratio $\lambda(V,S,t)$ which depends on portfolio value, stock price and time. Suppose risk free rate is 0... |
Suppose we have a portfolio $V$, we are only allowed to invest in one stock $S$, its price movement follows the geometric brownian motion, i.e. $dS=S(\mu dt+\sigma dW)$. We are allowed to choose different gearing ratio $\lambda(V,S,t)$ which depends on portfolio value, stock price and time. Suppose risk free rate is 0... |
I'm doing some labelling of time-series in preparation for ML.
However I'm not sure what approach I should use if I want to weight a label by two parameters ?
To keep it simple, let's say my label is `buy/sell`.
Now, clearly if I only had one variable `x` representing trend or whatever, I could either do a naï... |
How to weight a label by two parameters? |
I'm a math master student. I'm trying to follow a course-note that unfortunately has chasms to fill for this specific derivation. Rigour unfortunately has been thrown to the gutter.
Let $G$ denote a payoff function of some option, and suppose $G$ depends only on the final value of the underlying stock, so $G(S_T)$, ... |
I'm a math master student. I'm trying to follow a course-note that unfortunately has chasms to fill for this specific derivation. Rigour unfortunately has been thrown to the gutter.
Let $G$ denote a payoff function of some option, and suppose $G$ depends only on the final value of the underlying stock, so $G(S_T)$, ... |
Why does the EUR/USD exchange rate is in fact USD/EUR from a mathematical point of view?
By not using the mathematical notation it's a nightmare to compare exchange rates, so why is everyone still doing it?
**Edit:** I think I wasn't clear enough, what I would like to understand is why or how the dominant notatio... |
Why does the EUR/USD exchange rate is in fact USD/EUR from a mathematical point of view? Why finance does not use the mathematical notation? |
I am practicing for trading interview, especially the quick calculation of mental math. But I am wondering is there any quick method to calculate the general multiplication? like the one `-4.41 * 2.86`. I know some methods for `5.01*6.99`, as `(5+0.01)(7-0.01)`. But how can I calculate a general multiplication of two s... |
What is the logic behind using the conversion factor in determining the hedge ratio of deliverable bonds in 30Yr UST futures (WN contracts) throughout the trading life of the contract, but then having a 1:1 ratio in actual delivery of the bond to the long futures holder in physical delivery period and therefore leaving... |
I donloaded data regarding the YUM stock traded in the ney york stock exchange in year 2014 . Basically in this dataset we have 4 coloumns: the first coloumn is the day the second coloumn is the time in milliseconds expressed in epoch time , the third column is the transaction price and the fourth column is the volu... |
From Breeden-Litzenberger, we know that the second derivative of a European call option's price with respect to the strike price is equal to the risk-neutral probability density function of the underlying asset's price at the option's expiration. However, options_price(strike_price) is not a continuous function, so add... |
I donloaded data regarding the YUM stock traded in the ney york stock exchange in year 2014 . Basically in this dataset we have 4 coloumns: the first coloumn is the day the second coloumn is the time in milliseconds expressed in epoch time , the third column is the transaction price and the fourth column is the volu... |
I donloaded data regarding the YUM stock traded in the ney york stock exchange in year 2014 . Basically in this dataset we have 4 coloumns: the first coloumn is the day the second coloumn is the time in milliseconds expressed in epoch time , the third column is the transaction price and the fourth column is the volu... |
From Breeden-Litzenberger, we know that the second derivative of a European call option's price with respect to the strike price is equal to the risk-neutral probability density function of the underlying asset's price at the option's expiration. However, options_price(strike_price) is not a continuous function, so add... |
Let's say I want to sell shoes, which cost me 90€ in production, and I want to sell them with 20% profit.
Do I calculate my selling price then with 90€ * 1,2 (profit is 20% of costs) or with 90€/0.8 (profit is 20% of selling price)?
So do I calculate the profit from the costs of from my selling price? |
Which base to use to calculate profit of sold product? |
Consider a time series $S_i$ representing a stock price (say close prices of one minute candles). Let $\Delta$ be a quantization step (could be the price step in the strike prices of the corresponding options) and let $ dS_i \triangleq \lvert \lfloor (S_{i}-S_{i-1})/ \Delta \rceil \rvert$. Suppose there are $n$ candle... |
I am currently investigating the application of deep learning in calibrating option pricing models, specifically, models of rough volatility, such as rBergomi. While there is a lot of research on using deep neural nets as fast option pricing engines with market and model parameters as input features, there seems to be ... |
am trying to understand the core concept of Equity Forwards Curve, Funding Curve and yield Curves (most sources online seem to focus on Interest rate related examples, so any sources for equity related concepts would be much appreciated). Forwards Curve I kindof get, from the Definitions online it looks to be the insta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.