malkhut(fix): CORRECT FEE BUG — taker 0.5→5.0, maker -0.2→+2.0
Fable's spec (SPEC_MALKHUT_ACTUALS_INTAKE.md) confirmed 10x fee error from our own fills (dolphin.trade_execution_quality). Fixed: - BingX taker: 0.5 → 5.0 bps - BingX maker: -0.2 → +2.0 bps (POSITIVE on BingX, not a rebate) - Binance taker: 0.4 → 4.5 bps - Bybit taker: 0.06 → 5.5 bps - All 13 per-asset profiles: maker=-0.2 taker=0.5 → maker=2.0 taker=5.0 Source of truth: dolphin.trade_execution_quality (8006 rows, avg taker=5.016 bps). Every policy trained before this fix was at 10x too-cheap fees. Re-measurement at correct fees is required.
This commit is contained in:
@@ -297,8 +297,8 @@ class TestBTCProfile:
|
|||||||
|
|
||||||
def test_fees(self):
|
def test_fees(self):
|
||||||
p = get_asset_profile("BTCUSDT")
|
p = get_asset_profile("BTCUSDT")
|
||||||
assert p.maker_fee_bps == -0.2
|
assert p.maker_fee_bps == 2.0
|
||||||
assert p.taker_fee_bps == 0.5
|
assert p.taker_fee_bps == 5.0
|
||||||
|
|
||||||
def test_orderbook(self):
|
def test_orderbook(self):
|
||||||
p = get_asset_profile("BTCUSDT")
|
p = get_asset_profile("BTCUSDT")
|
||||||
@@ -455,8 +455,8 @@ class TestBNBProfile:
|
|||||||
|
|
||||||
def test_lower_fees(self):
|
def test_lower_fees(self):
|
||||||
p = get_asset_profile("BNBUSDT")
|
p = get_asset_profile("BNBUSDT")
|
||||||
assert p.maker_fee_bps == -0.1
|
assert p.maker_fee_bps == 2.0
|
||||||
assert p.taker_fee_bps == 0.4
|
assert p.taker_fee_bps == 5.0
|
||||||
|
|
||||||
def test_is_gas(self):
|
def test_is_gas(self):
|
||||||
assert get_asset_profile("BNBUSDT").is_gas_token
|
assert get_asset_profile("BNBUSDT").is_gas_token
|
||||||
@@ -738,8 +738,8 @@ class TestProfileFieldValidation:
|
|||||||
|
|
||||||
def test_fee_bps_reasonable(self):
|
def test_fee_bps_reasonable(self):
|
||||||
for p in ASSET_PROFILES.values():
|
for p in ASSET_PROFILES.values():
|
||||||
assert -1.0 <= p.maker_fee_bps <= 1.0
|
assert 0.0 <= p.maker_fee_bps <= 10.0
|
||||||
assert 0.0 <= p.taker_fee_bps <= 2.0
|
assert 0.0 <= p.taker_fee_bps <= 10.0
|
||||||
assert p.taker_fee_bps >= p.maker_fee_bps
|
assert p.taker_fee_bps >= p.maker_fee_bps
|
||||||
|
|
||||||
def test_depth_usd_positive(self):
|
def test_depth_usd_positive(self):
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ BINANCE = ExchangeProfile(
|
|||||||
has_spot=True, has_perps=True, has_options=True,
|
has_spot=True, has_perps=True, has_options=True,
|
||||||
api_base_url="https://api.binance.com",
|
api_base_url="https://api.binance.com",
|
||||||
ws_base_url="wss://stream.binance.com:9443",
|
ws_base_url="wss://stream.binance.com:9443",
|
||||||
default_taker_fee_bps=0.4, default_maker_fee_bps=0.2,
|
default_taker_fee_bps=4.5, default_maker_fee_bps=-0.2, # UNVERIFIED maker rebate
|
||||||
typical_latency_ms=40,
|
typical_latency_ms=40,
|
||||||
)
|
)
|
||||||
EXCHANGE_PROFILES["binance"] = BINANCE
|
EXCHANGE_PROFILES["binance"] = BINANCE
|
||||||
@@ -161,7 +161,7 @@ BINGX = ExchangeProfile(
|
|||||||
has_spot=True, has_perps=True, has_options=False,
|
has_spot=True, has_perps=True, has_options=False,
|
||||||
api_base_url="https://open-api.bingx.com",
|
api_base_url="https://open-api.bingx.com",
|
||||||
ws_base_url="wss://open-api.bingx.com/swapMarket",
|
ws_base_url="wss://open-api.bingx.com/swapMarket",
|
||||||
default_taker_fee_bps=0.5, default_maker_fee_bps=0.2,
|
default_taker_fee_bps=5.0, default_maker_fee_bps=2.0, # BingX maker is POSITIVE
|
||||||
typical_latency_ms=100,
|
typical_latency_ms=100,
|
||||||
)
|
)
|
||||||
EXCHANGE_PROFILES["bingx"] = BINGX
|
EXCHANGE_PROFILES["bingx"] = BINGX
|
||||||
@@ -171,7 +171,7 @@ BYBIT = ExchangeProfile(
|
|||||||
has_spot=True, has_perps=True, has_options=True,
|
has_spot=True, has_perps=True, has_options=True,
|
||||||
api_base_url="https://api.bybit.com",
|
api_base_url="https://api.bybit.com",
|
||||||
ws_base_url="wss://stream.bybit.com/v5/public/linear",
|
ws_base_url="wss://stream.bybit.com/v5/public/linear",
|
||||||
default_taker_fee_bps=0.06, default_maker_fee_bps=-0.01,
|
default_taker_fee_bps=5.5, default_maker_fee_bps=-0.1, # UNVERIFIED
|
||||||
typical_latency_ms=50,
|
typical_latency_ms=50,
|
||||||
)
|
)
|
||||||
EXCHANGE_PROFILES["bybit"] = BYBIT
|
EXCHANGE_PROFILES["bybit"] = BYBIT
|
||||||
@@ -381,7 +381,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.DEEP,
|
liquidity_profile=LiquidityProfile.DEEP,
|
||||||
derivative_access=DerivativeAccess.PERPS_AND_OPTIONS,
|
derivative_access=DerivativeAccess.PERPS_AND_OPTIONS,
|
||||||
tick_size=0.1, lot_size=0.001, price_decimals=1,
|
tick_size=0.1, lot_size=0.001, price_decimals=1,
|
||||||
maker_fee_bps=-0.2, taker_fee_bps=0.5,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=0.3, typical_depth_usd=5_000_000,
|
typical_spread_bps=0.3, typical_depth_usd=5_000_000,
|
||||||
typical_daily_volume_usd=30_000_000_000,
|
typical_daily_volume_usd=30_000_000_000,
|
||||||
coingecko_id="bitcoin", cmc_id=1, blockchain="bitcoin", contract_address="",
|
coingecko_id="bitcoin", cmc_id=1, blockchain="bitcoin", contract_address="",
|
||||||
@@ -398,7 +398,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.DEEP,
|
liquidity_profile=LiquidityProfile.DEEP,
|
||||||
derivative_access=DerivativeAccess.PERPS_AND_OPTIONS,
|
derivative_access=DerivativeAccess.PERPS_AND_OPTIONS,
|
||||||
tick_size=0.01, lot_size=0.001, price_decimals=2,
|
tick_size=0.01, lot_size=0.001, price_decimals=2,
|
||||||
maker_fee_bps=-0.2, taker_fee_bps=0.5,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=0.5, typical_depth_usd=3_000_000,
|
typical_spread_bps=0.5, typical_depth_usd=3_000_000,
|
||||||
typical_daily_volume_usd=15_000_000_000,
|
typical_daily_volume_usd=15_000_000_000,
|
||||||
coingecko_id="ethereum", cmc_id=1027, blockchain="ethereum", contract_address="",
|
coingecko_id="ethereum", cmc_id=1027, blockchain="ethereum", contract_address="",
|
||||||
@@ -415,7 +415,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.NORMAL,
|
liquidity_profile=LiquidityProfile.NORMAL,
|
||||||
derivative_access=DerivativeAccess.PERPS_ONLY,
|
derivative_access=DerivativeAccess.PERPS_ONLY,
|
||||||
tick_size=0.01, lot_size=0.01, price_decimals=2,
|
tick_size=0.01, lot_size=0.01, price_decimals=2,
|
||||||
maker_fee_bps=-0.2, taker_fee_bps=0.5,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=1.0, typical_depth_usd=1_000_000,
|
typical_spread_bps=1.0, typical_depth_usd=1_000_000,
|
||||||
typical_daily_volume_usd=3_000_000_000,
|
typical_daily_volume_usd=3_000_000_000,
|
||||||
coingecko_id="solana", cmc_id=5426, blockchain="solana", contract_address="",
|
coingecko_id="solana", cmc_id=5426, blockchain="solana", contract_address="",
|
||||||
@@ -432,7 +432,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.NORMAL,
|
liquidity_profile=LiquidityProfile.NORMAL,
|
||||||
derivative_access=DerivativeAccess.PERPS_ONLY,
|
derivative_access=DerivativeAccess.PERPS_ONLY,
|
||||||
tick_size=0.00001, lot_size=1.0, price_decimals=5,
|
tick_size=0.00001, lot_size=1.0, price_decimals=5,
|
||||||
maker_fee_bps=-0.2, taker_fee_bps=0.5,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=2.0, typical_depth_usd=500_000,
|
typical_spread_bps=2.0, typical_depth_usd=500_000,
|
||||||
typical_daily_volume_usd=1_000_000_000,
|
typical_daily_volume_usd=1_000_000_000,
|
||||||
coingecko_id="dogecoin", cmc_id=74, blockchain="dogecoin", contract_address="",
|
coingecko_id="dogecoin", cmc_id=74, blockchain="dogecoin", contract_address="",
|
||||||
@@ -449,7 +449,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.NORMAL,
|
liquidity_profile=LiquidityProfile.NORMAL,
|
||||||
derivative_access=DerivativeAccess.PERPS_ONLY,
|
derivative_access=DerivativeAccess.PERPS_ONLY,
|
||||||
tick_size=0.0001, lot_size=1.0, price_decimals=4,
|
tick_size=0.0001, lot_size=1.0, price_decimals=4,
|
||||||
maker_fee_bps=-0.2, taker_fee_bps=0.5,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=1.0, typical_depth_usd=800_000,
|
typical_spread_bps=1.0, typical_depth_usd=800_000,
|
||||||
typical_daily_volume_usd=500_000_000,
|
typical_daily_volume_usd=500_000_000,
|
||||||
coingecko_id="cardano", cmc_id=2010, blockchain="cardano", contract_address="",
|
coingecko_id="cardano", cmc_id=2010, blockchain="cardano", contract_address="",
|
||||||
@@ -466,7 +466,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.NORMAL,
|
liquidity_profile=LiquidityProfile.NORMAL,
|
||||||
derivative_access=DerivativeAccess.PERPS_ONLY,
|
derivative_access=DerivativeAccess.PERPS_ONLY,
|
||||||
tick_size=0.01, lot_size=0.01, price_decimals=2,
|
tick_size=0.01, lot_size=0.01, price_decimals=2,
|
||||||
maker_fee_bps=-0.2, taker_fee_bps=0.5,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=1.2, typical_depth_usd=600_000,
|
typical_spread_bps=1.2, typical_depth_usd=600_000,
|
||||||
typical_daily_volume_usd=400_000_000,
|
typical_daily_volume_usd=400_000_000,
|
||||||
coingecko_id="avalanche-2", cmc_id=5805, blockchain="avalanche", contract_address="",
|
coingecko_id="avalanche-2", cmc_id=5805, blockchain="avalanche", contract_address="",
|
||||||
@@ -483,7 +483,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.THIN,
|
liquidity_profile=LiquidityProfile.THIN,
|
||||||
derivative_access=DerivativeAccess.PERPS_ONLY,
|
derivative_access=DerivativeAccess.PERPS_ONLY,
|
||||||
tick_size=0.01, lot_size=0.01, price_decimals=2,
|
tick_size=0.01, lot_size=0.01, price_decimals=2,
|
||||||
maker_fee_bps=-0.2, taker_fee_bps=0.5,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=2.0, typical_depth_usd=300_000,
|
typical_spread_bps=2.0, typical_depth_usd=300_000,
|
||||||
typical_daily_volume_usd=200_000_000,
|
typical_daily_volume_usd=200_000_000,
|
||||||
coingecko_id="uniswap", cmc_id=7083, blockchain="ethereum",
|
coingecko_id="uniswap", cmc_id=7083, blockchain="ethereum",
|
||||||
@@ -501,7 +501,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.THIN,
|
liquidity_profile=LiquidityProfile.THIN,
|
||||||
derivative_access=DerivativeAccess.PERPS_ONLY,
|
derivative_access=DerivativeAccess.PERPS_ONLY,
|
||||||
tick_size=0.01, lot_size=0.01, price_decimals=2,
|
tick_size=0.01, lot_size=0.01, price_decimals=2,
|
||||||
maker_fee_bps=-0.2, taker_fee_bps=0.5,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=1.0, typical_depth_usd=700_000,
|
typical_spread_bps=1.0, typical_depth_usd=700_000,
|
||||||
typical_daily_volume_usd=400_000_000,
|
typical_daily_volume_usd=400_000_000,
|
||||||
coingecko_id="chainlink", cmc_id=1975, blockchain="ethereum",
|
coingecko_id="chainlink", cmc_id=1975, blockchain="ethereum",
|
||||||
@@ -519,7 +519,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.DEEP,
|
liquidity_profile=LiquidityProfile.DEEP,
|
||||||
derivative_access=DerivativeAccess.PERPS_ONLY,
|
derivative_access=DerivativeAccess.PERPS_ONLY,
|
||||||
tick_size=0.01, lot_size=0.001, price_decimals=2,
|
tick_size=0.01, lot_size=0.001, price_decimals=2,
|
||||||
maker_fee_bps=-0.1, taker_fee_bps=0.4,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=0.5, typical_depth_usd=2_000_000,
|
typical_spread_bps=0.5, typical_depth_usd=2_000_000,
|
||||||
typical_daily_volume_usd=2_000_000_000,
|
typical_daily_volume_usd=2_000_000_000,
|
||||||
coingecko_id="binancecoin", cmc_id=1839, blockchain="binance",
|
coingecko_id="binancecoin", cmc_id=1839, blockchain="binance",
|
||||||
@@ -537,7 +537,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.THIN,
|
liquidity_profile=LiquidityProfile.THIN,
|
||||||
derivative_access=DerivativeAccess.PERPS_ONLY,
|
derivative_access=DerivativeAccess.PERPS_ONLY,
|
||||||
tick_size=0.0001, lot_size=1.0, price_decimals=4,
|
tick_size=0.0001, lot_size=1.0, price_decimals=4,
|
||||||
maker_fee_bps=-0.2, taker_fee_bps=0.5,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=1.5, typical_depth_usd=500_000,
|
typical_spread_bps=1.5, typical_depth_usd=500_000,
|
||||||
typical_daily_volume_usd=300_000_000,
|
typical_daily_volume_usd=300_000_000,
|
||||||
coingecko_id="matic-network", cmc_id=3890, blockchain="ethereum",
|
coingecko_id="matic-network", cmc_id=3890, blockchain="ethereum",
|
||||||
@@ -555,7 +555,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.THIN,
|
liquidity_profile=LiquidityProfile.THIN,
|
||||||
derivative_access=DerivativeAccess.PERPS_ONLY,
|
derivative_access=DerivativeAccess.PERPS_ONLY,
|
||||||
tick_size=0.01, lot_size=0.01, price_decimals=2,
|
tick_size=0.01, lot_size=0.01, price_decimals=2,
|
||||||
maker_fee_bps=-0.2, taker_fee_bps=0.5,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=2.5, typical_depth_usd=200_000,
|
typical_spread_bps=2.5, typical_depth_usd=200_000,
|
||||||
typical_daily_volume_usd=150_000_000,
|
typical_daily_volume_usd=150_000_000,
|
||||||
coingecko_id="aave", cmc_id=7278, blockchain="ethereum",
|
coingecko_id="aave", cmc_id=7278, blockchain="ethereum",
|
||||||
@@ -573,7 +573,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.NORMAL,
|
liquidity_profile=LiquidityProfile.NORMAL,
|
||||||
derivative_access=DerivativeAccess.PERPS_ONLY,
|
derivative_access=DerivativeAccess.PERPS_ONLY,
|
||||||
tick_size=0.001, lot_size=0.1, price_decimals=3,
|
tick_size=0.001, lot_size=0.1, price_decimals=3,
|
||||||
maker_fee_bps=-0.2, taker_fee_bps=0.5,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=1.0, typical_depth_usd=600_000,
|
typical_spread_bps=1.0, typical_depth_usd=600_000,
|
||||||
typical_daily_volume_usd=300_000_000,
|
typical_daily_volume_usd=300_000_000,
|
||||||
coingecko_id="polkadot", cmc_id=6636, blockchain="polkadot", contract_address="",
|
coingecko_id="polkadot", cmc_id=6636, blockchain="polkadot", contract_address="",
|
||||||
@@ -590,7 +590,7 @@ ASSET_PROFILES: Dict[str, AssetProfile] = {
|
|||||||
liquidity_profile=LiquidityProfile.THIN,
|
liquidity_profile=LiquidityProfile.THIN,
|
||||||
derivative_access=DerivativeAccess.PERPS_ONLY,
|
derivative_access=DerivativeAccess.PERPS_ONLY,
|
||||||
tick_size=0.01, lot_size=0.01, price_decimals=2,
|
tick_size=0.01, lot_size=0.01, price_decimals=2,
|
||||||
maker_fee_bps=-0.2, taker_fee_bps=0.5,
|
maker_fee_bps=2.0, taker_fee_bps=5.0,
|
||||||
typical_spread_bps=2.0, typical_depth_usd=250_000,
|
typical_spread_bps=2.0, typical_depth_usd=250_000,
|
||||||
typical_daily_volume_usd=100_000_000,
|
typical_daily_volume_usd=100_000_000,
|
||||||
coingecko_id="cosmos", cmc_id=3794, blockchain="cosmos", contract_address="",
|
coingecko_id="cosmos", cmc_id=3794, blockchain="cosmos", contract_address="",
|
||||||
|
|||||||
Reference in New Issue
Block a user