Chris Conlan

Financial Data Scientist

  • About
  • Blog
    • Business Management
    • Programming with Python
    • Programming with R
    • Automated Trading
    • 3D Technology and Virtual Reality
  • Books
    • The Financial Data Playbook
    • Fast Python
    • Algorithmic Trading with Python
    • The Blender Python API
    • Automated Trading with R
  • Snippets

Snippets

Bits of knowledge, technical advice, and package recommendations not befitting of a whole blog post. If it takes me a substantial amount of time or effort to search out a solution to a common issue, I'll write about it here.

When to Use Heap Sort to Speed Up your Python Code

June 10, 2020 By Chris Conlan 1 Comment

If you have ever read an algorithms textbook, you know about the handful of sorting algorithms that run in O(n*log(n)) time. These include quicksort, heapsort, and mergesort. Under the hood, Python’s List.sort function uses yet another one called Timsort. That’s not the point of this post. The point of this post is show you how […]

Filed Under: Programming with Python, Snippets

Fastest Way to Flatten a List in Python

June 5, 2020 By Chris Conlan 23 Comments

In my latest book, Fast Python, I bust a lot of speed myths in Python. Some of the most basic advice people give about optimizing Python code is wrong, likely because no one ever bothered to test it. In this book, I go back to the basics and verify (or bust) all of the advice […]

Filed Under: Programming with Python, Snippets

Multicore Repeated K-Fold Classifier

April 12, 2020 By Chris Conlan Leave a Comment

The following snippet is a reusable multicore K-Fold classifier for scikit-learn models. The return value is an array of cross validation scores of length N_SPLITS * N_REPEATS. The sklearn library already provides a simple interface for multicore cross validation through the cross_val_score function, but it does not provide a facility for repeating the cross validation […]

Filed Under: Programming with Python, Snippets

Calculating Triple Barrier Labels from Advances in Financial Machine Learning

April 12, 2020 By Chris Conlan 4 Comments

In Marcos Lopez de Prado’s 2018 book, Advances in Financial Machine Learning, the author proposes a system for calculating labels for financial events based on the precipitation of events followings a list of event dates. These labels are typically members of the set {-1, 0, 1}, and are ideal for fitting machine learning classification models. […]

Filed Under: Automated Trading, Programming with Python, Snippets

Activate Verbose Logging Output in Django

June 26, 2018 By Chris Conlan Leave a Comment

When you are developing Django, you likely want the most verbose debugging output possible. Django uses the logging levels defined by Python logging module, and defines the logging style in a Python dictionary in settings.py. Read more about Django logging. Example Logging Configuration My favorite logging configuration is to dump the most verbose output possible […]

Filed Under: Snippets

  • 1
  • 2
  • Next Page »

Latest Release: The Financial Data Playbook

The Financial Data Playbook

Available for purchase at Amazon.com.

Algorithmic Trading

Pulling All Sorts of Financial Data in Python [Updated for 2021]

Calculating Financial Performance Metrics in Pandas

Moving from Single-Asset to Multi-Asset Algorithmic Trading

Topics

  • 3D Technology and Virtual Reality (8)
  • Automated Trading (9)
  • Business Management (9)
  • Chris Conlan Blog (5)
  • Computer Vision (2)
  • Programming with Python (16)
  • Programming with R (6)
  • Snippets (8)
  • Email
  • LinkedIn
  • RSS
  • YouTube

Copyright © 2022 · Enterprise Pro Theme On Log in