macrosynergy.pnl.transaction_costs#
- check_df_for_txn_stats(df, fids, tcost_n, rcost_n, size_n, tcost_l, rcost_l, size_l)[source]#
- Return type:
- extrapolate_cost(trade_size, median_size, median_cost, pct90_size, pct90_cost)[source]#
- Return type:
- extrapolate_cost_from_dict(cost_dict, fid, trade_size, fids=None)[source]#
Compute transaction costs from a static cost dictionary.
- Parameters:
cost_dict (Optional[Mapping[str, Mapping[str, Number]]]) – Mapping of fid to extrapolate_cost arguments. If None, returns NaN.
fid (str) – Financial contract identifier to query in cost_dict.
trade_size (Number) – Trade size in USD mn.
fids (Optional[List[str]]) – Optional list of traded fids to validate cost_dict coverage.
- Return type:
- class SparseCosts(df)[source]#
Bases:
object
- class TransactionCosts(df, fids, tcost_n='BIDOFFER_MEDIAN', rcost_n='ROLLCOST_MEDIAN', size_n='SIZE_MEDIAN', tcost_l='BIDOFFER_90PCTL', rcost_l='ROLLCOST_90PCTL', size_l='SIZE_90PCTL')[source]#
Bases:
objectInterface to query transaction statistics dataframe.
- DEFAULT_ARGS = {'rcost_l': 'ROLLCOST_90PCTL', 'rcost_n': 'ROLLCOST_MEDIAN', 'size_l': 'SIZE_90PCTL', 'size_n': 'SIZE_MEDIAN', 'tcost_l': 'BIDOFFER_90PCTL', 'tcost_n': 'BIDOFFER_MEDIAN'}#
- property change_index: DatetimeIndex#
- Return type:
DatetimeIndex
- property df_wide: DataFrame#
- Return type:
DataFrame
- property qdf: QuantamentalDataFrame#
- Return type:
- class TransactionCostsDictAdapter(cost_dict, fids=None)[source]#
Bases:
objectAdapter that exposes TransactionCosts-style methods using a static cost dictionary.
- class ExampleAdapter(*args, **kwargs)[source]#
Bases:
TransactionCosts