diff --git a/fin_depo/defi_kucoin.py b/fin_depo/defi_kucoin.py index 1f9133b..be19f01 100644 --- a/fin_depo/defi_kucoin.py +++ b/fin_depo/defi_kucoin.py @@ -124,8 +124,7 @@ class KucoinDepoFetcher(DepoFetcher): def place_market_order( self, - input_asset: fin_defs.Asset, - input_amount: Decimal, + input_: fin_defs.AssetAmount, output_asset: fin_defs.Asset, ) -> TradeOrderDetails: """Executes a market order through the Kucoin market. @@ -155,22 +154,22 @@ class KucoinDepoFetcher(DepoFetcher): msg = 'KucoinDepoFetcher.allow_trades is not enabled: Cannot make trades' raise PermissionError(msg) - if fin_defs.USDT not in [input_asset, output_asset]: + if fin_defs.USDT not in [input_.asset, output_asset]: msg = 'Non-USDT Markets are not supported' raise NotImplementedError(msg) # Convert arguments to kucoin client arguments - if input_asset == fin_defs.USDT: + if input_.asset == fin_defs.USDT: symbol: str = ( - f'{output_asset.raw_short_name()}-{input_asset.raw_short_name()}' + f'{output_asset.raw_short_name()}-{input_.asset.raw_short_name()}' ) side: str = 'buy' size = None - funds = str(input_amount) + funds = str(input_.amount) else: - symbol = f'{input_asset.raw_short_name()}-{output_asset.raw_short_name()}' + symbol = f'{input_.asset.raw_short_name()}-{output_asset.raw_short_name()}' side = 'sell' - size = str(input_amount) + size = str(input_.amount) funds = None # Place order @@ -181,7 +180,7 @@ class KucoinDepoFetcher(DepoFetcher): size=size, funds=funds, ) - del symbol, side, size, funds, input_amount + del symbol, side, size, funds, input_ # Determine order details return self._get_order_details(response['orderId']) diff --git a/test/test_kucoin_trading.py b/test/test_kucoin_trading.py index 54a1a09..dd24d7a 100644 --- a/test/test_kucoin_trading.py +++ b/test/test_kucoin_trading.py @@ -49,8 +49,7 @@ def test_place_buy_side_order(): input_amount = Decimal('0.1') order_details = fetcher.place_market_order( - fin_defs.USDT, - input_amount, + fin_defs.AssetAmount(fin_defs.USDT, input_amount), fin_defs.MPC, ) @@ -85,8 +84,7 @@ def test_place_sell_side_order(): input_amount = Decimal('1') order_details = fetcher.place_market_order( - fin_defs.MPC, - input_amount, + fin_defs.AssetAmount(fin_defs.MPC, input_amount), fin_defs.USDT, )