Skip to main content

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.

450 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1 vote
2 answers
297 views

$n$-day ahead forecast for asymmetric DCC-GARCH model

I am working on forecasting covariances with the use of MGARCH models. I was wondering if anyone knows how to implement a n-day ahead forecast of the aDCC (asymmetric DCC) model in R. The ...
duruixuan's user avatar
1 vote
0 answers
128 views

Maximum Sharpe ratio portfolio - derivation

I want mathematical derivation of how to construct maximum Sharpe ratio portfolio. Any resources with mathematical derivation (if its implemented in Python, that will be great) will be useful
SriM's user avatar
  • 11
1 vote
0 answers
107 views

What is a call-spread and its formula?

I am attempting Mark Joshi's The Concepts and Practice of Mathematical Finance. In B.3 Project 1: Vanilla options in a Black-Scholes world, he asked the following question. We need to be sure that ...
Idonknow's user avatar
  • 840
1 vote
0 answers
265 views

Pnl Explanation using R (blotter)

I have a portfolio of stocks based on a proprietary strategy. I would like to explain the Pnl over a period, for example I would like to find the pnl contribution of each name of the period. Is there ...
Rene Chan's user avatar
  • 171
1 vote
0 answers
287 views

quantlib isda cds time-series

I am trying to use quantlib from python to work with time series of cds quote, e.g I would like to evaluate the PV or PUF or other metrics on many different days. Each day has an associated yield ...
Jeremy Taylor's user avatar
1 vote
0 answers
123 views

Using news to predict Stock Prices dataset

In order to build Regression or Deep Learning models for predicting the market, we need a bunch of historical data. Prices and technical indicators are easily accessible, but getting news from the ...
GiorgosMaragkopoulos's user avatar
1 vote
0 answers
2k 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: ...
Molasar's user avatar
  • 11
1 vote
0 answers
118 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 ...
Emanuele's user avatar
1 vote
0 answers
162 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 ...
Don Coder's user avatar
  • 139
1 vote
0 answers
141 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 ...
user42108's user avatar
  • 2,272
1 vote
0 answers
80 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 ...
dsugasa's user avatar
  • 165
1 vote
0 answers
189 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 ...
Jordan Wrong's user avatar
1 vote
0 answers
471 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, ...
xzhan769's user avatar
1 vote
0 answers
118 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 ...
Revolucion for Monica's user avatar
1 vote
0 answers
41 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: ...
Revolucion for Monica's user avatar
1 vote
0 answers
114 views

Framework for analyzing transaction history

After many years of being discretionary trader I'm finally moving to systematized trading. I have all the transaction history from my broker I want to be the basis of my models. Is there a framework ...
kambi's user avatar
  • 161
1 vote
0 answers
521 views

Matching the yield on a bond with the zeroRate on a curve in Quantlib

I am using QuantLib to generate a US Treasury curve from 1y, 3y, 5y, and 10y yield quotes. However, after building the curve and running zeroRate on it, it ...
user2728814's user avatar
1 vote
0 answers
283 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 ...
LenaH's user avatar
  • 133
1 vote
0 answers
74 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, ...
LenaH's user avatar
  • 133
1 vote
0 answers
74 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 ...
Jay's user avatar
  • 382
1 vote
0 answers
210 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 ...
AbhiGupta's user avatar
  • 111
