Class: TinkoffInvestClient::MarketApi

Inherits:
Object
  • Object
show all
Defined in:
lib/tinkoff_invest_client/api/market_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MarketApi

Returns a new instance of MarketApi.



19
20
21
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#market_bonds_get(opts = {}) ⇒ MarketInstrumentListResponse

Получение списка облигаций

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



25
26
27
28
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 25

def market_bonds_get(opts = {})
  data, _status_code, _headers = market_bonds_get_with_http_info(opts)
  data
end

#market_bonds_get_with_http_info(opts = {}) ⇒ Array<(MarketInstrumentListResponse, Integer, Hash)>

Получение списка облигаций

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 33

def market_bonds_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketApi.market_bonds_get ...'
  end
  # resource path
  local_var_path = '/market/bonds'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'MarketInstrumentListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['sso_auth']

  new_options = opts.merge(
    :operation => :"MarketApi.market_bonds_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MarketApi#market_bonds_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#market_candles_get(figi, from, to, interval, opts = {}) ⇒ CandlesResponse

Получение исторических свечей по FIGI

Parameters:

  • figi (String)

    FIGI

  • from (Time)

    Начало временного промежутка

  • to (Time)

    Конец временного промежутка

  • interval (CandleResolution)

    Интервал свечи

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



84
85
86
87
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 84

def market_candles_get(figi, from, to, interval, opts = {})
  data, _status_code, _headers = market_candles_get_with_http_info(figi, from, to, interval, opts)
  data
end

#market_candles_get_with_http_info(figi, from, to, interval, opts = {}) ⇒ Array<(CandlesResponse, Integer, Hash)>

Получение исторических свечей по FIGI

Parameters:

  • figi (String)

    FIGI

  • from (Time)

    Начало временного промежутка

  • to (Time)

    Конец временного промежутка

  • interval (CandleResolution)

    Интервал свечи

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CandlesResponse, Integer, Hash)>)

    CandlesResponse data, response status code and response headers



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 96

