Class: KabustationClient::PositionsSuccess

Inherits:
Object
  • Object
show all
Defined in:
lib/kabustation_client/models/positions_success.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PositionsSuccess

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/kabustation_client/models/positions_success.rb', line 148

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `KabustationClient::PositionsSuccess` 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 `KabustationClient::PositionsSuccess`. 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?(:'execution_id')
    self.execution_id = attributes[:'execution_id']
  end

  if attributes.key?(:'account_type')
    self. = attributes[:'account_type']
  end

  if attributes.key?(:'symbol')
    self.symbol = attributes[:'symbol']
  end

  if attributes.key?(:'symbol_name')
    self.symbol_name = attributes[:'symbol_name']
  end

  if attributes.key?(:'exchange')
    self.exchange = attributes[:'exchange']
  end

  if attributes.key?(:'exchange_name')
    self.exchange_name = attributes[:'exchange_name']
  end

  if attributes.key?(:'security_type')
    self.security_type = attributes[:'security_type']
  end

  if attributes.key?(:'execution_day')
    self.execution_day = attributes[:'execution_day']
  end

  if attributes.key?(:'price')
    self.price = attributes[:'price']
  end

  if attributes.key?(:'leaves_qty')
    self.leaves_qty = attributes[:'leaves_qty']
  end

  if attributes.key?(:'hold_qty')
    self.hold_qty = attributes[:'hold_qty']
  end

  if attributes.key?(:'side')
    self.side = attributes[:'side']
  end

  if attributes.key?(:'expenses')
    self.expenses = attributes[:'expenses']
  end

  if attributes.key?(:'commission')
    self.commission = attributes[:'commission']
  end

  if attributes.key?(:'commission_tax')
    self.commission_tax = attributes[:'commission_tax']
  end

  if attributes.key?(:'expire_day')
    self.expire_day = attributes[:'expire_day']
  end

  if attributes.key?(:'margin_trade_type')
    self.margin_trade_type = attributes[:'margin_trade_type']
  end

  if attributes.key?(:'current_price')
    self.current_price = attributes[:'current_price']
  end

  if attributes.key?(:'valuation')
    self.valuation = attributes[:'valuation']
  end

  if attributes.key?(:'profit_loss')
    self.profit_loss = attributes[:'profit_loss']
  end

  if attributes.key?(:'profit_loss_rate')
    self.profit_loss_rate = attributes[:'profit_loss_rate']
  end
end

Instance Attribute Details

#account_typeObject

口座種別 <table> <thead> <tr> <th>定義値</th> <th>説明</th> </tr> </thead> <tbody> <tr> <td>2</td> <td>一般</td> </tr> <tr> <td>4</td> <td>特定</td> </tr> <tr> <td>12</td> <td>法人</td> </tr> </tbody> </table>



22
23
24
# File 'lib/kabustation_client/models/positions_success.rb', line 22

def 
  @account_type
end

#commissionObject

手数料
※信用・先物・オプションの場合のみ



58
59
60
# File 'lib/kabustation_client/models/positions_success.rb', line 58

def commission
  @commission
end

#commission_taxObject

手数料消費税
※信用・先物・オプションの場合のみ



61
62
63
# File 'lib/kabustation_client/models/positions_success.rb', line 61

def commission_tax
  @commission_tax
end

#current_priceObject

現在値
追加情報出力フラグ:falseの場合、null



70
71
72
# File 'lib/kabustation_client/models/positions_success.rb', line 70

def current_price
  @current_price
end

#exchangeObject

市場コード <table> <thead> <tr> <th>定義値</th> <th>説明</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>東証</td> </tr> <tr> <td>3</td> <td>名証</td> </tr> <tr> <td>5</td> <td>福証</td> </tr> <tr> <td>6</td> <td>札証</td> </tr> <tr> <td>2</td> <td>日通し</td> </tr> <tr> <td>23</td> <td>日中</td> </tr> <tr> <td>24</td> <td>夜間</td> </tr> </tbody> </table>



