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.

Filter by
Sorted by
Tagged with
2
votes
1answer
37 views

Bootstrap ESTER and SOFR curves with Quantlib Python

Is it possible to bootstrap the new ESTER and SOFR term structures in Quantlib? More in general, does the process work as the usual one? Given these are simple indices that are published on a daily ...
0
votes
2answers
1k views

Portfolio optimzation : efficient frontier with respect to risk aversion parameter with R

I am currently trying to write a little script in R to determine the optimal weights given a fixed risk aversion parameter. The problem I have is that by increasing the risk aversion parameter I think ...
2
votes
1answer
35 views

evaluating garch models

I used ugarchroll to backtest my garch model on S&P returns this is my code ...
0
votes
1answer
35 views

Is my python solution good? : Global Minimum Variance portfolio with 'no-short sale' constraint

Question Is my python code an answer (at least a close answer) to get the weight vector of the Global Minimum Variance portfolio problem? My codes are shown below after some explanations. Details ...
1
vote
1answer
12 views

Heston calibration using Quantlib and Python: failure in BlackVarianceSurface function

I have an error when trying to use the fucntion BlackVarianceSurface from quantlib. Can you help me? the error is RunTime Error: dates must be sorted unique. ...
0
votes
0answers
23 views

Fixed rate bond pricing issue in Quantlib

I cannot retrieve the same price for a fixed bond using quantlib. ...
6
votes
1answer
75 views

Error message when backtesting GARCH in R

I am trying to backtest my ARCH model using ugarchroll from rugarch package in R, but I am getting this warning message ...
0
votes
0answers
26 views

How can I estimate a dynamic GARCH model using a Kalman filter methodology in R or MATLAB?

Does anyone know of any R or MATLAB packages for estimating GARCH models using Kalman filtering or any other state-space methodology? I would like to estimate a GARCH so that not only the variance, ...
2
votes
0answers
74 views
+50

Using Python Quantlib's FittedBondDiscountCurve as Evaluator of Parametric Curve - Errors

I am using Quantlib's FittedBondDiscountCurve in Python 3.7 and setting MaxIterations to 0, and giving a guess_solution, which then turns the routine into an evaluator for the parametric form I choose,...
1
vote
4answers
9k views

Symbols for DAX from Alpha Vantage

I found the website https://www.alphavantage.co as an alternative for yahoo finance stock API. I am interested in the top 30 DAX symbols, but I seem to cannot find them on Alpha Vantage. Is there a ...
15
votes
4answers
11k views

Trading C++ Libraries

Are there any free c++ libraries that would have some of the functions that would be used in developing a trading strategy. For instance, calculating drawdown, Volatility Forecasting, MAE, MFE....etc. ...
3
votes
1answer
151 views

Finance: Portfolio - Long Short Portfolio construction

I am trying to construct a Long / Short portfolio in R. Say I have two portfolios Tech and Mature and I want to go long on the <...
0
votes
0answers
19 views

Where to find the components of an index and how to replicate it by subset selection?

I am interested in replicating the performance of the eurostoxx 50 index using different statistical methods. That's what ETFs do, right? How to replicate an index using subset selection? I think I ...
9
votes
4answers
10k views

How to learn QuantLib-python at first?

In my project, I have to get the delta of up and out call option (with vol surface). I found out that QuantLib might help me on that. Since my main language is python and I don't know well about C++, ...
0
votes
1answer
70 views

How to find sector/industry and market cap for securities in my portfolio using R?

I am working on a project where I need sector/industry classification and market cap for some securities, many of them are not in SP500, but are part of US market. I am using R for this. I don't have ...
4
votes
1answer
202 views

Numerical simulation of Heston model

I am trying to simulate on Python random paths for a general asset price as described by the Heston model: \begin{equation} \begin{aligned} dS_t &= \mu S_t dt + \sqrt{\nu_t} S_t dW^S_t \\ d\nu_t &...
5
votes
2answers
611 views

Random Portfolios vs Efficient Frontier

I understand the concept of the efficient frontier and am able to calculate it in Python. But even when generating 50'000 random 10 asset portfolios, the single portfolios are not even close to the ...
2
votes
0answers
67 views

Understanding APR via programming [closed]

I am trying to better understand different types of interest rates. However, I am having difficulties complete, consistent and pedagogically-efficient explanations online. Thus, I have decided to ...
1
vote
0answers
55 views

Why don't these betas match?

I am sure I am missing something simple, but I would expect my portfolio beta when regressed against the market to match my individual component betas multiplied by the portfolio weights. I have ...
2
votes
2answers
430 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 ...
4
votes
1answer
225 views

R or Cpp for some finance work involved complex numbers?

I need to implement some pricing functions which involve complex numbers. The equations involve various expressions such as $Re$ and $Img$ (i.e the real and imaginary part of the complex number), and ...
4
votes
2answers
2k 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
2answers
100 views

What are the best [free]resources to learn C++ particularly for quantitative finance?

What are the best free, online resources to learn C++ for quant finance? The course by quantnet seems too expensive for a broke student like me! If there are any free online resources, let me know! ...
0
votes
0answers
32 views

Which Python or C# backtesting framework supports multi-asset?

Is there any backtesting framework written in C# or Python that supports multiple assets? I'm trying to backtest a pair trading strategy that requires to
1
vote
0answers
24 views

Walk Forward Analysis Using Portfolio Analytics R

I am learning how to use the Portfolio Analytics package in R and I am concerned with overfitting the data for the optimization. The optimize.portfolio.rebalancing() function has 2 parameters that ...
1
vote
0answers
44 views

