Giter Site home page Giter Site logo

lmk's Introduction

Get Started with the code

  • Suppose you already have docker installed.
# in the same directory where this README.md resides.
scripts/run_docker.sh

in the jupyter ipython notebook page (e.g. http://<>:8888) create a new Python 3 notebook with ...

  • Cell 1 - install dependencies.
%%bash
conda install pandas_datareader pytables
  • Cell 2 - configure matplotlib
%matplotlib inline

import matplotlib
matplotlib.rcParams['figure.figsize'] = (19, 8)
  • Cell 3 - run it...
from lmk.ticker import Ticker

ticker = Ticker("TSLA")
ticker.retrieve_history("2015-06-01", "2016-04-30")
ticker.visualize("V,C,CL,LMK,WM,PV")

and github renders ipynb files, so here is what the above looks like. https://github.com/dyno/LMK/blob/master/lmk.ipynb

File Layout

.
├── README.md
├── book
│   ├── 1938_1940.py
│   └── 1938_1940.txt
├── lmk
│   ├── __init__.py
│   ├── cache.py
│   ├── calculator
│   │   ├── ATRCalculator.py
│   │   ├── EntryPointCalculator.py
│   │   ├── LMKBandCalculator.py
│   │   ├── ODRCalculator.py
│   │   └── PivotCalculator.py
│   ├── datasource
│   │   ├── DataSource.py
│   │   ├── Google.py
│   │   ├── NetEase.py
│   │   └── Yahoo.py
│   ├── market
│   │   ├── China.py
│   │   ├── Market.py
│   │   └── US.py
│   ├── test
│   │   ├── __init__.py
│   │   ├── test_calculator.py
│   │   ├── test_datasource.py
│   │   ├── test_market.py
│   │   └── test_utils.py
│   ├── ticker.py
│   └── utils.py
├── run.md
├── run_test.sh
└── scripts
    ├── launchd_wrapper.sh
    ├── org.jupyter.server.plist
    └── run_docker.sh

Code Highlight

  • NetEase.py - Get China market data with better quality than Yahoo/Google.
  • PivotCalculator.py - An algorithm to calculate local crest/trough.

TODO List

  • multi-tickers in one graph (unlikely...)

  • zipline ...

  • the cache layer see Market.py/cache.py

  • Chinese font (on Mac)

# remove font cache
# rm -rf $(python -c "import matplotlib; print(matplotlib.get_cachedir())")

# list all available fonts.
from matplotlib.font_manager import FontManager
m = FontManager()
{f.name:f.fname for f in m.ttflist}

# pick a font.
matplotlib.rcParams['font.family'] = ['sans-serif']
matplotlib.rcParams['font.sans-serif'] = ['STHeiti']

lmk's People

Contributors

codetalks avatar dyno avatar

Watchers

 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.