Class: Bitfinex::Models::MarginInfo
- Defined in:
- lib/models/margin_info.rb
Instance Attribute Summary collapse
-
#buy ⇒ Object
Returns the value of attribute buy.
-
#gross_balance ⇒ Object
Returns the value of attribute gross_balance.
-
#margin_balance ⇒ Object
Returns the value of attribute margin_balance.
-
#margin_net ⇒ Object
Returns the value of attribute margin_net.
-
#sell ⇒ Object
Returns the value of attribute sell.
-
#symbol ⇒ Object
Returns the value of attribute symbol.
-
#tradable_balance ⇒ Object
Returns the value of attribute tradable_balance.
-
#type ⇒ Object
Returns the value of attribute type.
-
#user_pl ⇒ Object
Returns the value of attribute user_pl.
-
#user_swaps ⇒ Object
Returns the value of attribute user_swaps.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ MarginInfo
constructor
A new instance of MarginInfo.
- #serialize ⇒ Object
Methods inherited from Model
Constructor Details
#initialize(data) ⇒ MarginInfo
Returns a new instance of MarginInfo.
9 10 11 |
# File 'lib/models/margin_info.rb', line 9 def initialize (data) super(data, {}, []) end |
Instance Attribute Details
#buy ⇒ Object
Returns the value of attribute buy.
7 8 9 |
# File 'lib/models/margin_info.rb', line 7 def buy @buy end |
#gross_balance ⇒ Object
Returns the value of attribute gross_balance.
7 8 9 |
# File 'lib/models/margin_info.rb', line 7 def gross_balance @gross_balance end |
#margin_balance ⇒ Object
Returns the value of attribute margin_balance.
6 7 8 |
# File 'lib/models/margin_info.rb', line 6 def margin_balance @margin_balance end |
#margin_net ⇒ Object
Returns the value of attribute margin_net.
6 7 8 |
# File 'lib/models/margin_info.rb', line 6 def margin_net @margin_net end |
#sell ⇒ Object
Returns the value of attribute sell.
7 8 9 |
# File 'lib/models/margin_info.rb', line 7 def sell @sell end |
#symbol ⇒ Object
Returns the value of attribute symbol.
7 8 9 |
# File 'lib/models/margin_info.rb', line 7 def symbol @symbol end |
#tradable_balance ⇒ Object
Returns the value of attribute tradable_balance.
7 8 9 |
# File 'lib/models/margin_info.rb', line 7 def tradable_balance @tradable_balance end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/models/margin_info.rb', line 6 def type @type end |
#user_pl ⇒ Object
Returns the value of attribute user_pl.
6 7 8 |
# File 'lib/models/margin_info.rb', line 6 def user_pl @user_pl end |
#user_swaps ⇒ Object
Returns the value of attribute user_swaps.
6 7 8 |
# File 'lib/models/margin_info.rb', line 6 def user_swaps @user_swaps end |
Class Method Details
.unserialize(arr) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/models/margin_info.rb', line 38 def self.unserialize (arr) type = arr[0] if type == 'base' payload = arr[1] return { :type => type, :user_pl => payload[0], :user_swaps => payload[1], :margin_balance => payload[2], :margin_net => payload[3] } else symbol = arr[1] payload = arr[2] return { :type => type, :symbol => symbol, :tradable_balance => payload[0], :gross_balance => payload[1], :buy => payload[2], :sell => payload[3] } end end |
Instance Method Details
#serialize ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/models/margin_info.rb', line 13 def serialize () if self.type == 'base' return [ self.type, [ self.user_pl, self.user_swaps, self.margin_balance, self.margin_net ] ] else return [ self.type, self.symbol, [ self.tradable_balance, self.gross_balance, self.buy, self.sell ] ] end end |