Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use. Please mention the version that you are using when asking a question about Python.

learn more… | top users | synonyms

4
votes
1answer
208 views

Wrong discount factors when finding Nelson Siegel Svensson model parameters

I am trying to determine the parameters for the Nelson Siegel Svensson model and am solving a Non- Linear Optimization problem to do this. Some of the code I have written is below and this is where my ...
4
votes
1answer
528 views

Moving window forecasting in Python

I am looking to create some code that will out-of-sample forecast the HAR-RV model. The model itself is formulated as the following, and the betas are estimated through HAC-OLS or Newey-West. ...
2
votes
1answer
118 views

quantlib python : missing methods?

I'm reading Introduction to Selected Classes of the QuantLib Library I by Dimitri Reiswich and tries to "convert" it to Python. It seems to me that some C++ possibilities aren't available in python. I'...
1
vote
1answer
50 views

Calculating the greeks for Quantlib Python Swaptions

So I have created a Swaption object and can get the premium with the NPV() function. However, I would also like to calculate the greeks (eg. delta, vega). From some searching, I found that vega can ...
1
vote
1answer
55 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 ...
1
vote
1answer
1k views

estimate implied volatility using newton-raphson in python

I am trying to calculate the implied volatility using newton-raphson in python, but the value diverges instead of converge. What is wrong with the code? ...
0
votes
1answer
266 views

Can I use PyAlgoTrade for Forex?

Is it possible to use PyAlgoTrade for Forex related algorithms? If it is, please point me in the right direction on how to get PyAlgoTrade to work on Forex data.
4
votes
0answers
344 views

Rate Distortion Minimization in a Python Clustering Algorithm

I'm attempting to solve for $\hat{k}$ clusters, such that the rate distortion is minimized, as described here, however, the answers that I am getting from my algorithm are not following the "Jump" ...
3
votes
0answers
119 views

What is the best open source automated trading platform or options?

I would like a custom C++ Automated Trading Platform for Futures like Multicharts, or similar automated trading platform that I can put on my servers so its secure and fast. I have found this so far, ...
2
votes
0answers
55 views

Changing timezones with historic forex data (Interactive Brokers API IBPy)

I would like to be able to change the timezone for my requests to the IB API, how can I do this? I am writing in Python, and thus use the IBPy wrapper found here. How to reproduce the problem: ...
2
votes
0answers
56 views

Black-Scholes explicit Euler implementation python

I've written some code for the explicit finite difference method to solve the BS equation. For certain sets of parameters (time-steps and asset-steps) I get a stable but wrong solution. For others, ...
2
votes
0answers
93 views

Problem with Naive Bootstrapping (US Government Bonds)

I am using the formula here to determine the discount factor function and eventually the zero-coupon yields. I get the data for Coupons, Face Values and Closing Prices from Thomson Reuters, which I ...
1
vote
0answers
54 views

QuantLib FittedBondDiscountCurve fitResults [Error]

I try to use FittedBondDiscountCurve with NelsonSiegelFitting, but I faced with error when call fitResults() method: ...
1
vote
0answers
60 views

Backtesting Long/Short Market Neutral Z-Score Strategy with Custom Factors and Custom Stock Universe

So I've managed to backtest simple strategies, like MA, RSI and some fundamental ones (P/E ratios etc) but Im stuck at my last strategy. Here is some information: Tools: Excel and Python (also a ...
1
vote
0answers
40 views

Model Free VIX Calculation in Python

I have previously seen this implementation and had meant to replicate it, but can't find it any longer. Does anyone know of a python implementation of the CBOE Volatility Index? Yes, the white paper ...
1
vote
0answers
37 views

Python regenerating ARMA params using statsmodels

I am trying to regenerate the ARMA parameters from statsmodel in python. The code I am using is: ...
1
vote
0answers
79 views

How to fit exogenous + GARCH Model In Python?

I am studying a textbook of statistics / econometrics, using Python for my computational needs. I have encountered GARCH models and my understanding is that this is a commonly used model. In an ...
1
vote
0answers
224 views

Formula behind pandas.Options() implied volatility

I noted that implied volatility (IV field) from pandas.Options class is very different (especially, for out of money options) than what I compute with Black-Scholes model. (risk free rate is pulled ...
1
vote
0answers
55 views

Issue with Naive Bootstrapping (US Government Bonds)

I am using the formula here to determine the discount factor function. I get the data for Coupons, Face Values and Closing Prices from Thomson Reuters, which I insert into the Dataframe ...
1
vote
0answers
119 views

bandwith portfolio rebalancing in python

I want to calculate a bandwith rebalancing machanism for a portfolio of two assets. As soon as the performance of one ov the assets gets bigger or smaller than the other one + a defined tolerance ...
1
vote
0answers
496 views

Implied volatility from American options using python

I am currently trying to construct volatility surface from american option prices (using Cox-Ross-Rubinstein tree) in Python 2.7. Below you can find the code I came up with. Any corrections would be ...
1
vote
0answers
256 views

How to implement the herding measure proposed by Lakonishok et. al (1992) in python

I would like to test for herding behaviour using the herding measure developed by Lakonishok et. al (1992) on a dataset containing trader transactions during 2013, however, i am having some trouble ...
1
vote
0answers
1k views

Black Scholes well coded Python

I have some trouble with the following code. Some jump and a decentered path are present but it's not the case, normally for Black Scholes diffusion ! Is anyone see a problem in my code ? ...
0
votes
0answers
19 views

Variance Ratio on Currency Pair, Validation

Can somebody tell me if my variance ratio (unit root test) test is correct? I don't want to rely on my results until I can find somebody that also has a variance ratio algo that confirms them? Here is ...
0
votes
0answers
82 views

First step of Black-Litterman portfolio

I tried to implement Black-Litterman model. I have a covariance matrix, market capitalization for each asset. I assume a risk aversion factor to be 10. First I use the following code to get ...
0
votes
0answers
31 views

Calculating returns when number of securities in a timeseries varies over time?

I have a timeseries of security returns in which the number of securities in the timeseries varies over time. More specifically, I have a universe of events where securities(their returns) are added ...
0
votes
0answers
137 views

QuantLib importing in Python

Since I am working with a thesis, QuantLib is a very new thing for me. I have installed and compiled QuantLib, including the QuantLib-SWIG. Everything was compiled and installed using the guidlines at ...
0
votes
0answers
120 views

Ideas for speeding up greek calculations

My current calculations using the vollib library averages 0.5 seconds. Is there any way to get it faster? Any tips/best practice notes will be helpful. This is for a scripting language such as python....
0
votes
0answers
23 views

Selling two uncorrelated OTM options lowers the over all probability of profit?

I am trying to simulate shorting two uncorrelated put options, I wrote a python program and used monte carlo method to simulate the PnL on expiration: gist It seems the probability of profit is ...
-1
votes
0answers
35 views

Python Calculating Drawdowns?

Simple question for a newb quant. I'm writing a program to calculate drawdown and duration for any given strategy. The problem is, if my cumulative returns start at zero and go negative immediately, ...