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
1
vote
2answers
49 views

Converting time bars to tick bars or volume bars in python

Recently I've started reading Advances in Financial Machine Learning by Marcos Lopez de Prado. In the second chapter the author defines some essencial financial data structures, like tick bars, volume ...
0
votes
0answers
18 views

R Portfolioanalytics - How to calcuate the objective measures for a given portfolio weights

I am trying to calculate the objective measure i.e return and std dev for a given set of portfolio weights using PortfolioAnalytics package. i am able to set the weights of the assets in the portfolio ...
1
vote
0answers
36 views

Looking for references on reinforcement learning in finance

I plan on using reinforcement learning for a research project. To be specific, I plan to define learning environments using market microstructure models whose solutions are well known and see if I can ...
0
votes
2answers
60 views

How to calculate 5 EMA

I am trying to understand the basics of finance indicators. I have made 15 minute ohlc candles for the past 50 days. Now if I try to calculate 5EMA, my doubt is ...
0
votes
2answers
52 views

Wha't the best place to grab historical sophisticated data about stocks?

I am looking for an API which allow me to grab a data about companies & their stocks in the historical perspective. Like not only prices, but let's say balance sheets & cashflow statements ...
0
votes
0answers
21 views

Quantlib-SWIG Python: impliedHazardRate requires “warm” discountcurve

I am getting different results from the CreditDefaultSwap().impliedHazardRate() method, depending on whether the discount curve passed is "cold" i.e. just created ...
0
votes
2answers
32 views

Value a Swap with Custom Coupons with QuantLib

I'd like to valuate a custom Libor3M - Fix swap with QuantLib in Python. With custom I mean, custom starting/end/payment dates for every coupon, a fixed coupon in the float leg (starting_date < ...
0
votes
0answers
16 views

Swaptions vols,object using quantlib xl

How can I build a good vol surface using QuantlibXl? My goal is to price a swaption 5 year with option maturity 1Y1M. The data are:
0
votes
1answer
15 views

Valuating Custom Amortization Schedule Libor IRS with QuantLib

I got to bootstrap the OIS and Libor 3M swap curves, and now I'd like to valuate some simple Libor3M - Fix IRS with QuantLib (in python). My problem is that some of the instruments I have to valuate ...
0
votes
1answer
14 views

Which object in DateGeneration object when there are two short, long or combination in Schedule object for py QuantLib?

I'm pricing a vanilla swap. I have two stubs, front and back, and they can be short, long or a combination. In this case, what do I use in ql.Schedule object for <...
0
votes
0answers
13 views

Financial models under the defprobstrip() command in Matlab 2020a

what is the financial theoretical model below - defprobstrip() - hazardrates() - survprobs() contained in https://www.mathworks.com/help/fininst/examples/...
0
votes
0answers
20 views

Q-learning, state transition, immediate rewards (grid world vs. trading bot)

I've been thinking about how to correctly calculate rewards in a trading environment for several weeks now. Here is a grid example: ...
0
votes
1answer
16 views

How to make the effective date to start on a holiday/weekend in py QuantLib?

I'm trying to price a non-standard swap. However, my schedule is not returning the correct dates. In particular, the effective date starts on a Saturday but the schedule returns the next biz date ...
1
vote
1answer
41 views

How can I extract the strike price from a Quantlib option object?

I am trying to write a Python function that performs some calculations using a list of Quantlib options, and I would like to pass only that list without other information. In particular, the strike of ...
0
votes
1answer
64 views

Pricing coupon bond on weekly basis effectively

