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.

3
votes
1answer
25 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
34 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
22 views

How simulate a time series in R with fixed parameters [on hold]

I would like to simulate time series data (250 data points) where I can set a fixed starting value, ending value, mean, variance and CPT value. I did it with VBA but it takes really long to generate ...
0
votes
0answers
13 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
44 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
20 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
62 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
148 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
24 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
37 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
70 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
53 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
48 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
53 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
55 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
148 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
85 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
62 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
108 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
82 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
26 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
24 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
68 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
72 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
62 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
73 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
131 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
61 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
101 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
126 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
80 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
30 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
63 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
58 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
143 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
76 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
255 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\...
0
votes
0answers
40 views

Simulation VaR and CVar assuming Normal Distribution

Am I missing something? Currently implementing a VaR and CVaR measure assuming normality of wealth value. after executing the following script, VaR is always greater than CVaR, as expected, but ...
1
vote
0answers
33 views

VaR calculation using excel gives different value than VaR using R at all c values except at c=0.5

This is VaR calculation in excel using variance-covariance method. This is VaR calculation in R. ...
0
votes
1answer
107 views

Dealing with weekends/gaps in financial data

My script takes some data from IEX and then outputs a pandas dataframe: ...
2
votes
0answers
37 views

IBrokers: How to assign trail amount for order type 'TRAIL'?

I'm using R package IBrokers with IB TWS. I'm trying to create a twsOrder object using twsOrder function: twsOrder(...., orderType = 'TRAIL', ...) How can I ...
5
votes
2answers
234 views

Create Tick Bars with R

How do I get OHLC bars with tick count (i.e. 500 ticks) instead of time? I prefer quantmod. Currently I have tick data and can already convert to minute bars using xts. ...
2
votes
1answer
791 views

Alpha vantage API Not working for NSE while the same query is giving output for NYSE stocks

Was trying to pull intraday data with free api from alpha vantage but unable to download it; While At the same time I'm able to download daily OHLC data. Also, intraday data query is working for NYSE ...
1
vote
0answers
30 views

Finding the distribution and moments of returns with GARCH models (in R if possible)

I understand the GARCH type models and I know how to fit a model to a time series. But, there is a paper which calculates the moments of the distribution of returns (Variance, Skewness, and Kurtosis) ...
2
votes
1answer
5k views

Did Google Finance API Go Away or Just Change Signature? [closed]

I have been using Google finance for many months to pull intraday and daily data. Today I tried to use it and got redirected. For example, the following URIs returned text data that could be parsed: ...
-1
votes
1answer
627 views

Choosing programming language for the next generation of a pricing library [closed]

If I were to start development of a pricing library, which programming language would be most suitable to satisfy the following needs: Implement highly parallelizable pricing models using GPU or any ...
2
votes
0answers
60 views

Generating Correlated Quasi Random Numbers

Hi I am trying to generate correlated quasi random numbers using a sobol sequence in matlab. My Problem is the Following: Using "standard" random numbers it is easy to generate the 6 correlated random ...
0
votes
1answer
157 views

Interpretation of PCA for commodity futures

I've done some PCA analysis of a portfolio consisting of futures on certain commodities. However, I am unsure of how to interpret the output as most of the information found online deals with fixed ...