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
1
vote
1answer
402 views

Quantlib: Getting error trying to price a Swap

I have bootstrapped my curve based on end-of-day data for 24th Nov, 2017 I am then using that to price a off-market swap as below: ...
3
votes
2answers
127 views

Deriving implied volatility programmatically

I'm working on a project to calculate the value of options using Python. I'm using the Black-Scholes model, and I can get accurate results by plugging in a given ...
0
votes
1answer
106 views

Basic Monte Carlo Present value calculation in R question

I'm self studying monte carlo applications with the application towards present values. However the values that I am using are of the uniform distribution variety with a pre defined minimum and ...
0
votes
0answers
23 views

I am getting an Invalid API call from Alpha Vantage TIME_SERIES_DAILY_ADJUSTED for Mexico or Toronto Stocks (with a period). Why?

I have used the following: https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=URBI&apikey=nnnnnnnnn I get back this: ...
0
votes
1answer
34 views

Usage of calculations / models in decision making [on hold]

This is probably extremely naive and a dumb question but how are models used to profit? If firms use the same popular calculations / models in their decision making, wouldn't they all come to the ...
0
votes
4answers
1k views

Where to find sample intraday data? One to two days or more

I'm looking for some intraday stock data. Doesn't really matter what kind of security... I'm just looking for price, volume, bid, and ask. I'm looking to test a model based on the dynamics and ...
0
votes
0answers
21 views

CFH TOOLBOX MATLAB OPTION PRICING [closed]

Does anybody know CFH (Characteristic Function Option Pricing) toolbox of matlab? How does this toolbox work? I've just intalled it into my matlab and I would like to use it to pricing option with ...
0
votes
1answer
40 views

Heston model with jumps in both variance and underlying dynamic

How can I build on Matlab a Heston model using characteristic function adding jumps in both variance and underlying dynamic ? Suppose that the number of jumps is Poisson-distributed but the jump size ...
2
votes
0answers
47 views

Dynamic Programming optimal saving-consumtion finite horizon problem

Let $w_t$ denote a consumer's wealth at time $t$ and $c_t$, the amount she chooses to consume, so her savings exiting this time period are $w_t-c_t$. Given this savings decision, her savings $w_{t+1}$ ...
0
votes
0answers
49 views

Solving for unknowns in Black-Scholes equation using Python

I have defined the Black-Scholes equation in Python as follows: ...
1
vote
1answer
42 views

Calculating and visualising the future value of 100USD invested in fixed income securities and bonds in R [closed]

I have uploaded TB3MS to R and would like to visualise the future value if i invest 100USD in it. The interval is from 2014 to 2019, monthly frequency. I would like it to be comparable to a plot i ...
1
vote
0answers
44 views

machine-learning method to predict PCA weights

I have been using certain linear-regression to extract the PCA (top 3) weights relating to a certain data-set. I was wondering, instead of using linear-regression to generate the weights, I can use ...
0
votes
0answers
28 views

How to get implied volatility from Heston Model? [closed]

I calibrated it with DEoptim, I got the Heston Model price, but now I can't get the implied volatility.I'm using the bisection method and it isn't working because I got it wrong. Could you help me ...
1
vote
1answer
57 views

Portfolio/sub-portfolio optimization

I have a finite amount of 26 assets, the total amount of these assets needs to be allocated to 9 portfolios. Each portfolio has its own required return which needs to be met, using a min-variance ...
4
votes
1answer
342 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 &...
0
votes
1answer
54 views

setting up bloomberg api for python

I am trying to configure bloomberg api in python. I have used pip to install the api, i also downloaded the BloombergWindowsSDK. I am not sure where to go from here. Can i please get a step by step ...
1
vote
0answers
73 views

How to correctly simulate volatility shocks?

I am working on the comparison of different volatility timing/target strategies on portfolios starting from different conditions (data, asset classes, calculation of realized volatility, different ...
1
vote
0answers
59 views

Annualizing Sharpe Ratio using small time frames

I have coded a strategy that works 5m time frame. I know you multiply it by 252 but i am using 5m or sometimes 1h time frame. Which number do i have to chose to multiply? There are 72576 five minutes ...
1
vote
0answers
44 views

Bloomberg C# / CS.NET SDK for STDY Functions

I have downloaded and installed the CS.NET SDK from STDY. I have installed this as admin and had no problems with the install. However, when I open VS2017 (last version supported by BBG) I do not see ...
0
votes
0answers
38 views

Automatically gathering closing prices for stocks listed on different exchanges

I am looking at the holdings for a particular ETF. A lot of the tickers represent stocks on different exchanges. For example for one of the holdings the stock appears on Yahoo Finance, but for another ...
1
vote
1answer
35 views

Is there a quicker algorithm for calculating 'drifted' portfolio weights? (R, Pandas/NumPy, MATLAB)

'Sup, QuantSX. BLOT (Bottom Line On Top): Is there a nice clean algorithm for rapidly calculating portfolio weight drift? In R, Python or MATLAB - I'm not fussed which. Details I'm in the final ...
4
votes
2answers
265 views

Best topics to begin Quantitative Finance Research/Programming

I have a background in mathematics (Functional Analysis and Probability Theory) and am looking to acquaint myself with research in quantitative finance, particularly with a programming component. ...
5
votes
3answers
2k views

Are there Python algorithmic trading libraries supporting forex?

I know about zipline and ultrafinance, but as far as I know, they don't support fx trading. Which libraries do?
0
votes
0answers
13 views

Zipline calendar spanning multiple days

I am trying to back test an algorithm using zipline and need to build a zipline calendar that maps to my brokers opening hours. My broker (FXCM) opens on Sunday at 17:00 and closes on Friday at 16:55. ...
0
votes
1answer
57 views

Calculate return for a set of securities downloaded using quantmod

I downloaded adjusted closing price using quantmod for a set of securities. I want to calculate daily/weekly/monthly return for all securities. Usual dailyReturn, weeklyReturn etc not working. What do ...
3
votes
1answer
126 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 ...
2
votes
1answer
49 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. ...
1
vote
1answer
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
54 views

evaluating garch models

I used ugarchroll to backtest my garch model on S&P returns this is my code ...
1
vote
1answer
59 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 ...
0
votes
0answers
39 views

Fixed rate bond pricing issue in Quantlib

I cannot retrieve the same price for a fixed bond using quantlib. ...
6
votes
1answer
81 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
32 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
103 views

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
10k 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
159 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
21 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 ...
6
votes
2answers
678 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
57 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
500 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
233 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
117 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
34 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