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

best method for calculating dynamic hedge ratio between pairs?

I am relatively new to quantitative finance, and I would like to clarify something regarding the hedge ratio used in calculating the spread between the pair. using python Say I have time series <...
0
votes
0answers
11 views

Theta function in the Black Karasinski model to replicate the current yield curve?

I am trying to replicate a research paper "Gas Storage valuation using a Monte Carlo method" Gas storage valuation using a monte carlo method which is to me a not very complex but technical ...
0
votes
1answer
22 views

Pricing Compound Options using QuantLib

I am trying to price Compound Options using QuantLib on Python. I've looked around but am unable to find any sample code. I believe that the CompoundOption Class ...
0
votes
0answers
17 views

What are the API to get the key statistics (sales, dividends, earnings …) for any company on any tradable stock markets?

I am looking for an API that would help me do the analysis Graham provides for most Stock markets of the world in order to know which are the eligible stocks. So far I am doing it by hand with ...
0
votes
0answers
21 views

Correct labelling for trading strategies

In trying to build a ML powered trading strategy, one of the most important tasks is to correctly label the data so that the results of whatever classification algo you are using will be properly ...
0
votes
0answers
17 views

Why does real time tick data have to go through a Dataprovider to Business/Consumer?

So the data-flow for real-time tick data as I know it is from Exchange --to-- Dataprovider --to-- Business/consumer; but I want to understand why that dataprovider is necessary? I am full of fair ...
1
vote
1answer
58 views

How do I create a term structure of a bond using QuantLib?

Has anyone used QuantLib to create term structure (i.e bootstrapping process to produce spots) in python? I have been using the below example http://gouthamanbalaraman.com/blog/quantlib-term-structure-...
0
votes
0answers
17 views

Heston volatility surface in Python QuantLib

Does anyone have experience with the Python QuantLib function HestonBlackVolSurface? I'm trying to produce a 3D plot of the volatility surface as done in the ...
1
vote
0answers
31 views

What is a call-spread and its formula?

I am attempting Mark Joshi's The Concepts and Practice of Mathematical Finance. In B.3 Project 1: Vanilla options in a Black-Scholes world, he asked the following question. We need to be sure that ...
2
votes
1answer
29 views

Pricing options using the IG component GARCH model of BCHJ(2018)

Babaoglu, Christoffersen, Heston and Jacobs (2018) introduced a component GARCH model with inverse Gaussian innovations and an exponentially quadratic pricing kernel back in 2018. The article shouldn'...
0
votes
0answers
27 views

Can someone show me an example of retrieving ticker data by the minute in python?

Can someone show me an example of retrieving ticker data by the minute in python? I am new to python and trying to retrieve stock data by the minute for a stock. Id
0
votes
0answers
28 views

Quantlib : How does interpolation technique in zero curve improve the valuation of interest rate swaps?

I am working on building zero curve using interpolation = ql.Linear(). I know that this method is very popular to build short and long end curve. But am wondering if there is any another way of ...
0
votes
0answers
37 views

Two- (multi) dimensional geometric Brownian Motion

I am trying to calculate the value of a Basket Option with two stocks and the following information: S1 = 100, S2 = 120, r = 0.06 L = Volatilitymatrix = ((0.3, 0.1), (0.0, 0.2)), weight of Stock 1 = 1/...
0
votes
0answers
26 views

Discretizing Bates SVJ Model to simulate paths

I am trying to simulate a path for Bates Stochastic-Volatility-Jump model. It has the following dynamics: I've managed to implement the Heston model by following Gatheral's books the Volatility ...
2
votes
1answer
77 views

R: Finding peaks on a stock price chart

I would like to do is what I thought to be a simple task: find the locations of peaks for a certain stock, and mark those peaks on a chart. I was surprised by a lack of appropriate examples on the ...
3
votes
1answer
70 views

Quantlib - exercise probability function?

I am using Quantlib to obtain the option value embedded in a convertible bond. I create an american option as follows: ...
1
vote
0answers
37 views

GARCH(1,1)-M MLE optimization with fmincon in R

I've searched thru dozens of papers and did not find in any of them satisfying and enough theoretical answers to my concerns. So I've combined everything what I found below. Please indicate if my ...
0
votes
0answers
26 views