31
32
33
# File 'lib/kabustation_client/models/positions_success.rb', line 31

def exchange
  @exchange
end

#exchange_nameObject

市場名



34
35
36
# File 'lib/kabustation_client/models/positions_success.rb', line 34

def exchange_name
  @exchange_name
end

#execution_dayObject

約定日(建玉日)
※信用・先物・オプションの場合のみ
※現物取引では、nullが返ります。



40
41
42
# File 'lib/kabustation_client/models/positions_success.rb', line 40

def execution_day
  @execution_day
end

#execution_idObject

約定番号
※現物取引では、nullが返ります。



19
20
21
# File 'lib/kabustation_client/models/positions_success.rb', line 19

def execution_id
  @execution_id
end

#expensesObject

諸経費
※信用・先物・オプションの場合のみ



55
56
57
# File 'lib/kabustation_client/models/positions_success.rb', line 55

def expenses
  @expenses
end

#expire_dayObject

返済期日
※信用・先物・オプションの場合のみ



64
65
66
# File 'lib/kabustation_client/models/positions_success.rb', line 64

def expire_day
  @expire_day
end

#hold_qtyObject

拘束数量(返済のために拘束されている数量)



49
50
51
# File 'lib/kabustation_client/models/positions_success.rb', line 49

def hold_qty
  @hold_qty
end

#leaves_qtyObject

残数量(保有数量)



46
47
48
# File 'lib/kabustation_client/models/positions_success.rb', line 46

def leaves_qty
  @leaves_qty
end

#margin_trade_typeObject

信用取引区分
※信用の場合のみ <table> <thead> <tr> <th>定義値</th> <th>説明</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>制度信用</td> </tr> <tr> <td>2</td> <td>一般信用(長期)</td> </tr> <tr> <td>3</td> <td>一般信用(デイトレ)</td> </tr> </tbody> </table>



67
68
69
# File 'lib/kabustation_client/models/positions_success.rb', line 67

def margin_trade_type
  @margin_trade_type
end

#priceObject

値段



43
44
45
# File 'lib/kabustation_client/models/positions_success.rb', line 43

def price
  @price
end

#profit_lossObject

評価損益額
追加情報出力フラグ:falseの場合、null



76
77
78
# File 'lib/kabustation_client/models/positions_success.rb', line 76

def profit_loss
  @profit_loss
end

#profit_loss_rateObject

評価損益率
追加情報出力フラグ:falseの場合、null



79
80
81
# File 'lib/kabustation_client/models/positions_success.rb', line 79

def profit_loss_rate
  @profit_loss_rate
end

#security_typeObject

銘柄種別
※先物・オプション銘柄の場合のみ



37
38
39
# File 'lib/kabustation_client/models/positions_success.rb', line 37

def security_type
  @security_type
end

#sideObject

売買区分 <table> <thead> <tr> <th>定義値</th> <th>説明</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>売</td> </tr> <tr> <td>2</td> <td>買</td> </tr> </tbody> </table>



52
53
54
# File 'lib/kabustation_client/models/positions_success.rb', line 52

def side
  @side
end

#symbolObject

銘柄コード



25
26
27
# File 'lib/kabustation_client/models/positions_success.rb', line 25

def symbol
  @symbol
end

#symbol_nameObject

銘柄名



28
29
30
# File 'lib/kabustation_client/models/positions_success.rb', line 28

def symbol_name
  @symbol_name
end

#valuationObject

評価金額
追加情報出力フラグ:falseの場合、null



73
74
75
# File 'lib/kabustation_client/models/positions_success.rb', line 73

def valuation
  @valuation
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/kabustation_client/models/positions_success.rb', line 328

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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
    # models (e.g. Pet) or oneOf
    klass = KabustationClient.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



