Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
2answers
52 views

Imputation of missing returns

I'm trying to calculate a historical VaR for a portfolio of futures, however there are certain days for which some assets are missing prices. Since the portfolio consists of many spread positions, the ...
0
votes
0answers
20 views

Dynamically calculating credit risk concentration

I have a porfolio of mortgage loans where each loan has a number of attributes attr1, attr2, .., attrN. I would like to analyze the portfolio credit risk concentration using these attributes, but ...
0
votes
0answers
32 views

Book on credit risk modelling and R programming

I am looking for a book which explains credit risk modelling and ideally uses R. Python would be okay as well. It should cover topics such as Scorecard development ROC Curves PD, LGD, EAD estimation
1
vote
1answer
51 views

Finite difference: move forwards or backwards?

In finite differences for the black scholes method, you move backwards in time, since of course you know the prices at time $t = T$, and then you iterate until you get to time $t = 0$. However, why ...
0
votes
1answer
70 views

Bloomberg's Open Market Data Initiative

I am reading about OMDI: https://www.bloomberg.com/company/announcements/bloomberg-opens-its-data-distribution-technology/ After reading that, I am still not sure: Is it free? If so, what kind of ...
0
votes
0answers
10 views

Free API to get quarterly EBIT, total assets and current liabilities as of 2018?

I have looked at IEX v1.0 - they don't return Current Liabilities data nor EBIT data quarterly. I have looked at Intrinio - but that isn't free after 30 days. Is there any API that provides only ...
0
votes
0answers
17 views

CameronFIX Python Algos

I'm looking to now if any of you have experience loading python algorithms over CameronFix engine or could give me some orientation of how I can connect a python algo to Cameron.
1
vote
0answers
42 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 ...
3
votes
1answer
99 views

Why my implementation of CRR model does not converge?

Recall that CRR (Cox-Ross-Rubinstein) model for option pricing is the usual binomial tree model with $u$ (up-factor) and $p$ (one of the risk-neutral probabilities) defined as follows: $$u = e^{\sigma\...
0
votes
0answers
40 views

Calibrating from swaption straddle price quotes in QuantLib

I'm calibrating a short-rate model in QuantLib, and need to work with ATM swaption straddle price quotes. From reading Luigi Ballabio's highly instructive and entertaining Implementing QuantLib I ...
0
votes
0answers
27 views

Simulation VaR and CVar assuming Normal Distribution

Am I missing something? Currently implementing a VaR and CVaR measure assuming normality of wealth value. after executing the following script, VaR is always greater than CVaR, as expected, but ...
0
votes
0answers
44 views

How to interpret and store Level 1 stream data

I am very new to market data. Currently I am collecting top level 1 market data through the interactive brokers api by subscribing to a few tickers. I wanted to understand how to interpret the data. ...
0
votes
0answers
29 views

How to create a sample and hold signal in R

I would like to create a sample and hold signal (a flag) in R from a (financial) time series objekt. Like the sample and hold function in Matlab. The Sample and Hold block acquires the input at the ...
1
vote
0answers
27 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. ...
0
votes
0answers
77 views

How to fit Threshold Garch (TGARCH) with R and interpret the summary output?

Can somebody please provide an example of fitting a Threshold GARCH (TGARCH) model to stock log returns data with R and interpreting the summary output in terms of finding the best fit TGARCH model ...
0
votes
0answers
16 views

chartSeries {quantmod}: How to change the color of bars for Volume

I'm using the following code to extract a symbol and drawing line chart for closing price and bar chart for volume. ...
0
votes
1answer
62 views

Dealing with weekends/gaps in financial data

My script takes some data from IEX and then outputs a pandas dataframe: ...
2
votes
0answers
30 views

IBrokers: How to assign trail amount for order type 'TRAIL'?

I'm using R package IBrokers with IB TWS. I'm trying to create a twsOrder object using twsOrder function: twsOrder(...., orderType = 'TRAIL', ...) How can I ...
0
votes
0answers
46 views

How to fit and test VaR in R

I have estimated the below model with gjr-garch11 ...
5
votes
2answers
145 views

Create Tick Bars with R

How do I get OHLC bars with tick count (i.e. 500 ticks) instead of time? I prefer quantmod. Currently I have tick data and can already convert to minute bars using xts. ...
2
votes
1answer
307 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
0answers
29 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) ...
2
votes
1answer
3k views

Did Google Finance API Go Away or Just Change Signature? [closed]

I have been using Google finance for many months to pull intraday and daily data. Today I tried to use it and got redirected. For example, the following URIs returned text data that could be parsed: ...
-1
votes
1answer
592 views

Choosing programming language for the next generation of a pricing library [closed]

If I were to start development of a pricing library, which programming language would be most suitable to satisfy the following needs: Implement highly parallelizable pricing models using GPU or any ...
0
votes
0answers
75 views

How can I calculate Asian Option value when the averaging interval starts in the future?

So, actually the question is very straightforward. Say, at 01-Aug-2018 I bought an Asian Option with maturity at 01-Nov-2020. Averaging period is between 01-Aug-2020 - 01-Nov-2020. I would like to use ...
1
vote
0answers
35 views

Generating Correlated Quasi Random Numbers

Hi I am trying to generate correlated quasi random numbers using a sobol sequence in matlab. My Problem is the Following: Using "standard" random numbers it is easy to generate the 6 correlated random ...
0
votes
0answers
59 views

Bubble detection: R package MultipleBubbles

