👉 Read our data story online using the following link 🚀
The financial world of equity trading relies on centralised exchanges. These exchanges are disseminated around the globe. Thus, it is sometimes possible to trade a share of one given company in multiple regions. Arbitrage pricing theory tells us that the price on those exchanges should roughly be equivalent. However, because information speed is bounded, shocks on a given share price might take some time to reach all exchanges and be incorporated into the new stock prices.
This repository contains all the files used to analyse the price propagation delay for Shell's stock (RDSA) across multiple exchanges. It is organised into multiple folders and notebooks.
The repository contains the following folders :
figures
: this folder contains HTML version of all theplotly
figures produced during the analysis.helpers
: contains multiplepython
scripts used to process, load and extract information from the raw data. It also contains theconfig.yml
file. More details about these files here.results
: folder containing results of big computations such as thelags
time series.scripts
: contains a script used to efficiently push figures on the desired GitHub branch.
Most of the analysis is performed through notebooks. They all used the helper function defined in ./helper and are organised as follows :
data_exploration.ipynb
: first glance at the raw data. It contains the experiments that we conducted on the data to understand how to approach the problem. We also developed thepeak_finding
algorithm in that notebook.lag_computer_dask.ipynb
: combines thepeak_finding
algorithm with Dask helpers to compute and save (into theresults
folder) the daily lags.liquidity_computer.ipynb
: compute theliquidity
metric (daily median of the period between two consecutive trades) using Dask.mean_price_and_ret_extractor.ipynb
: extracts (using dask) the daily mean price and returns from the data files (one file per day) into time series.results_exploration.ipynb
: in this notebook, we study the obtained results (lags
) and generate multiple plots out of them. These plots are saved in thefigures
folder.viz.ipynb
: contains interactive visualisation of the data.viz_globe.ipynb
: contains a visual comparison of thelags
with the distance separating exchanges using a world globe.simple_stats.ipynb
: contains some simple statistics (average number of trades per day...)
runtime.txt
: file created by Heroku. Do not modify it.requirements.txt
: text file containing the requirements to run the code.
To run the analysis by yourself follow the described steps :
- run the command
pip install -r requirements.txt
to obtain the needed libraries to run the code. - edit the
helpers/config.yml
file to choose the signal to work with :trade
ofbbo
. - Download the data (here) into a folder named
data
. Note that you need access rights to use the mentioned link. - Run the "computational" notebooks :
lag_computer_dask.ipynb
,liquidity_computer.ipynb
andmean_price_and_ret_extractor.ipynb
. - Run the analysis and visualisation notebooks :
data_exploration.ipynb
,results_exploration.ipynb
,viz.ipynb
,simple_stats.ipynb
andviz_globe.ipynb
.