Giter VIP home page Giter VIP logo

technical_analysis's Introduction

Technical Analysis

This project aims to provide robust and extensible tools for better understanding market behavior and gaining insights on future trends. It has three pillars of focus:

  1. Collecting data (historic and real-time) relevant to market behavior (e.g. GDAX candles, tweets, etc.)
  2. Training plugins using historic data
  3. Inferring future market behavior using live data and knowledge gained through training

Installing Dependencies

First, ensure that Mongo, Node and Yarn are installed. Then, run the following from the project's root:

yarn install

Configuring the Environment

This repository's scripts use dotenv to manage environment variables. All variables documented in .env.template must be defined either in a .env file (located at the project root) or configured on the system.

Note: Currently there are no required environment variables, but if future plugins require API keys, this is where they should live.

In addition to any environment variables, there are a few required shared settings defined in ./settings.js, notably mongoUri and mongoDatabaseName. The default values are sensible, but should be reviewed.

Collecting Data Data

Most/all plugins will require historic data for training and real-time data for inference. Listed below are the strategies currently available for collecting data.

GDAX Candles

Historic GDAX Candles

To collect GDAX's historic candle data, first instantiate a new OneTimeGDAXCandleCollector with the following configuration:

  • product: The trading pair, e.g. BTC-USD
  • startTime: A Date object denoting the beginning of the range
  • endtime: A Date object denoting the end of the range
  • candleSize: The duration of candles to be gathered, supported values are 1-day, 6-hour, 1-hour, 15-minute, 5-minute, and 1-minute.

Next, invoke the start method of the collector, and when the candles for the given configuration have been gathered, the returned promise will resolve. Below is a simple example. See ./bin/collect_historic_gdax_candles.js for more details:

const config = { product, startTime, endTime, candleSize };
const collector = new OneTimeGDAXCandleCollector(config);
collector.start().then((candles) => console.log(candles));

Real-Time GDAX Candles

To collect real-time GDAX candles, first instantiate a new RealTimeGDAXCandleCollector with the following configuration:

  • product: The trading pair, e.g. BTC-USD
  • candleSize: The duration of candles to be gathered, supported values are 1-day, 6-hour, 1-hour, 15-minute, 5-minute, and 1-minute.
  • interval: The polling frequency in milliseconds.

In most cases, the collector instance should be passed to a Quant instance, which will manage starting and stopping the collector. When new candles have been retrieved, the collector will emit a RealTimeGDAXCandleCollector.events.COLLECT_FINISHED event, which can be utilized by concerned plugins. See ./bin/infer_bullish_engulfing.js for example usage.

Historic Tweets

Coming Soon...

Training With Historic Data

Once the necessary data has been collected, plugins can begin training with historic data. Listed below are the plugins currently available:

Available Training Plugins

Bullish Engulfing Trainer

The BullishEngulfingTrainer identifies historic instances of bullish engulfing candles and calculates the probability of various percent-price increases in the near-term future. For this exercise, a bullish engulfing candle is defined as having:

  1. a higher closing price than opening price
  2. a taller candle body than all recent candles
  3. a closing price that is at or near its highest price
  4. larger volume than all recent candles

The plugin requires the following to be configured:

  • product: The trading pair to be analyzed, e.g. BTC-USD
  • priceHistoryFile: The absolute path to a historic GDAX candle file generated by the script mentioned in the "Historic GDAX Candles" section
  • dbCollection: The mongo collection into which the results will be inserted
  • lookbackCandles: The number of previous candles that the current candle needs to be larger than in order to be considered "engulfing"
  • lookaheadCandles: The maximum number of candles to look ahead when determining the highs following a bullish engulfing candle
  • allowedWickToBodyRatio: The maximum body-to-upper-wick ratio that is allowed for a candle to be considered engulfing
  • groupSizeForPctPriceIncreaseProbability: The grouping size applied when calculating the probability of the price increasing by a particular percentage

Twitter Sentiment Trainer

Coming Soon...

Inferring Based On Live Data

Once the necessary training has been completed, plugins can begin inferring with real-time data. Listed below are the plugins currently available:

Available Inference Plugins

Bulllish Engulfing Inferrer

When the current candle meets the criteria defined in the "Bullish Engulfing Trainer" section, the BullishEngulfingInferrer emits a BullishEngulfingInferrer.CURRENT_CANDLE_IS_BULLISH_ENGULFING event, which contains the plugin settings, data about the most recent candle, along with probabilities of various percentage-price increases over the next lookaheadCandles candles. The plugin requires the following to be configured:

  • product: The trading pair to be analyzed, e.g. BTC-USD
  • dbCollection: The mongo collection where Bullish Engulfing Training data is stored
  • lookbackCandles: The number of previous candles that the current candle needs to be larger than in order to be considered "engulfing"
  • lookaheadCandles: The maximum number of candles to look ahead when determining the highs following a bullish engulfing candle (used to identify the appropriate training data)
  • allowedWickToBodyRatio: The maximum body-to-upper-wick ratio that is allowed for a candle to be considered engulfing

The BullishEngulfingInferrer also requires a RealTimeGDAXCandleCollector for a data feed. See ./bin/infer_bullish_engulfing.js for example usage.

Twitter Sentiment Inferrer

Coming Soon...

Registering A New Collector

Coming Soon...

Registering A New Plugin Set

Coming Soon...

technical_analysis's People

Contributors

nickcherry avatar

Watchers

 avatar  avatar

Forkers

adiman9

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.