v8 Framework
Search
⌃K

Framework v8 Latest

Pages in this category
On this page

Latest major release: v8.16.0 (Mar 2023)

In this release

Enhanced sig.object.get() can now query all cross pairs

With this release, you can use sig.obj.get() to query FX spot rates for any currency pair, even those which are not available in our data browser. Previously, sig.obj.get() you could only query FX spot rates for currency pairs in our data browser.
A couple of examples are shown below:
import sigtech.framework as sig
sig.init()
usdeur = sig.obj.get('USDEUR CURNCY')
usdeur
seknok = sig.obj.get('SEKNOK CURNCY')
seknok

Store and load environment configs from a file

You can save your Sigtech environment in your JupyterLab instance. This saves any variables or attributes that you have configured in your environment. JSON serialisable attributes are saved in a .JSON format and non-JSON serialisable attributes are saved in .PKL. Once an environment is saved, you can easily reload it in a new notebook.
See the code example below for an example:
import sigtech.framework as sig
# Saves environment config as 'env.json' and 'env.pkl'
env = sig.init()
env.save_config('env')
# Destroys the environment instance
sig.de_init()
# Loads environment config from 'env.json' and 'env.pkl'
loaded_env = sig.init(load_env=True, env_file='env')

Added minimalist attributes view to BuildingBlockBrowser widget

A new Minimalist View option is available on the BuildingBlockBrowser widget. Selecting this option reduces the list of the class attributes shown in the BuildingBlockBrowser by only showing you the mandatory attributes. Not selecting/deselecting this option will result in all the attributes available for a class is visible.

New data_df() method added and history_df() method deprecated

A new method data_df() has been added to all framework instruments. The data_df() method replaces the history_df() method as it returns improved data. This new method returns a pandas DataFrame containing all data available for this object.
The data_df() method takes the following optional arguments:
  • data_point: Choose the data point from which to return the history of the object.
  • multi_index: Set to True to index rows uniquely by a multi-index (if applicable). Default is False.
  • drop_nan_cols: Set to True to drop all NaN columns. Default is False.
data_df() is an improvement over the previous history_df() method as it can perform clean-up operations as the data is queried. Such clean-up operations include column rearrangement and renaming, reset of indices and forward filling of values when placeholders are set.
See the code example below for how to use data_df():
import sigtech.framework as sig
sig.init()
# Single stock
sig.obj.get('1000045.SINGLE_STOCK.TRADABLE').data_df(drop_nan_cols=True)
# Credit index curve
sig.obj.get('CDX.NA CURVE').data_df(multi_index=True)
# Vol surface
sig.obj.get('EURUSD VOLSURFACE').data_df()

Lists of holidays and instruments can be passed into SchedulePeriod method

With this release, you can now pass a single or a mixed list of holiday calendar names and instruments objects into the holidays parameter of the SchedulePeriod method. This generates a calendar that accommodates all the holidays in the passed list. If a list of instruments has been passed, then the calendar will accommodate the holidays for each of the instruments in the list. This is particularly useful if the list consists of different indices.
See the code example below for how to create a weekly schedule:
instrument_list = ['ESH23 INDEX', 'COH22 COMDTY', '1000045.SINGLE_STOCK.TRADABLE']
basket = [sig.obj.get(ins) for ins in instrument_list]
weekly_schedule = sig.SchedulePeriodic(
start_date=dtm.date(2020, 2, 1),
end_date=dtm.date(2020, 3, 28),
holidays=basket,
frequency='1W-WED',
offset='1BD',
offset_backwards=True,
bdc=sig.calendar.BDC_MODIFIED_FOLLOWING)
print(weekly_schedule.get_holidays())
print(weekly_schedule.get_holidays().all_data_dates())

New back_adjusted feature and equivalent get_rf_price_index method added to RollingFutureStrategy

