Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/kraken market orders #6703

Merged
merged 11 commits into from Dec 16, 2023
Merged

Feat/kraken market orders #6703

merged 11 commits into from Dec 16, 2023

Conversation

fengtality
Copy link
Sponsor Contributor

Before submitting this PR, please make sure:

  • Your code builds clean without any errors or warnings
  • You are using approved title ("feat/", "fix/", "docs/", "refactor/")

A description of the changes proposed in the pull request:

  • Add support for market orders to the Kraken connector
  • Adds a sample script that places an order that can be used to test order placement functionality on various connectors.

Copy link
Contributor

@cardosofede cardosofede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that also you need to adapt the test

elif order_type is OrderType.LIMIT_MAKER:
order_type_str = 'LIMIT_MAKER'
else:
order_type_str = 'MAKER'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that Market is MAKER in kraken?

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch this should be MARKET. It's just used in the log message below.

@@ -822,7 +822,7 @@ cdef class KrakenExchange(ExchangeBase):
try:
order_result = None
order_decimal_amount = f"{decimal_amount:f}"
if order_type is OrderType.LIMIT or order_type is OrderType.LIMIT_MAKER:
if order_type is OrderType.LIMIT or order_type is OrderType.LIMIT_MAKER or order_type is OrderType.MARKET:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you can simplify (mainly if other types are added) with
if order_type in self.supported_order_types() that you added in line 777

@rapcmia
Copy link
Contributor

rapcmia commented Dec 8, 2023

Run the market order script here

  • Getting OSError: {'error': {'error': ['EOrder:Invalid price:Invalid price argument.']}}
    2023-12-08 12:00:32,224 - 4703 - hummingbot.connector.exchange.kraken.kraken_exchange - ERROR - Error received from https://api.kraken.com/0/private/AddOrder. Response is {'error': ['EOrder:Invalid price:Invalid price argument.']}.
    2023-12-08 12:00:32,225 - 4703 - hummingbot.connector.exchange.kraken.kraken_exchange - NETWORK - Error submitting buy MAKER order to Kraken for 0.20000000 SOL-USDT NaN.
    Traceback (most recent call last):
      File "hummingbot/connector/exchange/kraken/kraken_exchange.pyx", line 837, in hummingbot.connector.exchange.kraken.kraken_exchange.KrakenExchange.execute_buy
        order_result = await self.place_order(userref=userref,
      File "hummingbot/connector/exchange/kraken/kraken_exchange.pyx", line 799, in place_order
        return await self._api_request_with_retry("post",
      File "hummingbot/connector/exchange/kraken/kraken_exchange.pyx", line 711, in _api_request_with_retry
        raise e
      File "hummingbot/connector/exchange/kraken/kraken_exchange.pyx", line 694, in hummingbot.connector.exchange.kraken.kraken_exchange.KrakenExchange._api_request_with_retry
        result= await self._api_request(method, endpoint, params, data, is_auth_required)
      File "hummingbot/connector/exchange/kraken/kraken_exchange.pyx", line 722, in _api_request
        async with self._throttler.execute_task(endpoint):
      File "hummingbot/connector/exchange/kraken/kraken_exchange.pyx", line 766, in hummingbot.connector.exchange.kraken.kraken_exchange.KrakenExchange._api_request
        raise IOError({"error": response_json})
    OSError: {'error': {'error': ['EOrder:Invalid price:Invalid price argument.']}}
    
    • Run the same script on other connectors that support market order, all ok but not with this PR

logs_a.log

@fengtality
Copy link
Sponsor Contributor Author

@rapcmia I updated the Kraken connector - can you test it out, especially on V2 strategies (ie. Binanc/Kucoin candles + trading on Kraken)

Copy link
Contributor

@nikspz nikspz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test performed:

  • Cloned and installed feature branch
  • Ran Dman-v3 strategy using kraken and binance_perpetual as candles exchange
  • Review bot failed to close orders with market orders (discussed to update later)
  • Ran simple_order_example script on sell and buy, review market order was filled
  • Created/start pureMM using kraken, review order fills not affected

Copy link
Contributor

@cardosofede cardosofede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@fengtality fengtality merged commit f777742 into development Dec 16, 2023
2 checks passed
@fengtality fengtality deleted the feat/kraken-market-orders branch December 16, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants