Skip to content

Commit d482209

Browse files
author
rob
committed
replaced edollar with sofr
1 parent 38a7c63 commit d482209

File tree

5 files changed

+64
-64
lines changed

5 files changed

+64
-64
lines changed

examples/introduction/simplesystem.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
my_system = System([my_rules], data)
4040
print(my_system)
4141

42-
print(my_system.rules.get_raw_forecast("EDOLLAR", "ewmac").tail(5))
42+
print(my_system.rules.get_raw_forecast("SOFR", "ewmac").tail(5))
4343
"""
4444
Define a TradingRule
4545
"""
@@ -59,7 +59,7 @@
5959
print(my_rules.trading_rules()["ewmac32"])
6060

6161
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)
6363

6464
from sysdata.config.configdata import Config
6565

@@ -69,25 +69,25 @@
6969
empty_rules = Rules()
7070
my_config.trading_rules = dict(ewmac8=ewmac_8, ewmac32=ewmac_32)
7171
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)
7373

7474
from systems.forecast_scale_cap import ForecastScaleCap
7575

7676
# we can estimate these ourselves
77-
my_config.instruments = ["US10", "EDOLLAR", "CORN", "SP500_micro"]
77+
my_config.instruments = ["US10", "SOFR", "CORN", "SP500_micro"]
7878
my_config.use_forecast_scale_estimates = True
7979

8080
fcs = ForecastScaleCap()
8181
my_system = System([fcs, my_rules], data, my_config)
8282
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))
8484

8585
# or we can use the values from the book
8686
my_config.forecast_scalars = dict(ewmac8=5.3, ewmac32=2.65)
8787
my_config.use_forecast_scale_estimates = False
8888
fcs = ForecastScaleCap()
8989
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))
9191
"""
9292
combine some rules
9393
"""
@@ -97,8 +97,8 @@
9797
# defaults
9898
combiner = ForecastCombine()
9999
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))
102102

103103
# estimates:
104104
from systems.accounts.accounts_stage import Account
@@ -135,7 +135,7 @@
135135
my_system = System(
136136
[fcs, empty_rules, combiner, raw_data, position_size], data, my_config
137137
) # 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)
139139

140140
# size positions
141141

@@ -146,13 +146,13 @@
146146

147147
my_system = System([fcs, my_rules, combiner, possizer, raw_data], data, my_config)
148148

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))
154154
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))
156156

157157
# portfolio - estimated
158158
from systems.portfolio import Portfolios
@@ -178,14 +178,14 @@
178178
portfolio = Portfolios()
179179
my_config.use_instrument_weight_estimates = False
180180
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)
182182
my_config.instrument_div_multiplier = 1.5
183183

184184
my_system = System(
185185
[fcs, my_rules, combiner, possizer, portfolio, raw_data], data, my_config
186186
)
187187

188-
print(my_system.portfolio.get_notional_position("EDOLLAR").tail(5))
188+
print(my_system.portfolio.get_notional_position("SOFR").tail(5))
189189
"""
190190
Have we made some dosh?
191191
"""
@@ -207,7 +207,7 @@
207207
my_config = Config(
208208
dict(
209209
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),
211211
instrument_div_multiplier=1.5,
212212
forecast_scalars=dict(ewmac8=5.3, ewmac32=2.65),
213213
forecast_weights=dict(ewmac8=0.5, ewmac32=0.5),
@@ -231,7 +231,7 @@
231231
data,
232232
my_config,
233233
)
234-
print(my_system.portfolio.get_notional_position("EDOLLAR").tail(5))
234+
print(my_system.portfolio.get_notional_position("SOFR").tail(5))
235235
"""
236236
... or to import one
237237
"""
@@ -250,13 +250,13 @@
250250
data,
251251
my_config,
252252
)
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))
259259

260-
print(my_system.positionSize.get_subsystem_position("EDOLLAR").tail(5))
260+
print(my_system.positionSize.get_subsystem_position("SOFR").tail(5))
261261

262-
print(my_system.portfolio.get_notional_position("EDOLLAR").tail(5))
262+
print(my_system.portfolio.get_notional_position("SOFR").tail(5))

systems/provided/futures_chapter15/futuresestimateconfig.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,5 @@ base_currency: "USD"
9090
#
9191
# Portfolio creation
9292
#
93-
instruments: ['EDOLLAR','US10','EUROSTX', 'MXP', 'CORN', 'V2X']
93+
instruments: ['SOFR','US10','EUROSTX', 'MXP', 'CORN', 'V2X']
9494

