PHPackages                             djansen20/poloniex-http-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. [HTTP &amp; Networking](/categories/http)
4. /
5. djansen20/poloniex-http-api

ActiveLibrary[HTTP &amp; Networking](/categories/http)

djansen20/poloniex-http-api
===========================

Package for the client implementation of the poloniex HTTP API

01PHP

Since Feb 21Pushed 8y ago1 watchersCompare

[ Source](https://github.com/DJansen20/poloniex-http-api)[ Packagist](https://packagist.org/packages/djansen20/poloniex-http-api)[ RSS](/packages/djansen20-poloniex-http-api/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Poloniex HTTP API client
========================

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

Client implementation for the Poloniex HTTP API

[![Minimum PHP Version](https://camo.githubusercontent.com/dcd4b4aec2c1709157fa6a2c050f709d75cde9552a79cfff0b70a97fad7281ae/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e312d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)

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

[](#installation)

This package can be installed using composer

```
composer require djansen20/poloniex-http-api dev-master

```

Usage
-----

[](#usage)

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

```
use Poloniex\PoloniexHttpApi
```

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

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

# Or Json
$json = $response->jsonSerialize();
```

### Request limit

[](#request-limit)

Poloniex asks to keep the amount of calls to the Public API to 6 request per second. Repeatedly and needlessly fetching excessive amount of data may result in your IP being banned.

### Trading pair constants

[](#trading-pair-constants)

Some API calls require you to provide a trading pair. You can make use of the CurrencyPair class constants to get the right strings expected by the API.

```
use \Poloniex\Models\\CurrencyPair;
$pair = CurrencyPair::USDT_BTC;
```

If you do not wish to use the CurrencyPair constants you need to provide a valid string of the currencypair in uppercase. e.g USDT\_BTC

### Public Methods

[](#public-methods)

This package allows you to use the public API without supplying account credentials. To retrieve an instance of the public API, call the following method

```
$api = PoloniexHttpApi::PublicApi();
```

Now you can start requesting data from the API.

#### getDailyTicker

[](#getdailyticker)

Returns ticker data of the past day for all currencies. The returned object contains an array for each currency. Each currency has the following properties.

PropertyDescriptionidPoloniex internal IDlastLast pricelowestAskLowest ask priceHighestBidHighest bid pricepercentChangePercentage changed in the past 24hrbaseVolumeVolume in base currency (e.g BTC in BTC\_BCN)quoteVolumeVolume in quote currency (e.g BCN in BTC\_BCNisFrozenBoolean to check if the pair is frozenhigh24hrHighest price in the past 24hrlow24hrLowest price in the past 24hrExample request

```
$api = PoloniexHttpApi::PublicApi();
$responseObject = $api->getDailyTicker();
$data = $responseObject->asArray();
```

Example response

```
array(99) {
  ["BTC_BCN"]=>
  array(10) {
    ["id"]=>
    int(7)
    ["last"]=>
    string(10) "0.00000048"
    ["lowestAsk"]=>
    string(10) "0.00000049"
    ["highestBid"]=>
    string(10) "0.00000048"
    ["percentChange"]=>
    string(11) "-0.07692307"
    ["baseVolume"]=>
    string(11) "58.98148207"
    ["quoteVolume"]=>
    string(18) "117273515.50009523"
    ["isFrozen"]=>
    string(1) "0"
    ["high24hr"]=>
    string(10) "0.00000053"
    ["low24hr"]=>
    string(10) "0.00000046"
  }
  ["BTC_BELA"]=>
  array(10) {
    ["id"]=>
    int(8)
    ["last"]=>
    string(10) "0.00001290"
    ["lowestAsk"]=>
    string(10) "0.00001302"
    ["highestBid"]=>
    string(10) "0.00001290"
    ["percentChange"]=>
    string(11) "-0.06045156"
    ["baseVolume"]=>
    string(10) "2.35221818"
    ["quoteVolume"]=>
    string(15) "180690.09194013"
    ["isFrozen"]=>
    string(1) "0"
    ["high24hr"]=>
    string(10) "0.00001373"
    ["low24hr"]=>
    string(10) "0.00001250"
  }
  ...
}
```

#### getDailyVolume

[](#getdailyvolume)

Returns the 24-hour volume for all markets, plus totals for primary currencies. Each returned market has the following properties.

PropertyDescriptionbaseVolumeVolume in base currency (e.g BTC in BTC\_BCN)quoteVolumeVolume in quote currency (e.g BCN in BTC\_BCN)Example request

```
$api = PoloniexHttpApi::PublicApi();
$responseObject = $api->getDailyVolume();
$data = $responseObject->asArray();
```

Example response

```
array(104) {
  ["BTC_BCN"]=>
  array(2) {
    ["BTC"]=>
    string(11) "54.13476343"
    ["BCN"]=>
    string(18) "111407382.31755247"
  }
  ["BTC_BELA"]=>
  array(2) {
    ["BTC"]=>
    string(10) "4.36484881"
    ["BELA"]=>
    string(15) "318971.34721168"
  }
  ...
  ["totalBTC"]=>
  string(14) "14101.39553898"
  ["totalETH"]=>
  string(13) "3206.73104864"
  ["totalUSDT"]=>
  string(18) "146242934.09559988"
  ["totalXMR"]=>
  string(13) "1041.71051366"
  ["totalXUSD"]=>
  string(10) "0.00000000"
}
```

#### getOrderBook

[](#getorderbook)

Returns the currency order book for the given pair. The first parameter to the function has to be a currencypair, the second parameter is optional to determine the depth.

You may set the currencyPair parameter to 'all' to get the data for all markets

Each response has the following properties

PropertyDescriptionasksCurrent asks in the order bookbidsCurrent bids in the order bookisFrozenBoolean to check if the order book is frozenseqSequence number for use with push apiExample request

```
$api = PoloniexHttpApi::PublicApi();
$responseObject = $api->getOrderBook(\Poloniex\Models\CurrencyPair::USDT_BCH, 2);
$data = $responseObject->asArray();
```

Example response

```
array(4) {
  ["asks"]=>
  array(2) {
    [0]=>
    array(2) {
      [0]=>
      string(13) "1299.52061526"
      [1]=>
      float(0.01)
    }
    [1]=>
    array(2) {
      [0]=>
      string(13) "1301.00000000"
      [1]=>
      float(0.82615439)
    }
  }
  ["bids"]=>
  array(2) {
    [0]=>
    array(2) {
      [0]=>
      string(13) "1299.52061509"
      [1]=>
      float(3.32059391)
    }
    [1]=>
    array(2) {
      [0]=>
      string(13) "1293.28756413"
      [1]=>
      float(15.14260483)
    }
  }
  ["isFrozen"]=>
  string(1) "0"
  ["seq"]=>
  int(53148248)
}
```

#### getTradeHistory

[](#gettradehistory)

Returns the past 200 trades for a given market, or up to 50000 trades between a range specified in UNIX timestamps.

Each response has the following properties

PropertyDescriptionglobalTradeIDOveral tradeID of all poloniex marketstradeIDTradeID of the given marketdateDate at which the trade occuredtypeBuy or sellrateAt what ticker price the order was executedamountThe amount boughttotalThe total cost for the tradeExample request

```
$api = PoloniexHttpApi::PublicApi();
$responseObject = $api->getTradeHistory(\Poloniex\Models\CurrencyPair::XMR_MAID, 1410158341, 1410499372);
$data = $responseObject->asArray();
```

Example response

```
array(15) {
  [0]=>
  array(7) {
    ["globalTradeID"]=>
    int(2036160)
    ["tradeID"]=>
    int(109)
    ["date"]=>
    string(19) "2014-09-12 04:19:39"
    ["type"]=>
    string(4) "sell"
    ["rate"]=>
    string(10) "0.00100100"
    ["amount"]=>
    string(12) "182.42951471"
    ["total"]=>
    string(10) "0.18261194"
  }
  [1]=>
  array(7) {
    ["globalTradeID"]=>
    int(2036159)
    ["tradeID"]=>
    int(108)
    ["date"]=>
    string(19) "2014-09-12 04:19:39"
    ["type"]=>
    string(4) "sell"
    ["rate"]=>
    string(10) "0.00710010"
    ["amount"]=>
    string(12) "152.00000000"
    ["total"]=>
    string(10) "1.07921520"
  }
```

#### getChartData

[](#getchartdata)

Returns candlestick chart data. Required parameters are "currencyPair", "period" (candlestick period in seconds; valid values are 300, 900, 1800, 7200, 14400, and 86400), "start", and "end". "Start" and "end" are given in UNIX timestamp format and used to specify the date range for the data returned.

Each returned period has the following properties

PropertyDescriptiondateDate at which the candlestick startedhighHighest price during the candlelowLowest price in the candleopenOpen price of the candlecloseClose price of the candlevolumeBase volume during the candle (e.g BTC in BTC\_XMR)quoteVolumeQuote volume during the candle (e.g XMR in BTC\_XMR)weightedAverageAverage price during the candleExample request

```
$api = PoloniexHttpApi::PublicApi();
$responseObject = $api->getChartData(\Poloniex\Models\CurrencyPair::BTC_XMR, 1510158341, 9999999999, 86400);
$data = $responseObject->asArray();
```

Example response

```
array(105) {
  [0]=>
  array(8) {
    ["date"]=>
    int(1510185600)
    ["high"]=>
    float(0.01725283)
    ["low"]=>
    float(0.01500069)
    ["open"]=>
    float(0.01523299)
    ["close"]=>
    float(0.0168699)
    ["volume"]=>
    float(1766.02561139)
    ["quoteVolume"]=>
    float(109182.67024292)
    ["weightedAverage"]=>
    float(0.01617496)
  }
  [1]=>
  array(8) {
    ["date"]=>
    int(1510272000)
    ["high"]=>
    float(0.01699997)
    ["low"]=>
    float(0.0155)
    ["open"]=>
    float(0.0168699)
    ["close"]=>
    float(0.01601257)
    ["volume"]=>
    float(1794.34874489)
    ["quoteVolume"]=>
    float(110576.71429265)
    ["weightedAverage"]=>
    float(0.01622718)
  }
}
```

#### getCurrencies

[](#getcurrencies)

Returns information about currencies.

Each currency contains the following properties

PropertyDescriptionidPoloniex internal IDnameName of the currencytxFeeTransaction feeminConfMinimum confirmations for network transactiondepositAddressPoloniex deposit addressdisabledBoolean to check if the currency is disableddelistedBoolean to check if the currency is delistedfrozenBoolean to check if the currency is frozenExample request

```
$api = PoloniexHttpApi::PublicApi();
$responseObject = $api->getCurrencies();
$data = $responseObject->asArray();
```

Example response

```
array(291) {
  ["1CR"]=>
  array(8) {
    ["id"]=>
    int(1)
    ["name"]=>
    string(7) "1CRedit"
    ["txFee"]=>
    string(10) "0.01000000"
    ["minConf"]=>
    int(3)
    ["depositAddress"]=>
    NULL
    ["disabled"]=>
    int(0)
    ["delisted"]=>
    int(1)
    ["frozen"]=>
    int(0)
  }
  ["ABY"]=>
  array(8) {
    ["id"]=>
    int(2)
    ["name"]=>
    string(7) "ArtByte"
    ["txFee"]=>
    string(10) "0.01000000"
    ["minConf"]=>
    int(8)
    ["depositAddress"]=>
    NULL
    ["disabled"]=>
    int(0)
    ["delisted"]=>
    int(1)
    ["frozen"]=>
    int(0)
  }
}
```

#### getLoanData

[](#getloandata)

Returns the list of loan offers and demands for a given currency.

Each currency has the following properties.

PropertyDescriptionrateInterest rateamountAmount available at given raterangeMinShortest max days for the given raterangeMaxLongest max days for the given rateExample request

```
$api = PoloniexHttpApi::PublicApi();
$responseObject = $api->getLoanData('BTC');
$data = $responseObject->asArray();
```

Example response

```
array(2) {
  ["offers"]=>
  array(50) {
    [0]=>
    array(4) {
      ["rate"]=>
      string(10) "0.00007200"
      ["amount"]=>
      string(10) "0.01997185"
      ["rangeMin"]=>
      int(2)
      ["rangeMax"]=>
      int(2)
    }
    [1]=>
    array(4) {
      ["rate"]=>
      string(10) "0.00007389"
      ["amount"]=>
      string(10) "0.01406117"
      ["rangeMin"]=>
      int(2)
      ["rangeMax"]=>
      int(2)
    }
    ...
  ["demands"]=>
  array(4) {
    [0]=>
    array(4) {
      ["rate"]=>
      string(10) "0.02000000"
      ["amount"]=>
      string(10) "0.00005250"
      ["rangeMin"]=>
      int(2)
      ["rangeMax"]=>
      int(2)
    }
    [1]=>
    array(4) {
      ["rate"]=>
      string(10) "0.00003010"
      ["amount"]=>
      string(10) "0.06571919"
      ["rangeMin"]=>
      int(2)
      ["rangeMax"]=>
      int(2)
    }
    ...
  }
}
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

cryptocurrency-exchangescryptocurrency-pricespoloniexpoloniex-apipoloniex-wrapper

### Embed Badge

![Health badge](/badges/djansen20-poloniex-http-api/health.svg)

```
[![Health](https://phpackages.com/badges/djansen20-poloniex-http-api/health.svg)](https://phpackages.com/packages/djansen20-poloniex-http-api)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M317](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M292](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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