PHP code example of rocketfellows / tinkoff-invest-v1-instruments-rest-client

1. Go to this page and download the library: Download rocketfellows/tinkoff-invest-v1-instruments-rest-client 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/ */

    

rocketfellows / tinkoff-invest-v1-instruments-rest-client example snippets


$client = new Client(
    (
        new ClientConfig(
            'https://invest-public-api.tinkoff.ru/rest',
            <your_access_token>
        )
    ),
    new \GuzzleHttp\Client()
);

$instrumentsService = new InstrumentsService($client);

$dividends = $instrumentsService->getDividends([
    "figi" => "BBG004730RP0",
    "from" => "2022-05-28T15:38:52.283Z",
    "to" => '2022-08-18T15:38:52.283Z',
])

Array
(
    [dividends] => Array
        (
            [0] => Array
                (
                    [dividendNet] => Array
                        (
                            [currency] => rub
                            [units] => 52
                            [nano] => 530000000
                        )
                    [declaredDate] => 2022-06-30T00:00:00Z
                    [lastBuyDate] => 2022-07-18T00:00:00Z
                    [dividendType] => 
                    [recordDate] => 2022-07-20T00:00:00Z
                    [regularity] => 
                    [closePrice] => Array
                        (
                            [currency] => rub
                            [units] => 306
                            [nano] => 500000000
                        )
                    [yieldValue] => Array
                        (
                            [units] => 17
                            [nano] => 140000000
                        )
                    [createdAt] => 2022-06-10T02:05:32.707197Z
                )
        )
)