Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

# 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,160 questions
Filter by
Sorted by
Tagged with
29 views

### How can i fit the following regression in R? Why is the coefficient [second Columns] for R so low?

'Rwml' is the monthly log return So the first column is clear, I got nearly the same values, at least the same magnitude. But: If I regress on the variance, my input values are way too low to get a ...
52 views

### Don't know if it is obvious, but how do I fit the following model in R?

From the Paper "momentum crashes", Daniel and Moskowitz $I_B$ is a dummy Variable which could be either one or zero Is it possible to regress on two intercepts? or do i get something wrong ? Are ...
94 views

### Free dividend data API for non-US stocks

Is there are any free API for dividend data that does also include non-US stocks? I know of this question from three years ago. However, the situation has changed since then apparently, as there are ...
2k views

### GARCH volatility modeling, squared returns, and convergence

After reading some more of Volatility Trading, I decided to try to make a simple volatility model using daily log returns of an ETF I follow. It turns out "simple" is sort of relative. Unfortunately, ...
20 views

### How to forecast monthly volatility with daily gjrGarch estimates

I'm currently writing a paper and need to regress the 22 days realized volatility of the following month on its GARCH estimate and the 126days realized volatility up to t=1 The paper im referring to ...
2k views

### Finding ETF Symbols for alpha vantange

I'd like to use the api of https://www.alphavantage.co/ which is pretty well documented, in terms of avaliable functions (but not parameters). However, in order to get an API response, one needs to ...
48 views

### Why doesn't tenor of Euribor index change spot rate in Quantlib?

I'm trying to create a yield curve in QuantLib based on swap rates. The swap rates I'm using have a 6 months fixed frequency and a 3 month float frequency based on LIBOR. What I don't understand is ...
3k views

### Pricing a fixed rate bond in Quantlib Python

I'm trying to implement a pricing model for fixed rate bonds with the code below. ...
582 views

### Forecasting conditional returns in DCC-GARCH-copula approach in R

anyone who could help me interpreting and modifying this code? I have a dataset and want to reserve the last 100 returns for out-of-sample analysis. After specifying and fitting the garch-spd-copula, ...
454 views

### Regularizers to compute Minimum Variance Portfolio weights

I need to compute the mimimum variance portfolio using different regularizers, to compare the results and use validation methods to find the optimal parameters. Currently my work has been performed ...
48 views

### Gatheral's SVI implementation in Java/Scala

I am trying to fit equity option implied vols using SVI model in Java, and I am using apache math commons library. Some of the option expiries fit very well, but others are completely off, and I am ...
94 views

### suggestions for improving monitoring of trading bots?

I'm simply looking for tips and ideas to make my system a little more professional. The structure: The botting script is hosted on a VPS. There's a database hosted on yet another VPS. There's a ...
65 views

### How to programmatically define financial leverage?

Financial leverage could be easily described as the tool that allows traders to multiply returns at the cost of multiplying also the risk involved in every trade. So, for instance, if a stock today ...
56 views

### Alternatives to irr function in Matlab to calculate internal rate of return

I am trying to calculate an IRR with several dimensions in Matlab 2019a. My formula below works in theory (ignoring the "multiple rates of return" warning for now), but the problem is that for bigger ...
66 views

### Small difference in IRR, big difference in NPV?