A back_adjusted parameter has been added to the price_series method (belonging to the RollingFutureStrategy class). This parameter calculates the back-adjusted prices for underlying futures.
Furthermore, a new method get_rf_price_index has been added to RollingFutureStrategy, it returns the corresponding rolling future price index object. Likewise, an additional method get_rolling_future_strategy has been added to the RFPriceIndex class, it returns the corresponding rolling future strategy.
See the code example below for how to pass the back_adjusted parameter:
rfs = sig.RollingFutureStrategy(
currency='USD',
start_date=dtm.date(2020, 1, 1),
end_date=dtm.date(2022, 1, 1),
contract_code='NG',
contract_sector='COMDTY',
rolling_rule='front',
front_offset='-2:-1'
)
rfs.price_series(back_adjusted=True)
The following example queries the rolling future price index from a back-adjusted rolling future strategy.
rfs_pi = rfs.get_rf_price_index(back_adjusted=True)
The following example gets a rolling futures strategy from the back-adjusted price index.
rfpi_strat = rfpi.get_rolling_future_strategy()

New parameters added to SignalStrategy that allow for order execution delays

You can now pass an execution_delay argument to a signal strategy.
This allows you to delay an order execution by a set period. In addition, you can use the bump_execution_delay parameter to ensure the order execution falls within trading hours. Set bump_execution_delay to False to ignore orders that would be executed out of trading hours. This means the order will not be executed if the delay causes it to execute outside of trading hours. Set bump_execution_delay to True (default) to ensure the order will be executed within trading hours by moving the execution time forward to the next available data point (that falls within trading hours).
For example:
import pytz
import datetime as dtm
import pandas as pd
import numpy as np
import sigtech.framework as sig
env = sig.init()
rfs = sig.default_strategy_objects.rolling_futures.es_index_front()
rfs.history();
start_date = dtm.date(2023,3,1)
signal = pd.Series({d: np.random.uniform(0,1) for d in pd.date_range(start_date, env.asofdate)}).to_frame(rfs.name)
rfs = sig.default_strategy_objects.rolling_futures.es_index_front()
rfs.history();
# Use bump_execution_delay=False to skip trades that would execute outside trading hours based on the delay provided via execution_delay
strategy = sig.SignalStrategy(
currency='USD',
signal_name=sig.signal.library.from_ts(signal).name,
start_date=start_date,
execution_delay = dtm.timedelta(days=1),
bump_execution_delay = False,
)
strategy.plot.portfolio_table('TOP_ORDER_PTS', end_dt=dtm.date(2023,3,6))
# Use bump_execution_delay=True to bump trades that would execute outside trading hours to the EOD execution on the next day based on the delay provided via execution_delay
strategy = sig.SignalStrategy(
currency='USD',
signal_name=sig.signal.library.from_ts(signal).name,
start_date=start_date,
execution_delay = dtm.timedelta(days=1),
bump_execution_delay = True,
)
strategy.plot.portfolio_table('TOP_ORDER_PTS', end_dt=dtm.date(2023,3,6))

Bug Fixes

  • The copy code issues in BuildingBlockBrowser have been resolved.
  • Overridden attributes in the BuildingBlockBrowser have been updated.
  • The data_date and env_date in the intraday notebook have been updated so that they no longer return errors.
  • Bugs involving abe_encryption_key and stream_access endpoints have been resolved.
  • Timeline retrieval is now prevented before a strategy is run.
  • OTC instruments can now trade before the instrument’s start date.
  • Use holidays to check the exchange open/close times and skip trades that occur outside of trading hours.
  • FX forwards now include the current date in the history time series.
  • The timestamp behaviour of the FX convert_at_d method has been corrected.
  • An attribute filter has been added to the DataBrowser widget.
  • The intraday argument can now be used in stoploss allocation functions.
  • The trading_decision_time argument has been removed following its deprecation.
  • Interactive optimizers now clear correctly.

Latest minor release: v8.16.1 (Mar 2023)

Fixes in this release
  • Grouped strategy orders now execute at EOD.
  • Conversion errors on FX objects causing FXFix datapoint retrieval issues have been fixed.
  • The behavior of the back_adjusted parameter in the price_series function of the RollingFutureStrategy building block has been fixed.
© 2023 SIG Technologies Limited