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
0
votes
1answer
84 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 ...
0
votes
0answers
61 views

Solving for unknowns in Black-Scholes equation using Python

I have defined the Black-Scholes equation in Python as follows: ...
1
vote
1answer
44 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 ...
2
votes
0answers
57 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 ...
4
votes
1answer
1k 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
509 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
83 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
71 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
53 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
49 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
87 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 ...
5
votes
2answers
390 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
3k 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
21 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. ...
3
votes
1answer
431 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
160 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 ...
6
votes
1answer
103 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
43 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
192 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,...
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
202 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
37 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 ...
6
votes
2answers
1k 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
73 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
64 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
1k 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
240 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 ...
1
vote
2answers
281 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
114 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
52 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
132 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
80 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
18 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
101 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
204 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 ...
0
votes
0answers
18 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 ...
5
votes
0answers
441 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 ...
3
votes
1answer
447 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
72 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
522 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
504 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
47 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
39 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
69 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
32 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: ...
1
vote
1answer
277 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
48 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 ...

1
3 4
5
6 7
26