portfolioperformance
v1.1.0
أداة لاختبار الأداء خارج العينة لنماذج تحسين المحفظة. بناءً على الورقة: التنويع الأمثل مقابل التنويع الساذج:
لقد قمت أيضًا بتطوير موقع ويب ملعب لهذه الحزمة حتى تتمكن من تشغيل هذه النماذج بسهولة على بياناتك الخاصة. رابط إلى موقع الويب
pip install portfolioperformance
# Each model takes a name parameter
ew = EqualWeight ( "Equal Weight" )
minVar = MinVar ( "Minimum Variance" )
JagannathanMa = JagannathanMa ( "Jagannathan Ma" )
minVarShortSellCon = MinVarShortSellCon ( "Minimum Variance with Short Sell Constrains" )
kanZhouEw = KanZhouEw ( "Kan Zhou EW" )
meanVar = MeanVar ( "Mean Variance (Markowitz)" )
meanVarShortSellCon = MeanVarShortSellCon ( "Mean Variance with Short Sell Constrains" )
kanZhou = KanZhou ( "Kan Zhou Three Fund" )
bayesStein = BayesStein ( "Bayes Stein" )
bayesSteinShortSellCon = BayesSteinShortSellCon ( "Bayes Stein with Short Sell Constrains" )
macKinlayPastor = MacKinlayPastor ( "MacKinlay and Pastor" ) import numpy as np
from portfolioperformance import *
# Risk aversion levels
GAMMAS = [ 1 , 2 , 3 , 4 , 5 , 10 ]
# Time horizons
TIME_HORIZON = [ 60 , 120 ]
benchmark = < benchmark model >
# List of models
models = [
benchmark ,
# <add other list of models>
]
app = App ( < data path > , GAMMAS , TIME_HORIZON , models , dateFormat = < pandas datetime format > ,
dateRange = [ "01011990" , "01012010" ], delim = < "," or " \ s+" > ,
riskFactorPositions = [ positions for risk factor column ],
riskFreePosition = < risk free asset column > )
sr = app . getSharpeRatios ()
sig = app . getStatisticalSignificanceWRTBenchmark ( benchmark )path ( str ): مسار إلى ملف csvgammas ( list[int] ): قائمة قيم GammastimeHorizon ( list[int] ): قائمة آفاق الوقتmodels ( list[Model] ): قائمة فئات النماذجdateFormat ( str ): تنسيق وقت تاريخ Pandas ، افتراضي = "٪ y- ٪ m- ٪ d"dateRange ( [str, str] ): تاريخ البدء والنهاية ، الافتراضي = []delim ( str ): نوع المحدد ، إما "،" أو " s+" (مساحة بيضاء) ، default = "،"logScale ( bool ): ما إذا كانت البيانات في نطاق السجل أم لا ، افتراضيًا = خطأriskFactorPositions ( list ): مواضع عمود أصول عامل الخطر (حيث يكون الموضع 1 هو عمود التاريخ) ، افتراضي = []riskFreePosition ( int ): موقف عمود الأصول الخالية من المخاطر ، الافتراضي = 1 getSharpeRatios() -> dict[str, float]احصل على نسب Sharpe
dict[str, float] : قاموس مع اسم النموذج ونسبة Sharpe كزوج ذو قيمة مفتاح getStatisticalSignificanceWRTBenchmark(benchmark) -> dict[str, float]احصل على الأهمية الإحصائية فيما يتعلق بالنموذج القياسي
حدود:
benchmark ( Model ): نموذج القياسdict[str, float] : قاموس مع اسم النموذج ونسبة Sharpe كزوج ذو قيمة مفتاح git clone https://github.com/sidnand/portfolioperformancepip install -r requirements.txt .
| -- __init__.py # import /src/app.py and all models
| -- /src
| -- app.py # code for running all the optimiation models
| -- model.py # parent class to all the models
| -- modelNoGamma.py # class for models that don't take extra parameters
| -- modelGamma.py # class for models that take an extra gamma parameter; gamma is a list of constants for the investors risk-aversion level
| -- ./models # all the models
| -- ./utils
| -- filter.py # includes a function that is used to filter the parameters passed to a function
| -- quadprog.py # quadratic programming
| -- sharedOptions.py # models options that are in common with >2 models
| -- statistics.py # statistics functionsيرجى إنشاء طلب سحب لتضمين التغييرات الخاصة بك على هذا الريبو. سوف تنعكس هذه التغييرات على موقع الملعب المرتبط أعلاه.
pip install -e . لتثبيت الحزمة محليا.setup.py . يرجى استخدام نظام الإصدار الدلالي 2.0.0. انقر لمعرفة المزيد.python setup.py sdist bdist_wheel لإنشاء عجلة بيثون.1.1.0
quadprog == 0.1.12 تحديثpandas1.0.0
Python <= 3.9.9quadprog <= 0.1.11