systems/rawdata.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def daily_returns(self, instrument_code: str) -> pd.Series:
105105
>>>
106106
>>> (rawdata, data, config)=get_test_object()
107107
>>> system=System([rawdata], data)
108-
>>> system.rawdata.daily_returns("EDOLLAR").tail(2)
108+
>>> system.rawdata.daily_returns("SOFR").tail(2)
109109
price
110110
2015-12-10 -0.0650
111111
2015-12-11 0.1075
@@ -145,22 +145,22 @@ def daily_returns_volatility(self, instrument_code: str) -> pd.Series:
145145
>>> (rawdata, data, config)=get_test_object()
146146
>>> system=System([rawdata], data)
147147
>>> ## uses defaults
148-
>>> system.rawdata.daily_returns_volatility("EDOLLAR").tail(2)
148+
>>> system.rawdata.daily_returns_volatility("SOFR").tail(2)
149149
vol
150150
2015-12-10 0.054145
151151
2015-12-11 0.058522
152152
>>>
153153
>>> from sysdata.config.configdata import Config
154154
>>> config=Config("systems.provided.example.exampleconfig.yaml")
155155
>>> system=System([rawdata], data, config)
156-
>>> system.rawdata.daily_returns_volatility("EDOLLAR").tail(2)
156+
>>> system.rawdata.daily_returns_volatility("SOFR").tail(2)
157157
vol
158158
2015-12-10 0.054145
159159
2015-12-11 0.058522
160160
>>>
161161
>>> config=Config(dict(volatility_calculation=dict(func="sysquant.estimators.vol.robust_vol_calc", days=200)))
162162
>>> system2=System([rawdata], data, config)
163-
>>> system2.rawdata.daily_returns_volatility("EDOLLAR").tail(2)
163+
>>> system2.rawdata.daily_returns_volatility("SOFR").tail(2)
164164
vol
165165
2015-12-10 0.057946
166166
2015-12-11 0.058626
@@ -222,7 +222,7 @@ def get_daily_percentage_volatility(self, instrument_code: str) -> pd.Series:
222222
>>>
223223
>>> (rawdata, data, config)=get_test_object()
224224
>>> system=System([rawdata], data)
225-
>>> system.rawdata.get_daily_percentage_volatility("EDOLLAR").tail(2)
225+
>>> system.rawdata.get_daily_percentage_volatility("SOFR").tail(2)
226226
vol
227227
2015-12-10 0.055281
228228
2015-12-11 0.059789
@@ -252,7 +252,7 @@ def get_daily_vol_normalised_returns(self, instrument_code: str) -> pd.Series:
252252
>>>
253253
>>> (rawdata, data, config)=get_test_object()
254254
>>> system=System([rawdata], data)
255-
>>> system.rawdata.get_daily_vol_normalised_returns("EDOLLAR").tail(2)
255+
>>> system.rawdata.get_daily_vol_normalised_returns("SOFR").tail(2)
256256
norm_return
257257
2015-12-10 -1.219510
258258
2015-12-11 1.985413
@@ -408,7 +408,7 @@ def get_instrument_raw_carry_data(self, instrument_code: str) -> rawCarryData:
408408
>>> from systems.basesystem import System
409409
>>> (data, config)=get_test_object_futures()
410410
>>> system=System([RawData()], data)
411-
>>> system.rawdata.get_instrument_raw_carry_data("EDOLLAR").tail(2)
411+
>>> system.rawdata.get_instrument_raw_carry_data("SOFR").tail(2)
412412
PRICE CARRY CARRY_CONTRACT PRICE_CONTRACT
413413
2015-12-11 17:08:14 97.9675 NaN 201812 201903
414414
2015-12-11 19:33:39 97.9875 NaN 201812 201903
@@ -439,7 +439,7 @@ def raw_futures_roll(self, instrument_code: str) -> pd.Series:
439439
>>> from systems.basesystem import System
440440
>>> (data, config)=get_test_object_futures()
441441
>>> system=System([RawData()], data)
442-
>>> system.rawdata.raw_futures_roll("EDOLLAR").ffill().tail(2)
442+
>>> system.rawdata.raw_futures_roll("SOFR").ffill().tail(2)
443443
2015-12-11 17:08:14 -0.07
444444
2015-12-11 19:33:39 -0.07
445445
dtype: float64
@@ -464,7 +464,7 @@ def roll_differentials(self, instrument_code: str) -> pd.Series:
464464
>>> from systems.basesystem import System
465465
>>> (data, config)=get_test_object_futures()
466466
>>> system=System([RawData()], data)
467-
>>> system.rawdata.roll_differentials("EDOLLAR").ffill().tail(2)
467+
>>> system.rawdata.roll_differentials("SOFR").ffill().tail(2)
468468
2015-12-11 17:08:14 -0.246407
469469
2015-12-11 19:33:39 -0.246407
470470
dtype: float64
@@ -488,7 +488,7 @@ def annualised_roll(self, instrument_code: str) -> pd.Series:
488488
>>> from systems.basesystem import System
489489
>>> (data, config)=get_test_object_futures()
490490
>>> system=System([RawData()], data)
491-
>>> system.rawdata.annualised_roll("EDOLLAR").ffill().tail(2)
491+
>>> system.rawdata.annualised_roll("SOFR").ffill().tail(2)
492492
2015-12-11 17:08:14 0.284083
493493
2015-12-11 19:33:39 0.284083
494494
dtype: float64
@@ -524,7 +524,7 @@ def daily_annualised_roll(self, instrument_code: str) -> pd.Series:
524524
>>> from systems.basesystem import System
525525
>>> (data, config)=get_test_object_futures()
526526
>>> system=System([RawData()], data)
527-
>>> system.rawdata.daily_annualised_roll("EDOLLAR").ffill().tail(2)
527+
>>> system.rawdata.daily_annualised_roll("SOFR").ffill().tail(2)
528528
2015-12-10 0.284083
529529
2015-12-11 0.284083
530530
Freq: B, dtype: float64
@@ -645,7 +645,7 @@ def daily_denominator_price(self, instrument_code: str) -> pd.Series:
645645
>>> (data, config)=get_test_object_futures()
646646
>>> system=System([RawData()], data)
647647
>>>
648-
>>> system.rawdata.daily_denominator_price("EDOLLAR").ffill().tail(2)
648+
>>> system.rawdata.daily_denominator_price("SOFR").ffill().tail(2)
649649
2015-12-10 97.8800
650650
2015-12-11 97.9875
651651
Freq: B, Name: PRICE, dtype: float64

0 commit comments

Comments
 (0)