I calculated the following in Matlab 2019a, see code below. I was surprised about the big difference in present values (DiffPV, DiffPVpercentage) for only a small difference (DiffIRR, ...
472 views

### Least-Squares-Monte-Carlo by Neural Network Estimator for pricing American Option Python [closed]

First I did the LSM (Longstaff-Schwartz) to understand how its work to price an American option. code for standard_normal ...
38 views

### Backtesting EGARCH-NIG CVaR in R

I fitted an EGARCH model with a NIG distribution to a series of returns. Using the following link I tried got how I should calculate the CVaR of the model http://r.789695.n4.nabble.com/CVaR-with-NIG-...
50 views

### How to work with vine copula in R?

I have returns of 4 stocks: stock1, stock2, stock3, stock4. And I use R and library(VineCopula) to do: ...
33 views

### Extreme Value Simulation from Copulas with Monte Carlo

I'm trying to simulate the tail values from a multivariate distribution using copulas. I'm using Vine Copula package of R to derive the suitable copula for my data and I generate random samples out of ...
52 views

### API returning company tickers found in provided news article

I'm looking for a REST API (paid or free) that accepts a string containing a news article (example below) as payload and returns an array of company tickers (eg TSLA for Tesla) mentioned in the ...
41 views

### Problem in copula fitting

I have returns of 2 stocks: stock1 and stock2. And I want to fit pair copula. I use this libraries library(VineCopula) library(copula) then I select an ...
37k views

### Is there any thing out there as a substitute for KDB?

thanks a lot for your discussions on the original post. following your suggestions, let me re-phrase a bit : kdb is known for its efficiency, and such efficiency comes at a terrible price. However, ...
53 views

### How to apply multiplicative price seasonality to bond prices in quantlib?

Can someone please give a brief or any link which explains how to apply multiplicative price seasonality to inflation linked bonds in Quantlib using python modules. Have gone through most of the ...
69 views

### Python Numpy FFT array size limit?

I am trying to find the price of an Option based on the fft technique within the binomial model and it works fine until N>40000 where I start getting negative values and weird convergene and I am not ...
63 views

### What is the model behind Heston-Nandi functions in the fOptions R package?

I am dealing with Heston model in R and for this purpose I am using the package fOptions from RMetrics. The calibration formula requires the specification of some parameters (omega, lamda, alpha, ...
43 views

### Tangency portfolio with constraints

Hello to everyone I am trying to implement a version of MV optimization with constraints as UB and LB, it seems to work fine but now i was trying to figure out a simple way to derive a CML in the same ...
40 views

### Fit a copula model in R

I want to accomplish the task of creating an optimal portfolio of stocks, the yield between which is modeled using kopulas. And I have data: return of 4 stocks: ...
667 views

### Local Volatility calculation in Python

I am trying to price Local Volatility in Python using Dupire (Finite Difference Method). I have following set of information Spot: 770.05, Strike: 850, Type: 'C', rfr: 0.0066, time to maturity = ...
86 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 ...
212 views

### How to calculate the Maximum Drawdown for a portfolio in MATLAB?

I would like to verify my approach of calculating the Maximum Drawdown for a portfolio in MATLAB. I've got a vector of returns for the portfolio, to which I add 1 for every return. Afterwards I ...
27k views

### Except Zipline, are there any other Pythonic algorithmic trading library I can choose?

Except Zipline, are there any other Pythonic algorithmic trading library I can choose? Especially, for backtesting?
154 views

### How to calculate YTW (yield-to-worst) in QuantLib?

After defining a CallableFixedRateBond object in QuantLib, I can calculate YTM (yield-to-maturity) right now. I'm using Python so the function is bondYield(). Is there any way to calculate YTW (yield-...
34 views

### Why can't I take the Value at Risk “VaR” as a a risk objective in PerformanceAnalytics? (it does work for "ES)

I am currently playing around with PortfolioAnalytics package in R and some data and I am aiming to create different portfolios with different VaR. However, I am struggling first of all, add.objective(...
28 views

### fPortfolio specify our constraints for efficientPortfolio [closed]

I am working on the library fPortfolio in R and I have a question. How can we fix for a portfolio the sum of weights equal to 1 ? When I study the code, I see that we cannot choose which constraints ...
1k views

### FX Option strikes from ATM, RR, BF quotes

I am trying to replicate the results in Consistent Pricing of FX Options, A. Castagna and F. Mercurio. However, when I calculate the strike prices for 25-delta put and call and ATM I cannot get the ...
47 views

### How to migrate Octave Levenberg-Marquardt algorithm to Accord.Net (C#)

I am trying to migrate Matlab (Octave) Levenberg-Marquardt algorithm to Accord.Net (C#) but struggling to match input parameters For example this simple example available in the documentation here: ...
83 views

### Extend mean-variance optimisation to fama five factor

I'm new to quant finance, and as I'm not a mathematician, I am using python to try an understand it. There are a number of blogs on the internet which explain mean variance optimisation, but no-one ...
29 views

### How do I calculate from discountfactor to zerorate in Python using Quantlib [closed]

I knew rate to discountfactor InterestRate.discountFactor(yearFraction) I want to calculation discountfactor to zerorate
80 views

### Efficient computing of stock returns taking dividends into account

I have two DataFrames as follows: Dividends: ...
66 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 ...
136 views

### Dealing with weekends/gaps in financial data

My script takes some data from IEX and then outputs a pandas dataframe: ...
5k views

### List of Intraday stock prices API

I am looking for an API to request intraday data for the London stock exchange. I have seen products like eSignal but this seems to include a lot more than the simple data as XML or JSON and is fairly ...
115 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 ...
175 views

### Can someone confirm if I am correct about these numbers on companies' financial documents?

I am looking to implement Piotroski's F-score Value strategy discussed in the paper "Piotroski, J. D. (2000). Value investing: The use of historical financial statement information to separate winners ...
5k views

### Place to get free live Forex quotes via API?

Are any free Forex data APIs available? There are a ton of historical data repositories that are freely available but what about a live, streaming data API? 1 minute updates or tick data would be ...
29 views

### TWS API Python_Remaining Positions [closed]

I am trying to get the number of filled/remaining positions using the function orderStatus() under EWrapper class. I tried something like, print(p.orderStatus(orderId=6, filled)), which didn't work. ...
249 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 ...