New answers tagged python
The code below pulls AAPL time series from Yahoo Finance, computes mean/std and simulates 100 paths that are 20 days long. Input: import pandas as pd import numpy as np from numpy.random import normal # bring data ticker = 'AAPL' url = 'http://real-chart.finance.yahoo.com/table.csv?s=%s' % ticker data = pd.read_csv(url, index_col='Date', parse_dates=True) ...
If you want to use GBM in the physical measure then just calculate the standard deviation of log returns to get $\sigma$. For $\mu$ there are many choices. If you want to calibrate GBM to get option prices then you need the implied volatility and there is a package. The OP said that he/she wants to simulate paths. If you don't want to price derivatives ...
Take a look at pinkfish. Disclaimer, I am the author. http://fja05680.github.io/pinkfish/
Slight correction: the package in R is called rmgarch, not mgarch. It works well with rugarch, which provides a variety of univariate GARCH models. Both packages allow for parallelized computation on local cluster and return a nice and full set of fitted parameters, model specs, etc. I provided some additional links in this post.
What you need is more mutual information rather than Shannon entropy. It is dedicated to capture the influence of one variable on another (you can think about it as a non linear version of Pearson correlations). They are closely related since the mutual information $I$ between two variables $X$ and $Y$ reads: $$I(X;Y) = H(X,Y) - H(X|Y) - H(Y|X)$$ where $H$ ...
I calculate duration in Python using numpy, it's nice and simple: def durations(cfs, rates, price, ytm, no_coupons): import numpy as np mac_dur = np.sum([cfs[i]*i/np.power(1+rates[i],i) for i in range(len(cfs))])/price mod_dur = mac_dur/(1+ytm/no_coupons) return mac_dur, mod_dur
Native support is very limited. TradeStation's WebAPI pretty much works with any language because it is wrapped in HTTP calls using RESTful. If a platform has an API that supports std C/C++ interfaces, you can write a wrapper to extend the API to python. Search for "Calling C from Python". It is more work to code, but otherwise your choices are very ...
Top 50 recent answers are included