✍Tips and Tricks in Python

The conversion between list, dictionary, ndarray, Series and DataFrame

Photo by Dave Gandy under the Public Domain Dedication License

Note: This is the learning note for common data structure conversion between list, dictionary and ndarray, Pandas’ Series and DataFrame . Nothing fancy, but handy.

📈Python For Finance Series

  1. Identifying Outliers (updated on 10/28/2020 Winsorization added)
  2. Identifying Outliers — Part Two
  3. Identifying Outliers — Part Three
  4. Stylized Facts
  5. Feature Engineering & Feature Selection
  6. Data Transformation
  7. Fractionally Differentiated Features
  8. Data Labelling
  9. Meta-labeling and Stacking

When it comes to the data analysis, there are always needs for converting between different data containers.

List, dictionary, ndarray, Series and DataFream are data structures used most of the time in data analysis. …


Photo by Dave Gandy under the Public Domain Dedication License

📈Python For Finance Series

  1. Identifying Outliers
  2. Identifying Outliers — Part Two
  3. Identifying Outliers — Part Three
  4. Stylized Facts
  5. Feature Engineering & Feature Selection
  6. Data Transformation
  7. Fractionally Differentiated Features
  8. Data Labelling
  9. Meta-labeling and Stacking

TA-Lib is widely used by trading software developers requiring to perform technical analysis of financial market data.

  • Includes 150+ indicators such as ADX, MACD, RSI, Stochastic, Bollinger Bands, etc.
  • Candlestick pattern recognition
  • Open-source API for C/C++, Java, Perl, Python and 100% Managed .NET

I have tried a few ways to install it:

pip install ta-lib

and

conda install -c quantopian ta-lib

both shows that I need to downgrade my python==3.8 to…


📈Python for finance series

How to boost your machine learning score

Photo by Dave Gandy under the Public Domain Dedication License

Note from Towards Data Science’s editors: While we allow independent authors to publish articles in accordance with our rules and guidelines, we do not endorse each author’s contribution. You should not rely on an author’s works without seeking professional advice. See our Reader Terms for details.

Warning: There is no magical formula or Holy Grail here, though a new world might open the door for you.

Note 1: How to install mlfinlab package without error messages can be found here.

Note 2: If you are reading Advances in Financial Machine Learning by Marcos Prado. 7. Fractionally Differentiated Features is Chapter…


📈Python for finance series

The Triple-barrier Method

Photo by Dave Gandy under the Public Domain Dedication License

Note from Towards Data Science’s editors: While we allow independent authors to publish articles in accordance with our rules and guidelines, we do not endorse each author’s contribution. You should not rely on an author’s works without seeking professional advice. See our Reader Terms for details.

Warning: There is no magical formula or Holy Grail here, though a new world might open the door for you.

Note 1: How to install mlfinlab package without error messages can be found here.

Note 2: If you are reading Advances in Financial Machine Learning by Marcos Prado. 7. Fractionally Differentiated Features is Chapter…


✍Tips and Tricks in Python

Photo by Dave Gandy under the Public Domain Dedication License

Warning: There is no magical formula or Holy Grail here, though a new world might open the door for you.

📈Python For Finance Series

  1. Identifying Outliers
  2. Identifying Outliers — Part Two
  3. Identifying Outliers — Part Three
  4. Stylized Facts
  5. Feature Engineering & Feature Selection
  6. Data Transformation
  7. Fractionally Differentiated Features
  8. Data Labelling
  9. Meta-labeling and Stacking

TL;NR:

  • First of all, there is no pd.nan, but do have np.nan.
  • if a data is missing and showing NaN, be careful to use NaN ==np.nan. np.nan is not comparable to np.nan... directly.
np.nan == np.nanFalse

NaN is used as a placeholder for missing data consistently in pandas, consistency is…


📈Python for finance series

Fractionally Differentiated Features

Photo by Dave Gandy under the Public Domain Dedication License

