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
2answers
1k 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 ...
4
votes
1answer
94 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 ...
4
votes
3answers
192 views

Data sources to get past news articles

Are there data sources from which we could get news articles from the last 2 years? I tried reuters but they had data spanning back to just 3 months. Any suggestion/pointers are appreciated
0
votes
1answer
46 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
18 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 ...
29
votes
4answers
20k views

How to derive the implied probability distribution from B-S volatilities?

The general problem I have is visualization of the implied distribution of returns of a currency pair. I usually use QQplots for historical returns, so for example versus the normal distribution: ...
3
votes
2answers
627 views

C# - Using Black Scholes Newton returns NaN occasionally

First caveat: I'm a programmer doing this for a client, and my knowledge of options probably has holes in it. So be a little forgiving here. =) The Issue: When I run Black Scholes Newton against ...
0
votes
0answers
54 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 ...
1
vote
1answer
1k views

Programmatically detect RSI divergence

How can I programmatically detect bullish and bearish RSI divergences? A bullish divergence occurs when the underlying security makes a lower low and RSI forms a higher low. RSI does not confirm the ...
0
votes
1answer
429 views

How can I export intraday stock data into CSV from Interactive Broker or Yahoo Finance?

Google Finance API seems to be down forever. Are there instructions or manuals for downloading intraday stock data into CSV files from Interactive Broker OR Yahoo Finance?
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 ...
-1
votes
4answers
1k views

How to download bloomberg intraday data efficiently with API

so I would download a bunch of intraday data, for a bunch of securities, but we keep hitting our monthly cap limit. We don't want to upgrade to a more expensive package as this is simply a research ...
2
votes
0answers
32 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
74 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
164 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 ...
2
votes
2answers
79 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 '...
1
vote
0answers
29 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 ...
6
votes
1answer
3k views

Understanding Yang-Zhang Volatility Estimator

I am using TTR in R and I am trying to understand the Yang Zhang volatility estimator (without drift). The following equations seem to imply a single value: $$ \sigma = \sqrt{{\sigma_o^2}+k\sigma_c^2+...
1
vote
0answers
56 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 ...
12
votes
1answer
2k views

Tools/R code for predicting Dragon-Kings

The theory of the so called Dragon-Kings, esp. by Didier Sornette (ETH Zürich), basically states that financial crises and crashes are predictable (contrary to the theory of black swans). The ...
2
votes
0answers
61 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
53 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
62 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
2answers
65 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 ...
2
votes
1answer
157 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
1answer
132 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 ...
1
vote
1answer
77 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
3answers
303 views

Where to get historical equity data?

I have a decade of experience as a software engineer, but little quantitative finance knowledge. I have an idea for a simple trading strategy based around moving averages. In order to test it, I'd ...
3
votes
0answers
91 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 ...
1
vote
1answer
142 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.
3
votes
0answers
74 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. ...
0
votes
1answer
185 views

What is the best way to connect R with IB?

I am looking to connect my trading models to trade in IB. my models are R based. what is the best (and fastest) way to create a system that get data from IB and based on this data create trades in IB. ...
0
votes
1answer
126 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 ...
7
votes
0answers
106 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
33 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
29 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 ...
2
votes
0answers
63 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 ...
1
vote
1answer
70 views

Why the spread is calculated on raw prices instead on the price changes?

I'm reading Quantitative Trading With R written by Harry Georgakopoulos. In chapter 6 he exposes a basic quantitative strategy based on setting up a stock spread and buy when it is below a lower ...
1
vote
0answers
117 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 ...
10
votes
1answer
2k views

ARMA+GARCH prediction with package rugarch (R)

I am analyzing FTSE 100 series, from 2007-01-01 to 2010-12-31 (university exam homework). I have to use the data 'til 2010-11-30 as sample, and the remaining (23) observations as in-sample forecast (...
2
votes
1answer
120 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
2answers
813 views

Automated Import of 10-Q and 10-K Statements in XBRL Format from SEC.gov

I want to read financial statements in XBRL Format from the SEC site automatically. For instance the 10-Q File from Apple: http://www.sec.gov/Archives/edgar/data/320193/000119312515259935/aapl-...
3
votes
2answers
296 views

Handling IQFeed events in Matlab

I need to get some specific market data for my studies, and it seems like the most convenient way for me to do this is to use IQFeed data feed and MATLAB. But unfortunately, since I'm not a seasoned ...
2
votes
1answer
2k views

Calculating the VaR from a GARCH(1,1) with Student-t innovations

I'm self-studying several questions on Ruey S. Tsay's teaching page. I'm experiencing some difficulty getting the correct answer for final exam 2013 Problem B Question 3. Given a Student-t GARCH (1,1)...
8
votes
3answers
2k views

Automated 10-K XBRL data grab using the SEC file structure

I would like to write a program that takes as input a list of CIK/year/quarter entries. The program should iterate through the list and, for each entry, grab XBRL financial data from the SEC website ...
5
votes
1answer
679 views

Vasicek yield curve

Term structure is determined by a two-factor affine model (Vasicek). Using the monthly swap market data, we fit the model to match exactly the one-year and ten-year points along the swap curve ...
-2
votes
1answer
225 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 ...
1
vote
1answer
291 views

Looking for most current Financial API that is fast and accurate for NYSE NASDAQ AMEX OTC and PINKs

Looking to build a real time data feed, stock monitor window. Pretty much the same as equityfeed.com market viewer window, just with a few addedfeatures and or different filter columns with more up ...
4
votes
3answers
804 views

Online courses or C++ books combined with Finance (alternatives to Duffy and Joshi)

I am trying to find a book for our study group that teaches the bare minimum C++ needed for financial applications. I am trying to teach it in a project based manner. In case, I don't settle on one ...