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 compute some market microstructure measures.
Installation
You can install mktstructure
via pip
:
pip install mktstructure
Quick Start
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
Sub-commands:
Choose one from the following. Use `mktstructure subcommand -h` to see help for each sub-command.
{download,clean,classify,compute}
download Download data from Refinitiv Tick History
clean Clean downloaded data
classify Classify ticks into buy and sell orders
compute Compute market microstructure measures
1. Download data
Let's download the tick history for all S&P500 component stocks from Jan 1, 2022, to Jan 31, 2022:
mktstructure download -u {username} -p {password} --sp500 --parse --data_dir "./data" -b 2022-01-01 -e 2022-01-31
where {username}
and {password}
are the login credentials of Refinitiv DataScope Select.
Note that we set the --parse
flag to parse the downloaded data (gzip) into csv files by stock and date into the ./data
folder.
2. Clean data
Then we clean the downloaded and parsed data in the ./data
folder: sorting by time, removing duplicates, etc.
mktstructure clean --all --data_dir "./data" --replace
The --replace
flag, if set, asks the program to replace the data file with the cleaned one to save disk space.
3. Classify trade directions
Use the classify
subcommand to classify trades into buys and sells by the Lee and Ready (1991) algorithm.
mktstructure classify --all --data_dir "./data"
4. Compute
Lastly, use the compute
subcommand to compute specified market microstructure measures:
mktstructure compute --all --data_dir "./data" --out bidaskspread.csv --bid_ask_spread
Note
This tool is still a work in progress. Some breaking changes may be expected but will be kept minimal.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file mktstructure-0.2.4.tar.gz
.
File metadata
- Download URL: mktstructure-0.2.4.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6432c2352b667dbac5181ad14fb4779873744facb23cccce2c276d1d0d3522f6 |
|
MD5 | a0164e9f24a619ff6df7052c3ae479cb |
|
BLAKE2b-256 | dd34eb266b8150f5736c66f5a6e2327689eeed56f2af96da2361d5da453146d0 |