goldmansachs / gs-quant

Python toolkit for quantitative finance
https://developer.gs.com/discover/products/gs-quant/
Apache License 2.0
7.05k stars 856 forks source link

WIP: Backtest Module #53

Open gavriv opened 5 years ago

gavriv commented 5 years ago

Describe the problem. This is a feature proposal to add a first version of the backtest module in gs_quant. This module is a work-in-progress and would continue to improve over the coming months.

Describe the solution you'd like For the first working version of the backtest module, we wanted to support backtesting for systematic strategies on Equity Options. By systematic strategy, we refer to non-event based strategies where the strategy gets into a well defined portfolio every day, optionally hedges the delta risk and roll positions in the portfolio after a fixed time.

Example code snippet would be as following

underlierList = [
EqOption("SPX", "3m", 3000, OptionType.Call, OptionStyle.European),
EqOption("SPX", "3m", 3000, OptionType.Put, OptionStyle.European)
]

hedge = DeltaHedgeParameters(frequency="Daily")
strategy = StrategySystematic(name = "Mock Test",
                                underliers=underlierList,
                                delta_hedge=hedge,
                                quantity=100000,
                                quantity_type= QuantityType.Notional,
                                trade_in_method= TradeInMethod.FixedRoll,
                                roll_frequency="1m")

result = strategy.backtest(start="2019-06-01", end="2019-07-01")

In the coming months, we would want to add support for signal/event driven strategies, intraday actions, different trading and transaction cost models and support for more products.

Are you willing to contribute Yes

Rish001 commented 3 years ago

Is anyone working on this? I would want to take a shot at this