In my earlier post, I wrote about how pyenv is a great tool for running multiple versions of Python on the same host. It makes it simple to install multiple versions of Python on your workstation or server and control which version executes in a shell. But as a Python developer, the Python version is … Continue reading Use pyenv and virtual environments to manage Python complexity
You can easily and sensibly run multiple versions of Python with pyenv
Python 3.9 just came out recently, and I thought it would make sense to check out some of the new features (dict union operators, string remove prefix and suffix, etc.). Of course, doing this requires a Python 3.9 environment. Since new versions of Python may break existing code, I don't want to update my entire … Continue reading You can easily and sensibly run multiple versions of Python with pyenv
Python: how to use multiprocessing to finish work faster
It's very common in data science work to have some function or a set of functions that you run in a loop to process or analyze data. When you see a loop that's performing an expensive operation, you should immediately think of (at least) two ways to speed things up. The first is vectorization, which … Continue reading Python: how to use multiprocessing to finish work faster
Basic Pandas: Moving a DataFrame column
Sometimes we want to change the ordering of a DataFrame's columns. Maybe you are saving your data and require the columns to be in a certain order, or you may have a large number of columns and want a few of them to be visible whenever viewing your DataFrame in an interactive session, so you … Continue reading Basic Pandas: Moving a DataFrame column
Basic Pandas: Renaming a DataFrame column
A very common need in working with pandas DataFrames is to rename a column. Maybe the columns were supplied by a data source like a CSV file and they need cleanup. Or maybe you just changed your mind during an interactive session. Let's look at how you can do this, because there's more than one … Continue reading Basic Pandas: Renaming a DataFrame column
Basic Pandas: How to add a column to a DataFrame
Pandas is one of my favorite Python libraries, and I use it every day. A very common action is to add a column to a DataFrame. This is a pretty basic task. I'm going to look at a few examples to better show what is happening when we add a column, and how we need … Continue reading Basic Pandas: How to add a column to a DataFrame
How to get historical market data from Interactive Brokers using Python
When exploring the world of quantitative finance or algorithmic trading, you quickly end up facing a very common issue: Where do I get historical market data? No matter what sort of analysis or trading you plan to do, you'll need access to quality market data for your research and development. This can be a challenging … Continue reading How to get historical market data from Interactive Brokers using Python
How to connect to Interactive Brokers using Python
The discount brokerage space is getting very competitive with commissions going to zero recently at many brokerages, including Interactive Brokers. IB has long been a broker with one of the largest breadth of products and service offerings targeting a professional audience. It is also a low cost brokerage making it an excellent option for the … Continue reading How to connect to Interactive Brokers using Python
Backtrader, a Python backtesting and trading framework
After looking at zipline, another backtesting framework, I thought it would make sense to take a look at some other options in the open source community for backtesting and trading. The next framework to investigate is backtrader, an open source project that aims to provide tooling for backtesting and live trading algorithmic strategies. I'll use … Continue reading Backtrader, a Python backtesting and trading framework
Zipline, an open source backtesting library from Quantopian
Developing an algorithmic trading strategy is a challenging process, with many factors to consider. One part of the process in developing a strategy is to measure its performance using historical data in what is called a backtest. It can be very helpful is to have a decent library that abstracts away some of the challenging … Continue reading Zipline, an open source backtesting library from Quantopian