Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [programming]

For questions about programming languages, implementation, and packages in quantitative finance. Note: question must be specific to quantitative finance and must necessitate knowledge of quantitative finance in order to be on topic.

1
vote
1answer
42 views

Monte Carlo simulations in Python using quasi random standard normal numbers using sobol sequences gives erroneous values

I am trying to perform Monte Carlo Simulations using quasi random standard normal numbers. I understand that we can use sobol sequences to generate uniform numbers, and then use probability integral ...
0
votes
0answers
37 views

How to implement an investment strategy in MATLAB? [on hold]

Since I`m a total novice in MATLAB I am struggling with a question that might be not even really hard. I have to implement and backtest 4 heuristic investment strategies but literally no idea how to ...
0
votes
1answer
50 views

DeMark Indicators

Would anyone know of a library in R that handles DeMarkindicators. Just wanted to check-in with the community before I invested a whole lot of time reinventing the ...
1
vote
2answers
91 views

R: Book with extensive examples for either portfolio optimization or volatility forecasting?

I'm at a new job and there's the option to use R (you don't have to, but I'd like to). I used R years ago, so I while I'm somewhat familiar with it, I have forgotten most of it. For me, the best ...
0
votes
1answer
59 views

Is there a straightforward way to get a “family tree” for a stock?

I would like to find a way to generate what might be called a "family tree" for a stock. Given a stock symbol and a future date, I'd like a graph (either literally or represented in list or other ...
1
vote
0answers
69 views

R Equilibrium FX using VEC or Behavioural Equilibrium Exchange Rate (BEER)

I dont have much experience with R. I would like to do create model for FX Equlibrium using VEC or BEER. I already know what variables I want to use in model: trade differential between UK and the ...
1
vote
1answer
56 views

Efficient computing of stock returns taking dividends into account

I have two DataFrames as follows: Dividends: ...
1
vote
1answer
35 views

Function price output hops around sometimes due to rounding

Say we have a function for estimating the fair price of a security. The function gives outputs rounded to the nearest 0.5 (that is, the raw output is not a rounded float, but can have a decimal part ...
1
vote
0answers
49 views

Pricing Knock Out Barrier Options by solving Black Scholes PDE (MATLAB)

This question is based on MATLAB functions. Suppose there is a stock S following the process $dS_t=(r-q)S_tdt+\sigma(S_t,t)dW_t$ r - risk-free rate, q - dividend yield, W - Weiner process The ...
1
vote
0answers
15 views

RUGARCH (output) and Residual Resampling using GARCH(1,1)

I try to replicate the methodology proposed by Freedman and Peters (1984a, 1984b) which was applied in the famous paper by Brock, Lakonishok and LeBaron (1992) to generate many artificial log return ...
1
vote
1answer
62 views

Need explanation on weird Gamma Behaviour Black Formula

I am using the RQuantlib package to price options on futures. With a slight modification one can go from the Black Model (76) to The BS Model. It can easily be shown that if we write S0 = (e-rt) * F0 ...
4
votes
1answer
59 views

Tick Imbalance Bars - clarification on T index

I have been trying to learn quant related things on my own. I recently picked up a book called "Advances in Financial Machine Learning" by Marcos Lopez De Prado. I am having difficulty understanding ...
4
votes
1answer
77 views

Monte Carlo for Asian Pricing

I'm trying to verify the accuracy of my Monte Carlo method for pricing mean options. I came across this paper that supposedly gives an 'exact' solution for the arithmetic mean option (asian). It's a ...
0
votes
1answer
43 views

How to optimize a series of equations whose outputs are a variable of the subsequent equatinos

The basic question is, given $f(x) = y$ and $f(y) = z$, how can you find $x$ such that $z$ is at its maximum? I can optimize each equation independently, but I do not know how to optimize when ...
0
votes
0answers
17 views

Termstrc data preparation from Bloomberg terminal

I am trying to use the R package termstrc to estimate yield curves for the Czech Republic. I have found the structure of the required class ...
0
votes
0answers
51 views

Get data from Yahoo or google finance

I want to get all data symbols belong to TSX (Toronto Stock Exchange) I have all symbols, but sometimes some symbols do not exist in yahoo finance. Is there any special package for my goal? I use ...
0
votes
1answer
48 views

Advantage to access “non-display data”?

There's data which is hidden from the exchanges called "non-display data"? For a standard stock day trader, is there an advantage to get that type of data? Can I be in the first people to see the big ...
2
votes
0answers
27 views

Mixed-Frequency VAR -packages

My intention is to retrieve forecast error variance decomposition from a MF-VAR with no latent processes following Ghysels (2012) https://www.hec.ca/finance/seminaires/Ghysels.pdf I found the ...
1
vote
1answer
66 views

How can I calculate the amount of volume to use to ensure highest profit on an arbitrage trade of two Constant Product Market Making exchanges? [closed]

If there exists an arbitrage opportunity between two Constant Product Market Making exchanges, how can you confidently determine the maximum volume to use in order to ensure highest profit? I can ...
3
votes
3answers
153 views

Are there recommended books/readings for advanced option pricing

I am learning option pricing and derivative markets this year in class. I have had some background on stochastic calculus so it was relatively manageable for me to write vanilla and American option ...
1
vote
0answers
25 views

Fractional cointegration in R

I'm looking for a package (or some code that anyone has written) that will help me to estimate a VECM for fractionally cointegrated series. I.e. like the ca.jo ...
1
vote
0answers
40 views

How to find the tangency portfolio using quadprog in R with different risk free rates

I am trying to find the optimal tangency portfolio for the efficient frontier (calculated using qp.solver in quadprog) but subject to different risk-free rates. Demos for quadprog in R show that to ...
2
votes
2answers
74 views

Group name for currencies, equities and other financial products

I am working on a financial software system that deals with crypto currencies. This system has a model called 'Currency' that describes for example 'BTC' and market for which there is a 'base' and '...
3
votes
1answer
59 views
2
votes
0answers
56 views

Backtesting :: Migration to Simulated / Real-Time Trading

I am relatively new to backtesting and I want to migrate my system to simulated trading via Amibrokers Interactive Broker's API. What I have been doing is setting trade delays such that when a Buy or ...
1
vote
0answers
52 views

Error in QuantLib-Python when I use function “Bond”

I am using the "Bond" function in QuantLib-Python 1.14. I am planning to use it in this way: ...
2
votes
1answer
59 views

(R-studio) Incorporating overnight returns in high-frequency data

Turning here since I haven't been able to find any help online. I'm currently dealing with a high-frequency data set in R of some stock indicies and I'm currently trying to clean the data so that I ...
3
votes
1answer
80 views

Residuals Fama MacBeth Regression

I am still asking myself what the pricing error terms in the Fama-MacBeth regression are. Are they the intercept I regress across all assets in each month, once? Or are they the residuals of each ...
2
votes
1answer
150 views

After hours data - Interactive Brokers

I just started using Interactive Brokers because of their API. I'm using the IBrokers package in R. I've managed to get data for S&P 500 and other indices but now I want data for S&P 500 after ...
3
votes
0answers
88 views

Detecting leading stocks using lag correlation

I am working on a project to find leading stocks in a stock market by using lag correlation. Say I want to compare 2 stocks, X and Y, and I have the time series of stock prices. Assume that the ...
3
votes
0answers
68 views

Is there a more efficient data structure to implement binomial trees than 2d array?

I'm just curious what is the "industry standard" for implementing a binomial tree (if "standards" exist in this case). For simplicity, let's just talk about the simplest trees with recombining nodes. ...
1
vote
1answer
117 views

Is studying R quantstrat worth the effort for an individual trader? [closed]

I see at least two problems. The R package quantstrat is poorly documented. And one must have dividends adjusted data. Otherwise the test results will be irrelevant.
7
votes
0answers
89 views

Does your Parkinson volatility ratio work as Taleb explained?

According to Dynamic Hedging: Managing Vanilla and Exotic Options (Taleb, 1997), the Parkison volatility estimator has several meaningful properties. It is defined $$P=\sqrt{\frac{1}{n}\sum_{i=1}^{n}\...
1
vote
0answers
28 views

Value function does not converge when applying the general value iteration adaptive dynamic programming [closed]

Recently,I am trying to control a marco traffic system with the general value iteration adaptive dynamic programming algorithm.However,the results do not reach my expectation. Here is the pseudo code:...
1
vote
0answers
26 views

Getbars for matured interest rate products

Using the getbars function from rblpapi package. Can you extract intraday data for a matured interest rate product? For example a German bubill The function works for interest rate products that are ...
0
votes
1answer
89 views

Interactive brokers historical data availability

I'm considering Interactive Brokers because of the IBrokers package for R. On this site there is a small section on data availability and I'm having a hard time understanding the table. Lets say I ...
1
vote
0answers
87 views

Python book on derivative pricing

Are there any books that show how to price exotic options in Python with monte carlo methods? I am aware of two books by Yves Hilpisch, but in his books there are only simple options. I am struggling ...
1
vote
1answer
65 views

Calculate New Portfolio Weights Given Today's Returns

I'm looking for a formula to recalculate my portfolio's weights at the end of time $T$, given a vector of the asset weights at $T$ and a vector of returns at $T$. For example: ...
2
votes
1answer
101 views

Merton's Jump diffusion model: Specify poisson rate

Currently applying the Merton's jump diffusion to test how Option price change as parameters change. However, I am struggling to specify the poisson rate $\lambda$. We know that: $P(\text{There is a ...
-2
votes
1answer
162 views

Is R suited for a Quantitative Finance executable application

I wonder if a R-Shiny application works well for a production environment or the only option is C++. I make this question taking in account that R and C++ have a widely set of quant libraries that ...
3
votes
2answers
62 views

Properties of an iTraxx index

I am working on maintaining the market data of iTraxx indexes in our systems and I have the following questions: What events prompt change in series and version of an iTraxx index ? Is it after one ...
1
vote
2answers
103 views

Paper recommendation with examples

Could you please advise me some papers/working documents with applications mainly focused on Fixed Income/Financial Engineering (Numerical Methods) as the one in the link below? Preferably on Matlab, ...
0
votes
1answer
135 views

R: backtesting with path dependencies

I have a historical PMwR journal of trades (one for each side of position open/close) in R. I wish to backtest trade sizing algorithms, one of the inputs to which calculation will be, on-the-day ...
2
votes
2answers
83 views

Multi Period Return Table

For performance presentation a multi period (or multi horizon) table is needed. What I mean is a table showing the trailing month, quarter, YTD, and other sub periods up to since inception. So I ...
1
vote
0answers
31 views

Issue with chart.RiskReturnScatter in performance analytics, need finite 'ylim' values error

I am currently trying to create a Risk Return Scatter plot using the following code ...
0
votes
2answers
65 views

Imputation of missing returns

I'm trying to calculate a historical VaR for a portfolio of futures, however there are certain days for which some assets are missing prices. Since the portfolio consists of many spread positions, the ...
1
vote
1answer
60 views

Finite difference: move forwards or backwards?

In finite differences for the black scholes method, you move backwards in time, since of course you know the prices at time $t = T$, and then you iterate until you get to time $t = 0$. However, why ...
0
votes
1answer
162 views

Bloomberg's Open Market Data Initiative

I am reading about OMDI: https://www.bloomberg.com/company/announcements/bloomberg-opens-its-data-distribution-technology/ After reading that, I am still not sure: Is it free? If so, what kind of ...
1
vote
0answers
80 views

Convertible bonds pricer - implementation

Where I can find numerical implementation (in any programming language) of convertible bonds pricer based on the following article: E. Ayache, P. A. Forsyth, K. R. Vetzal, "The Valuation of ...
3
votes
1answer
295 views

Why my implementation of CRR model does not converge?

Recall that CRR (Cox-Ross-Rubinstein) model for option pricing is the usual binomial tree model with $u$ (up-factor) and $p$ (one of the risk-neutral probabilities) defined as follows: $$u = e^{\sigma\...