Skip to content

Latest commit

 

History

History
126 lines (89 loc) · 5.99 KB

README.md

File metadata and controls

126 lines (89 loc) · 5.99 KB

Marketing Monitoring API

GitHub release (latest by date) GitHub Release Date GitHub license

GitHub release (latest by date including pre-releases) GitHub commits since latest release (by date) GitHub contributors

GitHub Workflow Status GitHub repo size

ℹ️ Overview

This repository contains a smaller helper app that fetches the latest price of a given token from the CoinGecko's API and compares its price across different markets to detect if it is susceptible to arbitrage opportunities.

This helper app is used by the Cosmos Custom Data API to trigger alerts in case there are arbitrage opportunities flagged.

📖 Usage

The app is pre-configured to assess arbitrage opportunities for a given token's CoinGecko Token ID, e.g., cheqd-network across all the markets and token pairs it trades on.

The other parameter that needs to be set is a market arbitrage threshold (e.g., 10%), which is the allowed percentage difference allowed before a market pair is counted as susceptible to arbitrage.

The app is invoked hitting the / endpoint (with a GET request), which returns a JSON response with the following details.

Response Details

arbitrageOpportunities

Compares the token price for given token, e.g., CHEQ against a given token pair and calculates the percentage difference between the token price across two different market venues.

{
  "marketPairId": "01",
  "marketName1": "Osmosis",
  "coinPrice1": 0.03859061,
  "coinPair1": "osmosis",
  "marketName2": "Gate.io",
  "coinPrice2": 0.03902044,
  "coinPair2": "tether",
  "arbitragePossible": false,
  "percentageDelta": 1.1076515521952248
}

prices

An array of items containing coinPair, marketName and coinPrice of given token on that market and token pair.

{
  "coinPair": "osmosis",
  "marketName": "Osmosis",
  "coinPrice": 0.03487637
}

Sample Response

{
  "prices": [
    {
      "marketName": "Osmosis",
      "coinPair": "osmosis",
      "coinPrice": 0.03859061
    },
    {
      "marketName": "Gate.io",
      "coinPair": "tether",
      "coinPrice": 0.03902044
    }
  ],
  "arbitrageOpportunities": [
    {
      "marketPairId": "01",
      "marketName1": "Osmosis",
      "coinPrice1": 0.03859061,
      "coinPair1": "osmosis",
      "marketName2": "Gate.io",
      "coinPrice2": 0.03902044,
      "coinPair2": "tether",
      "arbitragePossible": false,
      "percentageDelta": 1.1076515521952248
    }
  ]
}

🧑‍💻🛠 Developer Guide

Setup

Dependencies can be installed using NPM or any other package manager.

npm install

Configuration

The application expects two environment variables to be defined for the app to function:

  1. MARKET_ARBITRAGE_THRESHOLD: Percentage difference to consider for arbitrage threshold. (Default: 10.0 or 10%)
  2. COINGECKO_TOKEN_ID: CoinGecko token ID ("name"), which is usually the name of the token's profile page on CoinGecko. (Default: cheqd-network for the CHEQ token)

Run

Once configured, the app can be run using NPM:

npm start

Or, to build and run in Docker, use the Dockerfile provided.

🐞 Bug reports & 🤔 feature requests

If you notice anything not behaving how you expected, or would like to make a suggestion / request for a new feature, please create a new issue and let us know.

💬 Community

The cheqd Community Slack is our primary chat channel for the open-source community, software developers, and node operators.

Please reach out to us there for discussions, help, and feedback on the project.

🙋 Find us elsewhere

Telegram Discord Twitter LinkedIn Slack Medium YouTube