Class: RakutenTrading::OrderData
- Inherits:
-
Object
- Object
- RakutenTrading::OrderData
- Defined in:
- lib/rakuten_trading/models/order_data.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
注文数量.
-
#close_behavior ⇒ Object
建玉決済の挙動(CROSS, FIFO).
-
#ifd_close_limit_price ⇒ Object
IFD決済指値注文価格.
-
#ifd_close_stop_price ⇒ Object
IFD決済逆指値注文価格.
-
#leverage ⇒ Object
レバレッジ倍率。新規注文の場合のみ。.
-
#order_behavior ⇒ Object
注文の種類(新規または決済).
-
#order_expire ⇒ Object
注文有効期限(GTC, DAY).
-
#order_side ⇒ Object
売買方向(BUYまたはSELL).
-
#order_type ⇒ Object
注文タイプ(LIMIT, MARKET, STOP).
-
#position_id ⇒ Object
決済対象の建玉ID。決済注文の場合必須。.
-
#post_only ⇒ Object
メイカー注文のみ許可するかどうか.
-
#price ⇒ Object
注文価格。指値注文や逆指値注文の場合必須。.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ OrderData
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ OrderData
Initializes the object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/rakuten_trading/models/order_data.rb', line 96 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `RakutenTrading::OrderData` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `RakutenTrading::OrderData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'order_behavior') self.order_behavior = attributes[:'order_behavior'] end if attributes.key?(:'position_id') self.position_id = attributes[:'position_id'] end if attributes.key?(:'order_side') self.order_side = attributes[:'order_side'] end if attributes.key?(:'order_type') self.order_type = attributes[:'order_type'] end if attributes.key?(:'price') self.price = attributes[:'price'] end if attributes.key?(:'amount') self.amount = attributes[:'amount'] end if attributes.key?(:'order_expire') self.order_expire = attributes[:'order_expire'] end if attributes.key?(:'leverage') self.leverage = attributes[:'leverage'] end if attributes.key?(:'close_behavior') self.close_behavior = attributes[:'close_behavior'] end if attributes.key?(:'post_only') self.post_only = attributes[:'post_only'] end if attributes.key?(:'ifd_close_limit_price') self.ifd_close_limit_price = attributes[:'ifd_close_limit_price'] end if attributes.key?(:'ifd_close_stop_price') self.ifd_close_stop_price = attributes[:'ifd_close_stop_price'] end end |
Instance Attribute Details
#amount ⇒ Object
注文数量
32 33 34 |
# File 'lib/rakuten_trading/models/order_data.rb', line 32 def amount @amount end |
#close_behavior ⇒ Object
建玉決済の挙動(CROSS, FIFO)
41 42 43 |
# File 'lib/rakuten_trading/models/order_data.rb', line 41 def close_behavior @close_behavior end |
#ifd_close_limit_price ⇒ Object
IFD決済指値注文価格
47 48 49 |
# File 'lib/rakuten_trading/models/order_data.rb', line 47 def ifd_close_limit_price @ifd_close_limit_price end |
#ifd_close_stop_price ⇒ Object
IFD決済逆指値注文価格
50 51 52 |
# File 'lib/rakuten_trading/models/order_data.rb', line 50 def ifd_close_stop_price @ifd_close_stop_price end |
#leverage ⇒ Object
レバレッジ倍率。新規注文の場合のみ。
38 39 40 |
# File 'lib/rakuten_trading/models/order_data.rb', line 38 def leverage @leverage end |
#order_behavior ⇒ Object
注文の種類(新規または決済)
17 18 19 |
# File 'lib/rakuten_trading/models/order_data.rb', line 17 def order_behavior @order_behavior end |
#order_expire ⇒ Object
注文有効期限(GTC, DAY)
35 36 37 |
# File 'lib/rakuten_trading/models/order_data.rb', line 35 def order_expire @order_expire end |
#order_side ⇒ Object
売買方向(BUYまたはSELL)
23 24 25 |
# File 'lib/rakuten_trading/models/order_data.rb', line 23 def order_side @order_side end |
#order_type ⇒ Object
注文タイプ(LIMIT, MARKET, STOP)
26 27 28 |
# File 'lib/rakuten_trading/models/order_data.rb', line 26 def order_type @order_type end |
#position_id ⇒ Object
決済対象の建玉ID。決済注文の場合必須。
20 21 22 |
# File 'lib/rakuten_trading/models/order_data.rb', line 20 def position_id @position_id end |
#post_only ⇒ Object
メイカー注文のみ許可するかどうか
44 45 46 |
# File 'lib/rakuten_trading/models/order_data.rb', line 44 def post_only @post_only end |
#price ⇒ Object
注文価格。指値注文や逆指値注文の場合必須。
29 30 31 |
# File 'lib/rakuten_trading/models/order_data.rb', line 29 def price @price end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rakuten_trading/models/order_data.rb', line 53 def self.attribute_map { :'order_behavior' => :'orderBehavior', :'position_id' => :'positionId', :'order_side' => :'orderSide', :'order_type' => :'orderType', :'price' => :'price', :'amount' => :'amount', :'order_expire' => :'orderExpire', :'leverage' => :'leverage', :'close_behavior' => :'closeBehavior', :'post_only' => :'postOnly', :'ifd_close_limit_price' => :'ifdCloseLimitPrice', :'ifd_close_stop_price' => :'ifdCloseStopPrice' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
225 226 227 |
# File 'lib/rakuten_trading/models/order_data.rb', line 225 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
89 90 91 92 |
# File 'lib/rakuten_trading/models/order_data.rb', line 89 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/rakuten_trading/models/order_data.rb', line 71 def self.openapi_types { :'order_behavior' => :'Object', :'position_id' => :'Object', :'order_side' => :'Object', :'order_type' => :'Object', :'price' => :'Object', :'amount' => :'Object', :'order_expire' => :'Object', :'leverage' => :'Object', :'close_behavior' => :'Object', :'post_only' => :'Object', :'ifd_close_limit_price' => :'Object', :'ifd_close_stop_price' => :'Object' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/rakuten_trading/models/order_data.rb', line 193 def ==(o) return true if self.equal?(o) self.class == o.class && order_behavior == o.order_behavior && position_id == o.position_id && order_side == o.order_side && order_type == o.order_type && price == o.price && amount == o.amount && order_expire == o.order_expire && leverage == o.leverage && close_behavior == o.close_behavior && post_only == o.post_only && ifd_close_limit_price == o.ifd_close_limit_price && ifd_close_stop_price == o.ifd_close_stop_price end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/rakuten_trading/models/order_data.rb', line 255 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model RakutenTrading.const_get(type).build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/rakuten_trading/models/order_data.rb', line 324 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/rakuten_trading/models/order_data.rb', line 232 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) end end self end |
#eql?(o) ⇒ Boolean
212 213 214 |
# File 'lib/rakuten_trading/models/order_data.rb', line 212 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
218 219 220 |
# File 'lib/rakuten_trading/models/order_data.rb', line 218 def hash [order_behavior, position_id, order_side, order_type, price, amount, order_expire, leverage, close_behavior, post_only, ifd_close_limit_price, ifd_close_stop_price].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/rakuten_trading/models/order_data.rb', line 160 def list_invalid_properties invalid_properties = Array.new if @order_behavior.nil? invalid_properties.push('invalid value for "order_behavior", order_behavior cannot be nil.') end if @order_side.nil? invalid_properties.push('invalid value for "order_side", order_side cannot be nil.') end if @order_type.nil? invalid_properties.push('invalid value for "order_type", order_type cannot be nil.') end if @amount.nil? invalid_properties.push('invalid value for "amount", amount cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
300 301 302 |
# File 'lib/rakuten_trading/models/order_data.rb', line 300 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/rakuten_trading/models/order_data.rb', line 306 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
294 295 296 |
# File 'lib/rakuten_trading/models/order_data.rb', line 294 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
183 184 185 186 187 188 189 |
# File 'lib/rakuten_trading/models/order_data.rb', line 183 def valid? return false if @order_behavior.nil? return false if @order_side.nil? return false if @order_type.nil? return false if @amount.nil? true end |