PHP code example of realization / tinkoff-invest-openapi-php-sdk

1. Go to this page and download the library: Download realization/tinkoff-invest-openapi-php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

realization / tinkoff-invest-openapi-php-sdk example snippets


    


iInstance = 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;
}

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