Evaluating Markov switching garch models with R

Hello I have been working on a Markov switching GARCH model my intention is to use it to trade options volatility . I have created a Markov switching garch model using the MSGARCH package in R and in ...
1
vote
1answer
25 views

QuantLib : How to get the 'last' and 'next' cash flow date and amount from the date of valuation in plain vanilla interest rate swap in Python?

Do we have any direct method to get the 'last' and 'next' cash flow date and amount from the date of valuation in Quantlib Python using fixed leg amt or floating leg amt, day counter,valuation date , ...
0
votes
1answer
42 views

Is there something for API trading in E-mini S&P 500 Futures or other futures

I found a lot of results about data feeds, and I found some platforms (like Alpaca) for API trading. But none seem to have the possibility to sell/buy futures via a REST API. So my question is: Who ...
0
votes
2answers
87 views

Calculate intermediate highs and lows given a minimum price movement threshold

I'm looking to get the high and low reversals/pivots in a price series given a minimum price movement threshold and wondering if there are any existing python libraries that can do this. Essentially, ...
0
votes
0answers
27 views

R-Help..Question regarding working day Frequency in Time series

I have a data where there are observations based on working days in a year. The working days are not same in each year. These are 248 (say in 2018) observations in first year and then may be 246 ...
0
votes
1answer
66 views

Orderbook db structure

I am currently saving a sub 1 sec snapshot of an orderbook to my SQL db. However I have quite the trouble on figuring out the architecture of this DB What I'm currently doing is saving a table with ...
0
votes
0answers
20 views

TFX(R Interface to the TrueFX) does not work properly

There's an R package for retrieving FX rates from TrueFX in the Cran but it does not work properly. In the tutorial here, it is said that the following will return the prices as shown below. But ...
0
votes
1answer
74 views

Python Quantlib : How to value the Non Deliverable currency Interest Rate Swaps?

I followed all the procedure in Quantlib to process interest rate swap valuation through Python Quantlib. I valued more than a million records. All the valuation is almost the expected amount. But '...
0
votes
1answer
58 views

QuantLib Error “=negative probability”

I am trying to calculate the price of an american option. The code works fine for some options but for an deep out of the money call, I get the above error. Below is my code that I am trying to run. ...
0
votes
0answers
109 views

Pnl Explanation using R (blotter)

I have a portfolio of stocks based on a proprietary strategy. I would like to explain the Pnl over a period, for example I would like to find the pnl contribution of each name of the period. Is there ...
0
votes
1answer
113 views

How to extract standard deviation from normal distribution in R

If I have some point forecast and an 80% confidence interval, with the forecast assumed to be normally distributed with a constant variance, how do I extract the actual variance? Let us work with the ...
0
votes
0answers
25 views

How to obtain tangency portfolio of the resampled efficient frontier in MATLAB?

I have generated the resampled frontier according to Michaud's approach. In order to compare it with the classical mean variance approach I want to invest in the respective tangency portfolios. While ...
1
vote
1answer
143 views

QuantLib returns slightly different bondYield when backtested

I am just starting to get familiar with QuantLib (in particular, fixed rate bond pricing functions). I read a number of examples, from which I am able to calculate bond price and bond yield. The ...
0
votes
0answers
43 views

Quantlib - Duration of a Floating Rate Bond with Spread

I've used Luigi Ballabio's workaround to calculate the duration/modified duration of a floating rate bond (which you can find here: https://www.youtube.com/watch?v=r_1wSd0hnN4). However, if I add a ...
1
vote
1answer
66 views
-4
votes
1answer
81 views

Why I can't append a string to a empty list? [closed]

Why I can't append a string to a empty list in Python? For example: lista_arg= list() arg="Nome" lista_arg= lista_arg.append(arg) I get this error: ...
0
votes
1answer
77 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
24 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
76 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
82 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
87 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
37 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
87 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: $$...
2
votes
0answers
133 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
48 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
82 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
37 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
45 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
37 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 ...
1
vote
1answer
56 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
82 views

Mean-reverting backtest between index and components [closed]

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
115 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
2 3 4 5
25