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

dYdX - Upgrade the connector to v4 #6897

Open
nikspz opened this issue Mar 8, 2024 · 21 comments · May be fixed by #6987
Open

dYdX - Upgrade the connector to v4 #6897

nikspz opened this issue Mar 8, 2024 · 21 comments · May be fixed by #6987

Comments

@nikspz
Copy link
Contributor

nikspz commented Mar 8, 2024

Description

Objective:
Upgrade the dYdX Connector to the latest standart v4. The connector should meet Hummingbot connector standarts https://hummingbot.org/developers/connectors/perp-connector-checklist/
and Contribution Guidelines
https://hummingbot.org/developers/contributions/

Submission: To submit your proposal, please provide details of your experience, approach to the upgrade, estimated timeline, and any relevant past projects or contributions.

Selection Criteria: Submissions will be evaluated based on technical expertise, experience with blockchain development, understanding of the dYdX protocol, proposed timeline.

For the mention here:
https://dydx.exchange/blog/v4-technical-architecture-overview
https://dydx.exchange/blog?#v4

Bounty

  • Sponsor: HB foundation (dYdX connector pots)
  • Bounty amount: 700K HBOT
  • Developer portion: 4000 USDC or 630K HBOT
@yancong001
Copy link
Contributor

I would like to be assigned this ticket

@nikspz
Copy link
Contributor Author

nikspz commented Mar 12, 2024

Assigned to @yancong001, please be informed:

Thanks for your contribution!

@nikspz
Copy link
Contributor Author

nikspz commented Mar 13, 2024

@yancong001
Currently there's a new bounty process.
Assigned developer should choose bounty amount (from advised) when dev assigned, please specify with comment below 4000 USDC or 630K HBOT

@yancong001
Copy link
Contributor

i prefer 630K HBOT

@nikspz
Copy link
Contributor Author

nikspz commented Mar 13, 2024

i prefer 630K HBOT

Thanks, noted

@nikspz
Copy link
Contributor Author

nikspz commented Mar 26, 2024

Hello @yancong001, Please add your updates on this bounty here

@yancong001
Copy link
Contributor

I'm halfway there. I'll submit the code this week.

@yancong001
Copy link
Contributor

hi,nikspz
I had some problems with the method dydx placed and canceled orders, which caused me to interrupt the process.

@yancong001
Copy link
Contributor

The official recommendation is to use the v4-client-py library, but they removed it some time ago (it is no longer installed). I tried to find the answer from a third-party library, but the process ran into difficulties.
image

image

I was just talking to fede about that

@fengtality
Copy link
Sponsor Contributor

The official recommendation is to use the v4-client-py library, but they removed it some time ago (it is no longer installed). I tried to find the answer from a third-party library, but the process ran into difficulties. image

image

I was just talking to fede about that

@yancong001 We asked dYdX and this was their reply:

We don't have an official python client and we are pointing people to the 3rd party forked client
https://twitter.com/LawrenceChiu14/status/1756111223509106831

Also, please take a look at these guides

  1. setup https://docs.google.com/document/d/1ZbVRpAjwdmJ4IOIU6QN0l0jt2sD8f4xGhE3RoCukkFc/edit?usp=sharing
  2. user manual https://docs.google.com/document/d/13aZz9o4g0WyLrteelBYDUOUmzJgOaPouVwRrF0kn-to/edit?usp=sharing

Let me know your Telegram handle and I'll add you to the group for easier communication

@yancong001
Copy link
Contributor

got it , i will continue

@nikspz
Copy link
Contributor Author

nikspz commented Apr 19, 2024

hi @yancong001 Could you please add your updates / progress info for dydx to v4 bounty here

@yancong001
Copy link
Contributor

I am 80% done and I will submit the code in a few days

@yancong001
Copy link
Contributor

here #6987

@yancong001
Copy link
Contributor

There are still some bugs, which I am working on

@yancong001
Copy link
Contributor

yancong001 commented Apr 26, 2024

I have tested orderbook, userstream, balance and other interfaces, but now I am stuck in the “place order” interface.
I encountered the the problem shown in the picture, which seems to be related to the “v4_proto” library of dydx_v4 and protobuf. I changed the ptorobuf and v4_proto versions, but it still didn't work.
I hope I could get some help.
image

@yancong001
Copy link
Contributor

yancong001 commented Apr 26, 2024

This is my test script

from hummingbot.core.data_type.common import OrderType, PositionAction, PositionMode, PositionSide, TradeType

from hummingbot.client.hummingbot_application import HummingbotApplication
from hummingbot.core.data_type.common import OrderType
from hummingbot.strategy.script_strategy_base import ScriptStrategyBase
from decimal import Decimal


class TestLimitOrders(ScriptStrategyBase):
    """
    This is a simple script strategy that buys 0.01 ETH at market price, then sells it at market price.
    The objective is to test the market order functionality of the Binance connector.
    """
    trading_pair = "TRX-USD"
    order_amount = Decimal("100")
    markets = {"dydx_v4_perpetual":{trading_pair}}
    buy_order_id = None
    sell_order_id = None

    def on_tick(self):
        if not self.buy_order_id:
            self.buy_order_id = self.connectors["dydx_v4_perpetual"].buy(
                trading_pair=self.trading_pair,
                amount=self.order_amount,
                price=Decimal("0.11"),
                position_action=PositionAction.OPEN,
                order_type=OrderType.LIMIT)
        HummingbotApplication.main_application().stop()


@rapcmia rapcmia linked a pull request Apr 29, 2024 that will close this issue
2 tasks
@yancong001
Copy link
Contributor

I found the problem.
dydx v4‘s library "v4-proto" and injective's "injective-py" conflict with each other.

@yancong001
Copy link
Contributor

At present, orders can be successfully placed when injective connector is removed, but there are still some problems in canceling orders, which I am working on.
Now we need to consider whether not to load injective connector (paper_trade) when hummingbot_appliaction starts.

@fengtality
Copy link
Sponsor Contributor

Now we need to consider whether not to load injective connector (paper_trade) when hummingbot_appliaction starts.

Actually, I just merged in a PR to development that removes InjectiveV2 as a default paper trading connector, so it shouldn't be loaded upon startup anymore. Does that solve the issue?

@yancong001
Copy link
Contributor

yancong001 commented May 5, 2024

image
I noticed that injective is still loaded at this point in the picture, which still causes conflict. @fengtality
With injective_v2 removed(”rm -rf hummingbot/connector/exchange/injective_v2/“, dydx_v4 can now be tested. @nikspz
Next I'll add unittest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Work
Development

Successfully merging a pull request may close this issue.

3 participants