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.

433 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1 vote
0 answers
155 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
  • 129
1 vote
0 answers
127 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,209
1 vote
0 answers
79 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
173 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
363 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
115 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
110 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
494 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
272 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
  • 113
1 vote
0 answers
73 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
  • 113
1 vote
0 answers
71 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
  • 357
1 vote
0 answers
192 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
72 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
274 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
606 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
726 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
241 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
130 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
107 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
242 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
  • 13
1 vote
0 answers
209 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
205 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
43 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
445 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
729 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
208 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
154 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
309 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
104 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
68 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,611
1 vote
0 answers
37 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
179 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
34 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
61 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
332 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
165 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
463 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
274 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
735 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
46 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 vote
0 answers
158 views

Equivalent of Force Indicator Within Ta-lib

Is there any equivalent of the Force indicator (http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:force_index) within the talib library? (...
user66893's user avatar
1 vote
0 answers
68 views

Market Profiling open source packages or tools

after reading the book Mind Over Market by Dalton I was wondering if there are any open source packages for Market Profiling (the technique developed by J. Peter Steidlmayer for representing price ...
Carol.Kar's user avatar
  • 482
1 vote
1 answer
186 views

Force Index EMA calculation for stock indicator

I am trying to smooth a 13 period EMA Elder Force Index in c++, and nobody really describes this as anything more than : ...
PushT's user avatar
  • 11
1 vote
0 answers
144 views

Should I interpolate before or after to find option price using Vanna-Volga method?

I am trying to calculate the implied option premium $C(K)$ and $\Delta$ using the procedure outlined by Castagna and Mercurio in this paper - http://www.fabiomercurio.it/consistentfxsmile.pdf My ...
Conrad Addo's user avatar
1 vote
0 answers
118 views

Long Term investment in leveraged ETFs not necessarily bad?

I have conducted very much research about leveraged ETFs lately. Most sources specifically say that these instruments are not meant for long-term investments and that they are very risky due to the ...
A.Pz's user avatar
  • 83
1 vote
0 answers
424 views

How to calculate mean reversion values for Hull White tree calibration on MATLAB?

As part of a time series analysis, I'm writing a MATLAB program to create a Hull White tree, for the purpose of pricing a coupon-bearing bond. While using the function hwvolspec (volatility ...
reed1707's user avatar
1 vote
0 answers
76 views

Binary or Multiclass Classification?

So I've been using ensemble methods to model stock price movement, using intraday per-minute data in the OHLCV format, with the prediction being a 1 if the future close goes up, and 0 if it goes down. ...
Hassan Sabree's user avatar
1 vote
0 answers
245 views

CRRA utility application

I fitted a CRRA utility function to daily S&P 500 returns in R. (As for instance in Optimal Option Portfolio Strategies, page 10) ...
Felix Dietrich's user avatar

1
3 4
5
6 7
9