I have a coupon bond with $NV=20 000 000$ and coupon $4\% p.a.$, assumed the coupon is paid annually (I don't have this stated explicitly). Let's assume, the starting date is 27.4.2015, so the first ...
5
votes
2answers
126 views

How to get a Daily Market Cap using Python

I'm looking for a way of getting free historical daily market caps ? I can get todays Market cap from yahoo but need old market caps also.. thanks for the help. ps: I don't have Bloomberg and school ...
0
votes
0answers
34 views

API for Real-time and historical Stocks Tick Data

I am looking for a reliable API (e.g. Bloomberg, but available for individuals) where I can get stock tick data up to the minute, both historical and real-time. Obviously I am willing to pay for the ...
0
votes
2answers
120 views

Would C++'s speed over Python make it a more applicable language for scalping arbitrage opportunities?

I am using the Bittrex exchange API to ping markets to poll whether there are triangular arbitrage opportunities available for USD/BTC/LTC/USD. Note that I am not trading but rather synthesising them ...
0
votes
0answers
42 views

Double jumps stochastic volatility model (SVCJ, Duffie et al, 2000) - characteristic function for VIX

Currently I am working at my master's degree paper where I want to evaluate VIX options using stochastic volatility jump models.I got some MATLAB codes for the SVCJ model for the S&P, but as the ...
1
vote
1answer
47 views

What market conditions are attributable to prolonged instances of triangular arbitrage opportunities?

I am investigating the potential for intra-exchange triangular arbitrage opportunities for the Cryptocurrency market. I believe that due its immaturity, relatively low volume and high volatility that ...
0
votes
0answers
43 views

How to code Heston’s Square-Root Volatility Model?

I’m currently trying to code the Heston square-root volatility model with the aim to sample from its posterior with MCMC. However, I couldn't add the lagged volatility term, that is, $\sqrt{V_{t-1}}$ ...
0
votes
1answer
62 views

Compound the monthly returns to make them quarterly [closed]

How can someone make the Kenneth French library data returns quarterly from monthly? Since they are not loq returns, then you need to compound returns rather than summing them up. I want to make the ...
2
votes
1answer
129 views

Python libraries for bloomberg?

I am very new with python, and I am used to work with bloomberg formulas for excel. I am starting to use a lot more python in my analysis, is there any library that performs same functions as bdp, bdh ...
0
votes
1answer
79 views

Monotonic Cubic Spline interpolation QuantLib python

I am new to QuantLib-Python and I am trying to replicate the implementation of a Dual Curve bootstrap using QuantLib-Python. I have followed the steps in Chapter 9 of the QuantLib Python Cookbook. ...
1
vote
1answer
48 views

Broker that allows algo trading, no pdt rule and a low minimum deposit

I was looking for a broker that offers these things: ...
1
vote
1answer
59 views

How to propertly change time horizon in Avellaneda-Stoikov model?

Im working in the Avellaneda-Stoikov implementation usign python. My implementation reproduces the authors results, but I dont know how to propertly adapt the algorithm in order to consider a larger ...
0
votes
1answer
54 views

Download historical index data, like SP500, using Python. History going back to at least 1960, if not further back

I want to download historical data for different indices. I am using Python for this. I used the following code. ...
0
votes
0answers
24 views

Obtaining 1 minute historical options quotes from Ameritrade API?

I'd like to track historical call option pricing data from any given day on the 1-minute for a symbol like SPY that are always ITM using Ameritrade. I've been unsuccessful so far, and it seems they ...
1
vote
0answers
23 views

Maximum Sharpe ratio portfolio - derivation

I want mathematical derivation of how to construct maximum Sharpe ratio portfolio. Any resources with mathematical derivation (if its implemented in Python, that will be great) will be useful
0
votes
0answers
28 views

Pricing options by IFT under the Heston and Nandi (2000) model: odd behavior

I am working on option pricing using GARCH models and, currently, I am coding the pricing of options under the Heston and Nandi (2000) model. This model admits a quasi analytical formula for pricing ...
1
vote
1answer
51 views

QuantLib 1.17 C++ does not contain some YieldTermStructure classes while QuantLib-Swig contains

I want to port some QuantLib-Swig dependent code written in Python to C++ with QuanLib-1.17. However some YieldTermStructure classes (PiecewiseLogCubicDiscount, PiecewiseLinearZero and ...
2
votes
2answers
98 views

Build autocorrelation matrix in Python

I am interested to build the following matrices in Python $B_{tt'} = e^{−|t − t'|/\tau }$ and $B_{tt'} = b^{|t−t'|}$, where $t,t' = 1, 2, \ldots , T$ for some fixed $T$, $|b| < 1$, and $\tau > 0$...
1
vote
1answer
45 views

Calculating returns with trading costs

This perhaps is an over simplification of calculating trading returns while including trading costs. I've made some assumptions - the commission for investing and extracting an investment is 1% and 2% ...
0
votes
0answers
28 views

QuantConnect Strategy Metrics

I am new here and trying to write new strategies. I am a good computer engineering student working on robotics now, but I want to see the opportunities(money) in the financial fields. Currently, I am ...
0
votes
1answer
51 views

How to get all the paths of a binomial tree

I'm trying to implement a pricing method for exotic options based on binomial tree's. The problem i'm having is that i'm not being able to generate all the paths of the tree. I have the following code ...
0
votes
2answers
114 views

Python Monte-Carlo Convergence

Edited to include VBA code for comparison Also, we know the analytical value of the simple Call option, which is 8.021, towards which the Monte-Carlo should converge, which makes the comparison ...
4
votes
3answers
153 views

Advice on learning C++ and its integration with Python/R/MATLAB for quantitative finance

For some background information, I am a PhD student in economics. Although I did not study in finance previously, I took a course on stochastic calculus and a course on asset pricing in incomplete ...
0
votes
0answers
14 views

Python Panel Data Regression for OUP Calibration

I have a model for predicting stock returns that classifies stocks as overbought or oversold, kind of like an RSI. It follows an OUP and I am curious about my $\mu$, $\sigma$, and $\kappa$ parameters, ...
0
votes
1answer
16 views

Suggestions for choosing an optimization algorithm for fitting custom GARCH models by QMLE in R?

I am trying to fit a custom GARCH model by QMLE in R. I have written out the log likelihood function and am now working on optimizing it. However, choosing an optimization algorithm has proven to be ...
0
votes
0answers
23 views

Machine-learning (python) non-parametric continuous variables and output

There are various machine-learning techniques available, of which I know there is the (K) NN -> nearest neighbour. However, it seems most non-parametric ML techniques need the input and output to be '...
1
vote
1answer
41 views

Determine the error term of SKEW-calculation

I am trying to recreate the CBOE's SKEW Index in Python. I need to calculate the errors terms that are adjustment terms for the differences between the atm strike ...
2
votes
3answers
136 views

Why is C/C++ used by researchers to develop and test algorithmic trading strategies?

I understand why compiled languages such as C/C++ are important for low-latency trading infrastructure. But I am curious why even researchers at the high-frequency trading firms also require a strong ...
1
vote
1answer
31 views

What value to put in lm() function when testing for cointegration (R)

I'm a CS student working on a financial computing project + have a question regarding cointegration testing using linear regression with the lm() function. https://www.rdocumentation.org/packages/...
0
votes
1answer
57 views

How Can I Use Python and Data Science in my Personal Trading? [closed]

I started learning about the stock market during the Pandemic. I don't necessarily think to be a quant but I'd like to atleast use my skills in programming in python, data visualization, (i don't ...
0
votes
0answers
27 views

calculating sharpe-ratio and annualized returns

Im trying to get the sharpe ratio to be calculated daily but I can only calculate it annually, this is also happening for my annualized returns, can somebody help me please? ...
0
votes
0answers
50 views

USING HIDDEN MARKOV MODEL TO DETECT MARKET REGIMES IN R

How can I use a hidden Markov model to detect different regimes within AAPL's returns using the R programming language . If anyone can point me to any papers or links which can help me out that would ...
0
votes
1answer
63 views

R - Portfolio construction based on own calculations, with rebalancing of components

I have used random forest in R to get probabilities for stocks being in a certain class. With those probabilities i would like to construct portfolios containing the 5 stocks with the highest ...
0
votes
0answers
24 views

Extract Accrued Interest in R using Bdlpapi package

I want to extract the accrrued interest of a bond in R using Rblpapi package, so my function is: bdp(securities = "CA135087D507@BGN Corp",fields = "INT_ACC", "SETTLE_DT=20200413") but this error is ...
0
votes
0answers
15 views

Introducing initial lockout period for American-Asian options pricing in R

Currently attempting to price American-Bermuda-Asian call options using Monte Carlo simulations as done in Longstaff and Schwartz (2001). The options have an initial lockout period of 3 months, ...

1
2 3 4 5
26