realization / tinkoff-invest-openapi-php-sdk
20.2
2020-08-01 12:39 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~1.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is auto-updated.
Last update: 2025-08-19 05:14:03 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/
Class | Method | HTTP request | Description |
---|---|---|---|
MarketApi | marketBondsGet | GET /market/bonds | Получение списка облигаций |
MarketApi | marketCandlesGet | GET /market/candles | Получение исторических свечей по FIGI |
MarketApi | marketCurrenciesGet | GET /market/currencies | Получение списка валютных пар |
MarketApi | marketEtfsGet | GET /market/etfs | Получение списка ETF |
MarketApi | marketOrderbookGet | GET /market/orderbook | Получение стакана по FIGI |
MarketApi | marketSearchByFigiGet | GET /market/search/by-figi | Получение инструмента по FIGI |
MarketApi | marketSearchByTickerGet | GET /market/search/by-ticker | Получение инструмента по тикеру |
MarketApi | marketStocksGet | GET /market/stocks | Получение списка акций |
OperationsApi | operationsGet | GET /operations | Получение списка операций |
OrdersApi | ordersCancelPost | POST /orders/cancel | Отмена заявки |
OrdersApi | ordersGet | GET /orders | Получение списка активных заявок |
OrdersApi | ordersLimitOrderPost | POST /orders/limit-order | Создание лимитной заявки |
OrdersApi | ordersMarketOrderPost | POST /orders/market-order | Создание рыночной заявки |
PortfolioApi | portfolioCurrenciesGet | GET /portfolio/currencies | Получение валютных активов клиента |
PortfolioApi | portfolioGet | GET /portfolio | Получение портфеля клиента |
SandboxApi | sandboxClearPost | POST /sandbox/clear | Удаление всех позиций |
SandboxApi | sandboxCurrenciesBalancePost | POST /sandbox/currencies/balance | Выставление баланса по валютным позициям |
SandboxApi | sandboxPositionsBalancePost | POST /sandbox/positions/balance | Выставление баланса по инструментным позициям |
SandboxApi | sandboxRegisterPost | POST /sandbox/register | Регистрация клиента в sandbox |
SandboxApi | sandboxRemovePost | POST /sandbox/remove | Удаление счета |
UserApi | userAccountsGet | GET /user/accounts | Получение брокерских счетов клиента |
Documentation For Models
- BrokerAccountType
- Candle
- CandleResolution
- Candles
- CandlesResponse
- Currencies
- Currency
- CurrencyPosition
- Error
- ErrorPayload
- InstrumentType
- LimitOrderRequest
- LimitOrderResponse
- MarketInstrument
- MarketInstrumentList
- MarketInstrumentListResponse
- MarketInstrumentResponse
- MarketOrderRequest
- MarketOrderResponse
- ModelEmpty
- MoneyAmount
- Operation
- OperationStatus
- OperationTrade
- OperationType
- OperationTypeWithCommission
- Operations
- OperationsResponse
- Order
- OrderResponse
- OrderStatus
- OrderType
- Orderbook
- OrderbookResponse
- OrdersResponse
- PlacedLimitOrder
- PlacedMarketOrder
- Portfolio
- PortfolioCurrenciesResponse
- PortfolioPosition
- PortfolioResponse
- SandboxAccount
- SandboxCurrency
- SandboxRegisterRequest
- SandboxRegisterResponse
- SandboxSetCurrencyBalanceRequest
- SandboxSetPositionBalanceRequest
- SearchMarketInstrument
- SearchMarketInstrumentResponse
- TradeStatus
- UserAccount
- UserAccounts
- UserAccountsResponse
Documentation For Authorization
sso_auth
- Type: HTTP bearer authentication