Warning: There is no magical formula or Holy Grail here, though a new world might open the door for you.

Note 1: How to install mlfinlab package without error messages can be found here.

Note 2: If you are reading Advances in Financial Machine Learning by Marcos Prado. 7. Fractionally Differentiated Features is Chapter 5 about Fractionally Differentiated Features. 8. Data Labelling is Chapter 3 about The Triple-barrier Method. And 9. Meta-labeling is Chapter 3.6 on page 50.

📈Python For Finance Series

  1. Identifying Outliers
  2. Identifying Outliers — Part Two
  3. Identifying Outliers — Part Three
  4. Stylized Facts
  5. Feature Engineering & Feature Selection
  6. Data Transformation
  7. Fractionally…


📈Python for finance series

How to apply modern Machine Learning on Volume Spread Analysis (VSA)

Photo by Jeremy Thomas on Unsplash

Warning: There is no magical formula or Holy Grail here, though a new world might open the door for you.

📈Python For Finance Series

  1. Identifying Outliers
  2. Identifying Outliers — Part Two
  3. Identifying Outliers — Part Three
  4. Stylized Facts
  5. Feature Engineering & Feature Selection
  6. Data Transformation
  7. Fractionally Differentiated Features
  8. Data Labelling
  9. Meta-labeling and Stacking

In the previews article, I briefly introduced the Volume Spread Analysis(VSA). After we did feature-engineering and feature-selection, there were two things I noticed immediately, the first one was that there were outliers in the dataset and the second issue was the distribution were no way close to normal. By using the…


📈Python for finance series

How to apply modern Machine Learning on Volume Spread Analysis (VSA)

Photo by Nong Vang on Unsplash

Warning: There is no magical formula or Holy Grail here, though a new world might open the door for you.

📈Python For Finance Series

  1. Identifying Outliers
  2. Identifying Outliers — Part Two
  3. Identifying Outliers — Part Three
  4. Stylized Facts
  5. Feature Engineering & Feature Selection
  6. Data Transformation
  7. Fractionally Differentiated Features
  8. Data Labelling
  9. Meta-labeling and Stacking

Following up the previous posts in these series, this time we are going to explore a real Technical Analysis (TA) in the financial market. For a very long time, I have been fascinated by the inner logic of TA called Volume Spread Analysis (VSA). I have found no articles on applying…


📈Python for finance series

What does it take to predict the future statistically?

Photo by Dave Gandy under the Public Domain Dedication License

Warning: There is no magical formula or Holy Grail here, though a new world might open the door for you.

📈Python For Finance Series

  1. Identifying Outliers
  2. Identifying Outliers — Part Two
  3. Identifying Outliers — Part Three
  4. Stylized Facts
  5. Feature Engineering & Feature Selection
  6. Data Transformation
  7. Fractionally Differentiated Features
  8. Data Labelling
  9. Meta-labeling and Stacking

We always say “let the data speak for themselves”. But data can either shout loud or whispering low. Some data properties are easy to spot, while others are not so obvious and buried in the noise. Like a whisper in your ear, you got to work hard to figure out what…


📈Python for finance series

How to find and visualize outliers in your dataset by Pandas

Photo by Dave Gandy

Warning: There is no magical formula or Holy Grail here, though a new world might open the door for you.

📈Python For Finance Series

  1. Identifying Outliers
  2. Identifying Outliers — Part Two
  3. Identifying Outliers — Part Three
  4. Stylized Facts
  5. Feature Engineering & Feature Selection
  6. Data Transformation
  7. Fractionally Differentiated Features
  8. Data Labelling
  9. Meta-labeling and Stacking

In Part one and Part two, I introduced the mean and standard deviation (std) to set the outliers boundary. Here we are going to use Exponential Moving Average (EMA) as the boundary. …

Ke Gui

An ordinary guy who wants to be the reason someone believes in the goodness of people. He is living at Brisbane, Australia, with a lovely backyard.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store