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
0answers
17 views

Interactive brokers historical data availability

I'm considering Interactive Brokers because of the IBrokers package for R. On this site there is a small section on data availability and I'm having a hard time understanding the table. Lets say I ...
1
vote
0answers
55 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 ...
0
votes
1answer
31 views

Calculate New Portfolio Weights Given Today's Returns

I'm looking for a formula to recalculate my portfolio's weights at the end of time $T$ given a vector of the asset weights at $T$, and a vector of returns at $T$ For example: weights = 0.2, 0.3, 0.5 ...
-1
votes
0answers
44 views

Euler scheme to simulate trajectories + Python Code

Question: Euler scheme to simulate trajectories of S + Python code to get independent trajectories of S? For solving a problem I have the following assumptions: stochastic basis (Ω,FT,(Ft)t≥0,P) ...
2
votes
1answer
59 views

Merton's Jump diffusion model: Specify poisson rate

Currently applying the Merton's jump diffusion to test how Option price change as parameters change. However, I am struggling to specify the poisson rate $\lambda$. We know that: $P(\text{There is a ...
-2
votes
1answer
72 views

Is R suited for a Quantitative Finance executable application

I wonder if a R-Shiny application works well for a production environment or the only option is C++. I make this question taking in account that R and C++ have a widely set of quant libraries that ...
1
vote
1answer
33 views

Properties of an itraxx index

I am working on maintaining the market data of itraxx indexes in our systems and I have the following questions. can someone clarify? 1.What events prompt change in series and version of an itraxx ...
1
vote
2answers
96 views

Paper recommendation with examples

Could you please advise me some papers/working documents with applications mainly focused on Fixed Income/Financial Engineering (Numerical Methods) as the one in the link below? Preferably on Matlab, ...
0
votes
1answer
92 views

R: backtesting with path dependencies

I have a historical PMwR journal of trades (one for each side of position open/close) in R. I wish to backtest trade sizing algorithms, one of the inputs to which calculation will be, on-the-day ...
2
votes
2answers
76 views

Multi Period Return Table

For performance presentation a multi period (or multi horizon) table is needed. What I mean is a table showing the trailing month, quarter, YTD, and other sub periods up to since inception. So I ...
1
vote
0answers
25 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 ...
0
votes
2answers
59 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 ...
1
vote
1answer
53 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
101 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 ...
1
vote
0answers
57 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
151 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
39 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 ...
1
vote
0answers
30 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
1answer
102 views

Dealing with weekends/gaps in financial data

My script takes some data from IEX and then outputs a pandas dataframe: ...
2
votes
0answers
34 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 ...
5
votes
2answers
189 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
559 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
4k 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
610 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
86 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 ...
2
votes
0answers
57 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
1answer
130 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
139 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
116 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 ...
1
vote
1answer
65 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
105 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
131 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
101 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
96 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
576 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
56 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
30 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
32 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
300 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
126 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
551 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
26 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
74 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
170 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
49 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 ...
1
vote
1answer
121 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}{\...
0
votes
0answers
22 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....