Skip to main content

Download data from Refinitiv Tick History and compute some market microstructure measures.

Project description

mktstructure

A simple command-line tool to download data from Refinitiv Tick History and some market microstructure measures.

Installation

pip install mktstructure

After installation, use -h or --help to see the usage instruction:

$ mktstructure -h
usage: mktstructure [OPTION]...

Download data from Refinitiv Tick History and compute some market microstructure measures.

optional arguments:
  -h, --help       show this help message and exit
  -v, --version    show program's version number and exit
  -u user          DataScope username
  -p password      DataScope password
  -b begin         begin UTC date (YYYY-MM-DD)
  -e end           end UTC date (YYYY-MM-DD)
  -o out           output file path
  --ric [RIC ...]  RIC of securities to process
  --sp500          if set, process all S&P500 components (extending RIC list, if any)
  --parse          if set, parse the downloaded raw data to output data directory
  --data_dir dir   output data directory (used when --parse is set)

Usage examples

Simple use cases

Download the tick history of Google from 2022-01-01 to 2022-02-01, saved as out.csv.gz in the current working directory:

mktstructure -u XXXXXX -p XXXXXX --ric GOOG.OQ -b 2022-01-01 -e 2022-02-01 -o out.csv.gz

Download the tick history of Google and Apple from 2022-01-01 to 2022-02-01, saved as out.csv.gz in the current working directory:

mktstructure -u XXXXXX -p XXXXXX --ric GOOG.OQ AAPL.OQ -b 2022-01-01 -e 2022-02-01 -o out.csv.gz

Most common use case

Download the tick history of all S&P500 component stocks from 2022-01-01 to 2022-02-01, saved as sp500.csv.gz in the current working directory:

mktstructure -u XXXXXX -p XXXXXX --sp500 -b 2022-01-01 -e 2022-02-01 -o sp500.csv.gz

Or further, download and parse the downloaded data:

mktstructure -u XXXXXX -p XXXXXX --sp500 -b 2022-01-01 -e 2022-02-01 -o sp500.csv.gz --parse --datadir "./data"

After everything's completed, the daily tick history will be stored in ./data folder as specified by the --data_dir option.

PS C:\Users\mgao\Documents\GitHub\mkt-microstructure> ls .\data\


    Directory: C:\Users\mgao\Documents\GitHub\mkt-microstructure\data


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         6/03/2022   3:30 PM                A.N
d-----         6/03/2022   3:30 PM                AAL.OQ
d-----         6/03/2022   3:31 PM                AAP.N
d-----         6/03/2022   3:31 PM                AAPL.OQ

...

d-----         6/03/2022   3:51 PM                ZBH.N
d-----         6/03/2022   3:51 PM                ZBRA.OQ
d-----         6/03/2022   3:51 PM                ZION.OQ
d-----         6/03/2022   3:51 PM                ZTS.N

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mktstructure-0.1.0.tar.gz (13.5 kB view details)

Uploaded Source

File details

Details for the file mktstructure-0.1.0.tar.gz.

File metadata

  • Download URL: mktstructure-0.1.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for mktstructure-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dcea60c380e3a48bb7eca7d443a247905ba6c67a9e4b5b36dddc09f693fb053f
MD5 e42364ccfc9acb7d1a0caee40a74129f
BLAKE2b-256 d01a88e1ae4fcfa6c4e072d35b9d023ee3f75448e18d41a800c4f0d4c92e66ee

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page