Coder Social home page Coder Social logo

apocarich's Introduction

Build Status codecov

apocarich

An apocalyptic stock market analyzer.

alt text

Requirements

This project requires:

R

Plots are created using the R language.

Under arch linux you can install it with:

sudo pacman -S r

If you use a different operating system, then check this link.

Install instructions

git clone https://github.com/ptrstn/apocarich
cd apocarich
python -m venv venv
. venv/bin/activate
pip install -e .

Usage

Help

apocarich --help

Output:

usage: apocarich [-h] [--version] [--retrieve-data] [--start DATE] [--end DATE] [--update-csv]

Analyzing the stock market

optional arguments:
  -h, --help       show this help message and exit
  --version        show program's version number and exit

Retrieving data from Xetra:
  --retrieve-data  Retrieve data from Xetra using the Amazon aws-cli
  --start DATE     Start date (default is 2019-11-01)
  --end DATE       End date (default is today)

Updating exported data.csv by retrieved data:
  --update-csv     Generates an updated data.csv by regrouping previously retrieved data

Retrieve Data

First you have to retrieve some data. The following command downloads data from Xetra using the Amazon aws-cli.

apocarich --retrieve-data

If you want to specify specific dates, then you can use the --start and --end arguments:

apocarich --retrieve-data --start 2020-01-01 --end 2020-03-26

Process data

For the next step you have to regroup the raw data, to be able to visualize them later.

Create the grouped CSV file, based on previously retrieved data:

apocarich --update-csv

Create plots

Once the data is processed you can run the R script that generates a plot for you. You can specify different arguments to further filter your data.

argument Description
--start Start date
--end End date
--apocalypse Date of when shit hit the fan
--stocktype "Common stock", "ETF", "ETC", "ETN" or "Other"
--numstocks Number of stocks to visualize at once
--windowsize Moving average window size
--numchars Number of characters to display per subtitle
--outdir Path of the output directory
--untilrecent Calculate loss by biggest drop after apocalypse day or until most recent day
--nolossuntilapo Filter to stocks with no loss from starting day until apocalypse day
--nmosttraded Filter to n most traded stocks
--nmostvolume Filter to n stocks with highest volume

Run the R script:

Rscript R/apocarich.R 

You can also specify the arguments described above as follows:

Rscript R/apocarich.R \
    --start 2020-02-01 \
    --end 2020-03-26 \
    --apocalypse 2020-02-15 \
    --numchars 5 \
    --outdir images \
    --windowsize 10 \
    --stocktype ETF

Example

Full example of how to create a plot

git clone https://github.com/ptrstn/apocarich
cd apocarich
python -m venv venv
. venv/bin/activate
pip install .
apocarich --retrieve-data --start 2020-02-10 --end 2020-02-26
apocarich --update-csv
apocarich.R

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.