Class: FdxV660Api::OpenOrderEntity

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/open_order_entity.rb

Overview

An open investment transaction order

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(order_id: SKIP, security_id: SKIP, security_id_type: SKIP, symbol: SKIP, description: SKIP, units: SKIP, order_type: SKIP, order_date: SKIP, unit_price: SKIP, unit_type: SKIP, order_duration: SKIP, sub_account: SKIP, limit_price: SKIP, stop_price: SKIP, inv401k_source: SKIP, additional_properties: nil) ⇒ OpenOrderEntity

Returns a new instance of OpenOrderEntity.



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
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 122

def initialize(order_id: SKIP, security_id: SKIP, security_id_type: SKIP,
               symbol: SKIP, description: SKIP, units: SKIP,
               order_type: SKIP, order_date: SKIP, unit_price: SKIP,
               unit_type: SKIP, order_duration: SKIP, sub_account: SKIP,
               limit_price: SKIP, stop_price: SKIP, inv401k_source: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @order_id = order_id unless order_id == SKIP
  @security_id = security_id unless security_id == SKIP
  @security_id_type = security_id_type unless security_id_type == SKIP
  @symbol = symbol unless symbol == SKIP
  @description = description unless description == SKIP
  @units = units unless units == SKIP
  @order_type = order_type unless order_type == SKIP
  @order_date = order_date unless order_date == SKIP
  @unit_price = unit_price unless unit_price == SKIP
  @unit_type = unit_type unless unit_type == SKIP
  @order_duration = order_duration unless order_duration == SKIP
  @sub_account =  unless  == SKIP
  @limit_price = limit_price unless limit_price == SKIP
  @stop_price = stop_price unless stop_price == SKIP
  @inv401k_source = inv401k_source unless inv401k_source == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#descriptionString

Description of order

Returns:

  • (String)


30
31
32
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 30

def description
  @description
end

#inv401k_sourceInvestment401KSourceType1

For 401(k) accounts, source of money for this order. PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST. Default if not present is OTHERNONVEST



73
74
75
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 73

def inv401k_source
  @inv401k_source
end

#limit_priceFloat

Limit price

Returns:

  • (Float)


63
64
65
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 63

def limit_price
  @limit_price
end

#order_dateDate

Order date

Returns:

  • (Date)


43
44
45
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 43

def order_date
  @order_date
end

#order_durationOrderDuration2

This order is good for DAY, GOODTILLCANCEL, IMMEDIATE

Returns:



55
56
57
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 55

def order_duration
  @order_duration
end

#order_idString

Long-term persistent identity of the order. Id for this order transaction

Returns:

  • (String)


14
15
16
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 14

def order_id
  @order_id
end

#order_typeOrderType2

Type of order. One of BUY, SELL, BUYTOCOVER, BUYTOOPEN, SELLTOCOVER, SELLTOOPEN, SELLSHORT, SELLCLOSE

Returns:



39
40
41
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 39

def order_type
  @order_type
end

#security_idString

Unique identifier of security

Returns:

  • (String)


18
19
20
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 18

def security_id
  @security_id
end

#security_id_typeSecurityIdType1

CINS, CMC, CME, CUSIP, ISIN, ITSA, NASDAQ, SEDOL, SICC, VALOR, WKN

Returns:



22
23
24
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 22

def security_id_type
  @security_id_type
end

#stop_priceFloat

Stop price

Returns:

  • (Float)


67
68
69
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 67

def stop_price
  @stop_price
end

#sub_accountSubAccountType4

CASH, MARGIN, SHORT, OTHER

Returns:



59
60
61
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 59

def 
  @sub_account
end

#symbolString

Market symbol

Returns:

  • (String)


26
27
28
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 26

def symbol
  @symbol
end

#unit_priceFloat

Unit price

Returns:

  • (Float)


47
48
49
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 47

def unit_price
  @unit_price
end

#unit_typeUnitType3

Type of unit. One of SHARES, CURRENCY

Returns:



51
52
53
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 51

def unit_type
  @unit_type
end

#unitsFloat

Number of units (shares or bonds etc.)

Returns:

  • (Float)


34
35
36
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 34

def units
  @units
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 150

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  order_id = hash.key?('orderId') ? hash['orderId'] : SKIP
  security_id = hash.key?('securityId') ? hash['securityId'] : SKIP
  security_id_type =
    hash.key?('securityIdType') ? hash['securityIdType'] : SKIP
  symbol = hash.key?('symbol') ? hash['symbol'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  units = hash.key?('units') ? hash['units'] : SKIP
  order_type = hash.key?('orderType') ? hash['orderType'] : SKIP
  order_date = hash.key?('orderDate') ? hash['orderDate'] : SKIP
  unit_price = hash.key?('unitPrice') ? hash['unitPrice'] : SKIP
  unit_type = hash.key?('unitType') ? hash['unitType'] : SKIP
  order_duration = hash.key?('orderDuration') ? hash['orderDuration'] : SKIP
   = hash.key?('subAccount') ? hash['subAccount'] : SKIP
  limit_price = hash.key?('limitPrice') ? hash['limitPrice'] : SKIP
  stop_price = hash.key?('stopPrice') ? hash['stopPrice'] : SKIP
  inv401k_source = hash.key?('inv401kSource') ? hash['inv401kSource'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  OpenOrderEntity.new(order_id: order_id,
                      security_id: security_id,
                      security_id_type: security_id_type,
                      symbol: symbol,
                      description: description,
                      units: units,
                      order_type: order_type,
                      order_date: order_date,
                      unit_price: unit_price,
                      unit_type: unit_type,
                      order_duration: order_duration,
                      sub_account: ,
                      limit_price: limit_price,
                      stop_price: stop_price,
                      inv401k_source: inv401k_source,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 76

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['order_id'] = 'orderId'
  @_hash['security_id'] = 'securityId'
  @_hash['security_id_type'] = 'securityIdType'
  @_hash['symbol'] = 'symbol'
  @_hash['description'] = 'description'
  @_hash['units'] = 'units'
  @_hash['order_type'] = 'orderType'
  @_hash['order_date'] = 'orderDate'
  @_hash['unit_price'] = 'unitPrice'
  @_hash['unit_type'] = 'unitType'
  @_hash['order_duration'] = 'orderDuration'
  @_hash['sub_account'] = 'subAccount'
  @_hash['limit_price'] = 'limitPrice'
  @_hash['stop_price'] = 'stopPrice'
  @_hash['inv401k_source'] = 'inv401kSource'
  @_hash
end

.nullablesObject

An array for nullable fields



118
119
120
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 118

def self.nullables
  []
end

.optionalsObject

An array for optional fields



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 97

def self.optionals
  %w[
    order_id
    security_id
    security_id_type
    symbol
    description
    units
    order_type
    order_date
    unit_price
    unit_type
    order_duration
    sub_account
    limit_price
    stop_price
    inv401k_source
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (OpenOrderEntity | Hash)

    value against the validation is performed.



199
200
201
202
203
204
205
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 199

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



219
220
221
222
223
224
225
226
227
228
229
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 219

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} order_id: #{@order_id.inspect}, security_id: #{@security_id.inspect},"\
  " security_id_type: #{@security_id_type.inspect}, symbol: #{@symbol.inspect}, description:"\
  " #{@description.inspect}, units: #{@units.inspect}, order_type: #{@order_type.inspect},"\
  " order_date: #{@order_date.inspect}, unit_price: #{@unit_price.inspect}, unit_type:"\
  " #{@unit_type.inspect}, order_duration: #{@order_duration.inspect}, sub_account:"\
  " #{@sub_account.inspect}, limit_price: #{@limit_price.inspect}, stop_price:"\
  " #{@stop_price.inspect}, inv401k_source: #{@inv401k_source.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



208
209
210
211
212
213
214
215
216
# File 'lib/fdx_v660_api/models/open_order_entity.rb', line 208

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} order_id: #{@order_id}, security_id: #{@security_id}, security_id_type:"\
  " #{@security_id_type}, symbol: #{@symbol}, description: #{@description}, units: #{@units},"\
  " order_type: #{@order_type}, order_date: #{@order_date}, unit_price: #{@unit_price},"\
  " unit_type: #{@unit_type}, order_duration: #{@order_duration}, sub_account:"\
  " #{@sub_account}, limit_price: #{@limit_price}, stop_price: #{@stop_price}, inv401k_source:"\
  " #{@inv401k_source}, additional_properties: #{@additional_properties}>"
end