Skip to content

Latest commit

 

History

History
143 lines (86 loc) · 3.15 KB

README.md

File metadata and controls

143 lines (86 loc) · 3.15 KB

trading-tools

Set of CLI tools for working with stock market data.

Some tools require access to gatewayed APIs. Credentials should be added to inc/config.h after running make config (and inspecting the source code of this whole codebase prior, of course).


Tool #1: ticker-scraper

This CLI tool is capable of scraping general stock market ticker data from various web resources. It generates CSV files that can later be used by other tools in the suite.

Currently supported markets:

Dependencies

libcsv, libcurl, libtidy

How to build

make -j ticker-scraper

How to run

bin/ticker-scraper NASDAQ > nasdaq-and-pink.csv
bin/ticker-scraper --no-csv-header Pink >> nasdaq-and-pink.csv
bin/ticker-scraper US OTC > us-and-otc-stocks.csv

Sample output

"marketplace","ticker","company","price","sector","industry","country","marketcap"
"NASDAQ","A","Agilent Technologies, Inc.","173.94","Healthcare","Diagnostics & Research","USA","52.46B"
"NASDAQ","AA","Alcoa Corporation","48.83","Basic Materials","Aluminum","USA","9.23B"
"NASDAQ","AAAU","Goldman Sachs Physical Gold ETF","17.42","Financial","Exchange Traded Fund","USA","-"
"NASDAQ","AAC","Ares Acquisition Corporation","9.74","Financial","Shell Companies","USA","1.22B"

Tool #2: historical-data-scraper

Historical stock market data scraper. Obtains OHLC records and saves them to disk (one JSON file per ticker).

The input is CSV files in the same format as the one that gets produced by ticker-scraper (Tool #1).

Currently supported data sources:

Dependencies

libcsv, libcurl, libjson-c

How to build

make config

put your TD Ameritrade API key into inc/config.h

make -j historical-data-scraper

How to run

bin/historical-data-scraper --min-price=0.1 --max-price=7.5 -o data/historical/ nasdaq-and-pink.csv

Sample output

{
    "candles": [
        {
            "open": 25.5,
            "high": 26.8485,
            "low": 25.5,
            "close": 26.1,
            "volume": 2291,
            "datetime": 1475470800000
        }
    ],
    "symbol": "EYEG",
    "empty": false,
    "marketplace": "NASDAQ",
    "company_name": "EyeGate Pharmaceuticals, Inc.",
    "country": "USA",
    "sector": "Healthcare",
    "industry": "Biotechnology"
}

Tool #3: chart-generator

CLI tool for creating chart images out of historical stock market data generated by historical-data-scraper (Tool #2).

Dependencies

libcairo2, libjson-c

How to build

make -j chart-generator

How to run

bin/chart-generator -o data/charts data/historical/*