|
39 | 39 | my_system = System([my_rules], data)
|
40 | 40 | print(my_system)
|
41 | 41 |
|
42 |
| -print(my_system.rules.get_raw_forecast("EDOLLAR", "ewmac").tail(5)) |
| 42 | +print(my_system.rules.get_raw_forecast("SOFR", "ewmac").tail(5)) |
43 | 43 | """
|
44 | 44 | Define a TradingRule
|
45 | 45 | """
|
|
59 | 59 | print(my_rules.trading_rules()["ewmac32"])
|
60 | 60 |
|
61 | 61 | my_system = System([my_rules], data)
|
62 |
| -my_system.rules.get_raw_forecast("EDOLLAR", "ewmac32").tail(5) |
| 62 | +my_system.rules.get_raw_forecast("SOFR", "ewmac32").tail(5) |
63 | 63 |
|
64 | 64 | from sysdata.config.configdata import Config
|
65 | 65 |
|
|
69 | 69 | empty_rules = Rules()
|
70 | 70 | my_config.trading_rules = dict(ewmac8=ewmac_8, ewmac32=ewmac_32)
|
71 | 71 | my_system = System([empty_rules], data, my_config)
|
72 |
| -my_system.rules.get_raw_forecast("EDOLLAR", "ewmac32").tail(5) |
| 72 | +my_system.rules.get_raw_forecast("SOFR", "ewmac32").tail(5) |
73 | 73 |
|
74 | 74 | from systems.forecast_scale_cap import ForecastScaleCap
|
75 | 75 |
|
76 | 76 | # we can estimate these ourselves
|
77 |
| -my_config.instruments = ["US10", "EDOLLAR", "CORN", "SP500_micro"] |
| 77 | +my_config.instruments = ["US10", "SOFR", "CORN", "SP500_micro"] |
78 | 78 | my_config.use_forecast_scale_estimates = True
|
79 | 79 |
|
80 | 80 | fcs = ForecastScaleCap()
|
81 | 81 | my_system = System([fcs, my_rules], data, my_config)
|
82 | 82 | my_config.forecast_scalar_estimate["pool_instruments"] = False
|
83 |
| -print(my_system.forecastScaleCap.get_forecast_scalar("EDOLLAR", "ewmac32").tail(5)) |
| 83 | +print(my_system.forecastScaleCap.get_forecast_scalar("SOFR", "ewmac32").tail(5)) |
84 | 84 |
|
85 | 85 | # or we can use the values from the book
|
86 | 86 | my_config.forecast_scalars = dict(ewmac8=5.3, ewmac32=2.65)
|
87 | 87 | my_config.use_forecast_scale_estimates = False
|
88 | 88 | fcs = ForecastScaleCap()
|
89 | 89 | my_system = System([fcs, my_rules], data, my_config)
|
90 |
| -print(my_system.forecastScaleCap.get_capped_forecast("EDOLLAR", "ewmac32").tail(5)) |
| 90 | +print(my_system.forecastScaleCap.get_capped_forecast("SOFR", "ewmac32").tail(5)) |
91 | 91 | """
|
92 | 92 | combine some rules
|
93 | 93 | """
|
|
97 | 97 | # defaults
|
98 | 98 | combiner = ForecastCombine()
|
99 | 99 | my_system = System([fcs, my_rules, combiner], data, my_config)
|
100 |
| -print(my_system.combForecast.get_forecast_weights("EDOLLAR").tail(5)) |
101 |
| -print(my_system.combForecast.get_forecast_diversification_multiplier("EDOLLAR").tail(5)) |
| 100 | +print(my_system.combForecast.get_forecast_weights("SOFR").tail(5)) |
| 101 | +print(my_system.combForecast.get_forecast_diversification_multiplier("SOFR").tail(5)) |
102 | 102 |
|
103 | 103 | # estimates:
|
104 | 104 | from systems.accounts.accounts_stage import Account
|
|
135 | 135 | my_system = System(
|
136 | 136 | [fcs, empty_rules, combiner, raw_data, position_size], data, my_config
|
137 | 137 | ) # no need for accounts if no estimation done
|
138 |
| -my_system.combForecast.get_combined_forecast("EDOLLAR").tail(5) |
| 138 | +my_system.combForecast.get_combined_forecast("SOFR").tail(5) |
139 | 139 |
|
140 | 140 | # size positions
|
141 | 141 |
|
|
146 | 146 |
|
147 | 147 | my_system = System([fcs, my_rules, combiner, possizer, raw_data], data, my_config)
|
148 | 148 |
|
149 |
| -print(my_system.positionSize.get_price_volatility("EDOLLAR").tail(5)) |
150 |
| -print(my_system.positionSize.get_block_value("EDOLLAR").tail(5)) |
151 |
| -print(my_system.positionSize.get_underlying_price("EDOLLAR")) |
152 |
| -print(my_system.positionSize.get_instrument_value_vol("EDOLLAR").tail(5)) |
153 |
| -print(my_system.positionSize.get_volatility_scalar("EDOLLAR").tail(5)) |
| 149 | +print(my_system.positionSize.get_price_volatility("SOFR").tail(5)) |
| 150 | +print(my_system.positionSize.get_block_value("SOFR").tail(5)) |
| 151 | +print(my_system.positionSize.get_underlying_price("SOFR")) |
| 152 | +print(my_system.positionSize.get_instrument_value_vol("SOFR").tail(5)) |
| 153 | +print(my_system.positionSize.get_volatility_scalar("SOFR").tail(5)) |
154 | 154 | print(my_system.positionSize.get_vol_target_dict())
|
155 |
| -print(my_system.positionSize.get_subsystem_position("EDOLLAR").tail(5)) |
| 155 | +print(my_system.positionSize.get_subsystem_position("SOFR").tail(5)) |
156 | 156 |
|
157 | 157 | # portfolio - estimated
|
158 | 158 | from systems.portfolio import Portfolios
|
|
178 | 178 | portfolio = Portfolios()
|
179 | 179 | my_config.use_instrument_weight_estimates = False
|
180 | 180 | my_config.use_instrument_div_mult_estimates = False
|
181 |
| -my_config.instrument_weights = dict(US10=0.1, EDOLLAR=0.4, CORN=0.3, SP500=0.2) |
| 181 | +my_config.instrument_weights = dict(US10=0.1, SOFR=0.4, CORN=0.3, SP500=0.2) |
182 | 182 | my_config.instrument_div_multiplier = 1.5
|
183 | 183 |
|
184 | 184 | my_system = System(
|
185 | 185 | [fcs, my_rules, combiner, possizer, portfolio, raw_data], data, my_config
|
186 | 186 | )
|
187 | 187 |
|
188 |
| -print(my_system.portfolio.get_notional_position("EDOLLAR").tail(5)) |
| 188 | +print(my_system.portfolio.get_notional_position("SOFR").tail(5)) |
189 | 189 | """
|
190 | 190 | Have we made some dosh?
|
191 | 191 | """
|
|
207 | 207 | my_config = Config(
|
208 | 208 | dict(
|
209 | 209 | trading_rules=dict(ewmac8=ewmac_8, ewmac32=ewmac_32),
|
210 |
| - instrument_weights=dict(US10=0.1, EDOLLAR=0.4, CORN=0.3, SP500_micro=0.2), |
| 210 | + instrument_weights=dict(US10=0.1, SOFR=0.4, CORN=0.3, SP500_micro=0.2), |
211 | 211 | instrument_div_multiplier=1.5,
|
212 | 212 | forecast_scalars=dict(ewmac8=5.3, ewmac32=2.65),
|
213 | 213 | forecast_weights=dict(ewmac8=0.5, ewmac32=0.5),
|
|
231 | 231 | data,
|
232 | 232 | my_config,
|
233 | 233 | )
|
234 |
| -print(my_system.portfolio.get_notional_position("EDOLLAR").tail(5)) |
| 234 | +print(my_system.portfolio.get_notional_position("SOFR").tail(5)) |
235 | 235 | """
|
236 | 236 | ... or to import one
|
237 | 237 | """
|
|
250 | 250 | data,
|
251 | 251 | my_config,
|
252 | 252 | )
|
253 |
| -print(my_system.rules.get_raw_forecast("EDOLLAR", "ewmac32").tail(5)) |
254 |
| -print(my_system.rules.get_raw_forecast("EDOLLAR", "ewmac8").tail(5)) |
255 |
| -print(my_system.forecastScaleCap.get_capped_forecast("EDOLLAR", "ewmac32").tail(5)) |
256 |
| -print(my_system.forecastScaleCap.get_forecast_scalar("EDOLLAR", "ewmac32")) |
257 |
| -print(my_system.combForecast.get_combined_forecast("EDOLLAR").tail(5)) |
258 |
| -print(my_system.combForecast.get_forecast_weights("EDOLLAR").tail(5)) |
| 253 | +print(my_system.rules.get_raw_forecast("SOFR", "ewmac32").tail(5)) |
| 254 | +print(my_system.rules.get_raw_forecast("SOFR", "ewmac8").tail(5)) |
| 255 | +print(my_system.forecastScaleCap.get_capped_forecast("SOFR", "ewmac32").tail(5)) |
| 256 | +print(my_system.forecastScaleCap.get_forecast_scalar("SOFR", "ewmac32")) |
| 257 | +print(my_system.combForecast.get_combined_forecast("SOFR").tail(5)) |
| 258 | +print(my_system.combForecast.get_forecast_weights("SOFR").tail(5)) |
259 | 259 |
|
260 |
| -print(my_system.positionSize.get_subsystem_position("EDOLLAR").tail(5)) |
| 260 | +print(my_system.positionSize.get_subsystem_position("SOFR").tail(5)) |
261 | 261 |
|
262 |
| -print(my_system.portfolio.get_notional_position("EDOLLAR").tail(5)) |
| 262 | +print(my_system.portfolio.get_notional_position("SOFR").tail(5)) |
0 commit comments