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

36
votes
7answers
7k views

Is R being replaced by Python at quant desks?

I know the title sounds a little extreme but I wonder whether R is phased out by a lot of quant desks at sell side banks as well as hedge funds in favor of Python. I get the impression that with ...
22
votes
9answers
7k views

What tools exist for order book analysis and visualization?

What tools exist for order book analysis and visualization? In particular, if one wanted to examine a limit order book and understand how it changes throughout the day where would you turn for ...
22
votes
11answers
13k views

What is the reference python library for portfolio optimization?

Does anyone know of a python library/source that is able to calculate the traditional mean-variance portfolio? To press my luck, any resources where the library/source also contains functions such as ...
18
votes
9answers
14k views

Except Zipline, are there any other Pythonic algorithmic trading library I can choose?

Except Zipline, are there any other Pythonic algorithmic trading library I can choose? Especially, for backtesting?
11
votes
1answer
4k views

Correctly applying GARCH in Python

Problem: Correct usage of GARCH(1,1) Aim of research: Forecasting volatility/variance. Tools used: Python Instrument: SPX (specifically adjusted close prices) Reference material: On Estimation of ...
7
votes
2answers
564 views

What time series database can be used with Python and Pandas?

I'm looking for a time series database that can be easily used with Python and Pandas objects such as DataFrame, Panel... But these objects will always contains time series. Ideally I'm looking for ...
7
votes
2answers
151 views

Are there any integrated framework that I can back-test and paper/live trading in one place?

I'm trying to start working on a fully automated algorithmic trading system, and I'm a little struggling with the framework to use. The requirements I have in my mind are: Needs to support back-...
6
votes
3answers
1k views

Generate tick data from candlestick

Is there software (or Python / R / ... scripts) to generate (pseudo) tick data from candlestick data. I have candlestick data (CSV format) from monthly timeframe (MN) to minute timeframe (M1) but ...
5
votes
1answer
198 views

Which Algorithmic trading library would you recommend for trading Bitcoin?

I am starting to do Algorithmic trading in cryptocurrencies using Python libraries. Most exchanges have RESTful API that make it easy to write you own code and get started. However, I would like to ...
5
votes
1answer
2k views

Historical volatility from close prices (Haug pg 166)

I have implemented a function for calculating historical volatility using close the close method as described by Haug on page 166. When I implemented the formula given by Haug, it resulted in some ...
4
votes
1answer
183 views

Why does regression capture differences in volatility?

I read the following statement in the book python for data analysis, chapter 11, and I was wondering if someone could give me intuition about why regression has this effect? The purpose of the ...
4
votes
1answer
1k views

Are there Python algorithmic trading libraries supporting forex?

I know about zipline and ultrafinance, but as far as I know, they don't support fx trading. Which libraries do?
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
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" ...
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. ...
3
votes
2answers
3k views

Build a customizable trading engine in python [closed]

I am planning building fully customizable backtesting trading engine in python from scratch as a open source project, the main features i am considering is, It should be fully customizable from ...
3
votes
2answers
144 views

Open source software for stock screening and scanning using technical analysis?

I am looking for open source software which can download stock data (yahoo/google finance etc) and used for screening/scanning stocks using technical analysis, for example: return stock list if ...
3
votes
1answer
308 views

Shannon's entropy for financial times-series (return)