1 vote
0 answers
73 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(...
brko's user avatar
  • 11
1 vote
0 answers
281 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: ...
Denis Evceev's user avatar
1 vote
0 answers
629 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 ...
user007's user avatar
  • 127
1 vote
0 answers
768 views

Pricing Knock Out Barrier Options by solving Black Scholes PDE (MATLAB)

This question is based on MATLAB functions. Suppose there is a stock S following the process $dS_t=(r-q)S_tdt+\sigma(S_t,t)dW_t$ r - risk-free rate, q - dividend yield, W - Weiner process The ...
Ranaji 's user avatar
1 vote
0 answers
263 views

RUGARCH (output) and Residual Resampling using GARCH(1,1)

I try to replicate the methodology proposed by Freedman and Peters (1984a, 1984b) which was applied in the famous paper by Brock, Lakonishok and LeBaron (1992) to generate many artificial log return ...
lilo's user avatar
  • 11
1 vote
0 answers
186 views

Is it Possible to replicate SPAN?

I currently trade intraday Options on the nearest term expiry and futures. Both E-mini S&P. I am trying to replicate the SPAN margin calculation for the entire portfolio of options and futures. So ...
Lovinthecane's user avatar
1 vote
0 answers
121 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 ...
Quantdaddy's user avatar
1 vote
0 answers
265 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 ...
sjedi's user avatar
  • 25
1 vote
0 answers
220 views

Derivative of the stock price and volume at time t

According to Forecasting of Jump Arrivals in Stock Prices: New Attention-based Network Architecture using Limit Order Book Data at page 9, I would be interested in deriving the the price (ask and bid ...
fgauth's user avatar
  • 329
1 vote
0 answers
209 views

Holding Period Return abnormally high

I've been doing my Dissertation and I was told to create a value - weighted portfolio on the 1979's 200 largest cap corporations (based on Market Value). I was also told that the correct way to build ...
Constantine Phoenix's user avatar
1 vote
0 answers
45 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 ...
Archer521's user avatar
1 vote
0 answers
485 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 ...
Markoff Chainz's user avatar
1 vote
0 answers
759 views

Poor results forecasting stock price volatility using Python's GARCH model

As far as I understand, forecasting stock price volatility should be more achievable than forecasting absolute prices or returns. It seems as though GARCH models are the traditional and most widely ...
KOB's user avatar
  • 193
1 vote
0 answers
214 views

Issue with chart.RiskReturnScatter in performance analytics, need finite 'ylim' values error

I am currently trying to create a Risk Return Scatter plot using the following code ...
UTexas80's user avatar
1 vote
0 answers
156 views

Time series analysis for stock prices

I am using GARCH model to simulate price of an index for 7 years. For input I am using difference of Log of prices (log of return). GARCH(1,1) has the lowest AIC, and I found parameters for the ...
Himeh's user avatar
  • 11
1 vote
0 answers
339 views

Convertible bonds pricer - implementation

Where I can find numerical implementation (in any programming language) of convertible bonds pricer based on the following article: E. Ayache, P. A. Forsyth, K. R. Vetzal, "The Valuation of ...
B_B's user avatar
  • 83
1 vote
0 answers
108 views

VaR calculation using excel gives different value than VaR using R at all c values except at c=0.5

This is VaR calculation in excel using variance-covariance method. This is VaR calculation in R. ...
knowrahulj's user avatar
1 vote
0 answers
70 views

Is my coding for my kalman filter off when testing this specific set of pairs?

My kalman filter seems to be off for this specific set of pairs I'm looking at. As you can see, in the kalman filtered linear regression, there seems to be an outlying blue line nowhere near the data ...
H. Acuna's user avatar
1 vote
0 answers
24 views

Simulating Taxed Equity Return Series (U.S.)

I'm looking to learn how to correctly simulate taxes on dividends and capital gains on simulated return series for U.S. Equities with dividend reinvestment. I understand I will have to keep track of ...
rhaskett's user avatar
  • 1,641
1 vote
0 answers
43 views

Finding the distribution and moments of returns with GARCH models (in R if possible)

I understand the GARCH type models and I know how to fit a model to a time series. But, there is a paper which calculates the moments of the distribution of returns (Variance, Skewness, and Kurtosis) ...
Novic's user avatar
  • 155
1 vote
0 answers
182 views

European Call Option Modelling under 2 factor Hull White interest rates

I have modelled the yield curve through the two factor Hull White Model. Now I want to implement in Matlab the price development of a ATM-Call-Option (European). Has someone an idea how to combine ...
SinusK's user avatar
  • 33
1 vote
0 answers
35 views

Trading Platform APIs which support editing holdings

I am developing a tool to assist human traders using a trading platform. For testing, I was wondering if anyone was aware of any trading platforms which support editing the holdings of a paper account....
kyryx's user avatar
  • 111
1 vote
0 answers
66 views

Trouble calculating the Dow Jones Industrial Average

I can successfully calculate the Dow Jones closing price by taking the sum of closing prices of the 30 component companies. However, using this same method, I'm unable to calculate the correct opening ...
Rez99's user avatar
  • 111
1 vote
0 answers
339 views

Mean Variance Optimization of 2000 pairs of securities (Python)

I would like to take the opportunity to ask for your help on an assignment I'm trying to complete. For this 'Modern Robo Advisory' course we are asked to solve a (target) goal-based investment ...
Mehdi's user avatar
  • 31
1 vote
0 answers
193 views

How to debug Example_1 of the Open Risk Engine (ORE) library?

Following the manual, I have built an Open Risk Engine library and I would like to learn the library by modifying examples that come together with the library. Question: How to run, for instance, <...
gencho's user avatar
  • 23
1 vote
0 answers
486 views

QuantLib in Python, are there any existing methods to handle the options delta on expiration day?

Tried [ql.Settings.instance().includeReferenceDateEvents = True] and it works for the calculation of NPV using intrinsic value of the option. But Delta is nan for an in-the-money option. I understand ...
Rayzola's user avatar
  • 11
1 vote
0 answers
296 views

Open Source library for calculating exposures?

I would like to know an open source quantitative library/ies that can calculate exposures out of the box (I have investigated a bit on OpenGamma/Strata libraries with no luck and the website of ...
gencho's user avatar
  • 23
1 vote
0 answers
795 views

bloomberg api: how to handle the max 1000 requests limit

I am using the Bloomberg API in R (package Rblpapi) to find the nearby price at elevator locations for Soybean/Corn in given states in the US. I use the function lookupSecurity: ...
Matifou's user avatar
  • 141
1 vote
0 answers
47 views

Transform 24hr cumulative volume to sampled periods

I have a Python Dataframe with cryptocurrency data that has three columns: time, 24hr volume and price. The time is the time at which the data was received from the exchange, price is the last price ...
Mustard Tiger's user avatar

1
3 4
5
6 7
9