2s10s Steepener Inflation Signal#

New user? The best way to learn SigTech is to follow the steps in our user guide.

Restricted data: You will only have access to the data used in this notebook if your organisation has specifically purchased it. To check your current data access, view Data. If you would like to access more data, please contact sales@sigtech.com.

Changes will not be saved: Edits made to SigTech’s example notebooks like this will only persist for the duration of your session. When you restart the research environment, this notebook will have been restored to its original state, and any changes you have made will have been lost. To make permanent changes, copy and paste the content to a new notebook in one of your workspaces.

Introduction#

The purpose of thise notebook is to show how create an investment strategy expressed as a 2s10s Steepener and is based on an inflation signal. ## Environment This section will import relevant internal and external libraries, as well as setting up the platform environment.

[ ]:
import sigtech.framework as sig

from uuid import uuid4
import datetime as dtm
import pandas as pd
import seaborn as sns

sns.set(rc={'figure.figsize': (18, 6)})
env = sig.init(env_date=dtm.date(2024, 2, 22))

Universe#

[ ]:
START_DATE = dtm.date(2007, 1, 4)
[ ]:
pce_df = sig.obj.get('ECO TRIMMED_MEAN_PCE STLOUISFED US MACROECONOMICFIX').data_df()
pce_df = pce_df[START_DATE:]
pce_df.head()
[ ]:
pce_df['value'].plot(title = 'PCE History');
[ ]:
# Create 2y rolling swap to go long
r_swap_short = sig.RollingSwapStrategy(
    currency='USD',
    swap_currency='USD',
    forward_start_months=3,
    start_date=dtm.date(2007, 1, 4),
    tenor='2Y',
    ticker=f'USD 1Y ROLLING SWAP {str(uuid4())[:8]}'
)

# create 10y rolling swap to go short
r_swap_long = sig.RollingSwapStrategy(
    currency='USD',
    swap_currency='USD',
    forward_start_months=3,
    start_date=dtm.date(2007, 1, 4),
    tenor='10Y',
    ticker=f'USD 30Y ROLLING SWAP {str(uuid4())[:8]}'
)

# put the 30y and 5y in to a basket with equal notional positions
# Basket Strategy Building Block
swap_basket = sig.BasketStrategy(
    currency='USD',
    start_date=dtm.date(2007, 1, 4),
    constituent_names=[r_swap_short.name,r_swap_long.name],
    weights=[0.5, -0.5],
    rebalance_frequency='EOM',
    ticker=f'USD SWAP CARRY BASKET {str(uuid4())[:8]}'
)

Strategy#

[ ]:
signal = pce_df['value'].diff(1).apply(lambda x: 1 if x >= 0 else 0)
signal.head()
[ ]:
swap_basket_mapped = pd.DataFrame({swap_basket.name:signal})
swap_signal_obj = sig.signal_library.from_ts(swap_basket_mapped)

Portfolio Construction#

[ ]:
signal_strategy = sig.SignalStrategy(
    start_date=START_DATE,
    currency='USD',
    signal_name=swap_signal_obj.name,
    convert_long_short_weight=False,
    use_signal_for_rebalance_dates=True,
    t0_execution=True,
    allocation_function=sig.signal_library.allocation.identity,
    include_trading_costs=False,
    ticker=f'INFLATION STRATEGY {str(uuid4())[:4]}'
)

Performance Analytics#

[ ]:
sig.PerformanceReport(signal_strategy.history()).report()