lyc0603 / tvl-measurement

Repository for the study of TVL double counting issue.
MIT License
1 stars 1 forks source link

tvl-measurement

python

Repository for the study of TVL double counting issue.

Clone this repository

git clone https://github.com/lyc0603/tvl-measurement.git

Navigate to the directory of the cloned repo

cd tvl-measurement

Installation

To install the latest release on PyPI <https://pypi.org/project/toml/>_, run:

  pip install toml

Set up the repo

Create a python virtual environment

python3 -m venv venv
python -m venv venv

Activate the virtual environment

. venv/bin/activate
venv\Scripts\activate.bat

Install the project in editable mode

pip install -e ".[dev]"

Connect to a full node to fetch on-chain data

Connect to a full node using ssh with port forwarding flag -L on:

ssh -L 8545:localhost:8545 satoshi.doc.ic.ac.uk

Assign URI value to WEB3_PROVIDER_URI in a new terminal:

set -xg WEB3_PROVIDER_URI http://localhost:8545

Git Large File Storage (Git LFS)

All files in data/ are stored with lfs.

To initialize Git LFS:

git lfs install
git lfs track data/**/*

To pull data files, use

git lfs pull

Synchronize with the repo

Always pull latest code first

git pull

Make changes locally, save. And then add, commit and push

git add [file-to-add]
git commit -m "update message"
git push

Best practice

Coding Style

We follow PEP8 coding format. The most important rules above all:

  1. Keep code lines length below 80 characters. Maximum 120. Long code lines are NOT readable.
  2. We use snake_case to name function, variables. CamelCase for classes.
  3. We make our code as DRY (Don't repeat yourself) as possible.
  4. We give a description to classes, methods and functions.
  5. Variables should be self explaining and just right long:
    • implied_volatility is preferred over impl_v
    • implied_volatility is preferred over implied_volatility_from_broker_name

Do not

  1. Do not place .py files at root level (besides setup.py)!
  2. Do not upload big files > 100 MB.
  3. Do not upload log files.
  4. Do not declare constant variables in the MIDDLE of a function