def market_candles_get_with_http_info(figi, from, to, interval, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketApi.market_candles_get ...'
  end
  # verify the required parameter 'figi' is set
  if @api_client.config.client_side_validation && figi.nil?
    fail ArgumentError, "Missing the required parameter 'figi' when calling MarketApi.market_candles_get"
  end
  # verify the required parameter 'from' is set
  if @api_client.config.client_side_validation && from.nil?
    fail ArgumentError, "Missing the required parameter 'from' when calling MarketApi.market_candles_get"
  end
  # verify the required parameter 'to' is set
  if @api_client.config.client_side_validation && to.nil?
    fail ArgumentError, "Missing the required parameter 'to' when calling MarketApi.market_candles_get"
  end
  # verify the required parameter 'interval' is set
  if @api_client.config.client_side_validation && interval.nil?
    fail ArgumentError, "Missing the required parameter 'interval' when calling MarketApi.market_candles_get"
  end
  # resource path
  local_var_path = '/market/candles'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'figi'] = figi
  query_params[:'from'] = from
  query_params[:'to'] = to
  query_params[:'interval'] = interval

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CandlesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['sso_auth']

  new_options = opts.merge(
    :operation => :"MarketApi.market_candles_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MarketApi#market_candles_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#market_currencies_get(opts = {}) ⇒ MarketInstrumentListResponse

Получение списка валютных пар

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



163
164
165
166
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 163

def market_currencies_get(opts = {})
  data, _status_code, _headers = market_currencies_get_with_http_info(opts)
  data
end

#market_currencies_get_with_http_info(opts = {}) ⇒ Array<(MarketInstrumentListResponse, Integer, Hash)>

Получение списка валютных пар

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 171

def market_currencies_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketApi.market_currencies_get ...'
  end
  # resource path
  local_var_path = '/market/currencies'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'MarketInstrumentListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['sso_auth']

  new_options = opts.merge(
    :operation => :"MarketApi.market_currencies_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MarketApi#market_currencies_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#market_etfs_get(opts = {}) ⇒ MarketInstrumentListResponse

Получение списка ETF

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



218
219
220
221
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 218

def market_etfs_get(opts = {})
  data, _status_code, _headers = market_etfs_get_with_http_info(opts)
  data
end

#market_etfs_get_with_http_info(opts = {}) ⇒ Array<(MarketInstrumentListResponse, Integer, Hash)>

Получение списка ETF

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 226

def market_etfs_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketApi.market_etfs_get ...'
  end
  # resource path
  local_var_path = '/market/etfs'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'MarketInstrumentListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['sso_auth']

  new_options = opts.merge(
    :operation => :"MarketApi.market_etfs_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MarketApi#market_etfs_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#market_orderbook_get(figi, depth, opts = {}) ⇒ OrderbookResponse

Получение стакана по FIGI

Parameters:

  • figi (String)

    FIGI

  • depth (Integer)

    Глубина стакана [1..20]

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



275
276
277
278
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 275

def market_orderbook_get(figi, depth, opts = {})
  data, _status_code, _headers = market_orderbook_get_with_http_info(figi, depth, opts)
  data
end

#market_orderbook_get_with_http_info(figi, depth, opts = {}) ⇒ Array<(OrderbookResponse, Integer, Hash)>

Получение стакана по FIGI

Parameters:

  • figi (String)

    FIGI

  • depth (Integer)

    Глубина стакана [1..20]

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(OrderbookResponse, Integer, Hash)>)

    OrderbookResponse data, response status code and response headers



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 285

def market_orderbook_get_with_http_info(figi, depth, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketApi.market_orderbook_get ...'
  end
  # verify the required parameter 'figi' is set
  if @api_client.config.client_side_validation && figi.nil?
    fail ArgumentError, "Missing the required parameter 'figi' when calling MarketApi.market_orderbook_get"
  end
  # verify the required parameter 'depth' is set
  if @api_client.config.client_side_validation && depth.nil?
    fail ArgumentError, "Missing the required parameter 'depth' when calling MarketApi.market_orderbook_get"
  end
  # resource path
  local_var_path = '/market/orderbook'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'figi'] = figi
  query_params[:'depth'] = depth

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrderbookResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['sso_auth']

  new_options = opts.merge(
    :operation => :"MarketApi.market_orderbook_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MarketApi#market_orderbook_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#market_search_by_figi_get(figi, opts = {}) ⇒ SearchMarketInstrumentResponse

Получение инструмента по FIGI

Parameters:

  • figi (String)

    FIGI

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



343
344
345
346
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 343

def market_search_by_figi_get(figi, opts = {})
  data, _status_code, _headers = market_search_by_figi_get_with_http_info(figi, opts)
  data
end

#market_search_by_figi_get_with_http_info(figi, opts = {}) ⇒ Array<(SearchMarketInstrumentResponse, Integer, Hash)>

Получение инструмента по FIGI

Parameters:

  • figi (String)

    FIGI

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 352

def market_search_by_figi_get_with_http_info(figi, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketApi.market_search_by_figi_get ...'
  end
  # verify the required parameter 'figi' is set
  if @api_client.config.client_side_validation && figi.nil?
    fail ArgumentError, "Missing the required parameter 'figi' when calling MarketApi.market_search_by_figi_get"
  end
  # resource path
  local_var_path = '/market/search/by-figi'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'figi'] = figi

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SearchMarketInstrumentResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['sso_auth']

  new_options = opts.merge(
    :operation => :"MarketApi.market_search_by_figi_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MarketApi#market_search_by_figi_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#market_search_by_ticker_get(ticker, opts = {}) ⇒ MarketInstrumentListResponse

Получение инструмента по тикеру

Parameters:

  • ticker (String)

    Тикер инструмента

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



405
406
407
408
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 405

def market_search_by_ticker_get(ticker, opts = {})
  data, _status_code, _headers = market_search_by_ticker_get_with_http_info(ticker, opts)
  data
end

#market_search_by_ticker_get_with_http_info(ticker, opts = {}) ⇒ Array<(MarketInstrumentListResponse, Integer, Hash)>

Получение инструмента по тикеру

Parameters:

  • ticker (String)

    Тикер инструмента

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 414

def market_search_by_ticker_get_with_http_info(ticker, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketApi.market_search_by_ticker_get ...'
  end
  # verify the required parameter 'ticker' is set
  if @api_client.config.client_side_validation && ticker.nil?
    fail ArgumentError, "Missing the required parameter 'ticker' when calling MarketApi.market_search_by_ticker_get"
  end
  # resource path
  local_var_path = '/market/search/by-ticker'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'ticker'] = ticker

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'MarketInstrumentListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['sso_auth']

  new_options = opts.merge(
    :operation => :"MarketApi.market_search_by_ticker_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MarketApi#market_search_by_ticker_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#market_stocks_get(opts = {}) ⇒ MarketInstrumentListResponse

Получение списка акций

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



466
467
468
469
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 466

def market_stocks_get(opts = {})
  data, _status_code, _headers = market_stocks_get_with_http_info(opts)
  data
end

#market_stocks_get_with_http_info(opts = {}) ⇒ Array<(MarketInstrumentListResponse, Integer, Hash)>

Получение списка акций

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/tinkoff_invest_client/api/market_api.rb', line 474

def market_stocks_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MarketApi.market_stocks_get ...'
  end
  # resource path
  local_var_path = '/market/stocks'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'MarketInstrumentListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['sso_auth']

  new_options = opts.merge(
    :operation => :"MarketApi.market_stocks_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MarketApi#market_stocks_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end