Mango integration for Hummingbot

Hi guys! I have been using Mango for some time now and even though the mango-explorer provides some good code to write your own market-maker, it still seems too hard for most people to run their own, unique market-making strategy on Mango. Thus I would like to see some work being done on this front, without needing to reinvent the wheel.

I propose that the Mango DAO should put out a bounty for the integration of a Mango connector for the market-making system.

I’m sure many crypto market makers already do have experience with their open-source software, as its GitHub repo has over 3.2k stars and 1.1k forks, and its community is continually offered numerous liquidity mining grants by token issuers such as SHIB, ALGO, AXIE and AVAX on exchanges such as Binance and AscendEX.

The goal is to make it easier for new market-makers to embark on Mango and to utilize their ever-expanding toolbox of efficient (CPython) and powerful (Avellaneda-Stoikov) market-making algorithms. This will increase order book depth and the variety of deployed market-maker strategies, which will minimize spread and create more order book activity, increasing users’ trust in the Mango markets’ prices.

I leave it up to the DAO to decide on how large the bounty should be and whether this actually is needed. Personally, I would find using Hummingbot on Mango very appealing and it would send a clear signal to the rest of the market-maker world that Mango is a hot place to be.

The implementation could be quite daunting as Mango would be the first

  • Solana protocol
  • and decentralized CLOB

to be implemented on Hummingbot. So it would probably be a good idea if someone from the DAO, experienced with Hummingbot (ideally a code contributor to their project), could survey the amount of work needing to be done and make a sensible estimate for a fair bounty price. The rest will be left to discussion.



1 Like

So it would probably be a good idea if someone from the DAO, experienced with Hummingbot (ideally a code contributor to their project), could survey the amount of work needing to be done and make a sensible estimate for a fair bounty price.

We can work together tomorrow to make an estimate of the amount of work + level of skill required to do this.

Do you know what kind of person typically uses hummingbot? Any guesses on how much of the liquidity on other dexes come from hummingbot?

Would be interested to see what kind of approach someone proposes.

Afaik hummingbot is written in python, so it could use mango-explorer to interact with the mango program directly, another option is to use the REST API from here mango-v3-service/mango-service-v3 at master · microwavedcola1/mango-v3-service · GitHub

IMO hummingbot integration would help doing the cross exchange dance of market making and could potentially bring in more liquidity.

I also remember that hummingbot offers creation of dedicated discord channels for integration with new CEX’es or DEX’es, but last time I checked the activity was a bit thin, maybe its better now.

1 Like

I just talked to Jay Kubert from AscendEX. He told me that they paid the Hummingbot developers 20k$ to get their spot connector developed in 6 months, which means without perps. I promised to stay in touch with him, so maybe I can get him to spill some more beans for me.

1 Like

6 months is way too long. We can pay more if it can be done in under a month.

1 Like

Some statistics:
The ascendEX spot connector contains ~2250 lines of code, the Binance perp connector ~1950 lines. Its test code spans ~500 lines.

One month could indeed be feasible. Hummingbot documented the requirements to implement a connector here Connector Requirements - Hummingbot Documentation where we would need to:

  1. Implement OrderBook for business logic & OrderBookDataSource which manages all the calls to Mango.
  2. Implement UserStreamTracker to query/listen for user account changes.
  3. InFlightOrder to describe how an order is structured, also for listening to changes in order status.
  4. Exchange class, which manages all the available actions for the user (this and 3. is the most work).
  5. Specify rate throttling behavior, initialize the connector, specify configuration parameters.
  6. Test and debug.

I’m talking with a guy, who also seems interested in implementing this python connector. I believe we could do it in one month, at the worst in two, as it’s the first connector for Solana.

Here’s my proposal: For 30k$ I’ll see to it that it gets finished by the 31st of December and for every new month after that, we reduce the pay by 5k$, such that you’d get it for 20k$ after three months.

1 Like

PS: Can someone write an SC defining this proposal with an oracle, such that the payment will be calculated and processed when this fork is merged into Hummingbot’s development branch? :wink:

Do you know if there’s a Websocket for Mango, too?

EDIT: But I’d probably go for the mango-explorer implementation, so that the connector communicates directly with the RPC node.

