snaptrade 2.0.155 → 2.0.156

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 215093f43172a954289d020e6feccadd0832d5dd17037013ee89bd0a42088d81
4
- data.tar.gz: e3828e6cad03623498859ae5d3df866a5a3e00d35acad759ae8e16ec09141552
3
+ metadata.gz: e1e0b2309a5ec4c7492fd0f2225d9d8971d639bae130012e8fd91b1c59151afb
4
+ data.tar.gz: 63b7e828dd57e35af1254fa9a61855772479448a0d389316e141647a5b902ae7
5
5
  SHA512:
6
- metadata.gz: 4908c95d293161623bee36599e3b8b127080c8c8ff17d0daec664aa20f1c090ccd74d00b4bfda02d6f537ec4de5282562fd8aa10be56452ba37d5632f1e3c266
7
- data.tar.gz: dbd496135c64eb0da77791c81623376522ddb0b40a40b03b7a7f49d527c34d4bad41e93f77e3049a4f505c9c79d6f1e0b23c325de41c012d52325db0f007c51e
6
+ metadata.gz: 98bdf4bc4450ff4bc234d9647a85b308882e28734649ae527262deaaffc3052863f962b22098c99f4c176c61624e635bb6fdb85440e674bfc51e84fda38972ca
7
+ data.tar.gz: eff0a518a595fbf4e7f97f4003b1a94d6136f315d445d020e6fe673c29d5e4ec82fed7cb783ca14a3748bba42cb88a0524123469775dbd698b615f1b499836fc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.155)
4
+ snaptrade (2.0.156)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
@@ -20,19 +20,19 @@ GEM
20
20
  base64
21
21
  faraday-net_http (>= 2.0, < 3.1)
22
22
  ruby2_keywords (>= 0.0.4)
23
- faraday-multipart (1.1.1)
23
+ faraday-multipart (1.2.0)
24
24
  multipart-post (~> 2.0)
25
25
  faraday-net_http (3.0.2)
26
- io-console (0.8.1)
26
+ io-console (0.8.2)
27
27
  irb (1.6.4)
28
28
  reline (>= 0.3.0)
29
29
  method_source (1.1.0)
30
30
  multipart-post (2.4.1)
31
31
  parallel (1.27.0)
32
- parser (3.3.10.0)
32
+ parser (3.3.10.1)
33
33
  ast (~> 2.4.1)
34
34
  racc
35
- prism (1.6.0)
35
+ prism (1.8.0)
36
36
  pry (0.14.2)
37
37
  coderay (~> 1.1)
38
38
  method_source (~> 1.0)
@@ -68,9 +68,9 @@ GEM
68
68
  rubocop-ast (>= 1.2.0, < 2.0)
69
69
  ruby-progressbar (~> 1.7)
70
70
  unicode-display_width (>= 1.4.0, < 3.0)
71
- rubocop-ast (1.48.0)
71
+ rubocop-ast (1.49.0)
72
72
  parser (>= 3.3.7.2)
73
- prism (~> 1.4)
73
+ prism (~> 1.7)
74
74
  ruby-progressbar (1.13.0)
75
75
  ruby2_keywords (0.0.5)
76
76
  unicode-display_width (2.6.0)
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Connect brokerage accounts to your app for live positions and trading
8
8
 
9
- [![npm](https://img.shields.io/badge/gem-v2.0.155-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.155)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.156-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.156)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -83,7 +83,7 @@ Connect brokerage accounts to your app for live positions and trading
83
83
  Add to Gemfile:
84
84
 
85
85
  ```ruby
86
- gem 'snaptrade', '~> 2.0.155'
86
+ gem 'snaptrade', '~> 2.0.156'
87
87
  ```
88
88
 
89
89
  ## Getting Started<a id="getting-started"></a>
@@ -35,6 +35,9 @@ module SnapTrade
35
35
  # If the position is a cash equivalent (usually a money market fund) that is also counted in account cash balance and buying power
36
36
  attr_accessor :cash_equivalent
37
37
 
38
+ # List of tax lots for the given position (disabled by default, contact support if needed)
39
+ attr_accessor :tax_lots
40
+
38
41
  # Attribute mapping from ruby-style variable name to JSON key.
39
42
  def self.attribute_map
40
43
  {
@@ -45,7 +48,8 @@ module SnapTrade
45
48
  :'average_purchase_price' => :'average_purchase_price',
46
49
  :'fractional_units' => :'fractional_units',
47
50
  :'currency' => :'currency',
48
- :'cash_equivalent' => :'cash_equivalent'
51
+ :'cash_equivalent' => :'cash_equivalent',
52
+ :'tax_lots' => :'tax_lots'
49
53
  }
50
54
  end
51
55
 
@@ -64,7 +68,8 @@ module SnapTrade
64
68
  :'average_purchase_price' => :'Float',
65
69
  :'fractional_units' => :'Float',
66
70
  :'currency' => :'PositionCurrency',
67
- :'cash_equivalent' => :'Boolean'
71
+ :'cash_equivalent' => :'Boolean',
72
+ :'tax_lots' => :'Array<TaxLot>'
68
73
  }
69
74
  end
70
75
 
@@ -76,7 +81,7 @@ module SnapTrade
76
81
  :'open_pnl',
77
82
  :'average_purchase_price',
78
83
  :'fractional_units',
79
- :'cash_equivalent'
84
+ :'cash_equivalent',
80
85
  ])
