PHPackages                             panychek/moex - 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. panychek/moex

ActiveLibrary

panychek/moex
=============

Moscow Exchange ISS Client

v0.1.0(8y ago)1980915[2 PRs](https://github.com/panychek/moex/pulls)MITPHPPHP &gt;=7.0

Since Jul 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/panychek/moex)[ Packagist](https://packagist.org/packages/panychek/moex)[ RSS](/packages/panychek-moex/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Moscow Exchange ISS Client
==========================

[](#moscow-exchange-iss-client)

[![Build Status](https://camo.githubusercontent.com/f72e02f093c7d644450e23643cdde5017c8400550f452840d073f1b77e068e4a/68747470733a2f2f7472617669732d63692e6f72672f70616e796368656b2f6d6f65782e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/panychek/moex)[![codecov](https://camo.githubusercontent.com/7c720101ab2fc1be397976a80cb7d98d901f227e2275ca0b66c15c141e18dbad/68747470733a2f2f636f6465636f762e696f2f67682f70616e796368656b2f6d6f65782f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/panychek/moex)[![Coverage Status](https://camo.githubusercontent.com/a78ab9ad70e28efa1ae4208e8eeb2d3ac57592d981b9ef0166f82d10f3f0d563/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f70616e796368656b2f6d6f65782f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/panychek/moex?branch=master)

A PHP library that provides easy access to [Moscow Exchange](https://www.moex.com/) data via its [Informational &amp; Statistical Server](https://www.moex.com/a2920).

Installation
------------

[](#installation)

Download via [Composer](https://getcomposer.org):

```
composer require panychek/moex
```

Include the autoloader:

```
require_once 'vendor/autoload.php';
```

Getting started
---------------

[](#getting-started)

The basic usage pattern is to instantiate a `Security` object for the security you want to interact with. You can pass any string you want (in Russian or English) - the library will perform a search and pick the best match.

```
use Panychek\MoEx\Security;
use Panychek\MoEx\Exception\ExceptionInterface as MoexException;

try {
    $security = new Security('Sberbank');
    $last_price = $security->getLastPrice();

} catch (MoexException $e) {
    echo $e->getMessage();
}
```

You can also access the security by its code (prefix it with a hash symbol (**\#**)). This will be slightly faster, since you avoid an extra API call to find it.

```
$security = new Security('#SBER');
```

The default language is **Russian**. You can switch to English like this:

```
Exchange::setLanguage('en');
```

Authentication
--------------

[](#authentication)

If you're subscribed to any paid services and want to access their private data, you should authenticate yourself first using your Passport account credentials:

```
Exchange::authenticate($username, $password);
```

Search
------

[](#search)

You can easily find the needed financial instrument. This call will return a collection of matched securities:

```
$securities = Exchange::findSecurities('Alrosa');
```

You can also limit the results:

```
$securities = Exchange::findSecurities('Gazprom', 5);
```

Retrieving market data
----------------------

[](#retrieving-market-data)

### Shares, currency pairs and futures

[](#shares-currency-pairs-and-futures)

Available methods:

MethodInput parametersReturnsgetLastPricefloatgetOpeningPricefloatgetClosingPricefloatgetDailyHighfloatgetDailyLowfloatgetLastUpdateobject(\\DateTime)getDailyChangefloatgetDailyPercentageChangefloatgetVolumestring **$currency**
*Possible values:* **RUB** or **USD**
*Defaults to:* **RUB**intFetching the ruble's exchange rate from the FX market:

> If omitted, the base currency defaults to US dollar

```
$usd_rub = Exchange::getRubleRate();
$eur_rub = Exchange::getRubleRate('EUR');
```

### Bonds

[](#bonds)

In addition, bonds also support the following methods:

MethodInput parametersReturnsgetYieldfloatgetDurationintgetFaceValuestringgetCouponValuestringgetCouponRatestringgetCouponDatestringgetMaturityDatestring### Indices

[](#indices)

Available methods:

MethodInput parametersReturnsgetValuefloatgetOpeningValuefloatgetPreviousClosefloatgetDailyHighfloatgetDailyLowfloatgetLastUpdateobject(\\DateTime)getChangestring **$range**
*Possible values:* **day**, **MTD** or **YTD**
*Defaults to:* **day**

string **$measurement**
*Possible values:* **points** or **%**
*Defaults to:* **points**float or intgetVolumestring **$currency**
*Possible values:* **RUB** or **USD**
*Defaults to:* **RUB**intgetCapitalizationstring **$currency**
*Possible values:* **RUB** or **USD**
*Defaults to:* **RUB**int###### Example usage

[](#example-usage)

```
$rtsi = new Security('RTS Index');

$year_to_date_return = $rtsi->getChange('YTD', '%');
$month_to_date_return = $rtsi->getChange('MTD', '%');

$volume_rub = $rtsi->getVolume('RUB');
$volume_usd = $rtsi->getVolume('USD');

$capitalization_rub = $rtsi->getCapitalization('RUB');
$capitalization_usd = $rtsi->getCapitalization('USD');
```

Historical quotes
-----------------

[](#historical-quotes)

For a specific date range:

```
$security = new Security('MICEX Index');
$data = $security->getHistoricalQuotes('2014-01-01', '2014-12-31');
```

Starting from a particular day:

```
$data = $security->getHistoricalQuotes('2017-01-01');
```

Profile
-------

[](#profile)

```
$security = new Security('#GAZP');
$security->setLanguage('en');

$code = $security->getId(); // "GAZP"
$name = $security->getName(); // "Gazprom"
$short_name = $security->getShortName(); // "Gazprom"
$isin_code = $security->getIsin(); // "RU0007661625"

$market_title = $security->getMarket()->getTitle(); // "Equities Market"
$engine_title = $security->getEngine()->getTitle(); // "Securities Market"
$board_title = $security->getBoard()->getTitle(); // "T+: Stocks, DRs"
$capitalization = $security->getEngine()->getCapitalization(); // 33015281259414 RUB

$issuer_title = $security->getIssuer()->getTitle(); // "Публичное акционерное общество "Газпром""

$indices = $security->getIndices();
foreach ($indices as $index) {
    $code = $index->getId(); // "MICEX10INDEX", "MICEXBMI", "MICEXINDEXCF", etc.
    $short_name = $index->getShortName(); // "MICEX10 Index", "Moscow Exchange Broad Market Index", "MICEX Index", etc.
}
```

Turnovers
---------

[](#turnovers)

### Totals for the exchange

[](#totals-for-the-exchange)

Last available trade day:

```
$exchange = $security->getExchange();

$turnovers_rub = $exchange->getTurnovers('rub');
$turnovers_usd = $exchange->getTurnovers('usd');
$num_trades = $exchange->getNumberOfTrades();
```

For a specific day:

```
$christmas_turnovers = $exchange->getTurnovers('usd', '2015-12-25');
$christmas_num_trades = $exchange->getNumberOfTrades('2015-12-25');
```

### Totals for a specific market

[](#totals-for-a-specific-market)

Last available trade day:

```
$security = new Security('USDRUB');
$fx_market = $security->getEngine();

$fx_turnovers_rub = $fx_market->getTurnovers('rub');
$fx_turnovers_usd = $security->getEngine()->getTurnovers('usd');
$fx_num_trades = $security->getEngine()->getNumberOfTrades();
```

For a specific day:

```
$fx_christmas_turnovers = $fx_market->getTurnovers('usd', '2015-12-25');
$fx_christmas_num_trades = $fx_market->getNumberOfTrades('2015-12-25');
```

Groups
------

[](#groups)

Get the most reliable stocks (that are on the First Level quotation list):

```
$shares_group = SecurityGroup::getInstance('stock_shares');
$first_level = $shares_group->getCollection('one');
$securities = $first_level->getSecurities();
```

Debugging
---------

[](#debugging)

To see what's going on at the network level, define a logging callback function and pass it to the client. Once done, it will be invoked on each API call with its statistics.

```
$logger = function(\GuzzleHttp\TransferStats $stats) {
    $request = $stats->getRequest();
    $uri = $request->getUri();

    $time = $stats->getTransferTime();

    $html = 'Request URI: %sTime: %s';
    echo sprintf($html, $uri, $time);
};

Client::getInstance()->setRequestLogger($logger);
```

Handling errors
---------------

[](#handling-errors)

A `Panychek\MoEx\Exception\DataException` exception is thrown in the event of any data related error. The following codes indicate the reason for the failure:

- `FAILED_REQUEST` - all network errors
- `INVALID_RESPONSE` - the response is not a valid JSON string or its format is not supported
- `EMPTY_RESULT` - the response contains no actual data

A `Panychek\MoEx\Exception\AuthenticationException` exception is thrown in case of authentication failure.

All exceptions thrown by the library implement the `Panychek\MoEx\Exception\ExceptionInterface` interface.

Tests
-----

[](#tests)

There are two types of tests distributed with the package: unit tests and integration tests.

The unit tests are run against mock data and hence are ready out-of-the-box. In order to run them, execute the following command:

```
phpunit --group Unit
```

The integration tests make real API calls and ensure that nothing has changed with the responses, so they require network access. You can perform integration testing by running:

```
phpunit --group Integration
```

###  Health Score

31

—

LowBetter than 71% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

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

3171d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9343bb4b2ca7f5913e9806cae76e5d0ecd89b6c252dd7f82b96a9c20ec4213a6?d=identicon)[panychek](/maintainers/panychek)

---

Top Contributors

[![panychek](https://avatars.githubusercontent.com/u/29440141?v=4)](https://github.com/panychek "panychek (19 commits)")[![igrizzli](https://avatars.githubusercontent.com/u/960937?v=4)](https://github.com/igrizzli "igrizzli (1 commits)")

---

Tags

exchangemoscowmoexmicex

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/panychek-moex/health.svg)

```
[![Health](https://phpackages.com/badges/panychek-moex/health.svg)](https://phpackages.com/packages/panychek-moex)
```

###  Alternatives

[fadion/fixerio

Wrapper for Fixer.io

49336.0k](/packages/fadion-fixerio)[chowjiawei/laravel-help-plugin

Integrating useful auxiliary functions into laravel,Assistant tools based on laravel.

671.5k](/packages/chowjiawei-laravel-help-plugin)[mocking-magician/coinbase-pro-sdk

Library for coinbase pro API calls

223.2k](/packages/mocking-magician-coinbase-pro-sdk)

PHPackages © 2026

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