Giter VIP home page Giter VIP logo

docktrader's Introduction

docktrader

GitHub repo size GitHub language count GitHub top language GitHub last commit GitHub stars GitHub forks GitHub watchers GitHub followers Buy Me A Coffee donate button Patreon donate button

Table of Contents

Python trading scripts running on Jupyter notebook.


About docktrader

This docktrader project is used by me to create trading scripts because:

  • Visual environment used to create reproducible backtesting results
  • Python dependencies containerized to run on MacOS, Windows, Ubuntu

This repository can be used as a starting point for adding further scripts, such as Deep Learning, Machine Learning, etc.


Known Issues

Python packages pyfolio and quantstats does not install on WinPython.

Alternatively, we can run notebooks with the above packages on Google Colab.


Prerequisites

This project is now running on a custom Docker image (dennislwm/pynotebook) and it has the following dependencies:

These additional Python libraries are installed in the Jupyter notebook:

This project is NO longer running on WinPython (deprecated):


Project Structure

 docktrader/                                                           <-- Root of your project
   |- Dockerfile                                                       <-- Dockerfile of image (deprecated)
   |- README.md                                                        <-- This README markdown file
   +- config/                                                          <-- System configuration files go here
      |- iex.conf                                                      <-- Token file (.gitignore)
   +- data/                                                            <-- Data files go here
      +- 01raw/                                                        <-- Raw data files go here
         +- stockrow/                                                  <-- Downloaded files from StockRow.com go here
      +- 02interim/                                                    <-- Cleaned version of raw files go here
      +- 03model/                                                      <-- Data files to develop model go here
      +- 04trained/                                                    <-- Trained models go here
      +- 05output/                                                     <-- Model output files go here
      +- 06report/                                                     <-- Reports and input to frontend
   +- notebooks/                                                       <-- Jupyter notebooks go here
      |- 001import.ipynb                                               <-- Sample notebook to import Python libraries
      |- 002basic.ipynb                                                <-- Sample notebook for Python script 001basic.py
      |- 003sma.ipynb                                                  <-- Sample notebook for Python script 002sma.py
      |- 004iexfinance.ipynb                                           <-- iexfinance is an IEX Cloud Python SDK
      |- 005iexnews.ipynb                                              <-- Jupyter notebook to showcase IEX news
      |- 006iexpiece.ipynb                                             <-- Jupyter notebook to showcase IEX financial statments
      |- 006mathplot.ipynb                                             <-- Jupyter notebook to showcase IEX price charts
      |- 007pyex.ipynb                                                 <-- pyex is an alternative IEX Cloud Python SDK
      |- 008stockrow.ipynb                                             <-- StockRow is an alternative to IEX Cloud
      |- 009stockrow-excel.ipynb                                       <-- Download financial statements as Excel spreadsheets from StockRow
      |- 011deepspeech.ipynb                                           <-- Mozilla Deep Speech Transcriber in Python
      |- 012portfolio.ipynb                                            <-- Mean Variance Optimizer in Python
      |- 013summarize.ipynb                                            <-- Simple Summarizer with NLP in Python
      |- 014piece.ipynb                                                <-- PIECE analysis in Python
      |- 015hmm_market_behaviour.ipynb                                 <-- Clone of https://github.com/lamres/hmm_market_behavior
      |- 016pairs_trading_cryptocurrencies_strategy_catalyst.ipynb     <-- Clone of https://github.com/lamres/pairs_trading_cryptocurrencies_strategy_catalyst/blob/master/cointegration_analysis_cryptocurrencies.ipynb
      |- 017trendet.ipynb                                              <-- Clone of https://github.com/alvarobartt/trendet
      |- 018ErrorCls.ipynb                                             <-- Define custom Class exception in Python
      |- 019whatsapp_analysis.ipynb                                    <-- Whatsapp chat analysis (non-API) from text file
   +- src/                                                             <-- Python scripts that correspond to notebooks
      |- 001import.py                                                  <-- Sample notebook to import Python libraries
      |- 002basic.py                                                   <-- Sample script to show account balance
      |- 003sma.py                                                     <-- Sample script to backtest SMA strategy

WinPython (deprecated)

Usage

After installing WinPython on your PC, go the installation folder and run the following file:

 > Jupyter Notebook.exe

This command opens a Jupyter Notebook web application in your browser.


Docker as a Virtual Environment for Python

Initialize Docker Container from Image

Type the following command in your terminal, e.g. Windows command prompt:

 > docker run --rm -v (notedir):/home:rw --name objDocktrader -p 8888:8888 -it dennislwm/pynotebook

Note: Substitute "(notedir)" with the path to your notebooks folder on your host computer, e.g. C:\DOCUMENT\NOTEBOOK


Running terminal in Docker Container

If you require root access to the Docker container, add a suffix "bash" to the above docker run command as follows:

 > docker run -v (notedir):/home --name objDocktrader -p 8888:8888 -it dennislwm/pynotebook bash

Run a stopped Docker Container

Type the following command in your terminal, e.g. Windows command prompt:

 > docker start -ia objDocktrader

Stop Docker Container

Type the following command in your terminal, e.g. Windows command prompt:

 > docker container stop objDocktrader

Remove Docker Container

Type the following command in your terminal, e.g. Windows command prompt:

 > docker container rm objDocktrader

Reach Out!

Please consider giving this repository a star on GitHub.

docktrader's People

Contributors

dennislwm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  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.