Extract list of tickers bloomberg api [closed]

Does anyone know what is the python equivalent to the BQL.Query/BSRCH functions from the Excel API? I am essentially trying to get a list of tickers for all government bonds from a certain country ...
1
vote
1answer
50 views

How to build a loop function for out-of-sample backtesting?

Many statistical libraries in R offer the possibility to fit a model and then use the results of optimization to predict values some periods ahead. However, many do not have the possibility to ...
0
votes
0answers
16 views

How can I download quarterly fundamentals of listed companies for the last 10 years+ using Python without charge? [duplicate]

There is a package in Python called yfinance which allows me to download the fundamentals of listed companies from yahoo for the last 5 years (Annual). However I would like to have data over a longer ...
2
votes
1answer
42 views

Compute Vega and Delta in R

I am trying to compute greeks for a large sample of CEO compensation contracts in R. However, my vega computations all result in a value of zero. In doing so, I follow Core and Guay [2002]: Here is ...
1
vote
1answer
74 views

Duan (1995) GARCH Option Pricing Model with MATLAB

This is the MATLAB code that replicates the option pricing model proposed by Duan in his paper "The GARCH Option Pricing Model". However, the parameters estimated in the file do not match with the ...
3
votes
2answers
173 views

How to interpret and define statistics of GBM output

I am trying to model the future prices of a number of commodities. For this, I am applying geometric Brownian motion, writing a Monte Carlo code in Python. Given that I want to estimate tommorows ...
0
votes
0answers
10 views

How to compute reference share price and reference volatility in CreditGrade?

I'm trying to implement CreditGrade in python, from the msci Technical Notes (https://www.msci.com/documents/10199/dd31bcce-6fe3-47b7-9fb7-10c4c8f750ba) but I'm running into some comprehension trouble ...
4
votes
1answer
169 views

Valuing structured loans in QuantLib

I'm trying to figure out if it's possible to value structured products, mainly loans, in quantlib. The idea is to build a bond class with different cash flows. For example, a loan could have coupons ...
2
votes
1answer
299 views

Best way to buy and sell large volumes of crypto

I had a few questions about how to properly execute a large order of crypto currency without moving the price much. I know a lot of funds employ a TWAP/VWAP algorithm to liquidate or purchase a large ...
4
votes
0answers
49 views

How to calculate average entry price for perpetual swap contracts?

I'm trying to calculate the average entry price for perpetual swap contracts for use in back-testing a trading strategy, as per Bitmex's documentation: A Perpetual Contract is a derivative product ...
0
votes
1answer
42 views

Confidence Intervals for ARMA+GARCH forecasts

I have fitted an ARMA(1,1)+GARCH(1,1) model to my logreturns series. When it comes to my standarized error's distribution however, I have opted for a Skewed Generalized Error Distribution, because of ...
2
votes
1answer
238 views

Crossing the spread as a ML signal

In the optic of high-frequency trading, most of the standard trading algorithms work on the principle of mid-price prediction or mid-price movement prediction. However a big drawback of this technique ...
3
votes
1answer
91 views

Basis Swaps in Quantlib/Python

I am aware that I can create a IRS in Quantlib/Python by using the following function: ...
1
vote
0answers
43 views

Quantlib Python OISRateHelper using Quantlib Cookbook - hands on Quant Finance

I am completely new to Python, just trying to reference Quantlib Cookbook to construct eonia curve, here is my code. I didn't change much compared to the cookbook Eonia Curve BootStrapping chapter, ...
2
votes
1answer
448 views

Rblpapi millisecond resolution

I'm using Rblapi to get tick data, using the nice getTicks function. Much to my dismay the index is rounded to the second, while milliseconds time stamp could be provided. Tried returnsAs xts, fts(?) ...
2
votes
1answer
360 views

How to sample from a copula in matlab

I have two random variables (say, X and Y). Each of these rv's are defined by their CDFs (CDF_X and CDF_Y). These CDFs were obtained empirically, so they are a "stair" graph. I also have a copula C ...
0
votes
1answer
36 views

How to use ARMA GARCH to do forecasting in R?

How to use ARMA GARCH to do forecasting in R? I only know how to use ARMA to do the prediction and GARCH to do volatility forecasting but how can we use ARMA GARCH to do forecasting in R. Can anyone ...
0
votes
0answers
20 views

Searching for historical gold price intraday data

I'm searching for historical gold price intraday data. Can someone help me and tell me where I can get this data from? I need this data for a research project. I've only found data for historical ...
1
vote
0answers
38 views

How does the mean interest rate of a loan shift over time?

I have a loan dataset (300MB) that comes from the Lending Club and I would like to know how has the average interest rate of a loan varied over time. I have the int_rate column but I'm not familiar ...
1
vote
0answers
20 views

How to check if the people segmentation based on prime and sub prime loans is accurate?

Using Lending Club dataset I have a dataframe with characteristics of loans of some borrowers. Here is their distribution of the sub-grades: ...
0
votes
1answer
64 views

Calculate the historical simulation VaR of the portfolio using Python

Assume that we have 200 stocks in WeiBo (WB), 300 stocks in Netflix (NFLX), 250 stocks in Ford Motor Company (F) and 150 in Royal Dutch Shell (RDS-A) as of 31 August 2019 in the portfolio. I have ...
2
votes
0answers
43 views

Conceptual help - Machine Learning on finance data set [closed]

I am working on Anomaly detection model problem for a finance data set - set of gift card activation transactions. My team member suggested an idea that " First train the model with normal instances ...