PHPackages                             m0k1/cryptowatch-prices-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. m0k1/cryptowatch-prices-api

ActiveLibrary[API Development](/categories/api)

m0k1/cryptowatch-prices-api
===========================

Package for the client implementation of the cryptowatch HTTP API

v1.x-dev(3y ago)01MITPHP

Since Nov 12Pushed 3y agoCompare

[ Source](https://github.com/m0k1/cryptowatch-prices-api)[ Packagist](https://packagist.org/packages/m0k1/cryptowatch-prices-api)[ RSS](/packages/m0k1-cryptowatch-prices-api/feed)WikiDiscussions v1.x Synced 1mo ago

READMEChangelogDependencies (1)Versions (1)Used By (0)

Cryptowatch HTTP API client
===========================

[](#cryptowatch-http-api-client)

A rough implementation of the Cryptowatch HTTP API

Installation
============

[](#installation)

This package can be installed using composer

```
composer require djansen20/cryptowatch-http-api:^1.0
```

Or add the following directly into your composer.json

```
{
    "require": {
        "djansen20/cryptowatch-http-api": "^1.0"
    }
}
```

Usage
-----

[](#usage)

In order to use this library, include the following namespace into you project

```
use Cryptowatch\CryptowatchHttpApi
```

All methods will return a response object that can be convertd to json or to a usable array

```
# To get data as array
$array = $response->asArray();

# Get data as json
$json = $response->jsonSerialize();
```

### Rate limiting

[](#rate-limiting)

Cryptowatch gives each client 8 seconds of CPU time per hour. Currently this client does not read this limit or does anything with it. If you get a response with status code 429 it means the request limit has been reached. The library will probably crap out earlier though.

### Methods

[](#methods)

All methods are called statically so there is no need to create an object. Currently there are 5 possible static methods.

### getAssets

[](#getassets)

An asset can be a crypto or fiat currency

Example request

```
$asset = 'neo';
$responseObject = CryptowatchHttpApi::getAssets($asset);
$data = $responseObject->asArray();
```

Example response

```
array(2) {
  ["result"]=>
  array(5) {
    ["id"]=>
    int(66)
    ["symbol"]=>
    string(3) "neo"
    ["name"]=>
    string(3) "NEO"
    ["fiat"]=>
    bool(false)
    ["markets"]=>
    array(1) {
      ["base"]=>
      array(11) {
        [0]=>
        array(5) {
          ["id"]=>
          int(643)
          ["exchange"]=>
          string(6) "bitmex"
          ["pair"]=>
          string(22) "neobtc-monthly-futures"
          ["active"]=>
          bool(true)
          ["route"]=>
          string(62) "https://api.cryptowat.ch/markets/bitmex/neobtc-monthly-futures"
        }
        [1]=>
        array(5) {
          ["id"]=>
          int(661)
          ["exchange"]=>
          string(6) "bitmex"
          ["pair"]=>
          string(24) "neobtc-quarterly-futures"
          ["active"]=>
          bool(true)
          ["route"]=>
          string(64) "https://api.cryptowat.ch/markets/bitmex/neobtc-quarterly-futures"
        }
        ...
      }
    }
  }
  ["allowance"]=>
  array(2) {
    ["cost"]=>
    int(113410)
    ["remaining"]=>
    int(7947157629)
  }
}
```

### getPairs

[](#getpairs)

A pair of assets. Each pair has a base and a quote. For example, btceur has base btc and quote eur.

Example Request

```
$pair = 'neotbtc'
$responseObject = CryptowatchHttpApi::getPairs($pair);
$data = $responseObject->asArray();
```

Example Response

```
array(2) {
  ["result"]=>
  array(6) {
    ["symbol"]=>
    string(6) "neobtc"
    ["id"]=>
    int(86)
    ["base"]=>
    array(5) {
      ["id"]=>
      int(66)
      ["symbol"]=>
      string(3) "neo"
      ["name"]=>
      string(3) "NEO"
      ["fiat"]=>
      bool(false)
      ["route"]=>
      string(35) "https://api.cryptowat.ch/assets/neo"
    }
    ["quote"]=>
    array(5) {
      ["id"]=>
      int(60)
      ["symbol"]=>
      string(3) "btc"
      ["name"]=>
      string(7) "Bitcoin"
      ["fiat"]=>
      bool(false)
      ["route"]=>
      string(35) "https://api.cryptowat.ch/assets/btc"
    }
    ["route"]=>
    string(37) "https://api.cryptowat.ch/pairs/neobtc"
    ["markets"]=>
    array(3) {
      [0]=>
      array(5) {
        ["id"]=>
        int(582)
        ["exchange"]=>
        string(7) "binance"
        ["pair"]=>
        string(6) "neobtc"
        ["active"]=>
        bool(true)
        ["route"]=>
        string(47) "https://api.cryptowat.ch/markets/binance/neobtc"
      }
      [1]=>
      array(5) {
        ["id"]=>
        int(34)
        ["exchange"]=>
        string(8) "bitfinex"
        ["pair"]=>
        string(6) "neobtc"
        ["active"]=>
        bool(true)
        ["route"]=>
        string(48) "https://api.cryptowat.ch/markets/bitfinex/neobtc"
      }
      [2]=>
      array(5) {
        ["id"]=>
        int(383)
        ["exchange"]=>
        string(7) "bittrex"
        ["pair"]=>
        string(6) "neobtc"
        ["active"]=>
        bool(true)
        ["route"]=>
        string(47) "https://api.cryptowat.ch/markets/bittrex/neobtc"
      }
    }
  }
  ["allowance"]=>
  array(2) {
    ["cost"]=>
    int(224791)
    ["remaining"]=>
    int(7946932838)
  }
}
```

### getExchanges

[](#getexchanges)

Get information on a specific exchange

Example Request

```
$exchange = 'bitstamp';
$responseObject = CryptowatchHttpApi::getExchanges($exchange);
$data = $responseObject->asArray();
```

Example Response

```
array(2) {
  ["result"]=>
  array(5) {
    ["id"]=>
    int(3)
    ["symbol"]=>
    string(8) "bitstamp"
    ["name"]=>
    string(8) "Bitstamp"
    ["active"]=>
    bool(true)
    ["routes"]=>
    array(1) {
      ["markets"]=>
      string(41) "https://api.cryptowat.ch/markets/bitstamp"
    }
  }
  ["allowance"]=>
  array(2) {
    ["cost"]=>
    int(29870)
    ["remaining"]=>
    int(7946902968)
  }
}
```

### getMarkets

[](#getmarkets)

A market is a pair listed on an exchange. For example, pair btceur on exchange kraken is a market.

There are various subcommands available for each exchange / pair combo.

- price // Returns a market’s last price.
- summary // Returns a market’s last price as well as other stats based on a 24-hour sliding window.
- trades // Returns a market’s most recent trades, incrementing chronologically.
- orderbook // Returns a market’s order book.
- ohlc // Returns a market’s OHLC candlestick data. Returns data as lists of lists of numbers for each time period integer.

Example Request

```
$exchange = 'bitstamp';
$pair = 'btcusd';
$subcommand = 'ohlc';

$params = [
    'after' => 1481563244
    'before' => 1481663244
    'periods' => 86400
];

$responseObject = CryptowatchHttpApi::getMarkets($exchange, $pair, $subcommand, $params);
$data = $responseObject->asArray();
```

Example Response

```
array(2) {
  ["result"]=>
  array(1) {
    [86400]=>
    array(2) {
      [0]=>
      array(7) {
        [0]=>
        int(1481587200)
        [1]=>
        float(768.97)
        [2]=>
        int(779)
        [3]=>
        float(768.96)
        [4]=>
        float(776.9)
        [5]=>
        float(2802.0916)
        [6]=>
        int(0)
      }
      [1]=>
      array(7) {
        [0]=>
        int(1481673600)
        [1]=>
        int(777)
        [2]=>
        float(793.27)
        [3]=>
        float(765.1)
        [4]=>
        float(775.35)
        [5]=>
        float(4918.8164)
        [6]=>
        int(0)
      }
    }
  }
  ["allowance"]=>
  array(2) {
    ["cost"]=>
    int(2032490)
    ["remaining"]=>
    int(7943769676)
  }
}
```

### getAggregate

[](#getaggregate)

Markets are identified by a slug, which is the exchange name and currency pair concatenated with a colon.

There are currently 2 aggregates available

- prices // Returns the current price for all supported markets. Some values may be out of date by a few seconds.
- summaries // Returns the market summary for all supported markets. Some values may be out of date by a few seconds.

Example Request

```
$method = 'prices';
$responseObject = CryptowatchHttpApi::getAggregate($method);
$data = $responseObject->asArray();
```

Example Response

```
array(2) {
  ["result"]=>
  array(726) {
    ["binance:adabtc"]=>
    float(2.165E-5)
    ["binance:adaeth"]=>
    float(0.00033469)
    ["binance:arkbtc"]=>
    float(0.0003211)
    ["binance:batbtc"]=>
    float(2.413E-5)
    ["binance:bateth"]=>
    float(0.00037179)
    ["binance:bccbtc"]=>
    float(0.115777)
    ["binance:bcceth"]=>
    float(1.79409)
    ["binance:bccusdt"]=>
    float(989.7)
  ...
  }
  ["allowance"]=>
  array(2) {
    ["cost"]=>
    int(1039078)
    ["remaining"]=>
    int(7941514860)
  }
}
```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 95.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1274d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bb650718deae5dc7af7fc97e58380692166fa1d802f2c5b799084e10b35421af?d=identicon)[m0k1](/maintainers/m0k1)

---

Top Contributors

[![DJansen20](https://avatars.githubusercontent.com/u/19436015?v=4)](https://github.com/DJansen20 "DJansen20 (22 commits)")[![mokiding](https://avatars.githubusercontent.com/u/2554542?v=4)](https://github.com/mokiding "mokiding (1 commits)")

---

Tags

apicryptowatch

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/m0k1-cryptowatch-prices-api/health.svg)

```
[![Health](https://phpackages.com/badges/m0k1-cryptowatch-prices-api/health.svg)](https://phpackages.com/packages/m0k1-cryptowatch-prices-api)
```

###  Alternatives

[m165437/laravel-blueprint-docs

API Blueprint Renderer for Laravel

22779.0k](/packages/m165437-laravel-blueprint-docs)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
