Skip to content

Instantly share code, notes, and snippets.

@TrystonPerry
Last active August 4, 2022 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TrystonPerry/937763e22ae48cb1b60db1ebaa1749a6 to your computer and use it in GitHub Desktop.
Save TrystonPerry/937763e22ae48cb1b60db1ebaa1749a6 to your computer and use it in GitHub Desktop.

Viper Direct API Docs

The API is only accessible from direct ping. If you try to fetch it from another website, you will get a CORS error. This is to secure the API. To authorize a request to the API, attach the api key you recieved to each request:

ex: Layout: "Authorization": "Bearer " Example: "Authorization": "Bearer djia9sd90q3j239i0jed0wejk"

Every api route will respond with the following reponse body unless auth fails

{
  success: true|undefined,
  data: {},
  error: ""|undefined
}

GET: api.vipercharts.com/

Responds with 200 code if API is running

GET: api.vipercharts.com/api/markets/get

Get all datasets / dataModels you have access to.

Example reponse:

{
  success: true,
  data: {
    Binance: {
      "BTCUSDT": {
        source: "Binance",
        name: "BTCUSDT"
        models: {
          price: {
            id: "price",
            name: "Price",
            model: "ohlc",
            label: "Bybit:CROUSDT",
            symbols: [
              "Bybit:CROUSDT"
            ],
            tags: {
              asset: "CRO",
              currency: "USDT"
            }
          }
        }
      }
    }
  }
}

POST: api.vipercharts.com/api/timeseries/get

This route accepts a body with an array called sources. It has a maximum length of 25 to allow you to batch multiple requests into one. Each source in the request can only fetch 300 intervals. Pushing these boundaries will result in the API request throwing an error to you.

You can mix and match requests. You can request BTC open interest of the 1min timeframe from 200 minutes back or the 1hr price action of ETH of july 29-30 specifically.

  • Timeframe is the timeframe in ms (1m: 60000, 1h: 60000 * 60)
  • Start & end are the start and times in ms since epoch

Example request body:

{
  sources: [
    {
      source: "Bybit",
      name: "BTCUSD",
      dataModel: "openInterest",
      timeframe: 300000,
      start: 1659523800000,
      end: 1659548400000,
    },
  ];
}

Example reponse:

{
  "success": true,
  "data": [
    {
      "source": "Bybit",
      "name": "BTCUSD",
      "timeframe": 300000,
      "dataModel": "openInterest",
      "data": [
        {
          "time": 1659523800000,
          "open": 18676,
          "high": 18692,
          "low": 18676,
          "close": 18692
        },
        {
          "time": 1659524100000,
          "open": 18694,
          "high": 18704,
          "low": 18649,
          "close": 18656
        },
        {
          "time": 1659524400000,
          "open": 18646,
          "high": 18677,
          "low": 18646,
          "close": 18662
        },
        {
          "time": 1659524700000,
          "open": 18686,
          "high": 18746,
          "low": 18685,
          "close": 18744
        },
        ...
      ]
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment