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 ): PATH ไปยังไฟล์ csvgammas ( list[int] ): รายการค่าแกมม่าtimeHorizon ( list[int] ): รายการเวลาอันไกล่เกลี่ยmodels ( list[Model] ): รายการคลาสโมเดลdateFormat ( str ): รูปแบบเวลาวันที่แพนด้า, ค่าเริ่มต้น = "%y-%m-%d"dateRange ( [str, str] ): วันที่เริ่มต้นและสิ้นสุด, default = []delim ( str ): ประเภทการพนันไม่ว่าจะ "," หรือ " s+" (Whitespace), default = ","logScale ( bool ): ไม่ว่าข้อมูลจะอยู่ในระดับบันทึกค่าเริ่มต้น = false หรือไม่riskFactorPositions ( list ): ตำแหน่งคอลัมน์สินทรัพย์ปัจจัยความเสี่ยง (ตำแหน่งที่ 1 คือคอลัมน์วันที่), default = []riskFreePosition ( int ): ตำแหน่งคอลัมน์สินทรัพย์ที่ปราศจากความเสี่ยงค่าเริ่มต้น = 1 getSharpeRatios() -> dict[str, float]รับอัตราส่วนชาร์ป
dict[str, float] : พจนานุกรมที่มีชื่อรุ่นและอัตราส่วนชาร์ปเป็นคู่ที่มีค่าคีย์ getStatisticalSignificanceWRTBenchmark(benchmark) -> dict[str, float]รับนัยสำคัญทางสถิติเกี่ยวกับโมเดลมาตรฐาน
พารามิเตอร์:
benchmark ( Model ): โมเดลมาตรฐานdict[str, float] : พจนานุกรมที่มีชื่อแบบจำลองและอัตราส่วนชาร์ปเป็นคู่ที่มีค่าคีย์ 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โปรดสร้างคำแนะนำแบบดึงเพื่อรวมการเปลี่ยนแปลงของคุณลงใน repo นี้ การเปลี่ยนแปลงเหล่านี้จะปรากฏบนเว็บไซต์สนามเด็กเล่นที่เชื่อมโยงด้านบน
pip install -e . เพื่อติดตั้งแพ็คเกจในเครื่องsetup.py โปรดใช้ระบบความหมายเวอร์ชัน 2.0.0 คลิกเพื่อเรียนรู้เพิ่มเติมpython setup.py sdist bdist_wheel เพื่อสร้างล้องูหลาม1.1.0
quadprog == 0.1.12 อัปเดตpandas ล่าสุด1.0.0
Python <= 3.9.9quadprog <= 0.1.11