rakuten_trading 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +455 -0
  4. data/Rakefile +8 -0
  5. data/docs/CfdOrderBody.md +9 -0
  6. data/docs/CfdOrderBody1.md +9 -0
  7. data/docs/CfdTrade.md +28 -0
  8. data/docs/InlineResponse200.md +22 -0
  9. data/docs/InlineResponse2001.md +9 -0
  10. data/docs/InlineResponse2001Candlesticks.md +12 -0
  11. data/docs/InlineResponse2002.md +14 -0
  12. data/docs/InlineResponse2003.md +15 -0
  13. data/docs/InlineResponse2004.md +9 -0
  14. data/docs/InlineResponse2005.md +8 -0
  15. data/docs/InlineResponse2006.md +19 -0
  16. data/docs/InlineResponse2007.md +18 -0
  17. data/docs/Order.md +9 -0
  18. data/docs/OrderData.md +18 -0
  19. data/docs/OrderDetail.md +33 -0
  20. data/docs/OrderResponse.md +29 -0
  21. data/docs/PrivateApi.md +518 -0
  22. data/docs/PublicApi.md +304 -0
  23. data/docs/Trade.md +12 -0
  24. data/git_push.sh +55 -0
  25. data/lib/rakuten_trading/api/private_api.rb +537 -0
  26. data/lib/rakuten_trading/api/public_api.rb +315 -0
  27. data/lib/rakuten_trading/api_client.rb +388 -0
  28. data/lib/rakuten_trading/api_error.rb +57 -0
  29. data/lib/rakuten_trading/configuration.rb +212 -0
  30. data/lib/rakuten_trading/models/cfd_order_body.rb +224 -0
  31. data/lib/rakuten_trading/models/cfd_order_body_1.rb +224 -0
  32. data/lib/rakuten_trading/models/cfd_trade.rb +417 -0
  33. data/lib/rakuten_trading/models/inline_response_200.rb +357 -0
  34. data/lib/rakuten_trading/models/inline_response_200_1.rb +226 -0
  35. data/lib/rakuten_trading/models/inline_response_200_1_candlesticks.rb +251 -0
  36. data/lib/rakuten_trading/models/inline_response_200_2.rb +275 -0
  37. data/lib/rakuten_trading/models/inline_response_200_3.rb +281 -0
  38. data/lib/rakuten_trading/models/inline_response_200_4.rb +226 -0
  39. data/lib/rakuten_trading/models/inline_response_200_5.rb +217 -0
  40. data/lib/rakuten_trading/models/inline_response_200_6.rb +327 -0
  41. data/lib/rakuten_trading/models/inline_response_200_7.rb +317 -0
  42. data/lib/rakuten_trading/models/order.rb +224 -0
  43. data/lib/rakuten_trading/models/order_data.rb +337 -0
  44. data/lib/rakuten_trading/models/order_detail.rb +440 -0
  45. data/lib/rakuten_trading/models/order_response.rb +427 -0
  46. data/lib/rakuten_trading/models/trade.rb +253 -0
  47. data/lib/rakuten_trading/version.rb +14 -0
  48. data/lib/rakuten_trading.rb +57 -0
  49. data/rakuten_trading.gemspec +38 -0
  50. data/rakuten_trading_api.yml +1256 -0
  51. data/spec/api/private_api_spec.rb +151 -0
  52. data/spec/api/public_api_spec.rb +94 -0
  53. data/spec/api_client_spec.rb +225 -0
  54. data/spec/base_object_spec.rb +109 -0
  55. data/spec/configuration_spec.rb +41 -0
  56. data/spec/models/cfd_order_body_1_spec.rb +52 -0
  57. data/spec/models/cfd_order_body_spec.rb +52 -0
  58. data/spec/models/cfd_trade_spec.rb +166 -0
  59. data/spec/models/inline_response_200_1_candlesticks_spec.rb +70 -0
  60. data/spec/models/inline_response_200_1_spec.rb +52 -0
  61. data/spec/models/inline_response_200_2_spec.rb +82 -0
  62. data/spec/models/inline_response_200_3_spec.rb +88 -0
  63. data/spec/models/inline_response_200_4_spec.rb +52 -0
  64. data/spec/models/inline_response_200_5_spec.rb +46 -0
  65. data/spec/models/inline_response_200_6_spec.rb +112 -0
  66. data/spec/models/inline_response_200_7_spec.rb +106 -0
  67. data/spec/models/inline_response_200_spec.rb +130 -0
  68. data/spec/models/order_data_spec.rb +106 -0
  69. data/spec/models/order_detail_spec.rb +196 -0
  70. data/spec/models/order_response_spec.rb +172 -0
  71. data/spec/models/order_spec.rb +52 -0
  72. data/spec/models/trade_spec.rb +70 -0
  73. data/spec/spec_helper.rb +110 -0
  74. metadata +201 -0
