diff --git a/dydx/client.py b/dydx/client.py index 90c4830..f71d890 100644 --- a/dydx/client.py +++ b/dydx/client.py @@ -105,7 +105,7 @@ def _make_solo_order( baseMarket, quoteMarket = utils.pair_to_base_quote_markets(market) isBuy = utils.get_is_buy(side) if limitFee is None: - limitFee = utils.get_limit_fee(baseMarket, amount, postOnly) + limitFee = utils.get_limit_fee(baseMarket, amount) order = { 'salt': random.randint(0, 2**256), @@ -167,7 +167,7 @@ def _make_perp_order( baseMarket, _ = utils.pair_to_base_quote_markets(market) isBuy = utils.get_is_buy(side) if limitFee is None: - limitFee = utils.get_limit_fee(baseMarket, amount, postOnly) + limitFee = utils.get_limit_fee(baseMarket, amount) order = { 'salt': random.randint(0, 2**256), diff --git a/dydx/constants.py b/dydx/constants.py index a68e0e0..7a962f0 100644 --- a/dydx/constants.py +++ b/dydx/constants.py @@ -33,6 +33,7 @@ MARKET_USDC = 2 MARKET_DAI = 3 MARKET_PBTC = 'PBTC' +MARKET_PUSD = 'PUSD' MARKET_INVALID = 4 # ------------ Pairs ------------ @@ -40,6 +41,7 @@ PAIR_WETH_USDC = 'WETH-USDC' PAIR_DAI_USDC = 'DAI-USDC' PAIR_PBTC_USDC = 'PBTC-USDC' +PAIR_WETH_PUSD = 'WETH_PUSD' DECIMALS_WETH = 18 DECIMALS_SAI = 18 @@ -53,17 +55,7 @@ # ------------ Fees ------------ FROM_BIPS = Decimal('1e-4') -SMALL_TRADE_SIZE_WETH = 20 * (10 ** DECIMALS_WETH) -SMALL_TRADE_SIZE_DAI = 10000 * (10 ** DECIMALS_DAI) -SMALL_TRADE_SIZE_PBTC = 0.5 * (10 ** DECIMALS_PBTC) -FEE_SMALL_WETH = Decimal(100) * FROM_BIPS -FEE_LARGE_WETH = Decimal(15) * FROM_BIPS -FEE_SMALL_DAI = Decimal(100) * FROM_BIPS -FEE_LARGE_DAI = Decimal(5) * FROM_BIPS -FEE_LARGE_PBTC = Decimal(7.5) * FROM_BIPS -FEE_SMALL_PBTC = Decimal(50) * FROM_BIPS -FEE_MAKER_PBTC = Decimal(-2.5) * FROM_BIPS -FEE_ZERO = Decimal(0) +LIMIT_FEE = Decimal(100) * FROM_BIPS # ------------ Transaction Constants ------------ DEFAULT_GAS_AMOUNT = 250000 diff --git a/dydx/util.py b/dydx/util.py index 42b4faa..d820ca4 100644 --- a/dydx/util.py +++ b/dydx/util.py @@ -95,6 +95,8 @@ def pair_to_base_quote_markets(pair): return (consts.MARKET_DAI, consts.MARKET_USDC) elif pair == consts.PAIR_PBTC_USDC: return (consts.MARKET_PBTC, consts.MARKET_USDC) + elif pair == consts.PAIR_WETH_PUSD: + return (consts.MARKET_PUSD, consts.MARKET_WETH) raise ValueError('Invalid pair') @@ -106,31 +108,8 @@ def get_is_buy(side): raise ValueError('Invalid side') -def get_limit_fee(base_market, amount, postOnly): - if postOnly: - if base_market == consts.MARKET_PBTC: - if (amount < consts.SMALL_TRADE_SIZE_PBTC): - return consts.FEE_ZERO - else: - return consts.FEE_MAKER_PBTC - else: - return consts.FEE_ZERO - if base_market == consts.MARKET_WETH: - if (amount < consts.SMALL_TRADE_SIZE_WETH): - return consts.FEE_SMALL_WETH - else: - return consts.FEE_LARGE_WETH - elif base_market == consts.MARKET_DAI: - if (amount < consts.SMALL_TRADE_SIZE_DAI): - return consts.FEE_SMALL_DAI - else: - return consts.FEE_LARGE_DAI - elif base_market == consts.MARKET_PBTC: - if (amount < consts.SMALL_TRADE_SIZE_PBTC): - return consts.FEE_SMALL_PBTC - else: - return consts.FEE_LARGE_PBTC - raise ValueError('Invalid base_market') +def get_limit_fee(base_market, amount): + return consts.LIMIT_FEE def decimalToStr(d): diff --git a/tests/test_client.py b/tests/test_client.py index a95d2fc..ea02249 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -94,7 +94,7 @@ def _additional_matcher(request): assert order['amount'] == str(args['amount']) assert order['limitPrice'] == str(args['limitPrice']) assert order['triggerPrice'] == '0' - assert order['limitFee'] == '0.00075' + assert order['limitFee'] == '0.01' assert order['maker'] == client.public_address assert order['taker'] == consts.TAKER_ACCOUNT_OWNER assert abs(