rakuten_trading 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,427 @@
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
+ require 'date'
13
+
14
+ module RakutenTrading
15
+ class OrderResponse
16
+ # 注文ID
17
+ attr_accessor :id
18
+
19
+ # シンボルID
20
+ attr_accessor :symbol_id
21
+
22
+ # 注文の種類(新規または決済)
23
+ attr_accessor :order_behavior
24
+
25
+ # 売買方向(BUYまたはSELL)
26
+ attr_accessor :order_side
27
+
28
+ # 注文パターン(NORMAL, OCO, IFD, IFD_OCO)
29
+ attr_accessor :order_pattern
30
+
31
+ # 注文タイプ(LIMIT, MARKET, STOP)
32
+ attr_accessor :order_type
33
+
34
+ # 注文価格
35
+ attr_accessor :price
36
+
37
+ # 平均約定価格
38
+ attr_accessor :average_price
39
+
40
+ # 注文数量
41
+ attr_accessor :amount
42
+
43
+ # 未約定数量
44
+ attr_accessor :remaining_amount
45
+
46
+ # 注文ステータス(WORKING_ORDER, PARTIAL_FILL等)
47
+ attr_accessor :order_status
48
+
49
+ # メイカー注文のみ許可されたかどうか
50
+ attr_accessor :post_only
51
+
52
+ # OCO1注文ID
53
+ attr_accessor :oco1_order_id
54
+
55
+ # OCO2注文ID
56
+ attr_accessor :oco2_order_id
57
+
58
+ # IFD新規注文ID
59
+ attr_accessor :ifd_open_order_id
60
+
61
+ # IFD決済指値注文価格
62
+ attr_accessor :ifd_close_limit_price
63
+
64
+ # IFD決済逆指値注文価格
65
+ attr_accessor :ifd_close_stop_price
66
+
67
+ # 決済対象建玉ID
68
+ attr_accessor :position_id
69
+
70
+ # 有効期限タイプ
71
+ attr_accessor :order_expire
72
+
73
+ # レバレッジ倍率
74
+ attr_accessor :leverage
75
+
76
+ # 注文中証拠金
77
+ attr_accessor :necessary_margin
78
+
79
+ # 注文作成日時
80
+ attr_accessor :created_at
81
+
82
+ # 注文更新日時
83
+ attr_accessor :updated_at
84
+
85
+ # Attribute mapping from ruby-style variable name to JSON key.
86
+ def self.attribute_map
87
+ {
88
+ :'id' => :'id',
89
+ :'symbol_id' => :'symbolId',
90
+ :'order_behavior' => :'orderBehavior',
91
+ :'order_side' => :'orderSide',
92
+ :'order_pattern' => :'orderPattern',
93
+ :'order_type' => :'orderType',
94
+ :'price' => :'price',
95
+ :'average_price' => :'averagePrice',
96
+ :'amount' => :'amount',
97
+ :'remaining_amount' => :'remainingAmount',
98
+ :'order_status' => :'orderStatus',
99
+ :'post_only' => :'postOnly',
100
+ :'oco1_order_id' => :'oco1OrderId',
101
+ :'oco2_order_id' => :'oco2OrderId',
102
+ :'ifd_open_order_id' => :'ifdOpenOrderId',
103
+ :'ifd_close_limit_price' => :'ifdCloseLimitPrice',
104
+ :'ifd_close_stop_price' => :'ifdCloseStopPrice',
105
+ :'position_id' => :'positionId',
106
+ :'order_expire' => :'orderExpire',
107
+ :'leverage' => :'leverage',
108
+ :'necessary_margin' => :'necessaryMargin',
109
+ :'created_at' => :'createdAt',
110
+ :'updated_at' => :'updatedAt'
111
+ }
112
+ end
113
+
114
+ # Attribute type mapping.
115
+ def self.openapi_types
116
+ {
117
+ :'id' => :'Object',
118
+ :'symbol_id' => :'Object',
119
+ :'order_behavior' => :'Object',
120
+ :'order_side' => :'Object',
121
+ :'order_pattern' => :'Object',
122
+ :'order_type' => :'Object',
123
+ :'price' => :'Object',
124
+ :'average_price' => :'Object',
125
+ :'amount' => :'Object',
126
+ :'remaining_amount' => :'Object',
127
+ :'order_status' => :'Object',
128
+ :'post_only' => :'Object',
129
+ :'oco1_order_id' => :'Object',
130
+ :'oco2_order_id' => :'Object',
131
+ :'ifd_open_order_id' => :'Object',
132
+ :'ifd_close_limit_price' => :'Object',
133
+ :'ifd_close_stop_price' => :'Object',
134
+ :'position_id' => :'Object',
135
+ :'order_expire' => :'Object',
136
+ :'leverage' => :'Object',
137
+ :'necessary_margin' => :'Object',
138
+ :'created_at' => :'Object',
139
+ :'updated_at' => :'Object'
140
+ }
141
+ end
142
+
143
+ # List of attributes with nullable: true
144
+ def self.openapi_nullable
145
+ Set.new([
146
+ ])
147
+ end
148
+
149
+ # Initializes the object
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ def initialize(attributes = {})
152
+ if (!attributes.is_a?(Hash))
153
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RakutenTrading::OrderResponse` initialize method"
154
+ end
155
+
156
+ # check to see if the attribute exists and convert string to symbol for hash key
157
+ attributes = attributes.each_with_object({}) { |(k, v), h|
158
+ if (!self.class.attribute_map.key?(k.to_sym))
159
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RakutenTrading::OrderResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
160
+ end
161
+ h[k.to_sym] = v
162
+ }
163
+
164
+ if attributes.key?(:'id')
165
+ self.id = attributes[:'id']
166
+ end
167
+
168
+ if attributes.key?(:'symbol_id')
169
+ self.symbol_id = attributes[:'symbol_id']
170
+ end
171
+
172
+ if attributes.key?(:'order_behavior')
173
+ self.order_behavior = attributes[:'order_behavior']
174
+ end
175
+
176
+ if attributes.key?(:'order_side')
177
+ self.order_side = attributes[:'order_side']
178
+ end
179
+
180
+ if attributes.key?(:'order_pattern')
181
+ self.order_pattern = attributes[:'order_pattern']
182
+ end
183
+
184
+ if attributes.key?(:'order_type')
185
+ self.order_type = attributes[:'order_type']
186
+ end
187
+
188
+ if attributes.key?(:'price')
189
+ self.price = attributes[:'price']
190
+ end
191
+
192
+ if attributes.key?(:'average_price')
193
+ self.average_price = attributes[:'average_price']
194
+ end
195
+
196
+ if attributes.key?(:'amount')
197
+ self.amount = attributes[:'amount']
198
+ end
199
+
200
+ if attributes.key?(:'remaining_amount')
201
+ self.remaining_amount = attributes[:'remaining_amount']
202
+ end
203
+
204
+ if attributes.key?(:'order_status')
205
+ self.order_status = attributes[:'order_status']
206
+ end
207
+
208
+ if attributes.key?(:'post_only')
209
+ self.post_only = attributes[:'post_only']
210
+ end
211
+
212
+ if attributes.key?(:'oco1_order_id')
213
+ self.oco1_order_id = attributes[:'oco1_order_id']
214
+ end
215
+
216
+ if attributes.key?(:'oco2_order_id')
217
+ self.oco2_order_id = attributes[:'oco2_order_id']
218
+ end
219
+
220
+ if attributes.key?(:'ifd_open_order_id')
221
+ self.ifd_open_order_id = attributes[:'ifd_open_order_id']
222
+ end
223
+
224
+ if attributes.key?(:'ifd_close_limit_price')
225
+ self.ifd_close_limit_price = attributes[:'ifd_close_limit_price']
226
+ end
227
+
228
+ if attributes.key?(:'ifd_close_stop_price')
229
+ self.ifd_close_stop_price = attributes[:'ifd_close_stop_price']
230
+ end
231
+
232
+ if attributes.key?(:'position_id')
233
+ self.position_id = attributes[:'position_id']
234
+ end
235
+
236
+ if attributes.key?(:'order_expire')
237
+ self.order_expire = attributes[:'order_expire']
238
+ end
239
+
240
+ if attributes.key?(:'leverage')
241
+ self.leverage = attributes[:'leverage']
242
+ end
243
+
244
+ if attributes.key?(:'necessary_margin')
245
+ self.necessary_margin = attributes[:'necessary_margin']
246
+ end
247
+
248
+ if attributes.key?(:'created_at')
249
+ self.created_at = attributes[:'created_at']
250
+ end
251
+
252
+ if attributes.key?(:'updated_at')
253
+ self.updated_at = attributes[:'updated_at']
254
+ end
255
+ end
256
+
257
+ # Show invalid properties with the reasons. Usually used together with valid?
258
+ # @return Array for valid properties with the reasons
259
+ def list_invalid_properties
260
+ invalid_properties = Array.new
261
+ invalid_properties
262
+ end
263
+
264
+ # Check to see if the all the properties in the model are valid
265
+ # @return true if the model is valid
266
+ def valid?
267
+ true
268
+ end
269
+
270
+ # Checks equality by comparing each attribute.
271
+ # @param [Object] Object to be compared
272
+ def ==(o)
273
+ return true if self.equal?(o)
274
+ self.class == o.class &&
275
+ id == o.id &&
276
+ symbol_id == o.symbol_id &&
277
+ order_behavior == o.order_behavior &&
278
+ order_side == o.order_side &&
279
+ order_pattern == o.order_pattern &&
280
+ order_type == o.order_type &&
281
+ price == o.price &&
282
+ average_price == o.average_price &&
283
+ amount == o.amount &&
284
+ remaining_amount == o.remaining_amount &&
285
+ order_status == o.order_status &&
286
+ post_only == o.post_only &&
287
+ oco1_order_id == o.oco1_order_id &&
288
+ oco2_order_id == o.oco2_order_id &&
289
+ ifd_open_order_id == o.ifd_open_order_id &&
290
+ ifd_close_limit_price == o.ifd_close_limit_price &&
291
+ ifd_close_stop_price == o.ifd_close_stop_price &&
292
+ position_id == o.position_id &&
293
+ order_expire == o.order_expire &&
294
+ leverage == o.leverage &&
295
+ necessary_margin == o.necessary_margin &&
296
+ created_at == o.created_at &&
297
+ updated_at == o.updated_at
298
+ end
299
+
300
+ # @see the `==` method
301
+ # @param [Object] Object to be compared
302
+ def eql?(o)
303
+ self == o
304
+ end
305
+
306
+ # Calculates hash code according to all attributes.
307
+ # @return [Integer] Hash code
308
+ def hash
309
+ [id, symbol_id, order_behavior, order_side, order_pattern, order_type, price, average_price, amount, remaining_amount, order_status, post_only, oco1_order_id, oco2_order_id, ifd_open_order_id, ifd_close_limit_price, ifd_close_stop_price, position_id, order_expire, leverage, necessary_margin, created_at, updated_at].hash
310
+ end
311
+
312
+ # Builds the object from hash
313
+ # @param [Hash] attributes Model attributes in the form of hash
314
+ # @return [Object] Returns the model itself
315
+ def self.build_from_hash(attributes)
316
+ new.build_from_hash(attributes)
317
+ end
318
+
319
+ # Builds the object from hash
320
+ # @param [Hash] attributes Model attributes in the form of hash
321
+ # @return [Object] Returns the model itself
322
+ def build_from_hash(attributes)
323
+ return nil unless attributes.is_a?(Hash)
324
+ self.class.openapi_types.each_pair do |key, type|
325
+ if type =~ /\AArray<(.*)>/i
326
+ # check to ensure the input is an array given that the attribute
327
+ # is documented as an array but the input is not
328
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
329
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
330
+ end
331
+ elsif !attributes[self.class.attribute_map[key]].nil?
332
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
333
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
334
+ self.send("#{key}=", nil)
335
+ end
336
+ end
337
+
338
+ self
339
+ end
340
+
341
+ # Deserializes the data based on type
342
+ # @param string type Data type
343
+ # @param string value Value to be deserialized
344
+ # @return [Object] Deserialized data
345
+ def _deserialize(type, value)
346
+ case type.to_sym
347
+ when :DateTime
348
+ DateTime.parse(value)
349
+ when :Date
350
+ Date.parse(value)
351
+ when :String
352
+ value.to_s
353
+ when :Integer
354
+ value.to_i
355
+ when :Float
356
+ value.to_f
357
+ when :Boolean
358
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
359
+ true
360
+ else
361
+ false
362
+ end
363
+ when :Object
364
+ # generic object (usually a Hash), return directly
365
+ value
366
+ when /\AArray<(?<inner_type>.+)>\z/
367
+ inner_type = Regexp.last_match[:inner_type]
368
+ value.map { |v| _deserialize(inner_type, v) }
369
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
370
+ k_type = Regexp.last_match[:k_type]
371
+ v_type = Regexp.last_match[:v_type]
372
+ {}.tap do |hash|
373
+ value.each do |k, v|
374
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
375
+ end
376
+ end
377
+ else # model
378
+ RakutenTrading.const_get(type).build_from_hash(value)
379
+ end
380
+ end
381
+
382
+ # Returns the string representation of the object
383
+ # @return [String] String presentation of the object
384
+ def to_s
385
+ to_hash.to_s
386
+ end
387
+
388
+ # to_body is an alias to to_hash (backward compatibility)
389
+ # @return [Hash] Returns the object in the form of hash
390
+ def to_body
391
+ to_hash
392
+ end
393
+
394
+ # Returns the object in the form of hash
395
+ # @return [Hash] Returns the object in the form of hash
396
+ def to_hash
397
+ hash = {}
398
+ self.class.attribute_map.each_pair do |attr, param|
399
+ value = self.send(attr)
400
+ if value.nil?
401
+ is_nullable = self.class.openapi_nullable.include?(attr)
402
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
403
+ end
404
+
405
+ hash[param] = _to_hash(value)
406
+ end
407
+ hash
408
+ end
409
+
410
+ # Outputs non-array value in the form of hash
411
+ # For object, use to_hash. Otherwise, just return the value
412
+ # @param [Object] value Any valid value
413
+ # @return [Hash] Returns the value in the form of hash
414
+ def _to_hash(value)
415
+ if value.is_a?(Array)
416
+ value.compact.map { |v| _to_hash(v) }
417
+ elsif value.is_a?(Hash)
418
+ {}.tap do |hash|
419
+ value.each { |k, v| hash[k] = _to_hash(v) }
420
+ end
421
+ elsif value.respond_to? :to_hash
422
+ value.to_hash
423
+ else
424
+ value
425
+ end
426
+ end end
427
+ end
@@ -0,0 +1,253 @@
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
+ require 'date'
13
+
14
+ module RakutenTrading
15
+ class Trade
16
+ # 約定履歴ID
17
+ attr_accessor :id
18
+
19
+ attr_accessor :order_side
20
+
21
+ attr_accessor :price
22
+
23
+ attr_accessor :amount
24
+
25
+ # 総額。価格 * 数量 * 円換算価格(買いの場合は買い板ベストBid, 売りの場合は売り板ベストAsk)。円換算価格取得不可時はnull
26
+ attr_accessor :asset_amount
27
+
28
+ attr_accessor :traded_at
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'id' => :'id',
34
+ :'order_side' => :'orderSide',
35
+ :'price' => :'price',
36
+ :'amount' => :'amount',
37
+ :'asset_amount' => :'assetAmount',
38
+ :'traded_at' => :'tradedAt'
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'id' => :'Object',
46
+ :'order_side' => :'Object',
47
+ :'price' => :'Object',
48
+ :'amount' => :'Object',
49
+ :'asset_amount' => :'Object',
50
+ :'traded_at' => :'Object'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `RakutenTrading::Trade` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `RakutenTrading::Trade`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'id')
76
+ self.id = attributes[:'id']
77
+ end
78
+
79
+ if attributes.key?(:'order_side')
80
+ self.order_side = attributes[:'order_side']
81
+ end
82
+
83
+ if attributes.key?(:'price')
84
+ self.price = attributes[:'price']
85
+ end
86
+
87
+ if attributes.key?(:'amount')
88
+ self.amount = attributes[:'amount']
89
+ end
90
+
91
+ if attributes.key?(:'asset_amount')
92
+ self.asset_amount = attributes[:'asset_amount']
93
+ end
94
+
95
+ if attributes.key?(:'traded_at')
96
+ self.traded_at = attributes[:'traded_at']
97
+ end
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properties with the reasons
102
+ def list_invalid_properties
103
+ invalid_properties = Array.new
104
+ invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ true
111
+ end
112
+
113
+ # Checks equality by comparing each attribute.
114
+ # @param [Object] Object to be compared
115
+ def ==(o)
116
+ return true if self.equal?(o)
117
+ self.class == o.class &&
118
+ id == o.id &&
119
+ order_side == o.order_side &&
120
+ price == o.price &&
121
+ amount == o.amount &&
122
+ asset_amount == o.asset_amount &&
123
+ traded_at == o.traded_at
124
+ end
125
+
126
+ # @see the `==` method
127
+ # @param [Object] Object to be compared
128
+ def eql?(o)
129
+ self == o
130
+ end
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Integer] Hash code
134
+ def hash
135
+ [id, order_side, price, amount, asset_amount, traded_at].hash
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def self.build_from_hash(attributes)
142
+ new.build_from_hash(attributes)
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ self.class.openapi_types.each_pair do |key, type|
151
+ if type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
155
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
+ end
157
+ elsif !attributes[self.class.attribute_map[key]].nil?
158
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
160
+ self.send("#{key}=", nil)
161
+ end
162
+ end
163
+
164
+ self
165
+ end
166
+
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
171
+ def _deserialize(type, value)
172
+ case type.to_sym
173
+ when :DateTime
174
+ DateTime.parse(value)
175
+ when :Date
176
+ Date.parse(value)
177
+ when :String
178
+ value.to_s
179
+ when :Integer
180
+ value.to_i
181
+ when :Float
182
+ value.to_f
183
+ when :Boolean
184
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
185
+ true
186
+ else
187
+ false
188
+ end
189
+ when :Object
190
+ # generic object (usually a Hash), return directly
191
+ value
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else # model
204
+ RakutenTrading.const_get(type).build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end end
253
+ end
@@ -0,0 +1,14 @@
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
+ VERSION = '1.0.0'
14
+ end