
Hummingbot Gateway is a REST API that exposes connections to various blockchains (wallet, node & chain interaction) and decentralized exchanges (pricing, trading & liquidity provision). It is written in Typescript and takes advantage of existing blockchain and DEX SDKs. The advantage of using gateway is it provideds a programming language agnostic approach to interacting with blockchains and DEXs.
Gateway may be used alongside the main Hummingbot client to enable trading on DEXs, or as a standalone module by external developers.
This is a list of DEX connections currently supported by Gateway.
| Connector | Blockchain | Trading Interface |
|---|---|---|
| UniswapV2 | Ethereum | AMM |
| Sushiswap | Ethereum | AMM |
| UniswapV3 | Ethereum | EVM_Range_AMM |
| Pangolin | Avalanche | AMM |
| PancakeSwap | Binance Smart Chain | AMM |
| Traderjoe | Avalanche | AMM |
| Quickswap | Polygon | AMM |
| Perp | Ethereum | EVM_Perpetual |
| Mad Meerkat | Cronos | AMM |
| VVS | Cronos | AMM |
There are a number of ways to contribute to gateway.
Add a new blockchain.
Add a new connector/DEX.
Fix a bug.
File an issue at hummingbot issues
Make a PR for anything useful on hummingbot.
Vote on a snapshot proposal: Hummingbot PRP, Hummingbot Foundation - HGP, Hummingbot Improvement Proposals.
Before running gateway, you need to setup some configs. You can start by copying all of the yml files from src/templates to conf. The format of this files are dictated by src/services/config-manager-v2.ts and the corresponding schema files in src/services/schema .
If you want to turn off https, set unsafeDevModeWithHTTP to true in conf/server.yml.
If you gateway to log to standard out, set logToStdOut to true in conf/logging.yml.
Edit the path to the SSL files in conf/ssl.yml. This can be generated by hummingbot with gateway generate-certs.
The hummingbot client is also able to edit this config files.
Compile the Typescript code with npm or yarn .
yarn
yarn build
yarn dev --passphrase=<ssl-files-passphrase>
# the passphrase can be anything if unsafeDevModeWithHTTP is true
The API is documented using swagger: gateway swagger docs. You can run the gateway swagger UI by starting gateway and visiting localhost:8080.
You can follow details about trading interfaces
Also, we maintain docs on the official website about gateway here.
Here are some files we recommend you look at in order to get familiar with the gateway code base.
src/services/ethereum-base.ts is a base class for EVM chains.
src/connectors/uniswap/uniswap.ts has functionality for interacting with Uniswap V2.
src/services/validator.ts defines functions for validating request payloads.
When making a PR, there are unit test coverage requirements. Look at our github workflow for the exact definition. There are some more
Read this document for more details about how to write unit test in gateway: How we write unit tests for gateway.
Run all unit tests.
yarn test:unit
Run an individual test file.
yarn jest test/app.test.ts
We have found it is useful to test individual endpoints with curl commands. We have a collection of prepared curl calls. POST bodies are stored in JSON files. Take a look at the curl calls for gateway. Note that some environment variables are expected.
This repo uses eslint and prettier. When you run git commit it will trigger the pre-commit hook. This will run eslint on the src and test directories.
You can lint before committing with:
yarn run lint
You can run the prettifier before committing with:
yarn run prettier
Content type
Image
Digest
sha256:38d205833…
Size
962.9 MB
Last updated
over 3 years ago
docker pull hummingbot/gateway-v2:gateway-v2-dev