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
21 views

Numerical simulation of Bates model (Monte Carlo)

I'm trying to build Bates model in Python! $$dS_{t} = \mu S_{t} dt + \sqrt{V_{t}}S_{t}dW_{t}^{1} + J_{t}dQ_{t}$$ $$dV_{t} = \kappa(\theta - V{t})dt + \eta \sqrt{V_{t}}dW_{t}^{2}$$ $$dW_{t}^{1}dW_{t}^{...
0
votes
0answers
12 views

Python Quantlib : How to deal with RuntimeError 'addFixing(date, value)'

for t_ccy in rate_dates.keys(): libor_base = ql.AUDLibor(ql.Period(3,ql.Months),ql.YieldTermStructureHandle(term_structure[t_ccy])) libor_up = ql.AUDLibor(ql.Period(3,ql.Months),ql....
1
vote
0answers
35 views

Understanding Ornstein Uhlenbeck Parameters

I am trying to fit an O-U process to a discrete time series (log prices). I am calculating the reversion rate and the mean level from coefficient of the linear regression between the log prices and ...
0
votes
0answers
23 views

Free resource to pull historical market cap data in Python? [duplicate]

I am trying to replicate the Russell 1000 with the top 25 stocks using a capitalization weighted method. I can pull historical price data from pandas(yahoo or quandl) with no problems. I need to pull ...
1
vote
1answer
33 views

Forecasting Volatility using GARCH in Python - Arch Package

Disclaimer: Posted this on stackoverflow, but maybe here should be the right place to ask something about GARCH I'm testing ARCH package to forecast the Variance (Standard Deviation) of two series ...
0
votes
0answers
44 views

Simulation of Heston process Quantlib-Python

I am wondering weather there exists some method such that one can simulate sample paths for the Heston model in Quantlib-Python. I am currently working on a project that require simulations with the ...
0
votes
0answers
33 views

Help with R normalization function [closed]

after reading the paper "Custom v. standardized risk models" (Kakushadze, Zura; Liew, Jim Kyung-Soo (2015)) I tried to understand the R functions they provided at the end (eg: Appendix A) and the very ...
0
votes
0answers
30 views

Finding stock symbols for alpha vantage api

So i just made my first program in Python wich reads stock symbols in excel. I tried going to "data" in excel and importing a text file with symbols and company names and some other stuff as well but ...
0
votes
0answers
33 views

Macro momentum analysis

I am conducting macro momentum analysis. In this, first I rank countries based on each macroeconomic indicator such as GDP, inflation, monetary policy etc. After this according to each indicator rank, ...
0
votes
1answer
79 views

Simulation Heston Model, markovianity

I am trying to simulate the instanteneous volatility of a Heston process. My equations are the following : wealth process: $$dX_t = r_t X_t + \theta \sqrt {V_t} u_t dt + u_t dW_{1t}$$ Volatility: $$...
0
votes
1answer
70 views

Simulating correlated Stock Prices python

has anyone tried simulating correlated stock prices via a geometric Brownian motion? I have done it in python but I have no idea if my code is correct since I can't compare it to anything. I would ...
2
votes
0answers
125 views

Pricing American Options by Neural Networks

Has anyone read the paper 'Pricing of High-Dimensional American Options by Neural Networks' by M. Kohler et al. (2010) and tried to program the proposed method in Python? I have been trying that for ...
0
votes
0answers
40 views

How to estimate the parameters of vasicek modle in R or Excel?

Thank you in advance. I use the yield to maturity of 2year, 3year, 5year and 7year japan government bond from 1989-2019 as my data (i.e. the name of my data is ...
0
votes
1answer
65 views

Optimization with turnover constraint

I am optimizing using scipy.optimize using SLSQP. I am looking to minimize the variance with some upper bounds and lower bounds on each stock. I am also looking to constraint the weight so that the ...
0
votes
1answer
19 views

Why does changing the evaluationDate multiple times lead to a performance lag?

I am simulating an swaption strategy through time. Following the examples in the Python Quantlib cookbook, as I progress through time I am updating the internal evaluation date ...
0
votes
1answer
40 views

Creating a matrix of average correlations for sub-industry from individual stock correlation matrix

I am having trouble trying to figure out how to do this in Python. I have created it in Excel, but I would like to automate this for any sector or grouping of sub-industries. I first start with ...
1
vote
0answers
32 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 ...
0
votes
0answers
24 views

Appropriate Encoding for Stock Technical Indicators ? RSI

happy new year and i am new to machine learning + python.. so recently i am doing a project on my own to use machine learning models on technical indicators.. I have my technical indicators data ...
1
vote
1answer
75 views

Mean-reverting backtest between index and components

I am a beginner with ETF replication: I have to make a code to make the value of my assets go back to the average of the index Eurostoxx 50 with a subset of components. I am not sure how to implement ...
3
votes
2answers
109 views

Sending market order via FIX using R

I built a strategy in R and I would like to send the orders directly to a broker, instead of creating a CSV file that would be emailed later on. I was told to use FIX protocole, but I so far do not ...
1
vote
1answer
73 views

Question regarding fitting Euribor curve using different basis quotes using Quantlib Python

I am trying to fit a EUR curve based on the following instruments:- EONIA quotes 1m vs 6m basis quotes 3m (outright) quotes 6m (outright) quotes 6m vs 12m quotes (1) , (3) & (4) are simply ...
2
votes
0answers
35 views

Where could I get European non-dividend option data

I am pretty new to option pricing. I got a task asking me to price a stock option, which should be an European non-dividend option, and compare my price to its quote. I used to use TSLA data ...
0
votes
1answer
39 views

Drawing values from a lognormal distribution of a GBM

I'm looking at a GBM with parameters $$ r=0.05 \\ \sigma=0.2 \\ K=130\\ T=0.25\\ S_0 = 100 $$ This is a process that is lognormally distributed with mean and variance given by $ \mu = S_0e^{r T+0.5\...
0
votes
3answers
177 views

What's a good resource of book for Python programming in relation to quantitative finance?

I know some of base Python, but I have only briefly used numpy, pandas, etc... I was wondering what's a good resource to learn Python specifically for quantitative finance. I know of plenty of books/...
4
votes
1answer
148 views

QuantLib Python: caplet/swaption pricing under dual curve

Is there a way to price caplets/swaptions in QuantLib python (v 1.6.2) under dual curve i.e. pass projection curve for forwards and discounting curve for discounting the cash flows? Goutham has an ...
2
votes
2answers
142 views

how to calculate implied volatility

I have some options prices I found using the Heston Model. How do I calculate the implied volatility? In Matlab there exist a blsimpv function, but is this the right tool for me since I'm working with ...
1
vote
0answers
44 views

Simulate option prices [closed]

Starting value = 3110.29 K = 3100 Trading days = 20 Need to simulate the price of an option by using these 2 methods. ( For homoscedastic errors ). *This is what I have already set up <...
0
votes
0answers
68 views

Complex Event Processing Engine for traders

I have created my quant model in python and now look for a way to run it on market data. I read that CEP - complex event processing engines - are the way how to approach this problem. I am looking ...
1
vote
1answer
90 views

Simulation of Geometric Brownian Motion in R

Using R, I would like to simulate a sample path of a geometric Brownian motion using \begin{equation*} S(t) = S(0) \exp\left(\left(\mu - \frac{\sigma^{2}}{2}\right)t + \sigma B_{t}\right), \end{...
1
vote
0answers
50 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 ...
0
votes
1answer
100 views

How to validate trading strategy performance

I'm backtesting some algorithmic trading strategy based on the buy/sell signals: To validate the strategy performance I compare it against the buy-and-hold strategy of the same asset and calculate ...
2
votes
1answer
106 views

SABR Calibration

I need to generate the Volatility Surface of call options on S&P500 index, my dataset contains implied volatilities regarding various expiration dates for various strike prices. My doubt is, ...
-1
votes
1answer
49 views

Quantlib python FRA rate helper

Can i get an example of how to use quantlib python FRAratehelper? I would like to use it to get discount factors, with 3month Jibar as a reference rate.
0
votes
1answer
126 views

European Swaption Pricing Using Normal volatilities

On page 6 of this paper a forumla is given for payer swaptions, I am just wondering what is the formula for receiver? My implementation of the formula for payer and receiver is here, but I am not ...
0
votes
0answers
56 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: ...
0
votes
1answer
113 views

Basic Monte Carlo Present value calculation in R question

I'm self studying monte carlo applications with the application towards present values. However the values that I am using are of the uniform distribution variety with a pre defined minimum and ...
4
votes
2answers
189 views

Deriving implied volatility programmatically

I'm working on a project to calculate the value of options using Python. I'm using the Black-Scholes model, and I can get accurate results by plugging in a given ...
0
votes
1answer
50 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
56 views

Solving for unknowns in Black-Scholes equation using Python

I have defined the Black-Scholes equation in Python as follows: ...
2
votes
0answers
53 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 ...
1
vote
1answer
42 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 ...
1
vote
1answer
84 views

Portfolio/sub-portfolio optimization

I have a finite amount of 26 assets, the total amount of these assets needs to be allocated to 9 portfolios. Each portfolio has its own required return which needs to be met, using a min-variance ...
0
votes
1answer
143 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
1answer
67 views
1
vote
0answers
78 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
64 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
46 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
48 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
44 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 ...
0
votes
0answers
15 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. ...