81
86
  end
82
87
 
@@ -126,6 +131,12 @@ module SnapTrade
126
131
  if attributes.key?(:'cash_equivalent')
127
132
  self.cash_equivalent = attributes[:'cash_equivalent']
128
133
  end
134
+
135
+ if attributes.key?(:'tax_lots')
136
+ if (value = attributes[:'tax_lots']).is_a?(Array)
137
+ self.tax_lots = value
138
+ end
139
+ end
129
140
  end
130
141
 
131
142
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -153,7 +164,8 @@ module SnapTrade
153
164
  average_purchase_price == o.average_purchase_price &&
154
165
  fractional_units == o.fractional_units &&
155
166
  currency == o.currency &&
156
- cash_equivalent == o.cash_equivalent
167
+ cash_equivalent == o.cash_equivalent &&
168
+ tax_lots == o.tax_lots
157
169
  end
158
170
 
159
171
  # @see the `==` method
@@ -165,7 +177,7 @@ module SnapTrade
165
177
  # Calculates hash code according to all attributes.
166
178
  # @return [Integer] Hash code
167
179
  def hash
168
- [symbol, units, price, open_pnl, average_purchase_price, fractional_units, currency, cash_equivalent].hash
180
+ [symbol, units, price, open_pnl, average_purchase_price, fractional_units, currency, cash_equivalent, tax_lots].hash
169
181
  end
170
182
 
171
183
  # Builds the object from hash
@@ -0,0 +1,274 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'date'
11
+ require 'time'
12
+
13
+ module SnapTrade
14
+ # Describes a single tax lot for a position.
15
+ class TaxLot
16
+ # The date and time of the purchase.
17
+ attr_accessor :original_purchase_date
18
+
19
+ # The number of shares in the tax lot. This can be fractional or integer units.
20
+ attr_accessor :quantity
21
+
22
+ # The purchase price per share for the tax lot.
23
+ attr_accessor :purchased_price
24
+
25
+ # The cost basis of the entire lot.
26
+ attr_accessor :cost_basis
27
+
28
+ # The current market value of the entire lot.
29
+ attr_accessor :current_value
30
+
31
+ # The type of position for the tax lot (e.g., LONG, SHORT).
32
+ attr_accessor :position_type
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'original_purchase_date' => :'original_purchase_date',
38
+ :'quantity' => :'quantity',
39
+ :'purchased_price' => :'purchased_price',
40
+ :'cost_basis' => :'cost_basis',
41
+ :'current_value' => :'current_value',
42
+ :'position_type' => :'position_type'
43
+ }
44
+ end
45
+
46
+ # Returns all the JSON keys this model knows about
47
+ def self.acceptable_attributes
48
+ attribute_map.values
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'original_purchase_date' => :'Time',
55
+ :'quantity' => :'String',
56
+ :'purchased_price' => :'String',
57
+ :'cost_basis' => :'String',
58
+ :'current_value' => :'String',
59
+ :'position_type' => :'String'
60
+ }
61
+ end
62
+
63
+ # List of attributes with nullable: true
64
+ def self.openapi_nullable
65
+ Set.new([
66
+ :'original_purchase_date',
67
+ :'quantity',
68
+ :'purchased_price',
69
+ :'cost_basis',
70
+ :'current_value',
71
+ :'position_type'
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::TaxLot` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::TaxLot`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'original_purchase_date')
91
+ self.original_purchase_date = attributes[:'original_purchase_date']
92
+ end
93
+
94
+ if attributes.key?(:'quantity')
95
+ self.quantity = attributes[:'quantity']
96
+ end
97
+
98
+ if attributes.key?(:'purchased_price')
99
+ self.purchased_price = attributes[:'purchased_price']
100
+ end
101
+
102
+ if attributes.key?(:'cost_basis')
103
+ self.cost_basis = attributes[:'cost_basis']
104
+ end
105
+
106
+ if attributes.key?(:'current_value')
107
+ self.current_value = attributes[:'current_value']
108
+ end
109
+
110
+ if attributes.key?(:'position_type')
111
+ self.position_type = attributes[:'position_type']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ invalid_properties
120
+ end
121
+
122
+ # Check to see if the all the properties in the model are valid
123
+ # @return true if the model is valid
124
+ def valid?
125
+ true
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ original_purchase_date == o.original_purchase_date &&
134
+ quantity == o.quantity &&
135
+ purchased_price == o.purchased_price &&
136
+ cost_basis == o.cost_basis &&
137
+ current_value == o.current_value &&
138
+ position_type == o.position_type
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(o)
144
+ self == o
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Integer] Hash code
149
+ def hash
150
+ [original_purchase_date, quantity, purchased_price, cost_basis, current_value, position_type].hash
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def self.build_from_hash(attributes)
157
+ new.build_from_hash(attributes)
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ attributes = attributes.transform_keys(&:to_sym)
166
+ self.class.openapi_types.each_pair do |key, type|
167
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
168
+ self.send("#{key}=", nil)
169
+ elsif type =~ /\AArray<(.*)>/i
170
+ # check to ensure the input is an array given that the attribute
171
+ # is documented as an array but the input is not
172
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
173
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
174
+ end
175
+ elsif !attributes[self.class.attribute_map[key]].nil?
176
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
177
+ end
178
+ end
179
+
180
+ self
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def _deserialize(type, value)
188
+ case type.to_sym
189
+ when :Time
190
+ Time.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :Boolean
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ # models (e.g. Pet) or oneOf
221
+ klass = SnapTrade.const_get(type)
222
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ if value.nil?
245
+ is_nullable = self.class.openapi_nullable.include?(attr)
246
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
247
+ end
248
+
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+
272
+ end
273
+
274
+ end
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.155'
11
+ VERSION = '2.0.156'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -161,6 +161,7 @@ require 'snaptrade/models/symbol_figi_instrument'
161
161
  require 'snaptrade/models/symbol_query'
