Giter VIP home page Giter VIP logo

xilinjia / xj-strategist Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 4.0 6.65 MB

A powerful machine learning system for constructing sustainable strategies for financial trading.

License: GNU Affero General Public License v3.0

Julia 100.00%
julia machine-learning quantitative-analysis quantitative-finance quantitative-trading rest-api trading-algorithms trading-strategies data-analysis data-science data-visualization

xj-strategist's Introduction

What it is

This is a powerful machine learning system that's been developed, used and perfected in the past 10 years for constructing and validating financial trading strategies (long/short). It uses purely proprietary specialized algorithms that 1) requires minimal system resources and training data, 2) is capable of automatic construction of sustainable trading strategies, and 3) is applicable to various instruments.

Unlike most other machine learning practices that aim to obtain the "best" strategy only ending up losing in real trades, this system aims to construct strategies that remains valid for trades in the foreseeable future.

Applications

It handles trades with entries (long or short) on daily open or close, holding for various number of days, and exit on daily open or close. It's been tested to work well on cryptos, ETF's, indices, commodities, and futures.

The way it's used

To study on a financial instrument, one first needs to get the daily historical data in CSV format with the following columns: Open, Low, High, Close. If it's a futures instrument, then the contracts need to be stitched to make a continuous contract (Stitch routines are included here, and are also published in another project called Stitcher under a different license).

Once the historical data is handy, one needs to decide and cut out a section used for training the systems. Also specific requirements can be set so that the outputs can be more suitable to one's trading flavors. The system performs multiple rounds of studies and validations of thousands or even hundreds of thousands of possibilities (the user can preset subsets of interesting possibilities). At the end, it constructs strategies that can be launched for trading.

Showcases

*** Updated: The following reflect both a minor system update and trading dates update ***

Showcases below include results with S&P 500, SPY, Bitcoin, FTSE 100, DAX, CAC 40, Nikkei 225, and Palm Oil futures.

All cases are based on trading with a capital of $1,000,000. Profits are not re-invested, and losses are not taken out. No leverage or margins are used. Reasonable commissions and slippages are applied.

Shorts trade in the way as in futures, i.e. one deposits a guarantee on entering a short position. For example, to enter a short position of 100 units of an instrument at the price of $90, one needs to pay (100 x $90 + commission) up front, and to exit the short position at $85, one gets back (100 x $90 + 100 x ($90 - $85) - commission).

In all the charts of the following cases, the horizontal axis is the number of days (starting from day 1), and the vertical axis denotes either the price (on price charts) or the profit/loss in USD starting from $0 at day 1.

There are 3 or 4 charts in each of the following cases. The first 2 are with the training data, i.e. the in-sample data. The constructed strategies are purely based on the learning with the training data. The 3th chart shows the trading performance of a longer period outside of the training data, i.e. the out-sample results, or walk-forward results. This 3th chart demonstrates how effective the training and learning is. Chart 4 shows the performance with profits reinvested and losses deducted, so as to better compare with a buy-and-hold strategy in the long term.

Note that here the purpose is not to show the best performing strategies the system can find, but to demonstrate trading performance sustainabilities of the constructed strategies in the forseeable future after the training period. Optimal or customized strategies can be constructed by the system based on specific requirements set by the user.

Training data (2000-01-03 through 2009-02-23):

Outcome:

Performance on entire dataset (2000-01-03 through 2023-05-08. Note the training section at the beginning of the data set):

Performance on entire dataset with profits reinvested and losses deducted:

Constructed based on special request: train in a more recent period and show performance of last two years.

Training period is 2004-01-01 through 2020-12-31:

(Refined turbo version) Outcome for the training period:

(Refined turbo version) Performance on entire dataset (2004-01-01 through 2023-05-08):

Training data (2017-06-01 through 2018-09-30):

Outcome:

Performance on entire dataset (2017-06-01 through 2023-05-08. Note the training section at the beginning of the data set):

Training data (1996-06-03 through 2003-07-31):

Outcome:

Performance on entire dataset (1996-06-03 through 2023-05-08. Note the training section at the beginning of the data set):

Training data (1996-01-02 through 2003-11-28):

Outcome:

Performance on entire dataset (1996-01-02 through 2023-05-08. Note the training section at the beginning of the data set):

Training data (1996-01-02 through 2002-12-31):

Outcome:

Performance on entire dataset (1996-01-02 through 2023-05-08. Note the training section at the beginning of the data set):

Training data (1998-07-01 through 2006-08-11):

Outcome:

Performance on entire dataset (1998-07-01 through 2023-05-08. Note the training section at the beginning of the data set):

Training data (2008-11-03 through 2014-12-31):

Outcome:

Performance on entire dataset (2007-12-29 through 2021-12-31. Note the training section near the beginning of the data set):

How to get it

The published source codes here are samples. The system is fully functional and been at use during my algorithmic trading ventures at least for the past 7 years, as it kept being perfected, it's only intended to be used outside in serious collaborations.

How to collaborate

If you represent a sound financial institution, or if you have been an elite trader/investor with a solid standing, and would like to propose ways of collaboration, please write me an email at [dxjia1 at gmail dot com]

xj-strategist's People

Contributors

xilinjia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.