rakuten_trading 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 +455 -0
- data/Rakefile +8 -0
- data/docs/CfdOrderBody.md +9 -0
- data/docs/CfdOrderBody1.md +9 -0
- data/docs/CfdTrade.md +28 -0
- data/docs/InlineResponse200.md +22 -0
- data/docs/InlineResponse2001.md +9 -0
- data/docs/InlineResponse2001Candlesticks.md +12 -0
- data/docs/InlineResponse2002.md +14 -0
- data/docs/InlineResponse2003.md +15 -0
- data/docs/InlineResponse2004.md +9 -0
- data/docs/InlineResponse2005.md +8 -0
- data/docs/InlineResponse2006.md +19 -0
- data/docs/InlineResponse2007.md +18 -0
- data/docs/Order.md +9 -0
- data/docs/OrderData.md +18 -0
- data/docs/OrderDetail.md +33 -0
- data/docs/OrderResponse.md +29 -0
- data/docs/PrivateApi.md +518 -0
- data/docs/PublicApi.md +304 -0
- data/docs/Trade.md +12 -0
- data/git_push.sh +55 -0
- data/lib/rakuten_trading/api/private_api.rb +537 -0
- data/lib/rakuten_trading/api/public_api.rb +315 -0
- data/lib/rakuten_trading/api_client.rb +388 -0
- data/lib/rakuten_trading/api_error.rb +57 -0
- data/lib/rakuten_trading/configuration.rb +212 -0
- data/lib/rakuten_trading/models/cfd_order_body.rb +224 -0
- data/lib/rakuten_trading/models/cfd_order_body_1.rb +224 -0
- data/lib/rakuten_trading/models/cfd_trade.rb +417 -0
- data/lib/rakuten_trading/models/inline_response_200.rb +357 -0
- data/lib/rakuten_trading/models/inline_response_200_1.rb +226 -0
- data/lib/rakuten_trading/models/inline_response_200_1_candlesticks.rb +251 -0
- data/lib/rakuten_trading/models/inline_response_200_2.rb +275 -0
- data/lib/rakuten_trading/models/inline_response_200_3.rb +281 -0
- data/lib/rakuten_trading/models/inline_response_200_4.rb +226 -0
- data/lib/rakuten_trading/models/inline_response_200_5.rb +217 -0
- data/lib/rakuten_trading/models/inline_response_200_6.rb +327 -0
- data/lib/rakuten_trading/models/inline_response_200_7.rb +317 -0
- data/lib/rakuten_trading/models/order.rb +224 -0
- data/lib/rakuten_trading/models/order_data.rb +337 -0
- data/lib/rakuten_trading/models/order_detail.rb +440 -0
- data/lib/rakuten_trading/models/order_response.rb +427 -0
- data/lib/rakuten_trading/models/trade.rb +253 -0
- data/lib/rakuten_trading/version.rb +14 -0
- data/lib/rakuten_trading.rb +57 -0
- data/rakuten_trading.gemspec +38 -0
- data/rakuten_trading_api.yml +1256 -0
- data/spec/api/private_api_spec.rb +151 -0
- data/spec/api/public_api_spec.rb +94 -0
- data/spec/api_client_spec.rb +225 -0
- data/spec/base_object_spec.rb +109 -0
- data/spec/configuration_spec.rb +41 -0
- data/spec/models/cfd_order_body_1_spec.rb +52 -0
- data/spec/models/cfd_order_body_spec.rb +52 -0
- data/spec/models/cfd_trade_spec.rb +166 -0
- data/spec/models/inline_response_200_1_candlesticks_spec.rb +70 -0
- data/spec/models/inline_response_200_1_spec.rb +52 -0
- data/spec/models/inline_response_200_2_spec.rb +82 -0
- data/spec/models/inline_response_200_3_spec.rb +88 -0
- data/spec/models/inline_response_200_4_spec.rb +52 -0
- data/spec/models/inline_response_200_5_spec.rb +46 -0
- data/spec/models/inline_response_200_6_spec.rb +112 -0
- data/spec/models/inline_response_200_7_spec.rb +106 -0
- data/spec/models/inline_response_200_spec.rb +130 -0
- data/spec/models/order_data_spec.rb +106 -0
- data/spec/models/order_detail_spec.rb +196 -0
- data/spec/models/order_response_spec.rb +172 -0
- data/spec/models/order_spec.rb +52 -0
- data/spec/models/trade_spec.rb +70 -0
- data/spec/spec_helper.rb +110 -0
- metadata +201 -0
@@ -0,0 +1,217 @@
|
|
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 InlineResponse2005
|
16
|
+
# 通貨
|
17
|
+
attr_accessor :currency
|
18
|
+
|
19
|
+
# 保有数量
|
20
|
+
attr_accessor :onhand_amount
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'currency' => :'currency',
|
26
|
+
:'onhand_amount' => :'onhandAmount'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.openapi_types
|
32
|
+
{
|
33
|
+
:'currency' => :'Object',
|
34
|
+
:'onhand_amount' => :'Object'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# List of attributes with nullable: true
|
39
|
+
def self.openapi_nullable
|
40
|
+
Set.new([
|
41
|
+
])
|
42
|
+
end
|
43
|
+
|
44
|
+
# Initializes the object
|
45
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
46
|
+
def initialize(attributes = {})
|
47
|
+
if (!attributes.is_a?(Hash))
|
48
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `RakutenTrading::InlineResponse2005` initialize method"
|
49
|
+
end
|
50
|
+
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
53
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
54
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `RakutenTrading::InlineResponse2005`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
55
|
+
end
|
56
|
+
h[k.to_sym] = v
|
57
|
+
}
|
58
|
+
|
59
|
+
if attributes.key?(:'currency')
|
60
|
+
self.currency = attributes[:'currency']
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes.key?(:'onhand_amount')
|
64
|
+
self.onhand_amount = attributes[:'onhand_amount']
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
69
|
+
# @return Array for valid properties with the reasons
|
70
|
+
def list_invalid_properties
|
71
|
+
invalid_properties = Array.new
|
72
|
+
invalid_properties
|
73
|
+
end
|
74
|
+
|
75
|
+
# Check to see if the all the properties in the model are valid
|
76
|
+
# @return true if the model is valid
|
77
|
+
def valid?
|
78
|
+
true
|
79
|
+
end
|
80
|
+
|
81
|
+
# Checks equality by comparing each attribute.
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def ==(o)
|
84
|
+
return true if self.equal?(o)
|
85
|
+
self.class == o.class &&
|
86
|
+
currency == o.currency &&
|
87
|
+
onhand_amount == o.onhand_amount
|
88
|
+
end
|
89
|
+
|
90
|
+
# @see the `==` method
|
91
|
+
# @param [Object] Object to be compared
|
92
|
+
def eql?(o)
|
93
|
+
self == o
|
94
|
+
end
|
95
|
+
|
96
|
+
# Calculates hash code according to all attributes.
|
97
|
+
# @return [Integer] Hash code
|
98
|
+
def hash
|
99
|
+
[currency, onhand_amount].hash
|
100
|
+
end
|
101
|
+
|
102
|
+
# Builds the object from hash
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
104
|
+
# @return [Object] Returns the model itself
|
105
|
+
def self.build_from_hash(attributes)
|
106
|
+
new.build_from_hash(attributes)
|
107
|
+
end
|
108
|
+
|
109
|
+
# Builds the object from hash
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
111
|
+
# @return [Object] Returns the model itself
|
112
|
+
def build_from_hash(attributes)
|
113
|
+
return nil unless attributes.is_a?(Hash)
|
114
|
+
self.class.openapi_types.each_pair do |key, type|
|
115
|
+
if type =~ /\AArray<(.*)>/i
|
116
|
+
# check to ensure the input is an array given that the attribute
|
117
|
+
# is documented as an array but the input is not
|
118
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
119
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
120
|
+
end
|
121
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
122
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
123
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
124
|
+
self.send("#{key}=", nil)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
self
|
129
|
+
end
|
130
|
+
|
131
|
+
# Deserializes the data based on type
|
132
|
+
# @param string type Data type
|
133
|
+
# @param string value Value to be deserialized
|
134
|
+
# @return [Object] Deserialized data
|
135
|
+
def _deserialize(type, value)
|
136
|
+
case type.to_sym
|
137
|
+
when :DateTime
|
138
|
+
DateTime.parse(value)
|
139
|
+
when :Date
|
140
|
+
Date.parse(value)
|
141
|
+
when :String
|
142
|
+
value.to_s
|
143
|
+
when :Integer
|
144
|
+
value.to_i
|
145
|
+
when :Float
|
146
|
+
value.to_f
|
147
|
+
when :Boolean
|
148
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
149
|
+
true
|
150
|
+
else
|
151
|
+
false
|
152
|
+
end
|
153
|
+
when :Object
|
154
|
+
# generic object (usually a Hash), return directly
|
155
|
+
value
|
156
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
157
|
+
inner_type = Regexp.last_match[:inner_type]
|
158
|
+
value.map { |v| _deserialize(inner_type, v) }
|
159
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
160
|
+
k_type = Regexp.last_match[:k_type]
|
161
|
+
v_type = Regexp.last_match[:v_type]
|
162
|
+
{}.tap do |hash|
|
163
|
+
value.each do |k, v|
|
164
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
else # model
|
168
|
+
RakutenTrading.const_get(type).build_from_hash(value)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# Returns the string representation of the object
|
173
|
+
# @return [String] String presentation of the object
|
174
|
+
def to_s
|
175
|
+
to_hash.to_s
|
176
|
+
end
|
177
|
+
|
178
|
+
# to_body is an alias to to_hash (backward compatibility)
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_body
|
181
|
+
to_hash
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the object in the form of hash
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_hash
|
187
|
+
hash = {}
|
188
|
+
self.class.attribute_map.each_pair do |attr, param|
|
189
|
+
value = self.send(attr)
|
190
|
+
if value.nil?
|
191
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
192
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
193
|
+
end
|
194
|
+
|
195
|
+
hash[param] = _to_hash(value)
|
196
|
+
end
|
197
|
+
hash
|
198
|
+
end
|
199
|
+
|
200
|
+
# Outputs non-array value in the form of hash
|
201
|
+
# For object, use to_hash. Otherwise, just return the value
|
202
|
+
# @param [Object] value Any valid value
|
203
|
+
# @return [Hash] Returns the value in the form of hash
|
204
|
+
def _to_hash(value)
|
205
|
+
if value.is_a?(Array)
|
206
|
+
value.compact.map { |v| _to_hash(v) }
|
207
|
+
elsif value.is_a?(Hash)
|
208
|
+
{}.tap do |hash|
|
209
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
210
|
+
end
|
211
|
+
elsif value.respond_to? :to_hash
|
212
|
+
value.to_hash
|
213
|
+
else
|
214
|
+
value
|
215
|
+
end
|
216
|
+
end end
|
217
|
+
end
|
@@ -0,0 +1,327 @@
|
|
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 InlineResponse2006
|
16
|
+
# 建玉評価損益
|
17
|
+
attr_accessor :floating_profit
|
18
|
+
|
19
|
+
# 建玉管理料
|
20
|
+
attr_accessor :floating_position_fee
|
21
|
+
|
22
|
+
# 建玉管理料(未実現)
|
23
|
+
attr_accessor :remaining_floating_position_fee
|
24
|
+
|
25
|
+
# 想定約定手数料
|
26
|
+
attr_accessor :floating_trade_fee
|
27
|
+
|
28
|
+
# 総評価損益(建玉評価損益 - 建玉管理料(未実現) - 想定約定手数料)
|
29
|
+
attr_accessor :floating_profit_all
|
30
|
+
|
31
|
+
# 必要証拠金
|
32
|
+
attr_accessor :used_margin
|
33
|
+
|
34
|
+
# 注文中証拠金
|
35
|
+
attr_accessor :necessary_margin
|
36
|
+
|
37
|
+
# 証拠金残高
|
38
|
+
attr_accessor :balance
|
39
|
+
|
40
|
+
# 純資産額
|
41
|
+
attr_accessor :equity
|
42
|
+
|
43
|
+
# 証拠金維持率%
|
44
|
+
attr_accessor :margin_maintenance_percent
|
45
|
+
|
46
|
+
# 建玉可能額
|
47
|
+
attr_accessor :usable_amount
|
48
|
+
|
49
|
+
# 出金可能額
|
50
|
+
attr_accessor :withdrawable_amount
|
51
|
+
|
52
|
+
# 出金依頼中金額
|
53
|
+
attr_accessor :withdrawal_amount_reserved
|
54
|
+
|
55
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
56
|
+
def self.attribute_map
|
57
|
+
{
|
58
|
+
:'floating_profit' => :'floatingProfit',
|
59
|
+
:'floating_position_fee' => :'floatingPositionFee',
|
60
|
+
:'remaining_floating_position_fee' => :'remainingFloatingPositionFee',
|
61
|
+
:'floating_trade_fee' => :'floatingTradeFee',
|
62
|
+
:'floating_profit_all' => :'floatingProfitAll',
|
63
|
+
:'used_margin' => :'usedMargin',
|
64
|
+
:'necessary_margin' => :'necessaryMargin',
|
65
|
+
:'balance' => :'balance',
|
66
|
+
:'equity' => :'equity',
|
67
|
+
:'margin_maintenance_percent' => :'marginMaintenancePercent',
|
68
|
+
:'usable_amount' => :'usableAmount',
|
69
|
+
:'withdrawable_amount' => :'withdrawableAmount',
|
70
|
+
:'withdrawal_amount_reserved' => :'withdrawalAmountReserved'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
# Attribute type mapping.
|
75
|
+
def self.openapi_types
|
76
|
+
{
|
77
|
+
:'floating_profit' => :'Object',
|
78
|
+
:'floating_position_fee' => :'Object',
|
79
|
+
:'remaining_floating_position_fee' => :'Object',
|
80
|
+
:'floating_trade_fee' => :'Object',
|
81
|
+
:'floating_profit_all' => :'Object',
|
82
|
+
:'used_margin' => :'Object',
|
83
|
+
:'necessary_margin' => :'Object',
|
84
|
+
:'balance' => :'Object',
|
85
|
+
:'equity' => :'Object',
|
86
|
+
:'margin_maintenance_percent' => :'Object',
|
87
|
+
:'usable_amount' => :'Object',
|
88
|
+
:'withdrawable_amount' => :'Object',
|
89
|
+
:'withdrawal_amount_reserved' => :'Object'
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
# List of attributes with nullable: true
|
94
|
+
def self.openapi_nullable
|
95
|
+
Set.new([
|
96
|
+
])
|
97
|
+
end
|
98
|
+
|
99
|
+
# Initializes the object
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
101
|
+
def initialize(attributes = {})
|
102
|
+
if (!attributes.is_a?(Hash))
|
103
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `RakutenTrading::InlineResponse2006` initialize method"
|
104
|
+
end
|
105
|
+
|
106
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
107
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
108
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
109
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `RakutenTrading::InlineResponse2006`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
110
|
+
end
|
111
|
+
h[k.to_sym] = v
|
112
|
+
}
|
113
|
+
|
114
|
+
if attributes.key?(:'floating_profit')
|
115
|
+
self.floating_profit = attributes[:'floating_profit']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'floating_position_fee')
|
119
|
+
self.floating_position_fee = attributes[:'floating_position_fee']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:'remaining_floating_position_fee')
|
123
|
+
self.remaining_floating_position_fee = attributes[:'remaining_floating_position_fee']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'floating_trade_fee')
|
127
|
+
self.floating_trade_fee = attributes[:'floating_trade_fee']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'floating_profit_all')
|
131
|
+
self.floating_profit_all = attributes[:'floating_profit_all']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.key?(:'used_margin')
|
135
|
+
self.used_margin = attributes[:'used_margin']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.key?(:'necessary_margin')
|
139
|
+
self.necessary_margin = attributes[:'necessary_margin']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.key?(:'balance')
|
143
|
+
self.balance = attributes[:'balance']
|
144
|
+
end
|
145
|
+
|
146
|
+
if attributes.key?(:'equity')
|
147
|
+
self.equity = attributes[:'equity']
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes.key?(:'margin_maintenance_percent')
|
151
|
+
self.margin_maintenance_percent = attributes[:'margin_maintenance_percent']
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.key?(:'usable_amount')
|
155
|
+
self.usable_amount = attributes[:'usable_amount']
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes.key?(:'withdrawable_amount')
|
159
|
+
self.withdrawable_amount = attributes[:'withdrawable_amount']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.key?(:'withdrawal_amount_reserved')
|
163
|
+
self.withdrawal_amount_reserved = attributes[:'withdrawal_amount_reserved']
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
168
|
+
# @return Array for valid properties with the reasons
|
169
|
+
def list_invalid_properties
|
170
|
+
invalid_properties = Array.new
|
171
|
+
invalid_properties
|
172
|
+
end
|
173
|
+
|
174
|
+
# Check to see if the all the properties in the model are valid
|
175
|
+
# @return true if the model is valid
|
176
|
+
def valid?
|
177
|
+
true
|
178
|
+
end
|
179
|
+
|
180
|
+
# Checks equality by comparing each attribute.
|
181
|
+
# @param [Object] Object to be compared
|
182
|
+
def ==(o)
|
183
|
+
return true if self.equal?(o)
|
184
|
+
self.class == o.class &&
|
185
|
+
floating_profit == o.floating_profit &&
|
186
|
+
floating_position_fee == o.floating_position_fee &&
|
187
|
+
remaining_floating_position_fee == o.remaining_floating_position_fee &&
|
188
|
+
floating_trade_fee == o.floating_trade_fee &&
|
189
|
+
floating_profit_all == o.floating_profit_all &&
|
190
|
+
used_margin == o.used_margin &&
|
191
|
+
necessary_margin == o.necessary_margin &&
|
192
|
+
balance == o.balance &&
|
193
|
+
equity == o.equity &&
|
194
|
+
margin_maintenance_percent == o.margin_maintenance_percent &&
|
195
|
+
usable_amount == o.usable_amount &&
|
196
|
+
withdrawable_amount == o.withdrawable_amount &&
|
197
|
+
withdrawal_amount_reserved == o.withdrawal_amount_reserved
|
198
|
+
end
|
199
|
+
|
200
|
+
# @see the `==` method
|
201
|
+
# @param [Object] Object to be compared
|
202
|
+
def eql?(o)
|
203
|
+
self == o
|
204
|
+
end
|
205
|
+
|
206
|
+
# Calculates hash code according to all attributes.
|
207
|
+
# @return [Integer] Hash code
|
208
|
+
def hash
|
209
|
+
[floating_profit, floating_position_fee, remaining_floating_position_fee, floating_trade_fee, floating_profit_all, used_margin, necessary_margin, balance, equity, margin_maintenance_percent, usable_amount, withdrawable_amount, withdrawal_amount_reserved].hash
|
210
|
+
end
|
211
|
+
|
212
|
+
# Builds the object from hash
|
213
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
214
|
+
# @return [Object] Returns the model itself
|
215
|
+
def self.build_from_hash(attributes)
|
216
|
+
new.build_from_hash(attributes)
|
217
|
+
end
|
218
|
+
|
219
|
+
# Builds the object from hash
|
220
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
221
|
+
# @return [Object] Returns the model itself
|
222
|
+
def build_from_hash(attributes)
|
223
|
+
return nil unless attributes.is_a?(Hash)
|
224
|
+
self.class.openapi_types.each_pair do |key, type|
|
225
|
+
if type =~ /\AArray<(.*)>/i
|
226
|
+
# check to ensure the input is an array given that the attribute
|
227
|
+
# is documented as an array but the input is not
|
228
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
229
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
230
|
+
end
|
231
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
232
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
233
|
+
elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
234
|
+
self.send("#{key}=", nil)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
self
|
239
|
+
end
|
240
|
+
|
241
|
+
# Deserializes the data based on type
|
242
|
+
# @param string type Data type
|
243
|
+
# @param string value Value to be deserialized
|
244
|
+
# @return [Object] Deserialized data
|
245
|
+
def _deserialize(type, value)
|
246
|
+
case type.to_sym
|
247
|
+
when :DateTime
|
248
|
+
DateTime.parse(value)
|
249
|
+
when :Date
|
250
|
+
Date.parse(value)
|
251
|
+
when :String
|
252
|
+
value.to_s
|
253
|
+
when :Integer
|
254
|
+
value.to_i
|
255
|
+
when :Float
|
256
|
+
value.to_f
|
257
|
+
when :Boolean
|
258
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
259
|
+
true
|
260
|
+
else
|
261
|
+
false
|
262
|
+
end
|
263
|
+
when :Object
|
264
|
+
# generic object (usually a Hash), return directly
|
265
|
+
value
|
266
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
267
|
+
inner_type = Regexp.last_match[:inner_type]
|
268
|
+
value.map { |v| _deserialize(inner_type, v) }
|
269
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
270
|
+
k_type = Regexp.last_match[:k_type]
|
271
|
+
v_type = Regexp.last_match[:v_type]
|
272
|
+
{}.tap do |hash|
|
273
|
+
value.each do |k, v|
|
274
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
else # model
|
278
|
+
RakutenTrading.const_get(type).build_from_hash(value)
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
# Returns the string representation of the object
|
283
|
+
# @return [String] String presentation of the object
|
284
|
+
def to_s
|
285
|
+
to_hash.to_s
|
286
|
+
end
|
287
|
+
|
288
|
+
# to_body is an alias to to_hash (backward compatibility)
|
289
|
+
# @return [Hash] Returns the object in the form of hash
|
290
|
+
def to_body
|
291
|
+
to_hash
|
292
|
+
end
|
293
|
+
|
294
|
+
# Returns the object in the form of hash
|
295
|
+
# @return [Hash] Returns the object in the form of hash
|
296
|
+
def to_hash
|
297
|
+
hash = {}
|
298
|
+
self.class.attribute_map.each_pair do |attr, param|
|
299
|
+
value = self.send(attr)
|
300
|
+
if value.nil?
|
301
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
302
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
303
|
+
end
|
304
|
+
|
305
|
+
hash[param] = _to_hash(value)
|
306
|
+
end
|
307
|
+
hash
|
308
|
+
end
|
309
|
+
|
310
|
+
# Outputs non-array value in the form of hash
|
311
|
+
# For object, use to_hash. Otherwise, just return the value
|
312
|
+
# @param [Object] value Any valid value
|
313
|
+
# @return [Hash] Returns the value in the form of hash
|
314
|
+
def _to_hash(value)
|
315
|
+
if value.is_a?(Array)
|
316
|
+
value.compact.map { |v| _to_hash(v) }
|
317
|
+
elsif value.is_a?(Hash)
|
318
|
+
{}.tap do |hash|
|
319
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
320
|
+
end
|
321
|
+
elsif value.respond_to? :to_hash
|
322
|
+
value.to_hash
|
323
|
+
else
|
324
|
+
value
|
325
|
+
end
|
326
|
+
end end
|
327
|
+
end
|