realization/tinkoff-invest-openapi-php-sdk

20.2 2020-08-01 12:39 UTC

This package is auto-updated.

Last update: 2025-02-19 04:12:27 UTC


README

tinkoff.ru/invest OpenAPI.

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/realization/tinkoff-invest-openapi-php-sdk.git"
    }
  ],
  "require": {
    "realization/tinkoff-invest-openapi-php-sdk": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');


$apiInstance = new Swagger\Client\Api\MarketApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->marketBondsGet();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MarketApi->marketBondsGet: ', $e->getMessage(), PHP_EOL;
}


$apiInstance = new Swagger\Client\Api\MarketApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$figi = "figi_example"; // string | FIGI
$from = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Начало временного промежутка
$to = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Конец временного промежутка
$interval = new \Swagger\Client\Model\CandleResolution(); // \Swagger\Client\Model\CandleResolution | Интервал свечи

try {
    $result = $apiInstance->marketCandlesGet($figi, $from, $to, $interval);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MarketApi->marketCandlesGet: ', $e->getMessage(), PHP_EOL;
}


$apiInstance = new Swagger\Client\Api\MarketApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->marketCurrenciesGet();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MarketApi->marketCurrenciesGet: ', $e->getMessage(), PHP_EOL;
}


$apiInstance = new Swagger\Client\Api\MarketApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->marketEtfsGet();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MarketApi->marketEtfsGet: ', $e->getMessage(), PHP_EOL;
}


$apiInstance = new Swagger\Client\Api\MarketApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$figi = "figi_example"; // string | FIGI
$depth = 56; // int | Глубина стакана [1..20]

try {
    $result = $apiInstance->marketOrderbookGet($figi, $depth);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MarketApi->marketOrderbookGet: ', $e->getMessage(), PHP_EOL;
}


$apiInstance = new Swagger\Client\Api\MarketApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$figi = "figi_example"; // string | FIGI

try {
    $result = $apiInstance->marketSearchByFigiGet($figi);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MarketApi->marketSearchByFigiGet: ', $e->getMessage(), PHP_EOL;
}


$apiInstance = new Swagger\Client\Api\MarketApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$ticker = "ticker_example"; // string | Тикер инструмента

try {
    $result = $apiInstance->marketSearchByTickerGet($ticker);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MarketApi->marketSearchByTickerGet: ', $e->getMessage(), PHP_EOL;
}


$apiInstance = new Swagger\Client\Api\MarketApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->marketStocksGet();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MarketApi->marketStocksGet: ', $e->getMessage(), PHP_EOL;
}
?>

Documentation for API Endpoints

All URIs are relative to https://api-invest.tinkoff.ru/openapi/

Documentation For Models

Documentation For Authorization

sso_auth

  • Type: HTTP bearer authentication

Author

n.v.melnikov@tinkoff.ru