snaptrade 2.0.194 → 2.0.196

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: 6be02c4adb2cc7c3f8fbd660bc2a256a7e2bfd171bc8ecb1390b707ec4a977f5
4
- data.tar.gz: e822641bffd2b31a2ce8ebdb5e2bc233c09a4b942a20910f129fb78ca2c4aea9
3
+ metadata.gz: b754dc14c0f33c34f7ababe4f1ce48b1b8f41f5bcd1a4ef1455c601e7d38ce81
4
+ data.tar.gz: e56000668a36d8b8cd671c83e6a673de384b459217d3288f7696062db72d49f4
5
5
  SHA512:
6
- metadata.gz: d3c1c0d3157bc67d732b66c830212321ef6b5acf2f16e795c4eecc8514189a9fa3da1aafbc76a433702ef5f71015b19d65fd8b143fc17f41b27f9e3eb71d94d1
7
- data.tar.gz: 915f143950dd6c5999d9f89056437c091aaa4cafbae1f04296031f513f3746d5da6fd4a02f929d973a7b178052804421221f4231f0a662bcd4a34b940f69fdb2
6
+ metadata.gz: 98b08aec6d62f9b88ea7bfdb103f30bb727173928e39b9e695938deddbbefad77e5f395de559ffc2d35426bc1be4229e2d36230c9513d4c50cec7866103e533f
7
+ data.tar.gz: '08ad40a1146925f14907d98ec152b8270187db222d14741d32c35a6c6d8ced686890b30c1447b999f7a60e2a08974672609f76b5b914ac3ac67b1e90013f7183'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.194)
4
+ snaptrade (2.0.196)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
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.194-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.194)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.196-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.196)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -48,10 +48,6 @@ Connect brokerage accounts to your app for live positions and trading
48
48
  * [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
49
49
  * [`snaptrade.connections.return_rates`](#snaptradeconnectionsreturn_rates)
50
50
  * [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
51
- * [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
52
- * [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
53
- * [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
54
- * [`snaptrade.experimental_endpoints.sync_brokerage_authorization_transactions`](#snaptradeexperimental_endpointssync_brokerage_authorization_transactions)
55
51
  * [`snaptrade.options.list_option_holdings`](#snaptradeoptionslist_option_holdings)
56
52
  * [`snaptrade.reference_data.get_currency_exchange_rate_pair`](#snaptradereference_dataget_currency_exchange_rate_pair)
57
53
  * [`snaptrade.reference_data.get_partner_info`](#snaptradereference_dataget_partner_info)
@@ -91,7 +87,7 @@ Connect brokerage accounts to your app for live positions and trading
91
87
  Add to Gemfile:
92
88
 
93
89
  ```ruby
94
- gem 'snaptrade', '~> 2.0.194'
90
+ gem 'snaptrade', '~> 2.0.196'
95
91
  ```
96
92
 
97
93
  ## Getting Started<a id="getting-started"></a>
@@ -1303,173 +1299,6 @@ specific users
1303
1299
  ---
1304
1300
 
1305
1301
 
1306
- ### `snaptrade.experimental_endpoints.get_user_account_order_detail_v2`<a id="snaptradeexperimental_endpointsget_user_account_order_detail_v2"></a>
1307
-
1308
- Returns the detail of a single order using the brokerage order ID provided as a path parameter.
1309
-
1310
- The V2 order response format includes all legs of the order in the `legs` list field.
1311
- If the order is single legged, `legs` will be a list of one leg.
1312
-
1313
- This endpoint is always realtime and does not rely on cached data.
1314
-
1315
- This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
1316
-
1317
-
1318
- #### 🛠️ Usage<a id="🛠️-usage"></a>
1319
-
1320
- ```ruby
1321
- result = snaptrade.experimental_endpoints.get_user_account_order_detail_v2(
1322
- account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1323
- brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
1324
- user_id: "snaptrade-user-123",
1325
- user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1326
- )
1327
- p result
1328
- ```
1329
-
1330
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1331
-
1332
- ##### account_id: `String`<a id="account_id-string"></a>
1333
- ##### brokerage_order_id: `String`<a id="brokerage_order_id-string"></a>
1334
- ##### user_id: `String`<a id="user_id-string"></a>
1335
- ##### user_secret: `String`<a id="user_secret-string"></a>
1336
- #### 🔄 Return<a id="🔄-return"></a>
1337
-
1338
- [AccountOrderRecordV2](./lib/snaptrade/models/account_order_record_v2.rb)
1339
-
1340
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1341
-
1342
- `/accounts/{accountId}/orders/details/v2/{brokerageOrderId}` `GET`
1343
-
1344
- [🔙 **Back to Table of Contents**](#table-of-contents)
1345
-
1346
- ---
1347
-
1348
-
1349
- ### `snaptrade.experimental_endpoints.get_user_account_orders_v2`<a id="snaptradeexperimental_endpointsget_user_account_orders_v2"></a>
1350
-
1351
- Returns a list of recent orders in the specified account.
1352
-
1353
- The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg.
1354
-
1355
- If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
1356
-
1357
-
1358
- #### 🛠️ Usage<a id="🛠️-usage"></a>
1359
-
1360
- ```ruby
1361
- result = snaptrade.experimental_endpoints.get_user_account_orders_v2(
1362
- user_id: "snaptrade-user-123",
1363
- user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1364
- account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1365
- state: "all",
1366
- days: 30,
1367
- )
1368
- p result
1369
- ```
1370
-
1371
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1372
-
1373
- ##### user_id: `String`<a id="user_id-string"></a>
1374
- ##### user_secret: `String`<a id="user_secret-string"></a>
1375
- ##### account_id: `String`<a id="account_id-string"></a>
1376
- ##### state: `String`<a id="state-string"></a>
1377
- defaults value is set to \"all\"
1378
-
1379
- ##### days: `Integer`<a id="days-integer"></a>
1380
- Number of days in the past to fetch the most recent orders. Defaults to the last
1381
- 30 days if no value is passed in. Values greater than 90 will be capped at 90.
1382
-
1383
- #### 🔄 Return<a id="🔄-return"></a>
1384
-
1385
- [AccountOrdersV2Response](./lib/snaptrade/models/account_orders_v2_response.rb)
1386
-
1387
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1388
-
1389
- `/accounts/{accountId}/orders/v2` `GET`
1390
-
1391
- [🔙 **Back to Table of Contents**](#table-of-contents)
1392
-
1393
- ---
1394
-
1395
-
1396
- ### `snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`<a id="snaptradeexperimental_endpointsget_user_account_recent_orders_v2"></a>
1397
-
1398
- A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format.
1399
- This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders.
1400
- Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days.
1401
- By default only returns executed orders, but that can be changed by setting *only_executed* to false.
1402
- **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
1403
-
1404
-
1405
- #### 🛠️ Usage<a id="🛠️-usage"></a>
1406
-
1407
- ```ruby
1408
- result = snaptrade.experimental_endpoints.get_user_account_recent_orders_v2(
1409
- user_id: "snaptrade-user-123",
1410
- user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1411
- account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1412
- only_executed: true,
1413
- )
1414
- p result
1415
- ```
1416
-
1417
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1418
-
1419
- ##### user_id: `String`<a id="user_id-string"></a>
1420
- ##### user_secret: `String`<a id="user_secret-string"></a>
1421
- ##### account_id: `String`<a id="account_id-string"></a>
1422
- ##### only_executed: `Boolean`<a id="only_executed-boolean"></a>
1423
- Defaults to true. Indicates if request should fetch only executed orders. Set to
1424
- false to retrieve non executed orders as well
1425
-
1426
- #### 🔄 Return<a id="🔄-return"></a>
1427
-
1428
- [AccountOrdersV2Response](./lib/snaptrade/models/account_orders_v2_response.rb)
1429
-
1430
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1431
-
1432
- `/accounts/{accountId}/recentOrders/v2` `GET`
1433
-
1434
- [🔙 **Back to Table of Contents**](#table-of-contents)
1435
-
1436
- ---
1437
-
1438
-
1439
- ### `snaptrade.experimental_endpoints.sync_brokerage_authorization_transactions`<a id="snaptradeexperimental_endpointssync_brokerage_authorization_transactions"></a>
1440
-
1441
- Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
1442
-
1443
-
1444
- #### 🛠️ Usage<a id="🛠️-usage"></a>
1445
-
1446
- ```ruby
1447
- result = snaptrade.experimental_endpoints.sync_brokerage_authorization_transactions(
1448
- authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89",
1449
- user_id: "snaptrade-user-123",
1450
- user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1451
- )
1452
- p result
1453
- ```
1454
-
1455
- #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1456
-
1457
- ##### authorization_id: `String`<a id="authorization_id-string"></a>
1458
- ##### user_id: `String`<a id="user_id-string"></a>
1459
- ##### user_secret: `String`<a id="user_secret-string"></a>
1460
- #### 🔄 Return<a id="🔄-return"></a>
1461
-
1462
- [BrokerageAuthorizationTransactionsSyncConfirmation](./lib/snaptrade/models/brokerage_authorization_transactions_sync_confirmation.rb)
1463
-
1464
- #### 🌐 Endpoint<a id="🌐-endpoint"></a>
1465
-
1466
- `/authorizations/{authorizationId}/transactions/sync` `POST`
1467
-
1468
- [🔙 **Back to Table of Contents**](#table-of-contents)
1469
-
1470
- ---
1471
-
1472
-
1473
1302
  ### `snaptrade.options.list_option_holdings`<a id="snaptradeoptionslist_option_holdings"></a>
1474
1303
 
1475
1304
  Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).
@@ -15,7 +15,7 @@ module SnapTrade
15
15
  class Balance
16
16
  attr_accessor :currency
17
17
 
18
- # The amount of available cash in the account denominated in the currency of the `currency` field.
18
+ # The amount of available cash in the account denominated in the currency of the `currency` field. This value can be negative in a margin account with a margin balance. Money market funds will be included in this field, and also returned in positions endpoints with `cash_equivalent` = true
19
19
  attr_accessor :cash
20
20
 
21
21
  # Buying power only applies to margin accounts. For non-margin accounts, buying power should be the same as cash. Please note that this field is not always available for all brokerages.
@@ -0,0 +1,221 @@
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
+ class TradeDetectionCancelSubscriptionResponse
15
+ attr_accessor :success
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :'success' => :'success'
21
+ }
22
+ end
23
+
24
+ # Returns all the JSON keys this model knows about
25
+ def self.acceptable_attributes
26
+ attribute_map.values
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'success' => :'Boolean'
33
+ }
34
+ end
35
+
36
+ # List of attributes with nullable: true
37
+ def self.openapi_nullable
38
+ Set.new([
39
+ ])
40
+ end
41
+
42
+ # Initializes the object
43
+ # @param [Hash] attributes Model attributes in the form of hash
44
+ def initialize(attributes = {})
45
+ if (!attributes.is_a?(Hash))
46
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::TradeDetectionCancelSubscriptionResponse` initialize method"
47
+ end
48
+
49
+ # check to see if the attribute exists and convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h|
51
+ if (!self.class.attribute_map.key?(k.to_sym))
52
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::TradeDetectionCancelSubscriptionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
+ end
54
+ h[k.to_sym] = v
55
+ }
56
+
57
+ if attributes.key?(:'success')
58
+ self.success = attributes[:'success']
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ if @success.nil?
67
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
68
+ end
69
+
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ return false if @success.nil?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ success == o.success
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [success].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ new.build_from_hash(attributes)
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
115
+ self.send("#{key}=", nil)
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = SnapTrade.const_get(type)
169
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ end