Skip to content

Commit

Permalink
Chore: Make release 1.0.63
Browse files Browse the repository at this point in the history
  • Loading branch information
martinroberson authored and DominicCYK committed Feb 26, 2024
1 parent 465ea81 commit 37e11ef
Show file tree
Hide file tree
Showing 17 changed files with 606 additions and 709 deletions.
29 changes: 15 additions & 14 deletions gs_quant/api/gs/data.py
Expand Up @@ -693,15 +693,16 @@ def build_interval_chunked_market_data_queries(asset_ids: List[str],
where: Union[FieldFilterMap, Dict] = None,
source: Union[str] = None,
real_time: bool = False,
measure='Curve',
parallel_pool_size: int = 1) -> List[dict]:
def chunk_time(start, end, pool_size) -> tuple:
chunk_duration = (end - start) / pool_size
current = start
for _ in range(pool_size):
next_end = current + chunk_duration
yield current, next_end
current = next_end
measure='Curve') -> List[dict]:
parallel_interval = 365 # chunk over a year

def chunk_time(start, end) -> tuple:
# chunk the time interval into 1 year chunks
s = start
while s < end:
e = min(s + dt.timedelta(days=parallel_interval), end)
yield s, e
s = e

queries = []
if real_time:
Expand All @@ -711,14 +712,14 @@ def chunk_time(start, end, pool_size) -> tuple:
start, end = DataContext.current.start_date, DataContext.current.end_date
start_key, end_key = 'startDate', 'endDate'

for s, e in chunk_time(start, end, parallel_pool_size):
for s, e in chunk_time(start, end):
inner = copy(GsDataApi._get_market_data_filters(asset_ids, query_type, where, source, real_time, measure))
inner[start_key], inner[end_key] = s, e
queries.append({
'queries': [inner]
})

log_debug("", _logger, f"Created {len(queries)} market data queries. Pool size = {parallel_pool_size}")
log_debug("", _logger, f"Created {len(queries)} market data queries")

return queries

Expand All @@ -729,10 +730,10 @@ def build_market_data_query(asset_ids: List[str],
source: Union[str] = None,
real_time: bool = False,
measure='Curve',
parallel_pool_size: int = 1) -> Union[dict, List[dict]]:
if parallel_pool_size > 1:
parallelize_queries: bool = False) -> Union[dict, List[dict]]:
if parallelize_queries:
return GsDataApi.build_interval_chunked_market_data_queries(asset_ids, query_type, where, source, real_time,
measure, parallel_pool_size)
measure)

