jamesRUS52 / tinkoff-invest

PHP client for Tinkoff invest rest API (PHP клиент для API Тинькофф инвестиций)
MIT License
70 stars 12 forks source link

как получить массив instruments в объекте TIPortfolio? #4

Closed ayurushev closed 5 years ago

ayurushev commented 5 years ago

Добавляю в портфель сбер

$client->sbPositionBalance(2, 'BBG004730N88')

получаю портфель

$port = $client->getPortfolio();

и вижу в нем сбер print_r($port)   [instruments:jamesRUS52\TinkoffInvest\TIPortfolio:private] => Array

--
  | (
  | [0] => jamesRUS52\TinkoffInvest\TIPortfolioInstrument Object
  | (
  | [figi:jamesRUS52\TinkoffInvest\TIPortfolioInstrument:private] => BBG004730N88
  | [ticker:jamesRUS52\TinkoffInvest\TIPortfolioInstrument:private] => SBER
  | [isin:jamesRUS52\TinkoffInvest\TIPortfolioInstrument:private] => RU0009029540
  | [instrumentType:jamesRUS52\TinkoffInvest\TIPortfolioInstrument:private] => Stock
  | [balance:jamesRUS52\TinkoffInvest\TIPortfolioInstrument:private] => 2
  | [lots:jamesRUS52\TinkoffInvest\TIPortfolioInstrument:private] => 0
  | [expectedYieldValue:jamesRUS52\TinkoffInvest\TIPortfolioInstrument:private] =>
  | [expectedYieldCurrency:jamesRUS52\TinkoffInvest\TIPortfolioInstrument:private] =>
  | )

но массив instruments является private, вывести его весь я не могу. В TIPortfolio только 2 public функции: getCurrencyBalance и getInstrumentLots($ticker), которая выдает лоты(?) только при указании тикера. А полного списка, получается, получить нельзя на данный момент для отображения. Или я чего-то не догоняю:)

jamesRUS52 commented 5 years ago

Hi, thanks for reply

I've added two new functions in v. 0.3.3

$port->getAllCurrencies();
$port->getAllInstruments();

"Lots" is a amount lots of certain instruments, it may be not equal count for some stocks, f.g. RUSAL 1 lot = 10 stocks

ruzzzz6312 commented 4 years ago

Hi, thanks for reply

I've added two new functions in v. 0.3.3

$port->getAllCurrencies();
$port->getAllInstruments();

"Lots" is a amount lots of certain instruments, it may be not equal count for some stocks, f.g. RUSAL 1 lot = 10 stocks

Dear james and team, thanks for your great job! Short question, how can we list all instruments one by one? When I do $port->getAllInstruments() it returns everything but in a huge object with private properties, could you pleas kindly point me to the right answer?

Thanks.

ruzzzz6312 commented 4 years ago

Please consider sort of subscribe option for portfolio changes, of course it's not crucial