109
110
111
# File 'lib/kabustation_client/models/positions_success.rb', line 109

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/kabustation_client/models/positions_success.rb', line 82

def self.attribute_map
  {
    :'execution_id' => :'ExecutionID',
    :'account_type' => :'AccountType',
    :'symbol' => :'Symbol',
    :'symbol_name' => :'SymbolName',
    :'exchange' => :'Exchange',
    :'exchange_name' => :'ExchangeName',
    :'security_type' => :'SecurityType',
    :'execution_day' => :'ExecutionDay',
    :'price' => :'Price',
    :'leaves_qty' => :'LeavesQty',
    :'hold_qty' => :'HoldQty',
    :'side' => :'Side',
    :'expenses' => :'Expenses',
    :'commission' => :'Commission',
    :'commission_tax' => :'CommissionTax',
    :'expire_day' => :'ExpireDay',
    :'margin_trade_type' => :'MarginTradeType',
    :'current_price' => :'CurrentPrice',
    :'valuation' => :'Valuation',
    :'profit_loss' => :'ProfitLoss',
    :'profit_loss_rate' => :'ProfitLossRate'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/kabustation_client/models/positions_success.rb', line 304

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif 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[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



141
142
143
144
# File 'lib/kabustation_client/models/positions_success.rb', line 141

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/kabustation_client/models/positions_success.rb', line 114

def self.openapi_types
  {
    :'execution_id' => :'String',
    :'account_type' => :'Integer',
    :'symbol' => :'String',
    :'symbol_name' => :'String',
    :'exchange' => :'Integer',
    :'exchange_name' => :'String',
    :'security_type' => :'Integer',
    :'execution_day' => :'Integer',
    :'price' => :'Float',
    :'leaves_qty' => :'Float',
    :'hold_qty' => :'Float',
    :'side' => :'String',
    :'expenses' => :'Float',
    :'commission' => :'Float',
    :'commission_tax' => :'Float',
    :'expire_day' => :'Integer',
    :'margin_trade_type' => :'Integer',
    :'current_price' => :'Float',
    :'valuation' => :'Float',
    :'profit_loss' => :'Float',
    :'profit_loss_rate' => :'Float'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/kabustation_client/models/positions_success.rb', line 263

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      execution_id == o.execution_id &&
       == o. &&
      symbol == o.symbol &&
      symbol_name == o.symbol_name &&
      exchange == o.exchange &&
      exchange_name == o.exchange_name &&
      security_type == o.security_type &&
      execution_day == o.execution_day &&
      price == o.price &&
      leaves_qty == o.leaves_qty &&
      hold_qty == o.hold_qty &&
      side == o.side &&
      expenses == o.expenses &&
      commission == o.commission &&
      commission_tax == o.commission_tax &&
      expire_day == o.expire_day &&
      margin_trade_type == o.margin_trade_type &&
      current_price == o.current_price &&
      valuation == o.valuation &&
      profit_loss == o.profit_loss &&
      profit_loss_rate == o.profit_loss_rate
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/kabustation_client/models/positions_success.rb', line 399

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


291
292
293
# File 'lib/kabustation_client/models/positions_success.rb', line 291

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



297
298
299
# File 'lib/kabustation_client/models/positions_success.rb', line 297

def hash
  [execution_id, , symbol, symbol_name, exchange, exchange_name, security_type, execution_day, price, leaves_qty, hold_qty, side, expenses, commission, commission_tax, expire_day, margin_trade_type, current_price, valuation, profit_loss, profit_loss_rate].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



248
249
250
251
252
# File 'lib/kabustation_client/models/positions_success.rb', line 248

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



375
376
377
# File 'lib/kabustation_client/models/positions_success.rb', line 375

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/kabustation_client/models/positions_success.rb', line 381

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



369
370
371
# File 'lib/kabustation_client/models/positions_success.rb', line 369

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



256
257
258
259
# File 'lib/kabustation_client/models/positions_success.rb', line 256

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end