so I have L1/L2 on websockets here GitHub - microwavedcola1/mango-vial: Real-time WebSocket market data API for Mango Markets v3


Update: I was digging around the Hummingbot code base and found that they use a construct called a “Gateway” to connect to on-chain exchanges. These are implemented here:

The implementation follows TypeScript and is deployed as a local server besides the Hummingbot process. Here I wanna thank @microwavedcola for coincidentally implementing the needed services for Mango. The implementation in the gateway-api repository will require to disentangle some code, which will be generally needed to interact with Solana, but I’m confident we can do this (as we already talked and, if needed, the Hummingbot team will help out, too).

Solana Foundation Grant
This poses an opportunity to also ask the Solana Foundation for a grant, as this piece of software will enable many more DEXes on Solana to build their own connector. Two very prominent protocols, Uniswap and Balancer, already on board for Ethereum. Mango has the chance to become the very first protocol for Solana to join their ranks as easily accessible DEXes for HFT.

PS: Any tips on filling out the Solana Foundation form (Form)?

1 Like

Another update:
A friend of mine (JS/TS dev) and me will meet Mike from Hummingbot on Monday to be introduced to their plans regarding Gateway v2. He disclosed that many devs in Solana seem to be interested in creating a Hummingbot integration and that we’ll work together in making that happen. Excited!


Hi @dipfit,

Any update on how your conversation went? Any new information?

Hey @PlayerOfBits, thanks for asking.

We met up with Mike, introduced us to the other Solana-interested developers, had a webinar into Gateway v2 and tomorrow I’ll be discussing with the Hummingbot team on how to design their architecture to be more chain-agnostic.

I saw that there’s someone from in the 14-ppl strong Solana Connector Telegram group. So competitors are on board as well.

It seems that me and my mate are the only one’s actively pushing to get this done, there has been no activity in the Telegram besides Hummingbot’s guys and us. I’m interested to hear what the HB team has to say about the proposed refactorings in their python code, which would enable all the CLOB strategies (as well as perp arbitrage strategy) on HB for Mango and other Solana protocols.

We forked their git repo on GitHub - yourtrading-ai/hummingbot: Hummingbot: a client for crypto market making. If you are interested in collaboration, just shoot me a message and I’ll add you to the team. :mango:


Thanks, and I appreciate the update! I’m trying to avoid spreading myself too thin, but I may take you up on it. Cheers!

1 Like

this is really exciting, any activity that results in easier trader onboarding has my full support

Hey guys, good news!

Our PR for Solana (base) integration for Hummingbot went through, though right now only available from the CoinAlpha repository, until they merge it into the official hummingbot repo: Solana Gateway by MHHukiewitz · Pull Request #30 · CoinAlpha/hummingbot · GitHub

We’re now in full swing of our Mango integration for Hummingbot, as the first Solana project being connected: GitHub - yourtrading-ai/hummingbot at feat/gateway-v2_mango-integration

Even though we’re around a month behind what we believed should’ve been schedule, we’re optimistic to release a stable and QAed version of Hummingbot mid/end February, where both, perpetuals and spot market, will work with the trading software.


Update: After a further survey of the Hummingbot project, it appears that more work needs to be done than expected.

Even though Perpetuals support does exist, it is only implemented for Isolated Margin products. Cross Margin is a whole new beast to HB, so their team is currently conceptualizing the necessary architecture: Create new MarginTrading interface · Issue #3307 · hummingbot/hummingbot · GitHub. I intend to continue working with them on this issue, but this approximately delays a working, out-of-the-box implementation of a Perpetuals bot for Mango by around two months, until end of April.

As I’ll be probably waiting for the HB team to specify the Cross Margin interface, I think the best would be to stick to the simpler things and implement basic Serum markets integration for HB. I suspect that a lot of code would then be able to be recycled for the Mango connector.

I hope this isn’t too big of a downer for the Mangoes out there. I am sorry if I let you down. I aim to deliver a stable and reliable code-base, to make Hummingbot + Solana really click. I hope that in the meantime, you guys can manage to increase liquidity on your own, without the help of the Hummingbot army.

Kind regards,


Thanks for the update! It’s a pity that we won’t get to try it with Mango soon, but I appreciate the work you are doing.

1 Like