Skip to content

Commit

Permalink
second run dow30 daily
Browse files Browse the repository at this point in the history
  • Loading branch information
enzbus committed Dec 27, 2023
1 parent 08bff9a commit 1b5397a
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 5 deletions.
17 changes: 12 additions & 5 deletions examples/strategies/dow30_daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
itself, and an index ETF which tracks the Dow Jones.
We will see how it performs online.
You run it from the root of the repository in the development environment by:
.. code:: bash
python -m examples.strategies.dow30daily
"""

import cvxportfolio as cvx
Expand Down Expand Up @@ -62,15 +69,15 @@ def hyperparameter_optimize():
}

def execute_strategy(current_holdings, market_data, gamma_risk, gamma_trade):
"""_summary_
"""Execute this strategy.
:param current_holdings: _description_
:param current_holdings: Current holdings in dollars.
:type current_holdings: pandas.Series
:param market_data: _description_
:param market_data: Market data server.
:type market_data: cvxportfolio.data.MarketData
:param gamma_risk: _description_
:param gamma_risk: Risk aversion multiplier
:type gamma_risk: float
:param gamma_trade: _description_
:param gamma_trade: Transaction cost aversion multiplier.
:type gamma_trade: float
:return: Output of the execute method of a Cvxportfolio policy.
Expand Down
33 changes: 33 additions & 0 deletions examples/strategies/dow30_daily_initial_holdings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,38 @@
"VZ": 0.0,
"WBA": 0.0,
"WMT": 0.0
},
"2023-12-27 14:30:00+00:00": {
"AAPL": 246579.69703674305,
"AMGN": 29872.49999999998,
"AXP": 0.0,
"BA": 0.0,
"CAT": 0.0,
"CRM": 77388.54071044918,
"CSCO": 48005.3805847168,
"CVX": 0.0,
"DIS": 0.0,
"DOW": 0.0,
"GS": 0.0,
"HD": 109171.92114257811,
"HON": 0.0,
"IBM": 0.0,
"INTC": 0.0,
"JNJ": 0.0,
"JPM": 0.0,
"KO": 0.0,
"MCD": 2329.760009765625,
"MMM": 0.0,
"MRK": 0.0,
"MSFT": 287625.0,
"NKE": 3465.60009765625,
"PG": 0.0,
"TRV": 0.0,
"UNH": 100336.84094238281,
"USDOLLAR": -62.670703622057644,
"V": 77558.99963378906,
"VZ": 0.0,
"WBA": 0.0,
"WMT": 16761.549346923828
}
}
33 changes: 33 additions & 0 deletions examples/strategies/dow30_daily_target_weights.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,38 @@
"VZ": 5.397329043378718e-10,
"WBA": 1.0853776483959217e-09,
"WMT": 0.016696481121971495
},
"2023-12-27 14:30:00+00:00": {
"AAPL": 0.24589078777885695,
"AMGN": 0.0299014082321686,
"AXP": 5.499284657873057e-10,
"BA": 1.2890275184764871e-09,
"CAT": 4.955832115024613e-10,
"CRM": 0.08252239762708234,
"CSCO": 0.048051850130132155,
"CVX": 5.38934815608656e-10,
"DIS": 8.080166328161634e-10,
"DOW": 1.048542837181586e-09,
"GS": 5.206068454752672e-10,
"HD": 0.11114191311572022,
"HON": 3.8044934528264073e-10,
"IBM": 2.935982923134919e-10,
"INTC": 9.450614762250101e-10,
"JNJ": 7.439909165865663e-10,
"JPM": 1.1381789182932963e-09,
"KO": 5.426247696360391e-10,
"MCD": 3.0376189662575936e-09,
"MMM": 3.495765521810727e-10,
"MRK": 5.904313178512819e-10,
"MSFT": 0.28790334541736873,
"NKE": 0.0031106705871322706,
"PG": 4.388155901786739e-10,
"TRV": 3.942059392166395e-10,
"UNH": 0.10043395088713987,
"USDOLLAR": 4.205589951701387e-09,
"V": 0.07691135411449629,
"VZ": 3.760828029968684e-10,
"WBA": 6.436843790614438e-10,
"WMT": 0.01413230277935307
}
}

0 comments on commit 1b5397a

Please sign in to comment.