-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathportfolio.go
55 lines (46 loc) · 1.14 KB
/
portfolio.go
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
Portfolio Management V0.1
Perform analysis of portfolios composed of different combinations
of securities.
*/
package portfolio
// StockScenario defines a scenario for a set of securities and timeframe.
// Each stock is assigned a given percent of the portfolio. The stock is
// rebalanced at specific times. Currently rebalance is the 15th of the month
// but this may change in the future.
type StockScenario struct {
StartDate string
EndDate string
StartAmt float64
EndAmt float64
GeomeanPctChg float64
Variance float64
StdDev float64
SharpeRatio float64
PctChange float64
Stocks []*Stock
PctHolding []float64
Results []ScenarioResults
}
// Daily results of the portfolio value.
type ScenarioResults struct {
Date string
Shares []float64
StockHistIdx []int
Value float64
ChangeValue float64
PctChange float64
}
// Stock information, ticker and history.
type Stock struct {
Ticker string
History []StockHistory
}
// Stock history
type StockHistory struct {
Date string
Close float64
Dividend float64
Distribution float64
}
const MaxDate = "4000-01-01"