README.md 4.71 KB
Newer Older
Alex Thomae's avatar
Alex Thomae committed
1
# crypto-exporter
2 3 4 5 6 7

[![Pipeline Status](https://gitlab.com/ix.ai/crypto-exporter/badges/master/pipeline.svg)](https://gitlab.com/ix.ai/crypto-exporter/)
[![Docker Stars](https://img.shields.io/docker/stars/ixdotai/crypto-exporter.svg)](https://hub.docker.com/r/ixdotai/crypto-exporter/)
[![Docker Pulls](https://img.shields.io/docker/pulls/ixdotai/crypto-exporter.svg)](https://hub.docker.com/r/ixdotai/crypto-exporter/)
[![Gitlab Project](https://img.shields.io/badge/GitLab-Project-554488.svg)](https://gitlab.com/ix.ai/crypto-exporter/)

8
Prometheus exporter, written in python, for different crypto exchanges
Alex Thomae's avatar
Alex Thomae committed
9 10

## Usage
Alex Thomae's avatar
Alex Thomae committed
11
```sh
Alex Thomae's avatar
Alex Thomae committed
12 13
docker run --rm -it -p 9999:9999 \
  -e EXCHANGE="poloniex" \
Alex Thomae's avatar
Alex Thomae committed
14 15 16
  -e LOGLEVEL=DEBUG \
  -e API_KEY="your_api_key" \
  -e API_SECRET="your_api_secret" \
Alex Thomae's avatar
Alex Thomae committed
17 18 19 20
  -e PORT=9999
  -e GELF_HOST="graylog" \
  --name poloniex-exporter
  registry.gitlab.com/ix.ai/crypto-exporter:latest
Alex Thomae's avatar
Alex Thomae committed
21
```
Alex Thomae's avatar
Alex Thomae committed
22
Or use the image from `ixdotai/crypto-exporter`
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
```sh
docker run --rm -it -p 9999:9999 \
  -e EXCHANGE="poloniex" \
  -e LOGLEVEL=DEBUG \
  -e API_KEY="your_api_key" \
  -e API_SECRET="your_api_secret" \
  -e PORT=9999
  -e GELF_HOST="graylog" \
  --name poloniex-exporter
  ixdotai/crypto-exporter:latest
```

## Docker Stack example
```yml
version: '3.7'

services:
  binance:
    image: ixdotai/crypto-exporter:latest
    networks:
      - exporters
      - graylog
    environment:
      EXCHANGE: binance
      GELF_HOST: tasks.graylog_graylog
      GELF_PORT: 12201
      API_KEY: your_api_key
      API_SECRET: your_api_secret
  bitfinex:
    image: registry.gitlab.com/ix.ai/crypto-exporter:latest
    networks:
      - exporters
      - graylog
    environment:
      EXCHANGE: bitfinex
      GELF_HOST: tasks.graylog_graylog
      GELF_PORT: 12201
      API_KEY: your_api_key
      API_SECRET: your_api_secret

networks:
  exporters:
    external: true
  graylog:
    external: true

```
Alex Thomae's avatar
Alex Thomae committed
70

71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
### Prometheus configuration with DNS service discovery
```yml
scrape_configs:
- job_name: 'crypto-exporters'
  honor_timestamps: true
  scrape_interval: 30s
  scrape_timeout: 30s
  metrics_path: /metrics
  scheme: http
  dns_sd_configs:
  - names:
    - tasks.binance
    - tasks.bitfinex
```

Make sure that your prometheus server is able to reach the network set for the crypto-exporter.

**Warning**: some exchanges (notably: gdax/coinbasepro) need more than 30s to scrape

Alex Thomae's avatar
Alex Thomae committed
90
### Supported variables
91 92 93 94 95 96 97 98 99 100
| **Variable**  | **Default** | **Mandatory** | **Description**                                                                                                        |
|:--------------|:-----------:|:-------------:|:-----------------------------------------------------------------------------------------------------------------------|
| `EXCHANGE`    | -           | **YES**       | see below                                                                                                              |
| `API_KEY`     | -           | NO            | set this to your Exchange API key                                                                                      |
| `API_SECRET`  | -           | NO            | set this to your Exchange API secret                                                                                   |
| `API_SECRET`  | -           | NO            | only needed for certain exchanges (like `cex`)                                                                         |
| `LOGLEVEL`    | `INFO`      | NO            | [Logging Level](https://docs.python.org/3/library/logging.html#levels)                                                 |
| `GELF_HOST`   | -           | NO            | if set, the exporter will also log to this [GELF](https://docs.graylog.org/en/3.0/pages/gelf.html) capable host on UDP |
| `GELF_PORT`   | `12201`     | NO            | Ignored, if `GELF_HOST` is unset. The UDP port for GELF logging                                                        |
| `PORT`        | `9188`      | NO            | The port for prometheus metrics                                                                                        |
Alex Thomae's avatar
Alex Thomae committed
101 102 103 104 105 106 107 108 109 110 111

### Supported (tested) exchanges
* poloniex
* kraken
* binance
* bitfinex
* bitstamp
* cex
* hitbtc
* liquid
* gdax
Alex Thomae's avatar
Alex Thomae committed
112 113

All other exchanges supported by [ccxt](https://github.com/ccxt/ccxt) should be supported, however they are untested.
114

Alex Thomae's avatar
Alex Thomae committed
115 116
## Tags and Arch

117 118
Starting with version v0.5.0, the images are multi-arch, with builds for amd64, arm64 and armv7.
* `vN.N.N` - for example v0.5.0
Alex Thomae's avatar
Alex Thomae committed
119 120 121 122
* `latest` - always pointing to the latest version
* `dev-branch` - the last build on a feature/development branch
* `dev-master` - the last build on the master branch

123 124
## Resources:
* GitLab: https://gitlab.com/ix.ai/crypto-exporter
Alex Thomae's avatar
Alex Thomae committed
125
* GitHub: https://github.com/ix-ai/crypto-exporter
126
* Docker Hub: https://hub.docker.com/r/ixdotai/crypto-exporter