162
162
  require 'snaptrade/models/symbols_quotes_inner'
163
163
  require 'snaptrade/models/take_profit'
164
+ require 'snaptrade/models/tax_lot'
164
165
  require 'snaptrade/models/time_in_force_strict'
165
166
  require 'snaptrade/models/timeframe'
166
167
  require 'snaptrade/models/trading_instrument'
@@ -68,4 +68,10 @@ describe SnapTrade::Position do
68
68
  end
69
69
  end
70
70
 
71
+ describe 'test attribute "tax_lots"' do
72
+ it 'should work' do
73
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
+ end
75
+ end
76
+
71
77
  end
@@ -0,0 +1,59 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'spec_helper'
11
+ require 'json'
12
+ require 'date'
13
+
14
+ # Unit tests for SnapTrade::TaxLot
15
+ describe SnapTrade::TaxLot do
16
+ let(:instance) { SnapTrade::TaxLot.new }
17
+
18
+ describe 'test an instance of TaxLot' do
19
+ it 'should create an instance of TaxLot' do
20
+ expect(instance).to be_instance_of(SnapTrade::TaxLot)
21
+ end
22
+ end
23
+ describe 'test attribute "original_purchase_date"' do
24
+ it 'should work' do
25
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
+ end
27
+ end
28
+
29
+ describe 'test attribute "quantity"' do
30
+ it 'should work' do
31
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
+ end
33
+ end
34
+
35
+ describe 'test attribute "purchased_price"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "cost_basis"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "current_value"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ describe 'test attribute "position_type"' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptrade
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.155
4
+ version: 2.0.156
5
5
  platform: ruby
6
6
  authors:
7
7
  - SnapTrade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-05 00:00:00.000000000 Z
11
+ date: 2026-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -241,6 +241,7 @@ files:
241
241
  - lib/snaptrade/models/symbol_query.rb
242
242
  - lib/snaptrade/models/symbols_quotes_inner.rb
243
243
  - lib/snaptrade/models/take_profit.rb
244
+ - lib/snaptrade/models/tax_lot.rb
244
245
  - lib/snaptrade/models/time_in_force_strict.rb
245
246
  - lib/snaptrade/models/timeframe.rb
246
247
  - lib/snaptrade/models/trading_instrument.rb
@@ -416,6 +417,7 @@ files:
416
417
  - spec/models/symbol_spec.rb
417
418
  - spec/models/symbols_quotes_inner_spec.rb
418
419
  - spec/models/take_profit_spec.rb
420
+ - spec/models/tax_lot_spec.rb
419
421
  - spec/models/time_in_force_strict_spec.rb
420
422
  - spec/models/timeframe_spec.rb
421
423
  - spec/models/trading_instrument_spec.rb
@@ -568,6 +570,7 @@ test_files:
568
570
  - spec/models/manual_trade_spec.rb
569
571
  - spec/models/brokerage_instruments_response_spec.rb
570
572
  - spec/models/options_position_spec.rb
573
+ - spec/models/tax_lot_spec.rb
571
574
  - spec/models/account_order_record_option_symbol_spec.rb
572
575
  - spec/models/mleg_action_strict_spec.rb
573
576
  - spec/models/trading_instrument_type_spec.rb