forked from finanzascuantitativasfc/codigos_clase_2021-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path05_hedge.py
40 lines (35 loc) · 1.15 KB
/
05_hedge.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 21 09:39:52 2021
@author: Meva
"""
import numpy as np
import pandas as pd
import matplotlib as mpl
import scipy
import importlib
import matplotlib.pyplot as plt
from scipy.stats import skew, kurtosis, chi2, linregress
from scipy.optimize import minimize
# import our own files and reload
import file_classes
importlib.reload(file_classes)
import file_functions
importlib.reload(file_functions)
# inputs
inputs = file_classes.hedge_input()
inputs.benchmark = '^STOXX50E'
# inputs.security = 'ENI.MI'
inputs.security = 'REP.MC'
inputs.hedge_securities = ['BP.L','ENI.MI','RDSa.AS','RDSa.L','EQNR.OL','XOP']
# inputs.hedge_securities = ['EQNR.OL','REP.MC']
# inputs.hedge_securities = ['^GDAXI','^FCHI']
# inputs.hedge_securities = ['^STOXX50E','^GDAXI','^FCHI']
# inputs.hedge_securities = ['^STOXX50E']
inputs.delta_portfolio = 10 # mn USD
# computations
hedge = file_classes.hedge_manager(inputs)
hedge.load_betas() # get the betas for portfolio and hedges
hedge.compute(regularisation=0.1) # numerical solution
hedge_delta = hedge.hedge_delta
hedge_beta_usd = hedge.hedge_beta_usd