I would like to use the R package "MultipleBubbles" with different variations of the ADF test (augmented Dickey-Fuller test). These methods should facilitate the detection of financial bubbles. For ...
0
votes
1answer
108 views

Interpretation of PCA for commodity futures

I've done some PCA analysis of a portfolio consisting of futures on certain commodities. However, I am unsure of how to interpret the output as most of the information found online deals with fixed ...
5
votes
1answer
116 views

OpenGamma's Strata - Computational Overhead

I've been looking at the open-source library Strata (maintained by OpenGamma), which is written in Java. Now, upon inspection of the FX Forward Pricer and Payment Pricer I noticed two things: All ...
2
votes
1answer
30 views

Deriving the long-horizon predictive regression and hypothesis testing

I am working on the long-horizon regression, $$y_{t,K}=\mu+\beta_1x_{1,t-1}+...+\beta_nx_{n,t-1}+e_{t} $$, where $$y_{t,K}=y_{t}+y_{t+1}+...+y_{t+K-1}$$ and there can be multiple x's. So I am ...
4
votes
0answers
91 views

Implementing Hanson`s LMSR with Limit Orderbooks

I am trying to integrate Hanson's LMSR (see (see logarithmic market scoring rule)into an order-book with traditional bid/ask-limit orders (in KDB+/Q). The following functions define the basic LMSR ...
0
votes
0answers
41 views

Why the spread is calculated on raw prices instead on the price changes?

I'm reading *Quantitative Trading With R * written by Harry Georgakopoulos. In chapter 6 he exposes a basic quantitative strategy based on setting up a stock spread and buy when it is below a lower ...
3
votes
0answers
84 views

Simulation of a DCC-GARCH

I want to simulate some exchange rates with a DCC GARCH. I know the package rmgarch but I want to code the simulation my self. The following are the main equations ...
0
votes
0answers
74 views

Gonzalo Granger and Hasbrouck Information Share

I am trying to implement the two methods for price discovery following this paper Price Discovery in CDS and Bond Markets. I allready looked for implementation and based my work on this R project ...
0
votes
0answers
78 views

Calculate monthly returns for a QUARTERLY and YEARLY rebalanced portfolio in R

I built a minimum variance, equal weight, inverse volatility, and equal risk contribution portfolios based on the same data set of monthly returns for 30 different companies. The covariance matrix is ...
2
votes
1answer
77 views

How to use Kelly Criterion to place an order in financial market

I tried to write a real-time trading system, however do not know how to fit a Kelly model into the system. The system will automatically calculate everyday 12AM while I want to add another function ...
0
votes
0answers
193 views

Finding ETF Symbols for alpha vantange

I'd like to use the api of https://www.alphavantage.co/ which is pretty well documented, in terms of avaliable functions (but not parameters). However, in order to get an API response, one needs to ...
0
votes
0answers
46 views

Quantlib : How to get fixed leg NPV?

for my project using Quantlib 1.13 C++, I have to create a swap by creating each leg separately. So for instance in the case of a Vanilla swap, I have a Leg corresponding to a vector of ...
0
votes
0answers
27 views

BBands problem in quantstrat

I am currently trying to write a simple strategy using Bollinger Bands in R. The goal is to enter a long position when the closing price touches the lower band and ...
0
votes
0answers
27 views

Understanding QuantLib qlYieldTSForwardRate

I'm trying to understand the QuantLibXL function qlYieldTSForwardRate() but the QuantLib manual is not of much help so I'm hoping to find answers here. I think I ...
0
votes
1answer
221 views

Automatically get iShares ETF holdings

I heard that ETF's must publicly report their holdings all the time. I have seen that for example on the iShares website I can download the list of holdings as a csv file: https://www.ishares.com/us/...
2
votes
1answer
109 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
1answer
246 views

Programmatically detect RSI divergence

How can I programmatically detect bullish and bearish RSI divergences? A bullish divergence occurs when the underlying security makes a lower low and RSI forms a higher low. RSI does not confirm the ...
0
votes
0answers
21 views

How to interpret constant in a fixed effect panel data regression when using Stata

Dear Stackexchange community, I am running a panel data regression on 20 years of monthly historical excess returns of the stocks in the S&P 500 at 31/12/2017. I like to test the effectiveness of ...
1
vote
0answers
32 views

List of long-Term Support & Resistance in forex or stocks [duplicate]

I'm looking for a study of historic long-Term Support & Resistance in forex or stocks. If possible with their level of strength (strong, medium...). Example ...
1
vote
1answer
54 views

GBM in R giving negative numbers?

I was under the impression that simulations involving geometric brownian motion are not supposed to yield negative numbers. However, I was trying the following Monte Carlo simulation in R for a GBM, ...
2
votes
1answer
157 views

SABR PDE spot/forward upper boundary condition implementation

When running my Finite Difference code, I observe something odd. Although implementing a classical (non-reverting) SABR model, I initialized the variables such that it should be equal to Black-...
1
vote
0answers
46 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 ...
0
votes
0answers
27 views

Is there a good back-test library for Matlab, similar to Quantopian's Zipline for Python?

If so, what? I'm keen to back-test some currency trading strategies and am restricted to using only Matlab. The back-test is intended to contain forward contracts for which I only have monthly data.
1
vote
1answer
119 views

Unable to obtain correct Finite Difference Results

A rather general question regarding a specific problem I am facing with my Matlab implementation of the implicit FD method for this PDE: \begin{equation} \frac{\sigma_s^2}{2}\frac{\partial^2 V}{\...