Learn practical skills, build real-world projects, and advance your career

Lending Wallet v2

Basic idea: due to the lack of reliable data, we will model our lending wallet based on assumptions.

Assumptions:

  • Daily trading volume: 2, 5, 10, 30, 50, 80 and 100 million USD. (btc/eth/xrp will be allocated proportionally according to historical trading volume)
  • Type of margin: 60%, 70%, 80% and 90%. That is, how much of the daily trading is on margin.
  • 3 virtual clients:
    • Client A: zero initial position
    • Client B: light position (around 50k USD)
    • Client C: heavy position (around 500k USD)

Key problem and the work-around:

  • Problem: determine approved margin level for each trade
  • Method:
    • Single order risk: individual VaR should be no larger than 0.6 * collateral
    • Portfolio risk: new portfolio CoVaR should be no larger than 0.6 * (collateral + locked margin)

Data set used:

  • For risk calculation: SFOX's internal daily data from 2020-1-1 to 2020-6-31
  • For pricing: in-house minute-wise data
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from datetime import datetime
import jovian
jovian.commit()
[jovian] Attempting to save notebook.. [jovian] Uploading notebook.. [jovian] Capturing environment.. [jovian] Committed successfully! https://jovian.ml/alexander/lending-wallet-v2

Step 1: set-up