Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ML based Pairs Selection #5

Merged
merged 37 commits into from Dec 9, 2020
Merged

ML based Pairs Selection #5

merged 37 commits into from Dec 9, 2020

Conversation

AaronDeb
Copy link

@AaronDeb AaronDeb commented Nov 8, 2020

Description

Implementation in this module are based on the book by Simão Moraes Sarmento and Nuno Horta "A Machine Learning based Pairs Trading Investment Strategy".

Type of Change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

This unit test file was created to test the added functions:

  • test_pairs_selector.py
  • test_data_importer.py
  • test_indexed_highlight.py

Test Configuration:

  • Ubuntu 18.04
  • Text Editor

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@PanPip PanPip self-requested a review November 9, 2020 09:45
@PanPip PanPip added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 9, 2020
Copy link
Contributor

@PanPip PanPip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments to the code part. Quite a lot of code you've added here 🙂

Now will go over the unit tests and the sphinx docs.

arbitragelab/__init__.py Outdated Show resolved Hide resolved
arbitragelab/ml_based_pairs_selection/__init__.py Outdated Show resolved Hide resolved
arbitragelab/ml_based_pairs_selection/__init__.py Outdated Show resolved Hide resolved
arbitragelab/ml_based_pairs_selection/data_import.py Outdated Show resolved Hide resolved
arbitragelab/ml_based_pairs_selection/data_import.py Outdated Show resolved Hide resolved
arbitragelab/ml_based_pairs_selection/pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/ml_based_pairs_selection/pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/ml_based_pairs_selection/pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/ml_based_pairs_selection/pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/ml_based_pairs_selection/pairs_selector.py Outdated Show resolved Hide resolved
Copy link
Contributor

@PanPip PanPip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great documentation! 👍

Will cover a few ways how it can be improvd over the call.

arbitragelab/ml_based_pairs_selection/stat_arb_utils.py Outdated Show resolved Hide resolved
arbitragelab/tests/test_data_importer.py Outdated Show resolved Hide resolved
arbitragelab/tests/test_data_importer.py Outdated Show resolved Hide resolved
arbitragelab/tests/test_pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/util/indexed_highlight.py Outdated Show resolved Hide resolved
docs/source/ml_based_pairs_selection/framework.rst Outdated Show resolved Hide resolved
docs/source/ml_based_pairs_selection/framework.rst Outdated Show resolved Hide resolved
docs/source/ml_based_pairs_selection/framework.rst Outdated Show resolved Hide resolved
docs/source/ml_based_pairs_selection/framework.rst Outdated Show resolved Hide resolved
docs/source/ml_based_pairs_selection/framework.rst Outdated Show resolved Hide resolved
@PanPip PanPip changed the title [Draft] ML based Pairs Selection ML based Pairs Selection Nov 13, 2020
Copy link
Contributor

@PanPip PanPip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great implementation! 👍

Left a few comments on the code. Will check the documentation now.

arbitragelab/ml_approach/pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/ml_approach/pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/ml_approach/pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/ml_approach/pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/ml_approach/pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/ml_approach/stat_arb_utils.py Outdated Show resolved Hide resolved
arbitragelab/tests/test_data_importer.py Outdated Show resolved Hide resolved
arbitragelab/tests/test_pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/tests/test_pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/util/data_importer.py Outdated Show resolved Hide resolved
Copy link
Contributor

@PanPip PanPip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good docs 🙂

Please split lines in sphinx docs so they are not more than 120-160 characters.

I might add more comments once I go over the Research notebook and use cases.

docs/source/index.rst Outdated Show resolved Hide resolved
requirements.txt Show resolved Hide resolved
docs/source/ml_approach/ml_based_pairs_selection.rst Outdated Show resolved Hide resolved
docs/source/ml_approach/ml_based_pairs_selection.rst Outdated Show resolved Hide resolved
docs/source/ml_approach/ml_based_pairs_selection.rst Outdated Show resolved Hide resolved
docs/source/ml_approach/ml_based_pairs_selection.rst Outdated Show resolved Hide resolved
docs/source/ml_approach/ml_based_pairs_selection.rst Outdated Show resolved Hide resolved
docs/source/ml_approach/ml_based_pairs_selection.rst Outdated Show resolved Hide resolved
docs/source/ml_approach/ml_based_pairs_selection.rst Outdated Show resolved Hide resolved
docs/source/utils/data_importer.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@PanPip PanPip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Thank you for fixing previous comments 👍

After a few minor adjustments will approve this PR.

arbitragelab/ml_approach/stat_arb_utils.py Outdated Show resolved Hide resolved
arbitragelab/ml_approach/stat_arb_utils.py Outdated Show resolved Hide resolved
docs/source/ml_approach/ml_based_pairs_selection.rst Outdated Show resolved Hide resolved
tests/test_pairs_selector.py Outdated Show resolved Hide resolved
Copy link
Contributor

@PanPip PanPip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adjusting the code! Approving this PR. 🙂

Ready for review @Jackal08.

@PanPip
Copy link
Contributor

PanPip commented Nov 19, 2020

Just thought that we might want to add a quick note to the docs that the pair selection step might take some time to calculate.

Copy link
Member

@Jackal08 Jackal08 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments that need correction and then I will approve. Excellent work with this. Very happy.

Also:

You get the following 2 deprecation warnings:

The pprint_val function was deprecated in Matplotlib 3.1 and will be removed in 3.3.
  return formatter.pprint_val(x)

The line2d_seg_dist function was deprecated in Matplotlib 3.1 and will be removed in 3.3.
  i, (p0, p1) in enumerate(edges)]

Can we please fix this?

arbitragelab/ml_approach/pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/ml_approach/pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/ml_approach/pairs_selector.py Show resolved Hide resolved
arbitragelab/ml_approach/pairs_selector.py Outdated Show resolved Hide resolved
arbitragelab/ml_approach/pairs_selector.py Outdated Show resolved Hide resolved
tests/test_data_importer.py Show resolved Hide resolved
tests/test_indexed_highlight.py Outdated Show resolved Hide resolved
tests/test_data_importer.py Show resolved Hide resolved
tests/test_indexed_highlight.py Show resolved Hide resolved
tests/test_pairs_selector.py Outdated Show resolved Hide resolved
@Jackal08
Copy link
Member

Approved. @PanPip, please merge and delete branch.

@PanPip PanPip merged commit 87b2f79 into develop Dec 9, 2020
@PanPip PanPip deleted the ml_based_pairs_selection branch December 9, 2020 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants