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:
- 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 the TransactionCosts cost methods (
bidofferandrollcost) from a static, nested cost dictionary.The dictionary is keyed by financial contract identifier (fid). Each fid carries one entry per cost type -
bid_offerandrollcost- and each cost type records two properties,sizeandcost, at two anchors,medianandpct90:{ "EUR_FX": { "bid_offer": { "size": {"median": 35, "pct90": 90}, "cost": {"median": 0.2, "pct90": 0.4}, }, "rollcost": { "size": {"median": 35, "pct90": 90}, "cost": {"median": 0.1, "pct90": 0.2}, }, }, }
The size and cost anchors feed
TransactionCosts.extrapolate_costexactly as the panel-backedTransactionCostsobject does, so the two are interchangeable wherever a cost object is expected.- COST_TYPES = ('bid_offer', 'rollcost')#
- PROPERTIES = ('size', 'cost')#
- ANCHORS = ('median', 'pct90')#
- class ExampleAdapter(*args, **kwargs)[source]#
Bases:
TransactionCosts