Last active
October 11, 2018 11:56
-
-
Save yogiben/648ba7396e60e9c4345a210ef032986a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import numpy as np | |
from riskMeasurement import readEodPrices, calcEodReturns, calcAggregatedReturn, calcVcVar | |
eodPrices = readEodPrices('eodTs_BTC_EUR.csv') | |
eodReturns = calcEodReturns(eodPrices) | |
aggregatedReturns = calcAggregatedReturn(eodReturns) | |
currentBtcEur = 5000 | |
btcHeld = 500 | |
def valuationFunction(currentPrices): | |
return btcHeld * currentPrices | |
# 1-year VaR 99% | |
oneYear99 = calcVcVar(eodReturns, np.array([currentBtcEur]), valuationFunction, 365, 0.01) | |
# VaR limit | |
# Provided by sB | |
# VaR limit utilisation | |
limitUtilisation = oneYear99 / varLimit | |
# 1 day VaR 99% | |
oneDay99 = calcVcVar(eodReturns, np.array([currentBtcEur]), valuationFunction, 1, 0.01) | |
# 1 year VaR 99.5% | |
oneYear99point5 = calcVcVar(eodReturns, np.array([currentBtcEur]), valuationFunction, 1, 0.005) | |
# 1 year Var 99.9 | |
oneYear99point9 = oneYear99point5 = calcVcVar(eodReturns, np.array([currentBtcEur]), valuationFunction, 1, 0.001) | |
# total loss VaR | |
totalLoss = currentBtcEur * btcHeld | |
# 1 year max VaR | |
# max value of eodReturns | |
# 10 day VaR (assuming 99%) | |
tenDay = calcVcVar(eodReturns, np.array([currentBtcEur]), valuationFunction, 10, 0.01) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment