tinkoff_invest_client 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +169 -0
- data/Rakefile +10 -0
- data/docs/BrokerAccountType.md +15 -0
- data/docs/Candle.md +32 -0
- data/docs/CandleResolution.md +15 -0
- data/docs/Candles.md +22 -0
- data/docs/CandlesResponse.md +22 -0
- data/docs/Currencies.md +18 -0
- data/docs/Currency.md +15 -0
- data/docs/CurrencyPosition.md +22 -0
- data/docs/Empty.md +22 -0
- data/docs/Error.md +22 -0
- data/docs/ErrorPayload.md +20 -0
- data/docs/InstrumentType.md +15 -0
- data/docs/LimitOrderRequest.md +22 -0
- data/docs/LimitOrderResponse.md +22 -0
- data/docs/MarketApi.md +547 -0
- data/docs/MarketInstrument.md +34 -0
- data/docs/MarketInstrumentList.md +20 -0
- data/docs/MarketInstrumentListResponse.md +22 -0
- data/docs/MarketInstrumentResponse.md +22 -0
- data/docs/MarketOrderRequest.md +20 -0
- data/docs/MarketOrderResponse.md +22 -0
- data/docs/MoneyAmount.md +20 -0
- data/docs/Operation.md +44 -0
- data/docs/OperationStatus.md +15 -0
- data/docs/OperationTrade.md +24 -0
- data/docs/OperationType.md +15 -0
- data/docs/OperationTypeWithCommission.md +15 -0
- data/docs/Operations.md +18 -0
- data/docs/OperationsApi.md +83 -0
- data/docs/OperationsResponse.md +22 -0
- data/docs/Order.md +32 -0
- data/docs/OrderResponse.md +20 -0
- data/docs/OrderStatus.md +15 -0
- data/docs/OrderType.md +15 -0
- data/docs/Orderbook.md +38 -0
- data/docs/OrderbookResponse.md +22 -0
- data/docs/OrdersApi.md +297 -0
- data/docs/OrdersResponse.md +22 -0
- data/docs/PlacedLimitOrder.md +32 -0
- data/docs/PlacedMarketOrder.md +32 -0
- data/docs/Portfolio.md +18 -0
- data/docs/PortfolioApi.md +147 -0
- data/docs/PortfolioCurrenciesResponse.md +22 -0
- data/docs/PortfolioPosition.md +38 -0
- data/docs/PortfolioResponse.md +22 -0
- data/docs/SandboxAccount.md +20 -0
- data/docs/SandboxApi.md +367 -0
- data/docs/SandboxCurrency.md +15 -0
- data/docs/SandboxRegisterRequest.md +18 -0
- data/docs/SandboxRegisterResponse.md +22 -0
- data/docs/SandboxSetCurrencyBalanceRequest.md +20 -0
- data/docs/SandboxSetPositionBalanceRequest.md +20 -0
- data/docs/SearchMarketInstrument.md +32 -0
- data/docs/SearchMarketInstrumentResponse.md +22 -0
- data/docs/TradeStatus.md +15 -0
- data/docs/UserAccount.md +20 -0
- data/docs/UserAccounts.md +18 -0
- data/docs/UserAccountsResponse.md +22 -0
- data/docs/UserApi.md +72 -0
- data/generator_options.md +1 -0
- data/git_push.sh +58 -0
- data/lib/tinkoff_invest_client.rb +98 -0
- data/lib/tinkoff_invest_client/api/market_api.rb +518 -0
- data/lib/tinkoff_invest_client/api/operations_api.rb +97 -0
- data/lib/tinkoff_invest_client/api/orders_api.rb +291 -0
- data/lib/tinkoff_invest_client/api/portfolio_api.rb +138 -0
- data/lib/tinkoff_invest_client/api/sandbox_api.rb +335 -0
- data/lib/tinkoff_invest_client/api/user_api.rb +77 -0
- data/lib/tinkoff_invest_client/api_client.rb +390 -0
- data/lib/tinkoff_invest_client/api_error.rb +57 -0
- data/lib/tinkoff_invest_client/configuration.rb +281 -0
- data/lib/tinkoff_invest_client/models/broker_account_type.rb +37 -0
- data/lib/tinkoff_invest_client/models/candle.rb +322 -0
- data/lib/tinkoff_invest_client/models/candle_resolution.rb +46 -0
- data/lib/tinkoff_invest_client/models/candles.rb +253 -0
- data/lib/tinkoff_invest_client/models/candles_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/currencies.rb +225 -0
- data/lib/tinkoff_invest_client/models/currency.rb +44 -0
- data/lib/tinkoff_invest_client/models/currency_position.rb +246 -0
- data/lib/tinkoff_invest_client/models/empty.rb +253 -0
- data/lib/tinkoff_invest_client/models/error.rb +253 -0
- data/lib/tinkoff_invest_client/models/error_payload.rb +227 -0
- data/lib/tinkoff_invest_client/models/instrument_type.rb +39 -0
- data/lib/tinkoff_invest_client/models/limit_order_request.rb +251 -0
- data/lib/tinkoff_invest_client/models/limit_order_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/market_instrument.rb +317 -0
- data/lib/tinkoff_invest_client/models/market_instrument_list.rb +239 -0
- data/lib/tinkoff_invest_client/models/market_instrument_list_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/market_instrument_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/market_order_request.rb +237 -0
- data/lib/tinkoff_invest_client/models/market_order_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/money_amount.rb +237 -0
- data/lib/tinkoff_invest_client/models/operation.rb +370 -0
- data/lib/tinkoff_invest_client/models/operation_status.rb +38 -0
- data/lib/tinkoff_invest_client/models/operation_trade.rb +266 -0
- data/lib/tinkoff_invest_client/models/operation_type.rb +37 -0
- data/lib/tinkoff_invest_client/models/operation_type_with_commission.rb +56 -0
- data/lib/tinkoff_invest_client/models/operations.rb +225 -0
- data/lib/tinkoff_invest_client/models/operations_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/order.rb +321 -0
- data/lib/tinkoff_invest_client/models/order_response.rb +237 -0
- data/lib/tinkoff_invest_client/models/order_status.rb +44 -0
- data/lib/tinkoff_invest_client/models/order_type.rb +37 -0
- data/lib/tinkoff_invest_client/models/orderbook.rb +346 -0
- data/lib/tinkoff_invest_client/models/orderbook_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/orders_response.rb +255 -0
- data/lib/tinkoff_invest_client/models/placed_limit_order.rb +307 -0
- data/lib/tinkoff_invest_client/models/placed_market_order.rb +307 -0
- data/lib/tinkoff_invest_client/models/portfolio.rb +225 -0
- data/lib/tinkoff_invest_client/models/portfolio_currencies_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/portfolio_position.rb +333 -0
- data/lib/tinkoff_invest_client/models/portfolio_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/sandbox_account.rb +237 -0
- data/lib/tinkoff_invest_client/models/sandbox_currency.rb +44 -0
- data/lib/tinkoff_invest_client/models/sandbox_register_request.rb +218 -0
- data/lib/tinkoff_invest_client/models/sandbox_register_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/sandbox_set_currency_balance_request.rb +237 -0
- data/lib/tinkoff_invest_client/models/sandbox_set_position_balance_request.rb +232 -0
- data/lib/tinkoff_invest_client/models/search_market_instrument.rb +307 -0
- data/lib/tinkoff_invest_client/models/search_market_instrument_response.rb +253 -0
- data/lib/tinkoff_invest_client/models/trade_status.rb +37 -0
- data/lib/tinkoff_invest_client/models/user_account.rb +237 -0
- data/lib/tinkoff_invest_client/models/user_accounts.rb +225 -0
- data/lib/tinkoff_invest_client/models/user_accounts_response.rb +253 -0
- data/lib/tinkoff_invest_client/version.rb +15 -0
- data/spec/api/market_api_spec.rb +123 -0
- data/spec/api/operations_api_spec.rb +49 -0
- data/spec/api/orders_api_spec.rb +84 -0
- data/spec/api/portfolio_api_spec.rb +57 -0
- data/spec/api/sandbox_api_spec.rb +95 -0
- data/spec/api/user_api_spec.rb +45 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/broker_account_type_spec.rb +28 -0
- data/spec/models/candle_resolution_spec.rb +28 -0
- data/spec/models/candle_spec.rb +76 -0
- data/spec/models/candles_response_spec.rb +46 -0
- data/spec/models/candles_spec.rb +46 -0
- data/spec/models/currencies_spec.rb +34 -0
- data/spec/models/currency_position_spec.rb +46 -0
- data/spec/models/currency_spec.rb +28 -0
- data/spec/models/empty_spec.rb +46 -0
- data/spec/models/error_payload_spec.rb +40 -0
- data/spec/models/error_spec.rb +46 -0
- data/spec/models/instrument_type_spec.rb +28 -0
- data/spec/models/limit_order_request_spec.rb +46 -0
- data/spec/models/limit_order_response_spec.rb +46 -0
- data/spec/models/market_instrument_list_response_spec.rb +46 -0
- data/spec/models/market_instrument_list_spec.rb +40 -0
- data/spec/models/market_instrument_response_spec.rb +46 -0
- data/spec/models/market_instrument_spec.rb +82 -0
- data/spec/models/market_order_request_spec.rb +40 -0
- data/spec/models/market_order_response_spec.rb +46 -0
- data/spec/models/money_amount_spec.rb +40 -0
- data/spec/models/operation_spec.rb +112 -0
- data/spec/models/operation_status_spec.rb +28 -0
- data/spec/models/operation_trade_spec.rb +52 -0
- data/spec/models/operation_type_spec.rb +28 -0
- data/spec/models/operation_type_with_commission_spec.rb +28 -0
- data/spec/models/operations_response_spec.rb +46 -0
- data/spec/models/operations_spec.rb +34 -0
- data/spec/models/order_response_spec.rb +40 -0
- data/spec/models/order_spec.rb +76 -0
- data/spec/models/order_status_spec.rb +28 -0
- data/spec/models/order_type_spec.rb +28 -0
- data/spec/models/orderbook_response_spec.rb +46 -0
- data/spec/models/orderbook_spec.rb +94 -0
- data/spec/models/orders_response_spec.rb +46 -0
- data/spec/models/placed_limit_order_spec.rb +76 -0
- data/spec/models/placed_market_order_spec.rb +76 -0
- data/spec/models/portfolio_currencies_response_spec.rb +46 -0
- data/spec/models/portfolio_position_spec.rb +94 -0
- data/spec/models/portfolio_response_spec.rb +46 -0
- data/spec/models/portfolio_spec.rb +34 -0
- data/spec/models/sandbox_account_spec.rb +40 -0
- data/spec/models/sandbox_currency_spec.rb +28 -0
- data/spec/models/sandbox_register_request_spec.rb +34 -0
- data/spec/models/sandbox_register_response_spec.rb +46 -0
- data/spec/models/sandbox_set_currency_balance_request_spec.rb +40 -0
- data/spec/models/sandbox_set_position_balance_request_spec.rb +40 -0
- data/spec/models/search_market_instrument_response_spec.rb +46 -0
- data/spec/models/search_market_instrument_spec.rb +76 -0
- data/spec/models/trade_status_spec.rb +28 -0
- data/spec/models/user_account_spec.rb +40 -0
- data/spec/models/user_accounts_response_spec.rb +46 -0
- data/spec/models/user_accounts_spec.rb +34 -0
- data/spec/spec_helper.rb +111 -0
- data/tinkoff_invest_client.gemspec +38 -0
- metadata +336 -0
@@ -0,0 +1,97 @@
|
|
1
|
+
=begin
|
2
|
+
#OpenAPI
|
3
|
+
|
4
|
+
#tinkoff.ru/invest OpenAPI.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: al.a.volkov@tinkoff.ru
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module TinkoffInvestClient
|
16
|
+
class OperationsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Получение списка операций
|
23
|
+
# @param from [Time] Начало временного промежутка
|
24
|
+
# @param to [Time] Конец временного промежутка
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @option opts [String] :figi Figi инструмента для фильтрации
|
27
|
+
# @option opts [String] :broker_account_id Номер счета (по умолчанию - Тинькофф)
|
28
|
+
# @return [OperationsResponse]
|
29
|
+
def operations_get(from, to, opts = {})
|
30
|
+
data, _status_code, _headers = operations_get_with_http_info(from, to, opts)
|
31
|
+
data
|
32
|
+
end
|
33
|
+
|
34
|
+
# Получение списка операций
|
35
|
+
# @param from [Time] Начало временного промежутка
|
36
|
+
# @param to [Time] Конец временного промежутка
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @option opts [String] :figi Figi инструмента для фильтрации
|
39
|
+
# @option opts [String] :broker_account_id Номер счета (по умолчанию - Тинькофф)
|
40
|
+
# @return [Array<(OperationsResponse, Integer, Hash)>] OperationsResponse data, response status code and response headers
|
41
|
+
def operations_get_with_http_info(from, to, opts = {})
|
42
|
+
if @api_client.config.debugging
|
43
|
+
@api_client.config.logger.debug 'Calling API: OperationsApi.operations_get ...'
|
44
|
+
end
|
45
|
+
# verify the required parameter 'from' is set
|
46
|
+
if @api_client.config.client_side_validation && from.nil?
|
47
|
+
fail ArgumentError, "Missing the required parameter 'from' when calling OperationsApi.operations_get"
|
48
|
+
end
|
49
|
+
# verify the required parameter 'to' is set
|
50
|
+
if @api_client.config.client_side_validation && to.nil?
|
51
|
+
fail ArgumentError, "Missing the required parameter 'to' when calling OperationsApi.operations_get"
|
52
|
+
end
|
53
|
+
# resource path
|
54
|
+
local_var_path = '/operations'
|
55
|
+
|
56
|
+
# query parameters
|
57
|
+
query_params = opts[:query_params] || {}
|
58
|
+
query_params[:'from'] = from
|
59
|
+
query_params[:'to'] = to
|
60
|
+
query_params[:'figi'] = opts[:'figi'] if !opts[:'figi'].nil?
|
61
|
+
query_params[:'brokerAccountId'] = opts[:'broker_account_id'] if !opts[:'broker_account_id'].nil?
|
62
|
+
|
63
|
+
# header parameters
|
64
|
+
header_params = opts[:header_params] || {}
|
65
|
+
# HTTP header 'Accept' (if needed)
|
66
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
67
|
+
|
68
|
+
# form parameters
|
69
|
+
form_params = opts[:form_params] || {}
|
70
|
+
|
71
|
+
# http body (model)
|
72
|
+
post_body = opts[:debug_body]
|
73
|
+
|
74
|
+
# return_type
|
75
|
+
return_type = opts[:debug_return_type] || 'OperationsResponse'
|
76
|
+
|
77
|
+
# auth_names
|
78
|
+
auth_names = opts[:debug_auth_names] || ['sso_auth']
|
79
|
+
|
80
|
+
new_options = opts.merge(
|
81
|
+
:operation => :"OperationsApi.operations_get",
|
82
|
+
:header_params => header_params,
|
83
|
+
:query_params => query_params,
|
84
|
+
:form_params => form_params,
|
85
|
+
:body => post_body,
|
86
|
+
:auth_names => auth_names,
|
87
|
+
:return_type => return_type
|
88
|
+
)
|
89
|
+
|
90
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
91
|
+
if @api_client.config.debugging
|
92
|
+
@api_client.config.logger.debug "API called: OperationsApi#operations_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
93
|
+
end
|
94
|
+
return data, status_code, headers
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,291 @@
|
|
1
|
+
=begin
|
2
|
+
#OpenAPI
|
3
|
+
|
4
|
+
#tinkoff.ru/invest OpenAPI.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: al.a.volkov@tinkoff.ru
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module TinkoffInvestClient
|
16
|
+
class OrdersApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Отмена заявки
|
23
|
+
# @param order_id [String] ID заявки
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @option opts [String] :broker_account_id Номер счета (по умолчанию - Тинькофф)
|
26
|
+
# @return [Empty]
|
27
|
+
def orders_cancel_post(order_id, opts = {})
|
28
|
+
data, _status_code, _headers = orders_cancel_post_with_http_info(order_id, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Отмена заявки
|
33
|
+
# @param order_id [String] ID заявки
|
34
|
+
# @param [Hash] opts the optional parameters
|
35
|
+
# @option opts [String] :broker_account_id Номер счета (по умолчанию - Тинькофф)
|
36
|
+
# @return [Array<(Empty, Integer, Hash)>] Empty data, response status code and response headers
|
37
|
+
def orders_cancel_post_with_http_info(order_id, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: OrdersApi.orders_cancel_post ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'order_id' is set
|
42
|
+
if @api_client.config.client_side_validation && order_id.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'order_id' when calling OrdersApi.orders_cancel_post"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/orders/cancel'
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = opts[:query_params] || {}
|
50
|
+
query_params[:'orderId'] = order_id
|
51
|
+
query_params[:'brokerAccountId'] = opts[:'broker_account_id'] if !opts[:'broker_account_id'].nil?
|
52
|
+
|
53
|
+
# header parameters
|
54
|
+
header_params = opts[:header_params] || {}
|
55
|
+
# HTTP header 'Accept' (if needed)
|
56
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
57
|
+
|
58
|
+
# form parameters
|
59
|
+
form_params = opts[:form_params] || {}
|
60
|
+
|
61
|
+
# http body (model)
|
62
|
+
post_body = opts[:debug_body]
|
63
|
+
|
64
|
+
# return_type
|
65
|
+
return_type = opts[:debug_return_type] || 'Empty'
|
66
|
+
|
67
|
+
# auth_names
|
68
|
+
auth_names = opts[:debug_auth_names] || ['sso_auth']
|
69
|
+
|
70
|
+
new_options = opts.merge(
|
71
|
+
:operation => :"OrdersApi.orders_cancel_post",
|
72
|
+
:header_params => header_params,
|
73
|
+
:query_params => query_params,
|
74
|
+
:form_params => form_params,
|
75
|
+
:body => post_body,
|
76
|
+
:auth_names => auth_names,
|
77
|
+
:return_type => return_type
|
78
|
+
)
|
79
|
+
|
80
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
81
|
+
if @api_client.config.debugging
|
82
|
+
@api_client.config.logger.debug "API called: OrdersApi#orders_cancel_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
83
|
+
end
|
84
|
+
return data, status_code, headers
|
85
|
+
end
|
86
|
+
|
87
|
+
# Получение списка активных заявок
|
88
|
+
# @param [Hash] opts the optional parameters
|
89
|
+
# @option opts [String] :broker_account_id Номер счета (по умолчанию - Тинькофф)
|
90
|
+
# @return [OrdersResponse]
|
91
|
+
def orders_get(opts = {})
|
92
|
+
data, _status_code, _headers = orders_get_with_http_info(opts)
|
93
|
+
data
|
94
|
+
end
|
95
|
+
|
96
|
+
# Получение списка активных заявок
|
97
|
+
# @param [Hash] opts the optional parameters
|
98
|
+
# @option opts [String] :broker_account_id Номер счета (по умолчанию - Тинькофф)
|
99
|
+
# @return [Array<(OrdersResponse, Integer, Hash)>] OrdersResponse data, response status code and response headers
|
100
|
+
def orders_get_with_http_info(opts = {})
|
101
|
+
if @api_client.config.debugging
|
102
|
+
@api_client.config.logger.debug 'Calling API: OrdersApi.orders_get ...'
|
103
|
+
end
|
104
|
+
# resource path
|
105
|
+
local_var_path = '/orders'
|
106
|
+
|
107
|
+
# query parameters
|
108
|
+
query_params = opts[:query_params] || {}
|
109
|
+
query_params[:'brokerAccountId'] = opts[:'broker_account_id'] if !opts[:'broker_account_id'].nil?
|
110
|
+
|
111
|
+
# header parameters
|
112
|
+
header_params = opts[:header_params] || {}
|
113
|
+
# HTTP header 'Accept' (if needed)
|
114
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
115
|
+
|
116
|
+
# form parameters
|
117
|
+
form_params = opts[:form_params] || {}
|
118
|
+
|
119
|
+
# http body (model)
|
120
|
+
post_body = opts[:debug_body]
|
121
|
+
|
122
|
+
# return_type
|
123
|
+
return_type = opts[:debug_return_type] || 'OrdersResponse'
|
124
|
+
|
125
|
+
# auth_names
|
126
|
+
auth_names = opts[:debug_auth_names] || ['sso_auth']
|
127
|
+
|
128
|
+
new_options = opts.merge(
|
129
|
+
:operation => :"OrdersApi.orders_get",
|
130
|
+
:header_params => header_params,
|
131
|
+
:query_params => query_params,
|
132
|
+
:form_params => form_params,
|
133
|
+
:body => post_body,
|
134
|
+
:auth_names => auth_names,
|
135
|
+
:return_type => return_type
|
136
|
+
)
|
137
|
+
|
138
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
139
|
+
if @api_client.config.debugging
|
140
|
+
@api_client.config.logger.debug "API called: OrdersApi#orders_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
141
|
+
end
|
142
|
+
return data, status_code, headers
|
143
|
+
end
|
144
|
+
|
145
|
+
# Создание лимитной заявки
|
146
|
+
# @param figi [String] FIGI инструмента
|
147
|
+
# @param limit_order_request [LimitOrderRequest]
|
148
|
+
# @param [Hash] opts the optional parameters
|
149
|
+
# @option opts [String] :broker_account_id Номер счета (по умолчанию - Тинькофф)
|
150
|
+
# @return [LimitOrderResponse]
|
151
|
+
def orders_limit_order_post(figi, limit_order_request, opts = {})
|
152
|
+
data, _status_code, _headers = orders_limit_order_post_with_http_info(figi, limit_order_request, opts)
|
153
|
+
data
|
154
|
+
end
|
155
|
+
|
156
|
+
# Создание лимитной заявки
|
157
|
+
# @param figi [String] FIGI инструмента
|
158
|
+
# @param limit_order_request [LimitOrderRequest]
|
159
|
+
# @param [Hash] opts the optional parameters
|
160
|
+
# @option opts [String] :broker_account_id Номер счета (по умолчанию - Тинькофф)
|
161
|
+
# @return [Array<(LimitOrderResponse, Integer, Hash)>] LimitOrderResponse data, response status code and response headers
|
162
|
+
def orders_limit_order_post_with_http_info(figi, limit_order_request, opts = {})
|
163
|
+
if @api_client.config.debugging
|
164
|
+
@api_client.config.logger.debug 'Calling API: OrdersApi.orders_limit_order_post ...'
|
165
|
+
end
|
166
|
+
# verify the required parameter 'figi' is set
|
167
|
+
if @api_client.config.client_side_validation && figi.nil?
|
168
|
+
fail ArgumentError, "Missing the required parameter 'figi' when calling OrdersApi.orders_limit_order_post"
|
169
|
+
end
|
170
|
+
# verify the required parameter 'limit_order_request' is set
|
171
|
+
if @api_client.config.client_side_validation && limit_order_request.nil?
|
172
|
+
fail ArgumentError, "Missing the required parameter 'limit_order_request' when calling OrdersApi.orders_limit_order_post"
|
173
|
+
end
|
174
|
+
# resource path
|
175
|
+
local_var_path = '/orders/limit-order'
|
176
|
+
|
177
|
+
# query parameters
|
178
|
+
query_params = opts[:query_params] || {}
|
179
|
+
query_params[:'figi'] = figi
|
180
|
+
query_params[:'brokerAccountId'] = opts[:'broker_account_id'] if !opts[:'broker_account_id'].nil?
|
181
|
+
|
182
|
+
# header parameters
|
183
|
+
header_params = opts[:header_params] || {}
|
184
|
+
# HTTP header 'Accept' (if needed)
|
185
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
186
|
+
# HTTP header 'Content-Type'
|
187
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
188
|
+
|
189
|
+
# form parameters
|
190
|
+
form_params = opts[:form_params] || {}
|
191
|
+
|
192
|
+
# http body (model)
|
193
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(limit_order_request)
|
194
|
+
|
195
|
+
# return_type
|
196
|
+
return_type = opts[:debug_return_type] || 'LimitOrderResponse'
|
197
|
+
|
198
|
+
# auth_names
|
199
|
+
auth_names = opts[:debug_auth_names] || ['sso_auth']
|
200
|
+
|
201
|
+
new_options = opts.merge(
|
202
|
+
:operation => :"OrdersApi.orders_limit_order_post",
|
203
|
+
:header_params => header_params,
|
204
|
+
:query_params => query_params,
|
205
|
+
:form_params => form_params,
|
206
|
+
:body => post_body,
|
207
|
+
:auth_names => auth_names,
|
208
|
+
:return_type => return_type
|
209
|
+
)
|
210
|
+
|
211
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
212
|
+
if @api_client.config.debugging
|
213
|
+
@api_client.config.logger.debug "API called: OrdersApi#orders_limit_order_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
214
|
+
end
|
215
|
+
return data, status_code, headers
|
216
|
+
end
|
217
|
+
|
218
|
+
# Создание рыночной заявки
|
219
|
+
# @param figi [String] FIGI инструмента
|
220
|
+
# @param market_order_request [MarketOrderRequest]
|
221
|
+
# @param [Hash] opts the optional parameters
|
222
|
+
# @option opts [String] :broker_account_id Уникальный идентификатор счета (по умолчанию - Тинькофф)
|
223
|
+
# @return [MarketOrderResponse]
|
224
|
+
def orders_market_order_post(figi, market_order_request, opts = {})
|
225
|
+
data, _status_code, _headers = orders_market_order_post_with_http_info(figi, market_order_request, opts)
|
226
|
+
data
|
227
|
+
end
|
228
|
+
|
229
|
+
# Создание рыночной заявки
|
230
|
+
# @param figi [String] FIGI инструмента
|
231
|
+
# @param market_order_request [MarketOrderRequest]
|
232
|
+
# @param [Hash] opts the optional parameters
|
233
|
+
# @option opts [String] :broker_account_id Уникальный идентификатор счета (по умолчанию - Тинькофф)
|
234
|
+
# @return [Array<(MarketOrderResponse, Integer, Hash)>] MarketOrderResponse data, response status code and response headers
|
235
|
+
def orders_market_order_post_with_http_info(figi, market_order_request, opts = {})
|
236
|
+
if @api_client.config.debugging
|
237
|
+
@api_client.config.logger.debug 'Calling API: OrdersApi.orders_market_order_post ...'
|
238
|
+
end
|
239
|
+
# verify the required parameter 'figi' is set
|
240
|
+
if @api_client.config.client_side_validation && figi.nil?
|
241
|
+
fail ArgumentError, "Missing the required parameter 'figi' when calling OrdersApi.orders_market_order_post"
|
242
|
+
end
|
243
|
+
# verify the required parameter 'market_order_request' is set
|
244
|
+
if @api_client.config.client_side_validation && market_order_request.nil?
|
245
|
+
fail ArgumentError, "Missing the required parameter 'market_order_request' when calling OrdersApi.orders_market_order_post"
|
246
|
+
end
|
247
|
+
# resource path
|
248
|
+
local_var_path = '/orders/market-order'
|
249
|
+
|
250
|
+
# query parameters
|
251
|
+
query_params = opts[:query_params] || {}
|
252
|
+
query_params[:'figi'] = figi
|
253
|
+
query_params[:'brokerAccountId'] = opts[:'broker_account_id'] if !opts[:'broker_account_id'].nil?
|
254
|
+
|
255
|
+
# header parameters
|
256
|
+
header_params = opts[:header_params] || {}
|
257
|
+
# HTTP header 'Accept' (if needed)
|
258
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
259
|
+
# HTTP header 'Content-Type'
|
260
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
261
|
+
|
262
|
+
# form parameters
|
263
|
+
form_params = opts[:form_params] || {}
|
264
|
+
|
265
|
+
# http body (model)
|
266
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(market_order_request)
|
267
|
+
|
268
|
+
# return_type
|
269
|
+
return_type = opts[:debug_return_type] || 'MarketOrderResponse'
|
270
|
+
|
271
|
+
# auth_names
|
272
|
+
auth_names = opts[:debug_auth_names] || ['sso_auth']
|
273
|
+
|
274
|
+
new_options = opts.merge(
|
275
|
+
:operation => :"OrdersApi.orders_market_order_post",
|
276
|
+
:header_params => header_params,
|
277
|
+
:query_params => query_params,
|
278
|
+
:form_params => form_params,
|
279
|
+
:body => post_body,
|
280
|
+
:auth_names => auth_names,
|
281
|
+
:return_type => return_type
|
282
|
+
)
|
283
|
+
|
284
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
285
|
+
if @api_client.config.debugging
|
286
|
+
@api_client.config.logger.debug "API called: OrdersApi#orders_market_order_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
287
|
+
end
|
288
|
+
return data, status_code, headers
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
=begin
|
2
|
+
#OpenAPI
|
3
|
+
|
4
|
+
#tinkoff.ru/invest OpenAPI.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: al.a.volkov@tinkoff.ru
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module TinkoffInvestClient
|
16
|
+
class PortfolioApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Получение валютных активов клиента
|
23
|
+
# @param [Hash] opts the optional parameters
|
24
|
+
# @option opts [String] :broker_account_id Номер счета (по умолчанию - Тинькофф)
|
25
|
+
# @return [PortfolioCurrenciesResponse]
|
26
|
+
def portfolio_currencies_get(opts = {})
|
27
|
+
data, _status_code, _headers = portfolio_currencies_get_with_http_info(opts)
|
28
|
+
data
|
29
|
+
end
|
30
|
+
|
31
|
+
# Получение валютных активов клиента
|
32
|
+
# @param [Hash] opts the optional parameters
|
33
|
+
# @option opts [String] :broker_account_id Номер счета (по умолчанию - Тинькофф)
|
34
|
+
# @return [Array<(PortfolioCurrenciesResponse, Integer, Hash)>] PortfolioCurrenciesResponse data, response status code and response headers
|
35
|
+
def portfolio_currencies_get_with_http_info(opts = {})
|
36
|
+
if @api_client.config.debugging
|
37
|
+
@api_client.config.logger.debug 'Calling API: PortfolioApi.portfolio_currencies_get ...'
|
38
|
+
end
|
39
|
+
# resource path
|
40
|
+
local_var_path = '/portfolio/currencies'
|
41
|
+
|
42
|
+
# query parameters
|
43
|
+
query_params = opts[:query_params] || {}
|
44
|
+
query_params[:'brokerAccountId'] = opts[:'broker_account_id'] if !opts[:'broker_account_id'].nil?
|
45
|
+
|
46
|
+
# header parameters
|
47
|
+
header_params = opts[:header_params] || {}
|
48
|
+
# HTTP header 'Accept' (if needed)
|
49
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
50
|
+
|
51
|
+
# form parameters
|
52
|
+
form_params = opts[:form_params] || {}
|
53
|
+
|
54
|
+
# http body (model)
|
55
|
+
post_body = opts[:debug_body]
|
56
|
+
|
57
|
+
# return_type
|
58
|
+
return_type = opts[:debug_return_type] || 'PortfolioCurrenciesResponse'
|
59
|
+
|
60
|
+
# auth_names
|
61
|
+
auth_names = opts[:debug_auth_names] || ['sso_auth']
|
62
|
+
|
63
|
+
new_options = opts.merge(
|
64
|
+
:operation => :"PortfolioApi.portfolio_currencies_get",
|
65
|
+
:header_params => header_params,
|
66
|
+
:query_params => query_params,
|
67
|
+
:form_params => form_params,
|
68
|
+
:body => post_body,
|
69
|
+
:auth_names => auth_names,
|
70
|
+
:return_type => return_type
|
71
|
+
)
|
72
|
+
|
73
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
74
|
+
if @api_client.config.debugging
|
75
|
+
@api_client.config.logger.debug "API called: PortfolioApi#portfolio_currencies_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
76
|
+
end
|
77
|
+
return data, status_code, headers
|
78
|
+
end
|
79
|
+
|
80
|
+
# Получение портфеля клиента
|
81
|
+
# @param [Hash] opts the optional parameters
|
82
|
+
# @option opts [String] :broker_account_id Номер счета (по умолчанию - Тинькофф)
|
83
|
+
# @return [PortfolioResponse]
|
84
|
+
def portfolio_get(opts = {})
|
85
|
+
data, _status_code, _headers = portfolio_get_with_http_info(opts)
|
86
|
+
data
|
87
|
+
end
|
88
|
+
|
89
|
+
# Получение портфеля клиента
|
90
|
+
# @param [Hash] opts the optional parameters
|
91
|
+
# @option opts [String] :broker_account_id Номер счета (по умолчанию - Тинькофф)
|
92
|
+
# @return [Array<(PortfolioResponse, Integer, Hash)>] PortfolioResponse data, response status code and response headers
|
93
|
+
def portfolio_get_with_http_info(opts = {})
|
94
|
+
if @api_client.config.debugging
|
95
|
+
@api_client.config.logger.debug 'Calling API: PortfolioApi.portfolio_get ...'
|
96
|
+
end
|
97
|
+
# resource path
|
98
|
+
local_var_path = '/portfolio'
|
99
|
+
|
100
|
+
# query parameters
|
101
|
+
query_params = opts[:query_params] || {}
|
102
|
+
query_params[:'brokerAccountId'] = opts[:'broker_account_id'] if !opts[:'broker_account_id'].nil?
|
103
|
+
|
104
|
+
# header parameters
|
105
|
+
header_params = opts[:header_params] || {}
|
106
|
+
# HTTP header 'Accept' (if needed)
|
107
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
108
|
+
|
109
|
+
# form parameters
|
110
|
+
form_params = opts[:form_params] || {}
|
111
|
+
|
112
|
+
# http body (model)
|
113
|
+
post_body = opts[:debug_body]
|
114
|
+
|
115
|
+
# return_type
|
116
|
+
return_type = opts[:debug_return_type] || 'PortfolioResponse'
|
117
|
+
|
118
|
+
# auth_names
|
119
|
+
auth_names = opts[:debug_auth_names] || ['sso_auth']
|
120
|
+
|
121
|
+
new_options = opts.merge(
|
122
|
+
:operation => :"PortfolioApi.portfolio_get",
|
123
|
+
:header_params => header_params,
|
124
|
+
:query_params => query_params,
|
125
|
+
:form_params => form_params,
|
126
|
+
:body => post_body,
|
127
|
+
:auth_names => auth_names,
|
128
|
+
:return_type => return_type
|
129
|
+
)
|
130
|
+
|
131
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
132
|
+
if @api_client.config.debugging
|
133
|
+
@api_client.config.logger.debug "API called: PortfolioApi#portfolio_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
134
|
+
end
|
135
|
+
return data, status_code, headers
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|