inner = GsDataApi._get_market_data_filters(asset_ids, query_type, where, source, real_time, measure)
if DataContext.current.interval is not None:
Expand Down
Expand Up @@ -55,14 +55,16 @@
"|currency |**Required**|-- |Denomination you want your basket to tick in. This can not be changed once your basket has been created|\n",
"|return_type |**Required**|-- |Determines the index calculation methodology with respect to dividend reinvestment. One of Price Return, Gross Return, Total Return|\n",
"|position_set |**Required**|-- |Information of constituents associated with the basket. You may provide the weight or quantity for each position. If neither is provided we will distribute the total weight evenly among each position. Please also note that any fractional shares will be rounded up to whole numbers.|\n",
"|cash_reinvestment_treatment|Optional|Reinvest At Open|How to treat cash acquisitions, regular dividends, and special dividends for basket underliers.|\n",
"|description |Optional |-- |Free text description of basket. Description provided will be indexed in the search service for free text relevance match.|\n",
"|divisor |Optional |-- |Divisor to be applied to the overall position set. You need not set this unless you want to change the divisor to a specific number, which will in turn change the basket price (current notional/divisor). This might impact price continuity.|\n",
"|initial_price |Optional |100 |Initial price the basket should start ticking at|\n",
"|target_notional |Optional |10,000,000 |Target notional for the position set|\n",
"|publish_to_bloomberg|Optional |True |If you'd like us to publish your basket to Bloomberg|\n",
"|publish_to_reuters |Optional |False |If you'd like us to publish your basket to Reuters |\n",
"|publish_to_factset |Optional |False |If you'd like us to publish your basket to Factset |\n",
"|default_backcast |Optional |True |If you'd like us to backcast up to 5 years of pricing history and compositions, assuming constituents remained constant. Set to false if you'd like to upload your own custom history. If any IPOs are present in this composition, we will stop the backcast period accordingly.|\n",
"|historical_methodology|Optional |Backcast |Preferred methodology to be applied when publishing basket history.<ul><li>**Backcast**: Apply current composition backwards up to 5 years, assuming constituent shares remained constant</li><li>**Backtest**: Reset composition based on the selected criteria and rebalance frequency over selected period of time. Must specify these options in `backtest_parameters`.</li><li>**Custom History**: Upload your own basket history after the basket has been created. *Note: Previously this was indicated by setting* `default_backcast = False`</li></ul>|\n",
"|backtest_parameters |Optional |-- |Rules applied when performing a historical backtest.<ul><li>**Weighting Mechanism**: On each rebalance date, whether to reset positions to have equal weights or restore based on original position set values.</li><li>**Time Horizon**: Time horizon for which to generate historical backtest. (5 years is the only supported option at this time.)</li><li>**Frequency**: Frequency at which to recalculate position shares (Weekly, Monthly, Quarterly, Annually.)</li></ul>|\n",
"|reweight |Optional |False |If you'd like us to reweight positions if input weights don't add up to 1 upon submission|\n",
"|weighting_strategy |Optional |-- |Strategy used to price the position set (will be inferred if not indicated). One of Equal, Market Capitalization, Quantity, Weight|\n",
"|allow_ca_restricted_assets|Optional|False |Allow your basket to have constituents that will not be corporate action adjusted in the future (You will recieve a message indicating if this action is needed when attempting to create your basket)|\n",
Expand Down
7 changes: 5 additions & 2 deletions gs_quant/documentation/06_baskets/tutorials/Basket Edit.ipynb
Expand Up @@ -48,7 +48,10 @@
"|publish_to_bloomberg |If you'd like us to publish your basket to Bloomberg|\n",
"|publish_to_reuters |If you'd like us to publish your basket to Reuters |\n",
"|publish_to_factset |If you'd like us to publish your basket to Factset |\n",
"|include_price_history|Republish price history based on current composition when publishing to Bloomberg|"
"|include_price_history|Republish price history based on current composition|\n",
"|cash_reinvestment_treatment|How to treat cash acquisitions, regular dividends, and special dividends for basket underliers.|\n",
"|historical_methodology|Preferred methodology to be applied when publishing basket history.<ul><li>**Backcast**: Apply current composition backwards up to 5 years, assuming constituent shares remained constant</li><li>**Backtest**: Reset composition based on the selected criteria and rebalance frequency over selected period of time. Must specify these options in `backtest_parameters`.</li><li>**Custom History**: Upload your own basket history after the basket has been created. *Note: Previously this was indicated by setting* `default_backcast = False`</li></ul>|\n",
"|backtest_parameters |Rules applied when performing a historical backtest.<ul><li>**Weighting Mechanism**: On each rebalance date, whether to reset positions to have equal weights or restore based on original position set values.</li><li>**Time Horizon**: Time horizon for which to generate historical backtest. (5 years is the only supported option at this time.)</li><li>**Frequency**: Frequency at which to recalculate position shares (Weekly, Monthly, Quarterly, Annually.)</li></ul>|"
]
},
{
Expand Down Expand Up @@ -135,4 +138,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Expand Up @@ -54,7 +54,10 @@
"|reweight |Optional |If you'd like us to reweight positions if input weights don't add up to 1 upon submission|\n",
"|weighting_strategy |Optional |Strategy used to price the position set (will be inferred if not indicated). One of Equal, Market Capitalization, Quantity, Weight|\n",
"|allow_ca_restricted_assets|Optional|Allow your basket to have constituents that will not be corporate action adjusted in the future (You will recieve a message indicating if this action is needed when attempting to rebalance your basket)|\n",
"|allow_limited_access_assets|Optional|Allow basket to have constituents that GS has limited access to (You will recieve a message indicating if this action is needed when attempting to rebalance your basket)|"
"|allow_limited_access_assets|Optional|Allow basket to have constituents that GS has limited access to (You will recieve a message indicating if this action is needed when attempting to rebalance your basket)|\n",
"|cash_reinvestment_treatment|How to treat cash acquisitions, regular dividends, and special dividends for basket underliers.|\n",
"|historical_methodology|Preferred methodology to be applied when publishing basket history.<ul><li>**Backcast**: Apply current composition backwards up to 5 years, assuming constituent shares remained constant</li><li>**Backtest**: Reset composition based on the selected criteria and rebalance frequency over selected period of time. Must specify these options in `backtest_parameters`.</li><li>**Custom History**: Upload your own basket history after the basket has been created. *Note: Previously this was indicated by setting* `default_backcast = False`</li></ul>|\n",
"|backtest_parameters |Rules applied when performing a historical backtest.<ul><li>**Weighting Mechanism**: On each rebalance date, whether to reset positions to have equal weights or restore based on original position set values.</li><li>**Time Horizon**: Time horizon for which to generate historical backtest. (5 years is the only supported option at this time.)</li><li>**Frequency**: Frequency at which to recalculate position shares (Weekly, Monthly, Quarterly, Annually.)</li></ul>|"
]
},
{
Expand Down

0 comments on commit 37e11ef

Please sign in to comment.