# Poloniex

Poloniex exchange historical data for **all its currency pairs** is available since **2020-07-01.**

{% embed url="<https://api.tardis.dev/v1/exchanges/poloniex>" %}
See Poloniex historical data coverage: available symbols, channels, date ranges and incidents
{% endembed %}

### Downloadable **CSV** files

Historical CSV datasets for the first day of each month are **available to download without API key**. See [downloadable CSV files documentation](https://docs.tardis.dev/downloadable-csv-files/overview).

| data type             | symbol    | date       |                                                                                                           |
| --------------------- | --------- | ---------- | --------------------------------------------------------------------------------------------------------- |
| incremental\_book\_L2 | USDT\_BTC | 2020-07-01 | [Download sample](https://datasets.tardis.dev/v1/poloniex/incremental_book_L2/2020/07/01/USDT_BTC.csv.gz) |
| trades                | USDT\_BTC | 2020-07-01 | [Download sample](https://datasets.tardis.dev/v1/poloniex/trades/2020/07/01/USDT_BTC.csv.gz)              |
| quotes                | USDT\_BTC | 2020-07-01 | [Download sample](https://datasets.tardis.dev/v1/poloniex/quotes/2020/07/01/USDT_BTC.csv.gz)              |

### API Access and data format

Historical data format is the same as provided by real-time Poloniex WebSocket **v2** API with addition of local timestamps and **also with addition of symbol at the end of each message** which allows us providing filtering for the data server-side. If you'd like to work with normalized data format instead (same format for each exchange) see [downloadable CSV files](https://docs.tardis.dev/downloadable-csv-files/overview) or official [client libs](https://docs.tardis.dev/api/quickstart) that perform data normalization client-side.

{% tabs %}
{% tab title="Python" %}

```python
# pip install tardis-dev
import asyncio
from tardis_dev import Channel, replay

async def main():
    async for local_timestamp, message in replay(
        exchange="poloniex",
        from_date="2024-01-01",
        to_date="2024-01-02",
        filters=[Channel(name="book_lv2", symbols=["BTC_USDT"])],
        api_key="YOUR_API_KEY",
    ):
        # messages as provided by Poloniex real-time stream
        print(message)

asyncio.run(main())
```

See [Python client docs](https://docs.tardis.dev/python-client/quickstart).
{% endtab %}

{% tab title="Node.js" %}

```javascript
// npm install tardis-dev
import { replay } from 'tardis-dev';

const messages = replay({
  exchange: 'poloniex',
  from: '2024-01-01',
  to: '2024-01-02',
  filters: [{ channel: 'book_lv2', symbols: ['BTC_USDT'] }],
  apiKey: 'YOUR_API_KEY'
});

// messages as provided by Poloniex real-time stream
for await (const { localTimestamp, message } of messages) {
  console.log(localTimestamp, message);
}
```

See [Node.js client docs](https://docs.tardis.dev/node-client/quickstart).
{% endtab %}

{% tab title="cURL & HTTP API" %}

```bash
curl --compressed -g 'https://api.tardis.dev/v1/data-feeds/poloniex?from=2024-01-01&filters=[{"channel":"book_lv2","symbols":["BTC_USDT"]}]&offset=0'
```

{% embed url="<https://api.tardis.dev/v1/data-feeds/poloniex?from=2024-01-01&filters=[{%22channel%22:%22book_lv2%22,%22symbols%22:[%22BTC_USDT%22]}]&offset=0>" %}
Example API response for Poloniex historical market data request
{% endembed %}

See [HTTP API docs](https://docs.tardis.dev/api/http-api-reference).
{% endtab %}

{% tab title="cURL & tardis-machine" %}

```bash
curl -g 'localhost:8000/replay?options={"exchange":"poloniex","filters":[{"channel":"book_lv2","symbols":["BTC_USDT"]}],"from":"2024-01-01","to":"2024-01-02"}'
```

[Tardis-machine](https://docs.tardis.dev/tardis-machine/quickstart) is a locally runnable server that exposes API allowing efficiently requesting historical market data for whole time periods in contrast to [HTTP API](https://docs.tardis.dev/api/http-api-reference) that provides data only in minute by minute slices.

See [tardis-machine](https://docs.tardis.dev/tardis-machine/quickstart) docs.
{% endtab %}
{% endtabs %}

### Captured real-time channels

{% embed url="<https://docs.poloniex.com/#websocket-api>" %}
See Poloniex WebSocket API docs providing documentation for each captured channel's format
{% endembed %}

{% hint style="info" %}
Click any channel below to see [HTTP API](https://docs.tardis.dev/api/http-api-reference#data-feeds-exchange) response with historical data recorded for it.
{% endhint %}

* [price\_aggregated\_book](https://api.tardis.dev/v1/data-feeds/poloniex?from=2020-07-01\&filters=\[{%22channel%22:%22price_aggregated_book%22}]) — available to **2022-08-02** Order book snapshots and deltas with embedded trades, sequence validated. During data collection integrity of order book incremental updates is being **validated** using [sequence numbers](https://docs.poloniex.com/#price-aggregated-book) provided by real-time feed - in case of detecting missed message WebSocket connection is being restarted.
* [trades](https://api.tardis.dev/v1/data-feeds/poloniex?from=2024-01-01\&filters=\[{%22channel%22:%22trades%22}]) — available since **2022-08-02** Public trade executions stream
* [book\_lv2](https://api.tardis.dev/v1/data-feeds/poloniex?from=2024-01-01\&filters=\[{%22channel%22:%22book_lv2%22}]) — available since **2022-08-02** Level 2 order book updates
* [ticker](https://api.tardis.dev/v1/data-feeds/poloniex?from=2024-01-01\&filters=\[{%22channel%22:%22ticker%22}]) — available since **2022-08-02** 24h ticker updates

{% hint style="info" %}
Each collected Poloniex real-time data message has appended symbol at the end of array - this allows us providing data filtering via API.
{% endhint %}

### Market data collection details

[Market data collection infrastructure](https://docs.tardis.dev/faq/general#what-is-your-infrastructure-setup) for Poloniex is located in GCP europe-west2 region (London, UK).

Real-time market data is captured via **multiple WebSocket connections** to `wss://ws.poloniex.com/ws/public`.

{% hint style="info" %}
Poloniex servers are located in AWS eu-west-1 region (Dublin, Ireland). All its public APIs are proxied through Cloudflare.
{% endhint %}
