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
5
votes
2answers
6k views

What is the best alternative of Quantlib library

We need to build a Fixed Income Portfolio Risk Analytics solution. Somehow due to administrative reason we can't use Quantlib which is written in C++, even call it through SWIG via JNI. We have tried ...
1
vote
1answer
452 views

Calibration of Theta, A(t) and B(t) of Hull White 1Factor model

I’m simulating interest rates via the HullWhite One factor model. To simulate the short rate I’m using the code from the Quantlib Python Cookbook, chapter 15 and beyond (By Goutham Balaraman and Luigi ...
2
votes
1answer
405 views

Calculate tenor wise DV01 of a Swap in Quantlib Python, i.e. Key-rate Duration

Is there a way I can get DV01 breakup of a Swap across different tenors of the deal in Quantlib-Python. The question asked here, follows the basic method of re-valuing the swap by shifting the curve ...
2
votes
1answer
70 views

Fixed rate bond pricing issue in Quantlib

I cannot retrieve the same price for a fixed bond using quantlib. ...
2
votes
1answer
128 views

Quantlib Bond PV01 by Tenor

Having built a fixed rate bond object, and looking at here and here , is there any way of retrieving the NPV impact of a repriced bond by bucket/tenor of the Spot Curve instead of getting a simple NPV ...
18
votes
6answers
50k views

How to fit ARMA+GARCH Model In R?

I am currently working on ARMA+GARCH model using R. I am looking out for example which explain step by step explanation for fitting this model in R. I have time series which is stationary and I am ...
3
votes
1answer
328 views

Best way to buy and sell large volumes of crypto

I had a few questions about how to properly execute a large order of crypto currency without moving the price much. I know a lot of funds employ a TWAP/VWAP algorithm to liquidate or purchase a large ...
0
votes
1answer
63 views

Confidence Intervals for ARMA+GARCH forecasts

I have fitted an ARMA(1,1)+GARCH(1,1) model to my logreturns series. When it comes to my standarized error's distribution however, I have opted for a Skewed Generalized Error Distribution, because of ...
3
votes
1answer
294 views

Crossing the spread as a ML signal

In the optic of high-frequency trading, most of the standard trading algorithms work on the principle of mid-price prediction or mid-price movement prediction. However a big drawback of this technique ...
0
votes
1answer
59 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
60 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
118 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
38 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 ...
17
votes
3answers
2k views

Simulating Returns

I'll start this off with a rather broad question: I am trying to simulate returns of a large number of assets within a portfolio of different classes - equity and fixed income in a first step, say 100 ...
0
votes
1answer
15 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 ...
1
vote
3answers
2k views

Predicting stock returns with GARCH in Python

I have seen this post: Correctly applying GARCH in Python which shows how to correctly apply GARCH models in Python using the arch library. Now I am wondering how I ...
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
29 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
21 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
0answers
35 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
104 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 ...
2
votes
3answers
3k views

Forex brokers with free API compatible with Node.js

I have a Forex trading signal generator written in Node.js and now I am looking for a Forex broker with a free Node.js compatible API. The requirements are simple: be able to send new trade orders ...
4
votes
1answer
966 views

How to backtest strategy in portfolio of stocks using SIT R?

I am creating and testing strategies in R code and using systemic investor toolbox(SIT) package as the backtesting tool. I copied a SIT backtesting code from a website and made small changes to make ...
2
votes
1answer
102 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, ...
0
votes
1answer
78 views

Why doesn't tenor of Euribor index change spot rate in Quantlib?

I'm trying to create a yield curve in QuantLib based on swap rates. The swap rates I'm using have a 6 months fixed frequency and a 3 month float frequency based on LIBOR. What I don't understand is ...
1
vote
1answer
55 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 ...
0
votes
3answers
170 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/...
-1
votes
1answer
41 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
0answers
4 views

ADX Graph not clear [migrated]

I have to calculate ADX for a given dataset and then plot it.The dataset consist of a 2-second candlestick of an instrument for a period of 5 days.i have verified the values of ADX from excel and it ...
4
votes
1answer
619 views

Trader Workstation on Ubuntu cannot be connected to via the API

I am using ibPy to connect to TWS on a fairly fresh ubuntu machine. I have been successful in logging into the paper trading account and submitting buy and sell orders programatically via the ibPy ...
2
votes
0answers
33 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 ...
3
votes
1answer
292 views

VAR-aDCC full ARCH and GARCH parameter matrices in R

I am working with the rmgarch package in R and I estimated a VAR-aDCC model. Is there any way to extract the extended version of estimates (allowing for volatility ...
10
votes
0answers
454 views

Block bootstrap to synthesize asset prices

I have a few basic questions on block bootstrapping on a financial time series ('TS'). Assuming my trade universe consists of 10 stocks, I would like to create a set of synthetic prices for all 10 ...
0
votes
1answer
38 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\...
1
vote
1answer
83 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 ...
4
votes
1answer
132 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
139 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 ...
8
votes
4answers
13k views

What is the difference between the Interactive Brokers demo account and a personal paper trader account?

I'm interested in testing my trading strategy using the Interactive Brokers API for Trader Workstation. A demo account is provided to play with TWS for free, but if I fund a real account I will be ...
2
votes
1answer
282 views
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 <...
-3
votes
4answers
3k views

Modified or Macauley Duration in python

are there any existing python modules that can calculate Modified and/or Macauley Duration of a bond.
0
votes
0answers
66 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 ...
4
votes
3answers
17k views

How can I calculate the Maximum Drawdown MDD in python

I need to calculate the a time dynamic Maximum Drawdown in Python. The problem is that e.g.: ( df.CLOSE_SPX.max() - df.CLOSE_SPX.min() ) / df.CLOSE_SPX.max() can'...
1
vote
1answer
84 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
49 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
96 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 ...
4
votes
1answer
561 views

Optimal Portfolio from Efficient Frontier

I found this code on plotly site, using CVXOPT to find the efficient frontier, and then, the optimal Portfolio. The optimal function is ...
1
vote
1answer
100 views

Which Maximum Diversification Approach in MATLAB is correct?

I am currently trying to find the portfolio weights of the Maximum Diversification Portfolio and found two approaches which result in different outcomes. The first one is based on this paper:https://...
3
votes
1answer
98 views

evaluating garch models

I used ugarchroll to backtest my garch model on S&P returns this is my code ...