@@ -0,0 +1,315 @@
1
+ =begin
2
+ #API(証拠金取引所)
3
+
4
+ #本APIを利用することにより、取り扱っている銘柄一覧の取得、ローソク足データの取得、板の取得、歩値の取得、注文、残高照会といった操作を行う事ができます。 ## 留意事項 - APIキーはお客様のアカウント情報と紐付いております。もし第三者がお客様のAPIキーを知った場合、遠隔で売買注文の操作が可能となります。APIキーを第三者へ渡す事はセキュリティリスクを鑑みお控えください。 - 他社が提供するAPI機能を使用した自動売買取引ツールは、ご自身の判断と責任でご利用ください。 - リクエストパラメーターやレスポンスの日時についてはミリ秒のtimestamp(Unix Time)を用います。 - 日時の範囲検索は「以上・未満」で検索します。
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.54
10
+ =end
11
+
12
+ module RakutenTrading
13
+ class PublicApi
14
+ attr_accessor :api_client
15
+
16
+ def initialize(api_client = ApiClient.default)
17
+ @api_client = api_client
18
+ end
19
+ # ローソク取得
20
+ # 指定された銘柄のローソク足データを取得します。データは指定された範囲で検索され、最新のデータから最大500件まで取得することが可能です。
21
+ # @param symbol_id シンボルID
22
+ # @param candlestick_type ローソク足の種類。ISO8601フォーマットに準拠。
23
+ # @param [Hash] opts the optional parameters
24
+ # @option opts [Integer] :date_from 取得開始日時。UNIXタイムスタンプ(ミリ秒)で指定。
25
+ # @option opts [Integer] :date_to 取得終了日時。UNIXタイムスタンプ(ミリ秒)で指定。
26
+ # @return [InlineResponse2001]
27
+ def get_candlestick(symbol_id, candlestick_type, opts = {})
28
+ data, _status_code, _headers = get_candlestick_with_http_info(symbol_id, candlestick_type, opts)
29
+ data
30
+ end
31
+
32
+ # ローソク取得
33
+ # 指定された銘柄のローソク足データを取得します。データは指定された範囲で検索され、最新のデータから最大500件まで取得することが可能です。
34
+ # @param symbol_id シンボルID
35
+ # @param candlestick_type ローソク足の種類。ISO8601フォーマットに準拠。
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [Integer] :date_from 取得開始日時。UNIXタイムスタンプ(ミリ秒)で指定。
38
+ # @option opts [Integer] :date_to 取得終了日時。UNIXタイムスタンプ(ミリ秒)で指定。
39
+ # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers
40
+ def get_candlestick_with_http_info(symbol_id, candlestick_type, opts = {})
41
+ if @api_client.config.debugging
42
+ @api_client.config.logger.debug 'Calling API: PublicApi.get_candlestick ...'
43
+ end
44
+ # verify the required parameter 'symbol_id' is set
45
+ if @api_client.config.client_side_validation && symbol_id.nil?
46
+ fail ArgumentError, "Missing the required parameter 'symbol_id' when calling PublicApi.get_candlestick"
47
+ end
48
+ # verify the required parameter 'candlestick_type' is set
49
+ if @api_client.config.client_side_validation && candlestick_type.nil?
50
+ fail ArgumentError, "Missing the required parameter 'candlestick_type' when calling PublicApi.get_candlestick"
51
+ end
52
+ # verify enum value
53
+ if @api_client.config.client_side_validation && !['PT1M', 'PT5M', 'PT15M', 'PT30M', 'PT1H', 'PT4H', 'PT8H', 'P1D', 'P1W', 'P1M'].include?(candlestick_type)
54
+ fail ArgumentError, "invalid value for 'candlestick_type', must be one of PT1M, PT5M, PT15M, PT30M, PT1H, PT4H, PT8H, P1D, P1W, P1M"
55
+ end
56
+ # resource path
57
+ local_var_path = '/candlestick'
58
+
59
+ # query parameters
60
+ query_params = opts[:query_params] || {}
61
+ query_params[:'symbolId'] = symbol_id
62
+ query_params[:'candlestickType'] = candlestick_type
63
+ query_params[:'dateFrom'] = opts[:'date_from'] if !opts[:'date_from'].nil?
64
+ query_params[:'dateTo'] = opts[:'date_to'] if !opts[:'date_to'].nil?
65
+
66
+ # header parameters
67
+ header_params = opts[:header_params] || {}
68
+ # HTTP header 'Accept' (if needed)
69
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
70
+
71
+ # form parameters
72
+ form_params = opts[:form_params] || {}
73
+
74
+ # http body (model)
75
+ post_body = opts[:body]
76
+
77
+ return_type = opts[:return_type] || 'InlineResponse2001'
78
+
79
+ auth_names = opts[:auth_names] || ['ApiKeyAuth', 'SignatureAuth']
80
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type)
87
+
88
+ if @api_client.config.debugging
89
+ @api_client.config.logger.debug "API called: PublicApi#get_candlestick\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
90
+ end
91
+ return data, status_code, headers
92
+ end
93
+ # 板取得
94
+ # @param symbol_id シンボルID
95
+ # @param [Hash] opts the optional parameters
96
+ # @return [InlineResponse2002]
97
+ def get_orderbook(symbol_id, opts = {})
98
+ data, _status_code, _headers = get_orderbook_with_http_info(symbol_id, opts)
99
+ data
100
+ end
101
+
102
+ # 板取得
103
+ # @param symbol_id シンボルID
104
+ # @param [Hash] opts the optional parameters
105
+ # @return [Array<(InlineResponse2002, Integer, Hash)>] InlineResponse2002 data, response status code and response headers
106
+ def get_orderbook_with_http_info(symbol_id, opts = {})
107
+ if @api_client.config.debugging
108
+ @api_client.config.logger.debug 'Calling API: PublicApi.get_orderbook ...'
109
+ end
110
+ # verify the required parameter 'symbol_id' is set
111
+ if @api_client.config.client_side_validation && symbol_id.nil?
112
+ fail ArgumentError, "Missing the required parameter 'symbol_id' when calling PublicApi.get_orderbook"
113
+ end
114
+ # resource path
115
+ local_var_path = '/orderbook'
116
+
117
+ # query parameters
118
+ query_params = opts[:query_params] || {}
119
+ query_params[:'symbolId'] = symbol_id
120
+
121
+ # header parameters
122
+ header_params = opts[:header_params] || {}
123
+ # HTTP header 'Accept' (if needed)
124
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
125
+
126
+ # form parameters
127
+ form_params = opts[:form_params] || {}
128
+
129
+ # http body (model)
130
+ post_body = opts[:body]
131
+
132
+ return_type = opts[:return_type] || 'InlineResponse2002'
133
+
134
+ auth_names = opts[:auth_names] || ['ApiKeyAuth', 'SignatureAuth']
135
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
136
+ :header_params => header_params,
137
+ :query_params => query_params,
138
+ :form_params => form_params,
139
+ :body => post_body,
140
+ :auth_names => auth_names,
141
+ :return_type => return_type)
142
+
143
+ if @api_client.config.debugging
144
+ @api_client.config.logger.debug "API called: PublicApi#get_orderbook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
145
+ end
146
+ return data, status_code, headers
147
+ end
148
+ # 銘柄一覧取得
149
+ # 利用可能な全銘柄の一覧を取得します。
150
+ # @param [Hash] opts the optional parameters
151
+ # @option opts [String] :authority PERSONAL, CORPORATE。
152
+ # @return [Array<InlineResponse200>]
153
+ def get_symbol(opts = {})
154
+ data, _status_code, _headers = get_symbol_with_http_info(opts)
155
+ data
156
+ end
157
+
158
+ # 銘柄一覧取得
159
+ # 利用可能な全銘柄の一覧を取得します。
160
+ # @param [Hash] opts the optional parameters
161
+ # @option opts [String] :authority PERSONAL, CORPORATE。
162
+ # @return [Array<(Array<InlineResponse200>, Integer, Hash)>] Array<InlineResponse200> data, response status code and response headers
163
+ def get_symbol_with_http_info(opts = {})
164
+ if @api_client.config.debugging
165
+ @api_client.config.logger.debug 'Calling API: PublicApi.get_symbol ...'
166
+ end
167
+ if @api_client.config.client_side_validation && opts[:'authority'] && !['PERSONAL', 'CORPORATE'].include?(opts[:'authority'])
168
+ fail ArgumentError, 'invalid value for "authority", must be one of PERSONAL, CORPORATE'
169
+ end
170
+ # resource path
171
+ local_var_path = '/cfd/symbol'
172
+
173
+ # query parameters
174
+ query_params = opts[:query_params] || {}
175
+ query_params[:'authority'] = opts[:'authority'] if !opts[:'authority'].nil?
176
+
177
+ # header parameters
178
+ header_params = opts[:header_params] || {}
179
+ # HTTP header 'Accept' (if needed)
180
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
181
+
182
+ # form parameters
183
+ form_params = opts[:form_params] || {}
184
+
185
+ # http body (model)
186
+ post_body = opts[:body]
187
+
188
+ return_type = opts[:return_type] || 'Array<InlineResponse200>'
189
+
190
+ auth_names = opts[:auth_names] || ['ApiKeyAuth', 'SignatureAuth']
191
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
192
+ :header_params => header_params,
193
+ :query_params => query_params,
194
+ :form_params => form_params,
195
+ :body => post_body,
196
+ :auth_names => auth_names,
197
+ :return_type => return_type)
198
+
199
+ if @api_client.config.debugging
200
+ @api_client.config.logger.debug "API called: PublicApi#get_symbol\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
201
+ end
202
+ return data, status_code, headers
203
+ end
204
+ # ティッカー取得
205
+ # @param symbol_id シンボルID
206
+ # @param [Hash] opts the optional parameters
207
+ # @return [InlineResponse2003]
208
+ def get_ticker(symbol_id, opts = {})
209
+ data, _status_code, _headers = get_ticker_with_http_info(symbol_id, opts)
210
+ data
211
+ end
212
+
213
+ # ティッカー取得
214
+ # @param symbol_id シンボルID
215
+ # @param [Hash] opts the optional parameters
216
+ # @return [Array<(InlineResponse2003, Integer, Hash)>] InlineResponse2003 data, response status code and response headers
217
+ def get_ticker_with_http_info(symbol_id, opts = {})
218
+ if @api_client.config.debugging
219
+ @api_client.config.logger.debug 'Calling API: PublicApi.get_ticker ...'
220
+ end
221
+ # verify the required parameter 'symbol_id' is set
222
+ if @api_client.config.client_side_validation && symbol_id.nil?
223
+ fail ArgumentError, "Missing the required parameter 'symbol_id' when calling PublicApi.get_ticker"
224
+ end
225
+ # resource path
226
+ local_var_path = '/ticker'
227
+
228
+ # query parameters
229
+ query_params = opts[:query_params] || {}
230
+ query_params[:'symbolId'] = symbol_id
231
+
232
+ # header parameters
233
+ header_params = opts[:header_params] || {}
234
+ # HTTP header 'Accept' (if needed)
235
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
236
+
237
+ # form parameters
238
+ form_params = opts[:form_params] || {}
239
+
240
+ # http body (model)
241
+ post_body = opts[:body]
242
+
243
+ return_type = opts[:return_type] || 'InlineResponse2003'
244
+
245
+ auth_names = opts[:auth_names] || ['ApiKeyAuth', 'SignatureAuth']
246
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
247
+ :header_params => header_params,
248
+ :query_params => query_params,
249
+ :form_params => form_params,
250
+ :body => post_body,
251
+ :auth_names => auth_names,
252
+ :return_type => return_type)
253
+
254
+ if @api_client.config.debugging
255
+ @api_client.config.logger.debug "API called: PublicApi#get_ticker\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
256
+ end
257
+ return data, status_code, headers
258
+ end
259
+ # 歩み値取得
260
+ # @param symbol_id シンボルID
261
+ # @param [Hash] opts the optional parameters
262
+ # @return [InlineResponse2004]
263
+ def get_trades(symbol_id, opts = {})
264
+ data, _status_code, _headers = get_trades_with_http_info(symbol_id, opts)
265
+ data
266
+ end
267
+
268
+ # 歩み値取得
269
+ # @param symbol_id シンボルID
270
+ # @param [Hash] opts the optional parameters
271
+ # @return [Array<(InlineResponse2004, Integer, Hash)>] InlineResponse2004 data, response status code and response headers
272
+ def get_trades_with_http_info(symbol_id, opts = {})
273
+ if @api_client.config.debugging
274
+ @api_client.config.logger.debug 'Calling API: PublicApi.get_trades ...'
275
+ end
276
+ # verify the required parameter 'symbol_id' is set
277
+ if @api_client.config.client_side_validation && symbol_id.nil?
278
+ fail ArgumentError, "Missing the required parameter 'symbol_id' when calling PublicApi.get_trades"
279
+ end
280
+ # resource path
281
+ local_var_path = '/trades'
282
+
283
+ # query parameters
284
+ query_params = opts[:query_params] || {}
285
+ query_params[:'symbolId'] = symbol_id
286
+
287
+ # header parameters
288
+ header_params = opts[:header_params] || {}
289
+ # HTTP header 'Accept' (if needed)
290
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
291
+
292
+ # form parameters
293
+ form_params = opts[:form_params] || {}
294
+
295
+ # http body (model)
296
+ post_body = opts[:body]
297
+
298
+ return_type = opts[:return_type] || 'InlineResponse2004'
299
+
300
+ auth_names = opts[:auth_names] || ['ApiKeyAuth', 'SignatureAuth']
301
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
302
+ :header_params => header_params,
303
+ :query_params => query_params,
304
+ :form_params => form_params,
305
+ :body => post_body,
306
+ :auth_names => auth_names,
307
+ :return_type => return_type)
308
+
309
+ if @api_client.config.debugging
310
+ @api_client.config.logger.debug "API called: PublicApi#get_trades\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
311
+ end
312
+ return data, status_code, headers
313
+ end
314
+ end
315
+ end