I'm looking at Shannon entropy, and generaly at ways to tell noise from signal when observing intraday returns (at the minute level for now). In python, e.g. I've implemented the fomula (sum of P(xi)*...
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, ...
3
votes
1answer
128 views

Quantlib FuturesRateHelper triggers not a valid IMM date error

I'm beginning to use QuantLib with Python SWIG, and trying to build a EUR yield curve. I face this error which frankly I don't understand; I looked at the code of bool IMM::isIMMdate in imm.cpp and ...
2
votes
3answers
18k views

Which brokers offer a Python stock trading API?

I would like to automate my trading strategies. My strategies are not high-frequency and are written in Python. I have a trading account in Interactive Brokers, and I know some non-official Python ...
2
votes
1answer
128 views

How to get the IMM dates in Python for a given symbol?

How can I get an IMM date from its 2 character symbol (eg. "U6", "Z8") in python? I have not been able to install the quantlib addin (it's hard if you aren't tech savy), so please don't point me in ...
2
votes
2answers
2k views

Calculating Bollinger Band Correctly

My bollinger band comes out like the below, which doesn't seem right. Any idea what is wrong with my code for calculating upper and lower bollinber bands? I obtained my data from here ...
2
votes
1answer
62 views
2
votes
2answers
382 views

Multivariate GARCH in Python

Is there a package to run simplified multivariate GARCH models in Python? I found the Arch package but that seems to work on only univariate models. I'd like to test out some of the more simple ...
2
votes
1answer
114 views

How to model bracket orders?

I'm looking for a way to make my own Python backtester (like zipline or pyalgotrade) or improve one of these backtesters. One major lack of these backtesters is the lack of support of bracket orders (...
2
votes
1answer
137 views

Bloomberg Python Question - How do you access PRTU via python?

I am having some trouble using python to access Bloomberg as I cant find much documentation. All I really need to do is a simple lookup of dates in the PRTU function of Bloomberg, PRTU via a python ...
2
votes
1answer
76 views

importing columns of returns data into python from excel/csv [closed]

I'm fairly new to the quant finance space, and I was hoping to get some guidance. Say I have a csv/excel file with columns of daily returns data for various asset classes or securities (one column per ...
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
160 views

Finance Projects in Python [closed]

I am new to this forum. I work in the Market Risk Domain at a leading Investment Bank. I am currently learning Python. And the best way to learn is to experiment with some Real Live Analysis/Project(...
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
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'...
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
1answer
167 views

How to calculate bond yield in QuantLib - Python

I want to calculate yield of bond having market price and coupons. I try to replicate C++ from (https://mhittesdorf.wordpress.com/2013/03/03/introducing-quantlib-internal-rate-of-return/) in Python ...
1
vote
1answer
744 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
3answers
259 views

Building custom indices; getting data from web; stats analysis; Python or R?

I would like to build a couple of custom indices. I would like to be able to enter ticker(s) into an input and have ohlc, volume, qualitative ...data downloaded from yahoofinance, google finance, ...
1
vote
3answers
121 views

Python everywhere but where do they execute orders?

About every introduction I've read about automatic trading writes about how well python is suited for the task. But looking around, I've been able to find just one brooker, Oanda, which has a python ...
1
vote
2answers
267 views

Calculating log-returns across multiple securities and time

I've been getting very confused on the topic of calculating returns. To get cumulative returns in time, log-returns are used, but apparently log-returns aren't used across different securities at a ...
1
vote
1answer
1k views

Python code to download historical firm data

I am looking for a Python code that scraps a website to download historical firm data such as market capitalization, dividend-yield, and so on. I have a code that downloads the current firm data from ...
1
vote
3answers
195 views

accuracy of Yahoo Finance stock data (Python module)

I am using the yahoo finance python module: https://pypi.python.org/pypi/yahoo-finance I am using it for a project and would like to see if anybody else uses data from this source and can vouch for ...
1
vote
1answer
70 views

Strategies to merge bid, offer and trade price time series into a single price time series?

I'm doing intraday analysis on low volume stocks. There are just a few trades every day, but a whole host of bids and offers. In order to reduce the sparsity of the time series data I'd like to ...
1
vote
2answers
64 views

How can I find stocks that have had a X% price swing within Y days, sorted by recency of said swing? [closed]

Let's say that I want to find stocks that have moved +-20% within a 10 day period. ABC would match if at t, ...
1
vote
1answer
177 views

Broker or source of intraday futures data for a python API?

I am looking for a broker that offers a python API for downloading historical intraday data on futures. So far I have only seen Interactive Brokers and Tradestation. Are there some other brokers ...
1
vote
1answer
414 views

calculate YTD return / find first available datapoint of a year in python

I need to calculate the year-to-date relative return of a given dataset. I usually caculate the cumulative relative return with this simple function: ...
1
vote
1answer
1k views

IbPy download historical price data

How can i download historical price data from interactive brokers using IbPy and python?
1
vote
1answer
1k views

How to get positions of your portfolio from Interactive Brokers with python ibPy?

I am using ibpy to get the positions of my portfolio. I understand that I can do: ...
1
vote
0answers
56 views

QuantLib FittedBondDiscountCurve fitResults [Error]

I try to use FittedBondDiscountCurve with NelsonSiegelFitting, but I faced with error when call fitResults() method: ...
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
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 ...