Class: SchwabRb::DataObjects::ExecutionLeg

Inherits:
Object
  • Object
show all
Defined in:
lib/schwab_rb/data_objects/order.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(leg_id:, quantity:, mismarked_quantity:, price:, time:, instrument_id:) ⇒ ExecutionLeg

Returns a new instance of ExecutionLeg.



23
24
25
26
27
28
29
30
# File 'lib/schwab_rb/data_objects/order.rb', line 23

def initialize(leg_id:, quantity:, mismarked_quantity:, price:, time:, instrument_id:)
  @leg_id = leg_id
  @quantity = quantity
  @mismarked_quantity = mismarked_quantity
  @price = price
  @time = time
  @instrument_id = instrument_id
end

Instance Attribute Details

#instrument_idObject (readonly)

Returns the value of attribute instrument_id.



8
9
10
# File 'lib/schwab_rb/data_objects/order.rb', line 8

def instrument_id
  @instrument_id
end

#leg_idObject (readonly)

Returns the value of attribute leg_id.



8
9
10
# File 'lib/schwab_rb/data_objects/order.rb', line 8

def leg_id
  @leg_id
end

#mismarked_quantityObject (readonly)

Returns the value of attribute mismarked_quantity.



8
9
10
# File 'lib/schwab_rb/data_objects/order.rb', line 8

def mismarked_quantity
  @mismarked_quantity
end

#priceObject (readonly)

Returns the value of attribute price.



8
9
10
# File 'lib/schwab_rb/data_objects/order.rb', line 8

def price
  @price
end

#quantityObject (readonly)

Returns the value of attribute quantity.



8
9
10
# File 'lib/schwab_rb/data_objects/order.rb', line 8

def quantity
  @quantity
end

#timeObject (readonly)

Returns the value of attribute time.



8
9
10
# File 'lib/schwab_rb/data_objects/order.rb', line 8

def time
  @time
end

Class Method Details

.build(data) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/schwab_rb/data_objects/order.rb', line 11

def build(data)
  new(
    leg_id: data[:legId],
    quantity: data[:quantity],
    mismarked_quantity: data[:mismarkedQuantity],
    price: data[:price],
    time: data[:time],
    instrument_id: data[:instrumentId]
  )
end

Instance Method Details

#to_hObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/schwab_rb/data_objects/order.rb', line 32

def to_h
  {
    legId: @leg_id,
    quantity: @quantity,
    mismarkedQuantity: @mismarked_quantity,
    price: @price,
    time: @time,
    instrumentId: @instrument_id
  }
end