From 4691e71bbab3490250d312585bae0eeba2807de6 Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Fri, 30 Aug 2024 13:19:35 +0100 Subject: [PATCH 1/9] feat: make drift term available --- vega_sim/scenario/amm/registry.py | 1 + vega_sim/scenario/benchmark/configs.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/vega_sim/scenario/amm/registry.py b/vega_sim/scenario/amm/registry.py index a36fbddb1..96d31ef35 100644 --- a/vega_sim/scenario/amm/registry.py +++ b/vega_sim/scenario/amm/registry.py @@ -14,6 +14,7 @@ annualised_volatility=0.5, notional_trade_volume=100, process_theta=0.02, + drift=0.02, ), ], amm_liquidity_fee=0.001, diff --git a/vega_sim/scenario/benchmark/configs.py b/vega_sim/scenario/benchmark/configs.py index a50d88ae2..f17b5b8c6 100644 --- a/vega_sim/scenario/benchmark/configs.py +++ b/vega_sim/scenario/benchmark/configs.py @@ -11,10 +11,12 @@ def __init__( notional_trade_volume: int, risky_trader_funds: int = 1_000, process_theta: float = 0, + drift: float = 0, ): self.market_config = market_config self.initial_price = initial_price self.process_theta = process_theta + self.drift = drift self.annualised_volatility = annualised_volatility self.notional_trade_volume = notional_trade_volume self.risky_trader_funds = risky_trader_funds From 8229a58da57339d67aba4119d8cbaec7f47c8ef1 Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Fri, 30 Aug 2024 15:03:04 +0100 Subject: [PATCH 2/9] feat: address comments --- vega_sim/scenario/amm/registry.py | 2 +- vega_sim/scenario/benchmark/configs.py | 4 ++-- vega_sim/scenario/benchmark/scenario.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vega_sim/scenario/amm/registry.py b/vega_sim/scenario/amm/registry.py index 96d31ef35..df4a56d12 100644 --- a/vega_sim/scenario/amm/registry.py +++ b/vega_sim/scenario/amm/registry.py @@ -14,7 +14,7 @@ annualised_volatility=0.5, notional_trade_volume=100, process_theta=0.02, - drift=0.02, + process_drift=-0.1, ), ], amm_liquidity_fee=0.001, diff --git a/vega_sim/scenario/benchmark/configs.py b/vega_sim/scenario/benchmark/configs.py index f17b5b8c6..0b90e1f8d 100644 --- a/vega_sim/scenario/benchmark/configs.py +++ b/vega_sim/scenario/benchmark/configs.py @@ -11,12 +11,12 @@ def __init__( notional_trade_volume: int, risky_trader_funds: int = 1_000, process_theta: float = 0, - drift: float = 0, + process_drift: float = 0, ): self.market_config = market_config self.initial_price = initial_price self.process_theta = process_theta - self.drift = drift + self.process_drift = process_drift self.annualised_volatility = annualised_volatility self.notional_trade_volume = notional_trade_volume self.risky_trader_funds = risky_trader_funds diff --git a/vega_sim/scenario/benchmark/scenario.py b/vega_sim/scenario/benchmark/scenario.py index c2def24bf..ffb33c6c3 100644 --- a/vega_sim/scenario/benchmark/scenario.py +++ b/vega_sim/scenario/benchmark/scenario.py @@ -88,10 +88,10 @@ def configure_agents( x0=benchmark_config.initial_price, mu=benchmark_config.initial_price, theta=benchmark_config.process_theta, + drift=benchmark_config.process_drift, sigma=benchmark_config.annualised_volatility * np.sqrt(self.step_length_seconds / (365.25 * 24 * 60 * 60)) * benchmark_config.initial_price, - drift=0, ) self.agents.append( ConfigurableMarketManager( From 6113b41d89308ec33d237d9142450c8580bc50dc Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Mon, 2 Sep 2024 11:07:34 +0100 Subject: [PATCH 3/9] feat: add more asset to risky_trader --- vega_sim/scenario/benchmark/configs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vega_sim/scenario/benchmark/configs.py b/vega_sim/scenario/benchmark/configs.py index 0b90e1f8d..e5cc65581 100644 --- a/vega_sim/scenario/benchmark/configs.py +++ b/vega_sim/scenario/benchmark/configs.py @@ -9,7 +9,7 @@ def __init__( initial_price: float, annualised_volatility: float, notional_trade_volume: int, - risky_trader_funds: int = 1_000, + risky_trader_funds: int = 100_000, process_theta: float = 0, process_drift: float = 0, ): From 539989051f6d9c9862cfae980e0a887a65a6ad72 Mon Sep 17 00:00:00 2001 From: Charlie Date: Tue, 3 Sep 2024 12:41:37 +0100 Subject: [PATCH 4/9] feat: tweaks for consistent AMM runs --- vega_query/service/utils/party.py | 8 ++++++-- vega_query/visualisations/plots/amm.py | 18 ++++-------------- vega_sim/scenario/amm/registry.py | 9 +++++---- vega_sim/scenario/amm/scenario.py | 8 ++++---- vega_sim/scenario/benchmark/configs.py | 2 +- .../scenario/common/utils/price_process.py | 3 +-- 6 files changed, 21 insertions(+), 27 deletions(-) diff --git a/vega_query/service/utils/party.py b/vega_query/service/utils/party.py index ae56324db..b70be259c 100644 --- a/vega_query/service/utils/party.py +++ b/vega_query/service/utils/party.py @@ -8,6 +8,8 @@ import pandas as pd +from vega_query.utils import timestamp_to_datetime + logger = getLogger(__name__) @@ -42,7 +44,9 @@ def historic_positions( data = defaultdict(lambda: defaultdict(int)) for trade in trades: position_after_trade = positions.get(trade.market_id, 0) - data[trade.timestamp][trade.market_id] = position_after_trade + data[timestamp_to_datetime(trade.timestamp)][ + trade.market_id + ] = position_after_trade match party_id: case trade.buyer: positions[trade.market_id] -= trade.size @@ -92,7 +96,7 @@ def historic_balances( ) if aggregated_balance.market_id is not "": account_key += f" | {aggregated_balance.market_id[:7]}" - data[aggregated_balance.timestamp][account_key] = int( + data[timestamp_to_datetime(aggregated_balance.timestamp)][account_key] = int( aggregated_balance.balance ) diff --git a/vega_query/visualisations/plots/amm.py b/vega_query/visualisations/plots/amm.py index 05551b325..3c1511d22 100644 --- a/vega_query/visualisations/plots/amm.py +++ b/vega_query/visualisations/plots/amm.py @@ -65,13 +65,7 @@ def create( # Set unique colors for each party and request party specific information amms = service.api.data.list_amms(market_id=market.id) if party_ids is None: - # party_ids = __party_defaults_old(market_data_history=market_data_history) party_ids = __party_defaults(amms=amms) - # party_ids = __party_defaults(amms=amms) + __party_defaults_old( - # market_data_history=market_data_history - # ) - - print(party_ids) party_colors = __party_colors(party_ids) @@ -139,17 +133,13 @@ def create( ax11.get_lines()[-1].set_label(amm_party_id[:7]) # Reconstruct the AMMs aggregated balance from balance changes - aggregated_balances = service.api.data.list_balance_changes( - party_ids=[amm_party_id], + df = service.utils.party.historic_balances( + party_id=amm_party_id, + asset_id=asset.id, date_range_start_timestamp=start_timestamp, date_range_end_timestamp=end_timestamp, ) - overlay_aggregated_balances( - ax=ax21, - aggregated_balances=aggregated_balances, - asset_decimals=asset.details.decimals, - ) - ax21.get_lines()[-1].set_label(amm_party_id[:7]) + ax21.step(df.index, df.total, where="post", label="total") ax11.legend() ax21.legend() diff --git a/vega_sim/scenario/amm/registry.py b/vega_sim/scenario/amm/registry.py index df4a56d12..ba9d17598 100644 --- a/vega_sim/scenario/amm/registry.py +++ b/vega_sim/scenario/amm/registry.py @@ -11,16 +11,17 @@ BenchmarkConfig( market_config=configs.mainnet.BTCUSDT.CONFIG, initial_price=70000, - annualised_volatility=0.5, + annualised_volatility=1, notional_trade_volume=100, - process_theta=0.02, - process_drift=-0.1, + process_theta=0.05, + process_drift=-10, ), ], - amm_liquidity_fee=0.001, + amm_liquidity_fee=0.0001, amm_update_frequency=0, initial_network_parameters={ "validators.epoch.length": "1h", + "market.fee.factors.makerFee": "0", }, ), } diff --git a/vega_sim/scenario/amm/scenario.py b/vega_sim/scenario/amm/scenario.py index 76eea7b51..4b668ea46 100644 --- a/vega_sim/scenario/amm/scenario.py +++ b/vega_sim/scenario/amm/scenario.py @@ -67,13 +67,13 @@ def configure_agents( wallet_name="AutomatedMarketMaker", key_name=f"AutomatedMarketMaker_{benchmark_config.market_config.instrument.code}_{str(i_agent).zfill(3)}", market_name=benchmark_config.market_config.instrument.name, - initial_asset_mint=2e6, - commitment_amount=1e5, + initial_asset_mint=1e6, + commitment_amount=10_000, slippage_tolerance=0.05, proposed_fee=self.amm_liquidity_fee, price_process=iter(benchmark_config.price_process), - lower_bound_scaling=1 - 0.05, - upper_bound_scaling=1 + 0.05, + lower_bound_scaling=1 - 0.02, + upper_bound_scaling=1 + 0.02, leverage_at_lower_bound=20, leverage_at_upper_bound=20, update_bias=self.amm_update_frequency, diff --git a/vega_sim/scenario/benchmark/configs.py b/vega_sim/scenario/benchmark/configs.py index e5cc65581..0b90e1f8d 100644 --- a/vega_sim/scenario/benchmark/configs.py +++ b/vega_sim/scenario/benchmark/configs.py @@ -9,7 +9,7 @@ def __init__( initial_price: float, annualised_volatility: float, notional_trade_volume: int, - risky_trader_funds: int = 100_000, + risky_trader_funds: int = 1_000, process_theta: float = 0, process_drift: float = 0, ): diff --git a/vega_sim/scenario/common/utils/price_process.py b/vega_sim/scenario/common/utils/price_process.py index b6ae763cc..39e72b29b 100644 --- a/vega_sim/scenario/common/utils/price_process.py +++ b/vega_sim/scenario/common/utils/price_process.py @@ -336,9 +336,8 @@ def ou_price_process(n, theta=0.15, mu=0.0, sigma=0.2, x0=1.0, drift=0.0): x[0] = x0 for t in range(1, n): dx = ( - theta * (mu - x[t - 1]) * dt + theta * ((mu + t * drift) - x[t - 1]) * dt + sigma * np.sqrt(dt) * np.random.normal() - + drift * dt ) x[t] = x[t - 1] + dx return x From 64098729d3095a5e8989e1db757b6b819987966b Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Wed, 4 Sep 2024 12:53:50 +0100 Subject: [PATCH 5/9] feat: add cumulated trade volume plot --- vega_query/visualisations/overlay.py | 37 ++++++++++++++++++++++++++ vega_query/visualisations/plots/amm.py | 13 ++++++++- vega_sim/scenario/amm/registry.py | 4 +-- 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/vega_query/visualisations/overlay.py b/vega_query/visualisations/overlay.py index 42b216b3b..79b7371ff 100644 --- a/vega_query/visualisations/overlay.py +++ b/vega_query/visualisations/overlay.py @@ -895,6 +895,43 @@ def overlay_volume( ax.step(x, y, label="volume", where="post") +def overlay_cumulative_volume( + ax: Axes, + trades: List[protos.vega.vega.Trade], + price_decimals: int, + size_decimals: int, +): + x = [] + y = [] + cumulative_volume = 0 # Initialize cumulative volume + + for trade in trades: + # Convert timestamp to datetime for x-axis + x.append(timestamp_to_datetime(trade.timestamp, nano=True)) + + # Ensure price and size are available + if hasattr(trade, 'price') and hasattr(trade, 'size'): + price = padded_int_to_float(trade.price, price_decimals) + size = padded_int_to_float(trade.size, size_decimals) + + # Calculate traded volume (price * size) + volume = price * size if price != 0 else 0 + + # Debugging: Print current values + print(f"Trade timestamp: {trade.timestamp}, Price: {price}, Size: {size}, Volume: {volume}") + + # Accumulate volume + cumulative_volume += abs(volume) # Ensure volume is positive + y.append(cumulative_volume) + else: + # If price or size is missing, assume no change in cumulative volume + y.append(cumulative_volume) + print(f"Missing price or size for trade at {trade.timestamp}") + + # Plot the cumulative volume data using step plot + ax.step(x, y, label="Cumulative Volume", where="post") + + def overlay_maker_fee( ax: Axes, trades: List[protos.vega.vega.Trade], diff --git a/vega_query/visualisations/plots/amm.py b/vega_query/visualisations/plots/amm.py index 3c1511d22..e94d5af09 100644 --- a/vega_query/visualisations/plots/amm.py +++ b/vega_query/visualisations/plots/amm.py @@ -74,7 +74,7 @@ def create( ymin = ymax = 0 axes: List[Axes] = [] - axn0l = fig.add_subplot(gs[:, 0]) + axn0l = fig.add_subplot(gs[0, 0]) axn0r: Axes = axn0l.twinx() if market_data_history is not None: overlay_mark_price(axn0l, market_data_history, market.decimal_places) @@ -94,6 +94,10 @@ def create( axn0r.legend(loc="upper right", framealpha=1) axn0r.add_artist(leg) + ax10 = fig.add_subplot(gs[1, 0]) + ax10.set_title("Cumulated traded notional", loc="left") + ax10.set_ylabel("traded notional") + ax11 = fig.add_subplot(gs[0, 1]) ax11.set_title("AMM: Position", loc="left") ax11.set_ylabel("Open Volume") @@ -124,6 +128,13 @@ def create( date_range_start_timestamp=start_timestamp, date_range_end_timestamp=end_timestamp, ) + + overlay_cumulative_volume( + ax=ax10, + trades=trades, + price_decimals=market.decimal_places, + size_decimals=market.position_decimal_places, + ) overlay_position( ax=ax11, trades=trades, diff --git a/vega_sim/scenario/amm/registry.py b/vega_sim/scenario/amm/registry.py index ba9d17598..14fb30436 100644 --- a/vega_sim/scenario/amm/registry.py +++ b/vega_sim/scenario/amm/registry.py @@ -11,9 +11,9 @@ BenchmarkConfig( market_config=configs.mainnet.BTCUSDT.CONFIG, initial_price=70000, - annualised_volatility=1, + annualised_volatility=0.5, notional_trade_volume=100, - process_theta=0.05, + process_theta=0.01, process_drift=-10, ), ], From e59f9cf6565e089df55c02b2b6b946f2ab3c8001 Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Wed, 4 Sep 2024 13:10:01 +0100 Subject: [PATCH 6/9] feat: reverse trade order --- vega_query/visualisations/overlay.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/vega_query/visualisations/overlay.py b/vega_query/visualisations/overlay.py index 79b7371ff..ff01eaaf2 100644 --- a/vega_query/visualisations/overlay.py +++ b/vega_query/visualisations/overlay.py @@ -878,7 +878,6 @@ def overlay_price( y.append(price if price != 0 else np.nan) ax.step(x, y, label="price", where="post") - def overlay_volume( ax: Axes, trades: List[protos.vega.vega.Trade], @@ -894,20 +893,22 @@ def overlay_volume( y.append(price * size if price != 0 else np.nan) ax.step(x, y, label="volume", where="post") - def overlay_cumulative_volume( ax: Axes, trades: List[protos.vega.vega.Trade], price_decimals: int, size_decimals: int, ): - x = [] - y = [] + x = [] # List to store timestamps + y = [] # List to store cumulative volume cumulative_volume = 0 # Initialize cumulative volume + trades = reversed(trades) + for trade in trades: # Convert timestamp to datetime for x-axis - x.append(timestamp_to_datetime(trade.timestamp, nano=True)) + timestamp = timestamp_to_datetime(trade.timestamp, nano=True) + x.append(timestamp) # Ensure price and size are available if hasattr(trade, 'price') and hasattr(trade, 'size'): @@ -920,17 +921,22 @@ def overlay_cumulative_volume( # Debugging: Print current values print(f"Trade timestamp: {trade.timestamp}, Price: {price}, Size: {size}, Volume: {volume}") - # Accumulate volume - cumulative_volume += abs(volume) # Ensure volume is positive + # Accumulate volume (ensure volume is positive) + cumulative_volume += abs(volume) y.append(cumulative_volume) else: # If price or size is missing, assume no change in cumulative volume y.append(cumulative_volume) print(f"Missing price or size for trade at {trade.timestamp}") - + # Plot the cumulative volume data using step plot ax.step(x, y, label="Cumulative Volume", where="post") + # Optionally, set labels and title for clarity + ax.set_xlabel('Timestamp') + ax.set_ylabel('Cumulative Volume') + ax.set_title('Cumulative Volume Over Time') + ax.legend() def overlay_maker_fee( ax: Axes, From 85643fd08049163853436337d56efd18f914831b Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Wed, 4 Sep 2024 15:52:37 +0100 Subject: [PATCH 7/9] chore: tidy up --- vega_query/visualisations/plots/amm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vega_query/visualisations/plots/amm.py b/vega_query/visualisations/plots/amm.py index e94d5af09..bd11e2669 100644 --- a/vega_query/visualisations/plots/amm.py +++ b/vega_query/visualisations/plots/amm.py @@ -96,7 +96,7 @@ def create( ax10 = fig.add_subplot(gs[1, 0]) ax10.set_title("Cumulated traded notional", loc="left") - ax10.set_ylabel("traded notional") + ax10.set_ylabel("Market traded notional") ax11 = fig.add_subplot(gs[0, 1]) ax11.set_title("AMM: Position", loc="left") From 4c392302e57c79bb2adcc3639bb2b6af23ac877e Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Thu, 5 Sep 2024 10:52:58 +0100 Subject: [PATCH 8/9] feat: address comments from Charlie --- vega_query/visualisations/overlay.py | 17 +++-------------- vega_query/visualisations/plots/amm.py | 4 ++-- vega_sim/scenario/amm/scenario.py | 2 +- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/vega_query/visualisations/overlay.py b/vega_query/visualisations/overlay.py index ff01eaaf2..b7392aa95 100644 --- a/vega_query/visualisations/overlay.py +++ b/vega_query/visualisations/overlay.py @@ -898,14 +898,13 @@ def overlay_cumulative_volume( trades: List[protos.vega.vega.Trade], price_decimals: int, size_decimals: int, + **kwargs, ): x = [] # List to store timestamps y = [] # List to store cumulative volume cumulative_volume = 0 # Initialize cumulative volume - trades = reversed(trades) - - for trade in trades: + for trade in reversed(trades): # Convert timestamp to datetime for x-axis timestamp = timestamp_to_datetime(trade.timestamp, nano=True) x.append(timestamp) @@ -918,25 +917,15 @@ def overlay_cumulative_volume( # Calculate traded volume (price * size) volume = price * size if price != 0 else 0 - # Debugging: Print current values - print(f"Trade timestamp: {trade.timestamp}, Price: {price}, Size: {size}, Volume: {volume}") - # Accumulate volume (ensure volume is positive) cumulative_volume += abs(volume) y.append(cumulative_volume) else: # If price or size is missing, assume no change in cumulative volume y.append(cumulative_volume) - print(f"Missing price or size for trade at {trade.timestamp}") # Plot the cumulative volume data using step plot - ax.step(x, y, label="Cumulative Volume", where="post") - - # Optionally, set labels and title for clarity - ax.set_xlabel('Timestamp') - ax.set_ylabel('Cumulative Volume') - ax.set_title('Cumulative Volume Over Time') - ax.legend() + ax.step(x, y, label="Cumulative Volume", where="post", **kwargs) def overlay_maker_fee( ax: Axes, diff --git a/vega_query/visualisations/plots/amm.py b/vega_query/visualisations/plots/amm.py index bd11e2669..4fdddd5f4 100644 --- a/vega_query/visualisations/plots/amm.py +++ b/vega_query/visualisations/plots/amm.py @@ -79,8 +79,8 @@ def create( if market_data_history is not None: overlay_mark_price(axn0l, market_data_history, market.decimal_places) overlay_trading_mode(axn0r, market_data_history) - overlay_auction_starts(axn0r, market_data_history) - overlay_auction_ends(axn0r, market_data_history) + # overlay_auction_starts(axn0r, market_data_history) + # overlay_auction_ends(axn0r, market_data_history) axn0l.set_ylabel("USDT") axn0l.set_title( diff --git a/vega_sim/scenario/amm/scenario.py b/vega_sim/scenario/amm/scenario.py index 4b668ea46..317a38ff7 100644 --- a/vega_sim/scenario/amm/scenario.py +++ b/vega_sim/scenario/amm/scenario.py @@ -68,7 +68,7 @@ def configure_agents( key_name=f"AutomatedMarketMaker_{benchmark_config.market_config.instrument.code}_{str(i_agent).zfill(3)}", market_name=benchmark_config.market_config.instrument.name, initial_asset_mint=1e6, - commitment_amount=10_000, + commitment_amount=7000, slippage_tolerance=0.05, proposed_fee=self.amm_liquidity_fee, price_process=iter(benchmark_config.price_process), From ac4ade33a4482398a430eb687ee9f9c46ece592c Mon Sep 17 00:00:00 2001 From: Charlie Date: Thu, 5 Sep 2024 15:50:10 +0100 Subject: [PATCH 9/9] chore: run linter --- vega_query/service/utils/party.py | 4 ++-- vega_query/visualisations/overlay.py | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/vega_query/service/utils/party.py b/vega_query/service/utils/party.py index b70be259c..f1bb3d552 100644 --- a/vega_query/service/utils/party.py +++ b/vega_query/service/utils/party.py @@ -96,8 +96,8 @@ def historic_balances( ) if aggregated_balance.market_id is not "": account_key += f" | {aggregated_balance.market_id[:7]}" - data[timestamp_to_datetime(aggregated_balance.timestamp)][account_key] = int( - aggregated_balance.balance + data[timestamp_to_datetime(aggregated_balance.timestamp)][account_key] = ( + int(aggregated_balance.balance) ) df = pd.DataFrame.from_dict(data, orient="index").sort_index().ffill() diff --git a/vega_query/visualisations/overlay.py b/vega_query/visualisations/overlay.py index b7392aa95..9b299454f 100644 --- a/vega_query/visualisations/overlay.py +++ b/vega_query/visualisations/overlay.py @@ -878,6 +878,7 @@ def overlay_price( y.append(price if price != 0 else np.nan) ax.step(x, y, label="price", where="post") + def overlay_volume( ax: Axes, trades: List[protos.vega.vega.Trade], @@ -893,6 +894,7 @@ def overlay_volume( y.append(price * size if price != 0 else np.nan) ax.step(x, y, label="volume", where="post") + def overlay_cumulative_volume( ax: Axes, trades: List[protos.vega.vega.Trade], @@ -908,15 +910,15 @@ def overlay_cumulative_volume( # Convert timestamp to datetime for x-axis timestamp = timestamp_to_datetime(trade.timestamp, nano=True) x.append(timestamp) - + # Ensure price and size are available - if hasattr(trade, 'price') and hasattr(trade, 'size'): + if hasattr(trade, "price") and hasattr(trade, "size"): price = padded_int_to_float(trade.price, price_decimals) size = padded_int_to_float(trade.size, size_decimals) - + # Calculate traded volume (price * size) volume = price * size if price != 0 else 0 - + # Accumulate volume (ensure volume is positive) cumulative_volume += abs(volume) y.append(cumulative_volume) @@ -927,6 +929,7 @@ def overlay_cumulative_volume( # Plot the cumulative volume data using step plot ax.step(x, y, label="Cumulative Volume", where="post", **kwargs) + def overlay_maker_fee( ax: Axes, trades: List[protos.vega.vega.Trade],