Python for Finance: Analyze Big Financial Data
LANGUAGE The MPT example shows again how efficient it is with Python to translate mathematical concepts, l ...
portfolio statistics for an input weights vector/array: In [ 47 ]: def statistics(weights): ”’ Returns portfolio statis ...
fun: -1.0597540702789927 ...
tret and one for the sum of the portfolio weights as before. The boundary values for each parameter stay the same: ...
Figure 11-13. Minimum risk portfolios for given return level (crosses) The efficient frontier is comprised ...
Since we do not have a closed formula for the efficient frontier or the first derivative of it, we have to ...
plt.grid(True) plt.axhline( 0 , color=‘k’, ls=‘—’, lw=2.0) plt.axvline( 0 , color=‘k’, ls=‘—’, lw=2.0) plt.xlabel(‘expec ...
Principal Component Analysis Principal component analysis (PCA) has become a popular tool in finance. Wiki ...
Wall time: 5.61 s Let us separate the index data since we need it reg ...
Figure 11-15 shows the results for normalized data — already not too bad, given the rather simple application of ...
mpl_dates Out[17]: array([ 733776., 733777., 733778., ..., 735500., 735501., 735502.]) ...
Figure 11-18. DAX index values against PCA index values with early and late regression (regime switch) ...
Bayesian Regression Bayesian statistics nowadays is a cornerstone in empirical finance. This chapter cannot ...
B 2 is twice as high as for the same event happening with box B 1 . Therefore, having drawn a black ...
plt.ylabel(‘y’) Figure 11-19. Sample data points and regression line The result of the “standard” regression ap ...
# model specifications in PyMC3 # are wrapped in a with statement # define priors alpha = pm.Normal(‘alpha’ ...
In [ 30 ]: plt.figure(figsize=( 8 , 4 )) plt.scatter(x, y, c=y, marker=‘v’) plt.colorbar() plt.grid(True) plt.xlabel(‘ ...
Out[32]: GLD GDX <class ‘pandas.core.frame.DataFr ...
plt.xlabel(‘GDX’) plt.ylabel(‘GLD’) plt.colorbar(ticks=mpl.dates.DayLocator(interval= 250 ), format=mpl.dates.DateFormatter(’%d ...
Figure 11-24. Trace plots for alpha, beta, and sigma based on GDX and GLD data Figure 11-25 adds all the re ...
«
11
12
13
14
15
16
17
18
19
20
»
Free download pdf