We are pleased to announce the launch of SigTech Framework v9! Based on Python 3.11, version 9 of SigTech’s framework benefits from Python’s increased speed, as well as a host of major improvements, upgrades, and exciting new features.
You can now select Framework v9 from the dropdown menu when setting up your research environment (Framework version > select ‘V9-latest’). We’ll let you know once v9 becomes the default platform version. For now, we advise you to check if any strategies written in v8 work in v9, as you may come across deprecations and changes introduced by underlying libraries.
If you have any questions or feedback, feel free to get in touch with your SigTech technical account manager – we’re always happy to hear from users!
Building on Framework v8
Framework v9 is a culmination of all the upgrades we have been developing throughout v8, such as:
- Risk ladders and interest rate curve sensitivity for swaps
- Portfolio optimization with standard or customized constraints
- Expanded scenario simulation functionality to assess the impact on options portfolios with changes in the underlying FX and Equity indices
- Cross-currency swap and swaption modeling more closely aligned with industry standards
- New methods for trade sizing
- Improved and customizable trade diagnostics
Better trade diagnostics
Framework v8 saw continuous improvements in SigTech’s performance reporting and inspection features.
For instance, new trade-related statistics have been added to the performance report, such as number of trades, number of wins, number of losses, and win/loss ratio. These can be found within the `trade_statistics` table method – run `strat.analytics.trades_statistics()` to see.
We have also introduced a new range of cash methods when using the inspect wrapper in the `Strategy` base class. Previously, the methods only provided values at points where the strategy simulation performed an action. A new optional parameter, `dts`, has been added to make these methods more flexible – for example, you can now set `dts` to get values at points where orders are executed, or at points where the strategy’s top level holdings change. As a result, you can use these cash methods to get values at a variety of times.
Additionally, a new `trade_timings_df()` function has been added to the inspect wrapper. Add this function to an object to return a data frame that contains the timings associated with each trade in the strategy. You can clearly view the financial instruments bought and sold, when the decision to trade was made, when the trade was executed, and the size of trade.
Run the code example below to generate a data frame:
```
qqq = sig.ReinvestmentStrategy(underlyer='QQQ UP EQUITY', currency='USD')
qqq.inspect.trade_timings_df()
```
Features added to enhance portfolio optimization
The following useful features have been added to the portfolio optimizer and `optimized_allocations` function:
- A check added to the time-varying signal allocation input
- In-built correlation data source now provided
- Initial parameter specification
- Time-varying problems allowed
All these additions let you add your own custom objectives and constraints to a problem. To illustrate, below is an example of specifying a custom objective for an optimizer:
```
import pandas as pd
import datetime as dtm
import sigtech.framework as sig
sig.init()
amazon = sig.default_strategy_objects.single_stock_strategies.amazon_equity_rs()
apple = sig.default_strategy_objects.single_stock_strategies.apple_equity_rs()
returns = pd.concat([amazon.history(), apple.history()], axis=1, keys=[amazon.name, apple.name]).dropna().pct_change().dropna()
returns.head();
import cvxpy
base_opt = sig.PortfolioOptimizer()
base_opt.prefer_maximum_return()
base_opt.prefer_custom(lambda x, data: -cvxpy.quad_form(x, data['covariance']))
base_opt.calculate_weights(returns)
```
Introducing new features of v9
Building on the foundations of v8, Framework v9 adds new features and quality-of-life improvements. Highlights include:
- Python 3.11’s faster speeds
- Updated NumPy v1.26 and pandas v2.1 Python packages
- Improved transaction cost modeling for futures
- New methods to retrieve historical volatility smile and skewness when working with options
- The ability to download your strategy data in JSON format with the new utility function `sig.export`
- New option risk matrices that provide a better overview of an options strategy across multiple scenarios, such as showing the profit and loss in each potential scenario
New default values for improved usability
Framework v9 uses new default settings for certain framework environment parameters. By being more in line with industry standards, it aims to improve usability and create a more intuitive user experience.
For example, the default settings for transaction costs have changed: the default `include_trading_costs` parameter is now set as `False`, while global costs are enabled. As a result, the default behaviour is still to disable transaction costs but you now have more control over their inclusion when evaluating a strategy’s performance. You can control transaction costs for each strategy by setting `include_trading_costs` to `True`.
All environment changes are breaking and may cause material changes to your strategy outputs – be sure to check the generated data frames for any differences.
Framework v9 also includes updated parameter defaults, resulting in material changes to the output generated by strategies execution methods, instrument data retrieval methods, and analytics calculation methods.
For example, there is no longer a default value for the target weekday when creating options using the `get_option` method. This allows for greater flexibility when handling options maturity, specifically for index options that can expire on any day.
Better underlying framework logic
Framework v9 includes material changes to the underlying logic, bringing calculations more closely aligned with industry standards. For instance, we have improved futures contracts modeling for users by adjusting the transaction model of futures to capture the nuances of market impact. Now, v9 uses costs linked to the quantity traded.
See the SigTech Framework v9 release notes for a deeper dive into the new features and how they can help your strategy creation.
Advantages of Framework v9
As SigTech Framework v9 uses Python 3.11, it benefits from its enhanced functionality. Some noteworthy upgrades include:
Faster speeds
One big change is improved speed. Python 3.11 is between 10-60% faster than Python 3.10, and Framework v9 leverages Python 3.11’s faster execution speeds to allow for faster, more efficient backtesting on SigTech’s platform. When running our notebooks in v9, you should notice a discernible difference compared to v8.
Upgraded Python packages
Along with the upgrade from Python 3.9 to 3.11, SigTech Framework v9 comes with several upgrades in Python’s supporting libraries. This means you can make use of the latest features and benefit from these industry-standard improvements.
Two of the integral data science libraries in Python have been upgraded: `numpy` 1.18 to NumPy v1.26, and `pandas` 1.4 to pandas v2.1. Other dependencies for back-end utilities and platform tools include upgrading Python packages `cvxpy` from 1.1 to 1.4 and `scipy` from 1.8 to 1.11.
As a result, the default python packages installed in both your research environment and strategy deployment environment will be automatically upgraded. Read our SigTech Framework v9 release notes: Dependencies for a full list of the upgraded dependencies, as well as any packages that have been removed from the default research environment.
For more on the benefits of Python 3.11, read the 3.11 release notes.
Will these changes mean I’ll need to edit my existing code?
Framework v9 introduces some deprecations, refactorings and deletions for certain classes, functions and parameters. Examples include:
- Names of strategy building blocks updated to follow SigTech naming conventions more closely
- Property name change for rolling strategy classes to fix an error caused by name conflicts
- Changes to how custom roll tables are specified
As we say, it’s best to run any strategies you had in SigTech Framework v8 in the new Framework v9 to ensure they work as expected. In most cases, you will need to replace any deprecated v8 class/function names with their updated v9 names to avoid errors.
A full list of deprecations – and the changes you’ll need to make to your code – can be found in our release notes.