Class: FdxV660Api::GainOrLossFromCryptocurrencyTransaction
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- FdxV660Api::GainOrLossFromCryptocurrencyTransaction
- Defined in:
- lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb
Overview
Tax information for a single cryptocurrency transaction. Replaced summer of 2025 by Tax1099Da for IRS form 1099-DA
Instance Attribute Summary collapse
-
#cost_basis ⇒ Float
Cost or other basis (1099-B box 1e).
-
#cryptocurrency_name ⇒ String
Cryptocurrency name (e.g. Bitcoin).
-
#date_acquired ⇒ Date
Date acquired (1099-B box 1b).
-
#date_of_sale ⇒ Date
Date sold or disposed (1099-B box 1c).
-
#long_or_short ⇒ SaleTermType4
LONG or SHORT (1099-B box 2).
-
#quantity ⇒ Float
Quantity (e.g. 0.0125662).
-
#sale_description ⇒ String
Description of property (1099-B box 1a).
-
#sales_price ⇒ Float
Proceeds (not price per share, 1099-B box 1d).
-
#symbol ⇒ String
Cryptocurrency abbreviation or symbol (e.g. BTC).
-
#various_dates_acquired ⇒ TrueClass | FalseClass
Acquired on various dates (1099-B box 1b).
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(cryptocurrency_name: SKIP, symbol: SKIP, quantity: SKIP, sale_description: SKIP, date_acquired: SKIP, various_dates_acquired: SKIP, date_of_sale: SKIP, sales_price: SKIP, cost_basis: SKIP, long_or_short: SKIP, additional_properties: nil) ⇒ GainOrLossFromCryptocurrencyTransaction
constructor
A new instance of GainOrLossFromCryptocurrencyTransaction.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(cryptocurrency_name: SKIP, symbol: SKIP, quantity: SKIP, sale_description: SKIP, date_acquired: SKIP, various_dates_acquired: SKIP, date_of_sale: SKIP, sales_price: SKIP, cost_basis: SKIP, long_or_short: SKIP, additional_properties: nil) ⇒ GainOrLossFromCryptocurrencyTransaction
Returns a new instance of GainOrLossFromCryptocurrencyTransaction.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 90 def initialize(cryptocurrency_name: SKIP, symbol: SKIP, quantity: SKIP, sale_description: SKIP, date_acquired: SKIP, various_dates_acquired: SKIP, date_of_sale: SKIP, sales_price: SKIP, cost_basis: SKIP, long_or_short: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @cryptocurrency_name = cryptocurrency_name unless cryptocurrency_name == SKIP @symbol = symbol unless symbol == SKIP @quantity = quantity unless quantity == SKIP @sale_description = sale_description unless sale_description == SKIP @date_acquired = date_acquired unless date_acquired == SKIP @various_dates_acquired = various_dates_acquired unless various_dates_acquired == SKIP @date_of_sale = date_of_sale unless date_of_sale == SKIP @sales_price = sales_price unless sales_price == SKIP @cost_basis = cost_basis unless cost_basis == SKIP @long_or_short = long_or_short unless long_or_short == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#cost_basis ⇒ Float
Cost or other basis (1099-B box 1e)
47 48 49 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 47 def cost_basis @cost_basis end |
#cryptocurrency_name ⇒ String
Cryptocurrency name (e.g. Bitcoin)
15 16 17 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 15 def cryptocurrency_name @cryptocurrency_name end |
#date_acquired ⇒ Date
Date acquired (1099-B box 1b)
31 32 33 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 31 def date_acquired @date_acquired end |
#date_of_sale ⇒ Date
Date sold or disposed (1099-B box 1c)
39 40 41 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 39 def date_of_sale @date_of_sale end |
#long_or_short ⇒ SaleTermType4
LONG or SHORT (1099-B box 2)
51 52 53 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 51 def long_or_short @long_or_short end |
#quantity ⇒ Float
Quantity (e.g. 0.0125662)
23 24 25 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 23 def quantity @quantity end |
#sale_description ⇒ String
Description of property (1099-B box 1a)
27 28 29 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 27 def sale_description @sale_description end |
#sales_price ⇒ Float
Proceeds (not price per share, 1099-B box 1d)
43 44 45 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 43 def sales_price @sales_price end |
#symbol ⇒ String
Cryptocurrency abbreviation or symbol (e.g. BTC)
19 20 21 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 19 def symbol @symbol end |
#various_dates_acquired ⇒ TrueClass | FalseClass
Acquired on various dates (1099-B box 1b)
35 36 37 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 35 def various_dates_acquired @various_dates_acquired end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 112 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. cryptocurrency_name = hash.key?('cryptocurrencyName') ? hash['cryptocurrencyName'] : SKIP symbol = hash.key?('symbol') ? hash['symbol'] : SKIP quantity = hash.key?('quantity') ? hash['quantity'] : SKIP sale_description = hash.key?('saleDescription') ? hash['saleDescription'] : SKIP date_acquired = hash.key?('dateAcquired') ? hash['dateAcquired'] : SKIP various_dates_acquired = hash.key?('variousDatesAcquired') ? hash['variousDatesAcquired'] : SKIP date_of_sale = hash.key?('dateOfSale') ? hash['dateOfSale'] : SKIP sales_price = hash.key?('salesPrice') ? hash['salesPrice'] : SKIP cost_basis = hash.key?('costBasis') ? hash['costBasis'] : SKIP long_or_short = hash.key?('longOrShort') ? hash['longOrShort'] : 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. GainOrLossFromCryptocurrencyTransaction.new(cryptocurrency_name: cryptocurrency_name, symbol: symbol, quantity: quantity, sale_description: sale_description, date_acquired: date_acquired, various_dates_acquired: various_dates_acquired, date_of_sale: date_of_sale, sales_price: sales_price, cost_basis: cost_basis, long_or_short: long_or_short, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 54 def self.names @_hash = {} if @_hash.nil? @_hash['cryptocurrency_name'] = 'cryptocurrencyName' @_hash['symbol'] = 'symbol' @_hash['quantity'] = 'quantity' @_hash['sale_description'] = 'saleDescription' @_hash['date_acquired'] = 'dateAcquired' @_hash['various_dates_acquired'] = 'variousDatesAcquired' @_hash['date_of_sale'] = 'dateOfSale' @_hash['sales_price'] = 'salesPrice' @_hash['cost_basis'] = 'costBasis' @_hash['long_or_short'] = 'longOrShort' @_hash end |
.nullables ⇒ Object
An array for nullable fields
86 87 88 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 86 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 70 def self.optionals %w[ cryptocurrency_name symbol quantity sale_description date_acquired various_dates_acquired date_of_sale sales_price cost_basis long_or_short ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
162 163 164 165 166 167 168 169 170 171 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 162 def inspect class_name = self.class.name.split('::').last "<#{class_name} cryptocurrency_name: #{@cryptocurrency_name.inspect}, symbol:"\ " #{@symbol.inspect}, quantity: #{@quantity.inspect}, sale_description:"\ " #{@sale_description.inspect}, date_acquired: #{@date_acquired.inspect},"\ " various_dates_acquired: #{@various_dates_acquired.inspect}, date_of_sale:"\ " #{@date_of_sale.inspect}, sales_price: #{@sales_price.inspect}, cost_basis:"\ " #{@cost_basis.inspect}, long_or_short: #{@long_or_short.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
152 153 154 155 156 157 158 159 |
# File 'lib/fdx_v660_api/models/gain_or_loss_from_cryptocurrency_transaction.rb', line 152 def to_s class_name = self.class.name.split('::').last "<#{class_name} cryptocurrency_name: #{@cryptocurrency_name}, symbol: #{@symbol}, quantity:"\ " #{@quantity}, sale_description: #{@sale_description}, date_acquired: #{@date_acquired},"\ " various_dates_acquired: #{@various_dates_acquired}, date_of_sale: #{@date_of_sale},"\ " sales_price: #{@sales_price}, cost_basis: #{@cost_basis}, long_or_short:"\ " #{@long_or_short}, additional_properties: #{@additional_properties}>" end |