snaptrade 2.0.195 → 2.0.197

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: 89d6313108cd94956afeb65ef31c1a166978dc4fa1ad65013da4c0887bbe4b86
4
- data.tar.gz: 1cc2e032f95b89e624e5c281fe852a75a3a708504274d8382a216f8b4a7d346b
3
+ metadata.gz: bcbc842836424cdfc1f7b62023633b4663fc8b27e70b2d0c743e713590a8b7de
4
+ data.tar.gz: 5d3ea3e6598f63336d2453a61a9ad264de2c573c5b5889800d1b5b436357a036
5
5
  SHA512:
6
- metadata.gz: 94314bac7c431cc71aeb8b8548b301e7320a93bc6d796dfdc8790d794f53162f49cded316a53df0eec539226116a0a0e2aee012d2d99c00e0803c68441d26227
7
- data.tar.gz: aeb56f858145421f3076cadb431a209a57a3a980545af0c8bca4f4b1ab4725efb81323f6e5830214474df6c00b263a23bb6d0e957666aa4039a0a70671bd0ccb
6
+ metadata.gz: af50e106dbade938c3f7c177dffc031be8c787c1a3b4af969ebf27aeadf335982385a4b9a0bc4f4218cb4824f8b569ee5003bbd00d27fce7dfc811c69dbf869b
7
+ data.tar.gz: 9739208a6b3ac13f3444edd4bc7f6ddf843805b675aa07516efa8fb333327a215325705e1e2d6d5a0c27904d3ccf4770f42428dc5b2935c3a8eb63c6cb431202
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.195)
4
+ snaptrade (2.0.197)
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.195-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.195)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.197-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.197)
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.195'
90
+ gem 'snaptrade', '~> 2.0.197'
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).
@@ -2207,7 +2036,9 @@ Should be set to `True` if `symbols` are comprised of tickers. Defaults to
2207
2036
 
2208
2037
 
2209
2038
  ### `snaptrade.trading.place_bracket_order`<a id="snaptradetradingplace_bracket_order"></a>
2039
+ ![Deprecated](https://img.shields.io/badge/deprecated-yellow)
2210
2040
 
2041
+ **This endpoint is deprecated. Please switch to [the new complex order endpoint](/reference/Trading/Trading_placeComplexOrder) **
2211
2042
  Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for
2212
2043
  use. Only supported on certain brokerages
2213
2044
 
@@ -923,6 +923,7 @@ module SnapTrade
923
923
 
924
924
  # Place bracket order
925
925
  #
926
+ # **This endpoint is deprecated. Please switch to [the new complex order endpoint](/reference/Trading/Trading_placeComplexOrder) **
926
927
  # Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for
927
928
  # use. Only supported on certain brokerages
928
929
  #
@@ -958,6 +959,7 @@ module SnapTrade
958
959
 
959
960
  # Place bracket order
960
961
  #
962
+ # **This endpoint is deprecated. Please switch to [the new complex order endpoint](/reference/Trading/Trading_placeComplexOrder) **
961
963
  # Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for
962
964
  # use. Only supported on certain brokerages
963
965
  #
@@ -991,7 +993,7 @@ module SnapTrade
991
993
  end
992
994
 
993
995
  # Place bracket order
994
- # Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
996
+ # **This endpoint is deprecated. Please switch to [the new complex order endpoint](/reference/Trading/Trading_placeComplexOrder) ** Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
995
997
  # @param account_id [String] The ID of the account to execute the trade on.
996
998
  # @param user_id [String]
997
999
  # @param user_secret [String]
@@ -1004,7 +1006,7 @@ module SnapTrade
1004
1006
  end
1005
1007
 
1006
1008
  # Place bracket order
1007
- # Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
1009
+ # **This endpoint is deprecated. Please switch to [the new complex order endpoint](/reference/Trading/Trading_placeComplexOrder) ** Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
1008
1010
  # @param account_id [String] The ID of the account to execute the trade on.
1009
1011
  # @param user_id [String]
1010
1012
  # @param user_secret [String]
@@ -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