snaptrade 2.0.130 → 2.0.132
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 +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +16 -14
- data/lib/snaptrade/api/account_information_api.rb +4 -4
- data/lib/snaptrade/api/authentication_api.rb +2 -2
- data/lib/snaptrade/api/connections_api.rb +4 -4
- data/lib/snaptrade/api/trading_api.rb +38 -38
- data/lib/snaptrade/models/connection_type.rb +2 -1
- data/lib/snaptrade/models/snap_trade_login_user_request_body.rb +1 -1
- data/lib/snaptrade/models/stop_loss.rb +1 -1
- data/lib/snaptrade/models/take_profit.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +0 -1
- data/spec/api/account_information_api_spec.rb +1 -1
- data/spec/api/connections_api_spec.rb +1 -1
- data/spec/api/trading_api_spec.rb +2 -2
- metadata +2 -5
- data/lib/snaptrade/models/trading_cancel_user_account_order_request.rb +0 -217
- data/spec/models/trading_cancel_user_account_order_request_spec.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4063a04e16cf4c2859c165968113cb98b6c50d61f5d57a71cb2518151779f279
|
4
|
+
data.tar.gz: 5e11660bf6efe9f80458f44d06377552e431d2ea74d95ae3747d4402f339c643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6b33a7192a8d3a22e2828efc47863e5a67fa086ccff78a6dd05eab53247339460ba19984ff08c6453f08ae0e278c32437982c8b9a9836a4585379fa7b89ebd8
|
7
|
+
data.tar.gz: f59518344e2781984588934c5856539946cba17fd81acd1244bef28c4c08381ec1ecfd0aa6fcf7134e2d824d7ab82b73a49a16573adbdf00c356674ad98f1512
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snaptrade (2.0.
|
4
|
+
snaptrade (2.0.132)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
@@ -45,7 +45,7 @@ GEM
|
|
45
45
|
regexp_parser (2.11.2)
|
46
46
|
reline (0.6.2)
|
47
47
|
io-console (~> 0.5)
|
48
|
-
rexml (3.4.
|
48
|
+
rexml (3.4.4)
|
49
49
|
rspec (3.13.1)
|
50
50
|
rspec-core (~> 3.13.0)
|
51
51
|
rspec-expectations (~> 3.13.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
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.132)
|
10
10
|
[](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -81,7 +81,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
81
81
|
Add to Gemfile:
|
82
82
|
|
83
83
|
```ruby
|
84
|
-
gem 'snaptrade', '~> 2.0.
|
84
|
+
gem 'snaptrade', '~> 2.0.132'
|
85
85
|
```
|
86
86
|
|
87
87
|
## Getting Started<a id="getting-started"></a>
|
@@ -448,7 +448,7 @@ A lightweight endpoint that returns a list of orders executed in the last 24 hou
|
|
448
448
|
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
|
449
449
|
Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days
|
450
450
|
By default only returns executed orders, but that can be changed by setting *only_executed* to false
|
451
|
-
**
|
451
|
+
**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)**
|
452
452
|
|
453
453
|
|
454
454
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
@@ -747,8 +747,10 @@ left empty unless you are reconnecting a disabled connection. See the [guide on
|
|
747
747
|
fixing broken connections](/docs/fix-broken-connections) for more information.
|
748
748
|
|
749
749
|
##### connectionType: [`ConnectionType`](./lib/snaptrade/models/connection_type.rb)<a id="connectiontype-connectiontypelibsnaptrademodelsconnection_typerb"></a>
|
750
|
-
|
751
|
-
|
750
|
+
Determines connection permissions (default: read) - `read`: Data access only. -
|
751
|
+
`trade`: Data and trading access. - `trade-if-available`: Attempts to establish
|
752
|
+
a trading connection if the brokerage supports it, otherwise falls back to
|
753
|
+
read-only access automatically.
|
752
754
|
|
753
755
|
##### connectionPortalVersion: [`ConnectionPortalVersion`](./lib/snaptrade/models/connection_portal_version.rb)<a id="connectionportalversion-connectionportalversionlibsnaptrademodelsconnection_portal_versionrb"></a>
|
754
756
|
Sets the connection portal version to render. Currently only v4 is supported and
|
@@ -956,7 +958,7 @@ p result
|
|
956
958
|
Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection.
|
957
959
|
This endpoint will also trigger a transaction sync for the past day if one has not yet occurred.
|
958
960
|
|
959
|
-
**Because of the cost of refreshing a connection, each call to this endpoint incurs
|
961
|
+
**Please contact support before use. Because of the cost of refreshing a connection, 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)**
|
960
962
|
|
961
963
|
|
962
964
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
@@ -1515,23 +1517,23 @@ Cancels an order in the specified account. Accepts order IDs for all asset types
|
|
1515
1517
|
|
1516
1518
|
```ruby
|
1517
1519
|
result = snaptrade.trading.cancel_order(
|
1520
|
+
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
1518
1521
|
user_id: "snaptrade-user-123",
|
1519
1522
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1520
1523
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1521
|
-
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
1522
1524
|
)
|
1523
1525
|
p result
|
1524
1526
|
```
|
1525
1527
|
|
1526
1528
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1527
1529
|
|
1528
|
-
##### user_id: `String`<a id="user_id-string"></a>
|
1529
|
-
##### user_secret: `String`<a id="user_secret-string"></a>
|
1530
|
-
##### account_id: `String`<a id="account_id-string"></a>
|
1531
1530
|
##### brokerage_order_id: `String`<a id="brokerage_order_id-string"></a>
|
1532
1531
|
Order ID returned by brokerage. This is the unique identifier for the order in
|
1533
1532
|
the brokerage system.
|
1534
1533
|
|
1534
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
1535
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
1536
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
1535
1537
|
#### 🔄 Return<a id="🔄-return"></a>
|
1536
1538
|
|
1537
1539
|
[CancelOrderResponse](./lib/snaptrade/models/cancel_order_response.rb)
|
@@ -1556,23 +1558,23 @@ Attempts to cancel an open order with the brokerage. If the order is no longer c
|
|
1556
1558
|
|
1557
1559
|
```ruby
|
1558
1560
|
result = snaptrade.trading.cancel_user_account_order(
|
1561
|
+
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
1559
1562
|
user_id: "snaptrade-user-123",
|
1560
1563
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1561
1564
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1562
|
-
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
1563
1565
|
)
|
1564
1566
|
p result
|
1565
1567
|
```
|
1566
1568
|
|
1567
1569
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1568
1570
|
|
1569
|
-
##### user_id: `String`<a id="user_id-string"></a>
|
1570
|
-
##### user_secret: `String`<a id="user_secret-string"></a>
|
1571
|
-
##### account_id: `String`<a id="account_id-string"></a>
|
1572
1571
|
##### brokerage_order_id: `String`<a id="brokerage_order_id-string"></a>
|
1573
1572
|
Order ID returned by brokerage. This is the unique identifier for the order in
|
1574
1573
|
the brokerage system.
|
1575
1574
|
|
1575
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
1576
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
1577
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
1576
1578
|
#### 🔄 Return<a id="🔄-return"></a>
|
1577
1579
|
|
1578
1580
|
[AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
|
@@ -871,7 +871,7 @@ module SnapTrade
|
|
871
871
|
# 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
|
872
872
|
# Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days
|
873
873
|
# By default only returns executed orders, but that can be changed by setting *only_executed* to false
|
874
|
-
# **
|
874
|
+
# **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)**
|
875
875
|
#
|
876
876
|
# @param user_id [String]
|
877
877
|
# @param user_secret [String]
|
@@ -890,7 +890,7 @@ module SnapTrade
|
|
890
890
|
# 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
|
891
891
|
# Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days
|
892
892
|
# By default only returns executed orders, but that can be changed by setting *only_executed* to false
|
893
|
-
# **
|
893
|
+
# **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)**
|
894
894
|
#
|
895
895
|
# @param user_id [String]
|
896
896
|
# @param user_secret [String]
|
@@ -903,7 +903,7 @@ module SnapTrade
|
|
903
903
|
end
|
904
904
|
|
905
905
|
# List account recent orders (last 24 hours only)
|
906
|
-
# A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account. 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 Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days By default only returns executed orders, but that can be changed by setting *only_executed* to false **
|
906
|
+
# A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account. 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 Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days By default only returns executed orders, but that can be changed by setting *only_executed* to false **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)**
|
907
907
|
# @param user_id [String]
|
908
908
|
# @param user_secret [String]
|
909
909
|
# @param account_id [String]
|
@@ -916,7 +916,7 @@ module SnapTrade
|
|
916
916
|
end
|
917
917
|
|
918
918
|
# List account recent orders (last 24 hours only)
|
919
|
-
# A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account. 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 Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days By default only returns executed orders, but that can be changed by setting *only_executed* to false **
|
919
|
+
# A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account. 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 Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days By default only returns executed orders, but that can be changed by setting *only_executed* to false **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)**
|
920
920
|
# @param user_id [String]
|
921
921
|
# @param user_secret [String]
|
922
922
|
# @param account_id [String]
|
@@ -192,7 +192,7 @@ module SnapTrade
|
|
192
192
|
# @param immediate_redirect [Boolean] When set to `true`, user will be redirected back to the partner's site instead of the connection portal. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information.
|
193
193
|
# @param custom_redirect [String] URL to redirect the user to after the user connects their brokerage account. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information.
|
194
194
|
# @param reconnect [String] The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the [guide on fixing broken connections](/docs/fix-broken-connections) for more information.
|
195
|
-
# @param connection_type [ConnectionType]
|
195
|
+
# @param connection_type [ConnectionType] Determines connection permissions (default: read) - `read`: Data access only. - `trade`: Data and trading access. - `trade-if-available`: Attempts to establish a trading connection if the brokerage supports it, otherwise falls back to read-only access automatically.
|
196
196
|
# @param connection_portal_version [ConnectionPortalVersion] Sets the connection portal version to render. Currently only v4 is supported and is the default. All other versions are deprecated and will automatically be set to v4.
|
197
197
|
# @param body [SnapTradeLoginUserRequestBody]
|
198
198
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -221,7 +221,7 @@ module SnapTrade
|
|
221
221
|
# @param immediate_redirect [Boolean] When set to `true`, user will be redirected back to the partner's site instead of the connection portal. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information.
|
222
222
|
# @param custom_redirect [String] URL to redirect the user to after the user connects their brokerage account. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information.
|
223
223
|
# @param reconnect [String] The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the [guide on fixing broken connections](/docs/fix-broken-connections) for more information.
|
224
|
-
# @param connection_type [ConnectionType]
|
224
|
+
# @param connection_type [ConnectionType] Determines connection permissions (default: read) - `read`: Data access only. - `trade`: Data and trading access. - `trade-if-available`: Attempts to establish a trading connection if the brokerage supports it, otherwise falls back to read-only access automatically.
|
225
225
|
# @param connection_portal_version [ConnectionPortalVersion] Sets the connection portal version to render. Currently only v4 is supported and is the default. All other versions are deprecated and will automatically be set to v4.
|
226
226
|
# @param body [SnapTradeLoginUserRequestBody]
|
227
227
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -337,7 +337,7 @@ module SnapTrade
|
|
337
337
|
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection.
|
338
338
|
# This endpoint will also trigger a transaction sync for the past day if one has not yet occurred.
|
339
339
|
#
|
340
|
-
# **Because of the cost of refreshing a connection, each call to this endpoint incurs
|
340
|
+
# **Please contact support before use. Because of the cost of refreshing a connection, 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)**
|
341
341
|
#
|
342
342
|
# @param authorization_id [String]
|
343
343
|
# @param user_id [String]
|
@@ -353,7 +353,7 @@ module SnapTrade
|
|
353
353
|
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection.
|
354
354
|
# This endpoint will also trigger a transaction sync for the past day if one has not yet occurred.
|
355
355
|
#
|
356
|
-
# **Because of the cost of refreshing a connection, each call to this endpoint incurs
|
356
|
+
# **Please contact support before use. Because of the cost of refreshing a connection, 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)**
|
357
357
|
#
|
358
358
|
# @param authorization_id [String]
|
359
359
|
# @param user_id [String]
|
@@ -364,7 +364,7 @@ module SnapTrade
|
|
364
364
|
end
|
365
365
|
|
366
366
|
# Refresh holdings for a connection
|
367
|
-
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Because of the cost of refreshing a connection, each call to this endpoint incurs
|
367
|
+
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Please contact support before use. Because of the cost of refreshing a connection, 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)**
|
368
368
|
# @param authorization_id [String]
|
369
369
|
# @param user_id [String]
|
370
370
|
# @param user_secret [String]
|
@@ -376,7 +376,7 @@ module SnapTrade
|
|
376
376
|
end
|
377
377
|
|
378
378
|
# Refresh holdings for a connection
|
379
|
-
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Because of the cost of refreshing a connection, each call to this endpoint incurs
|
379
|
+
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Please contact support before use. Because of the cost of refreshing a connection, 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)**
|
380
380
|
# @param authorization_id [String]
|
381
381
|
# @param user_id [String]
|
382
382
|
# @param user_secret [String]
|
@@ -21,17 +21,17 @@ module SnapTrade
|
|
21
21
|
#
|
22
22
|
# Cancels an order in the specified account. Accepts order IDs for all asset types.
|
23
23
|
#
|
24
|
+
# @param brokerage_order_id [String] Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
24
25
|
# @param user_id [String]
|
25
26
|
# @param user_secret [String]
|
26
27
|
# @param account_id [String]
|
27
|
-
# @param
|
28
|
-
# @param body [TradingCancelUserAccountOrderRequest]
|
28
|
+
# @param body [AccountInformationGetUserAccountOrderDetailRequest]
|
29
29
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
30
|
-
def cancel_order(user_id:, user_secret:, account_id:,
|
30
|
+
def cancel_order(brokerage_order_id:, user_id:, user_secret:, account_id:, extra: {})
|
31
31
|
_body = {}
|
32
32
|
_body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
|
33
|
-
|
34
|
-
data, _status_code, _headers = cancel_order_with_http_info_impl(user_id, user_secret, account_id,
|
33
|
+
account_information_get_user_account_order_detail_request = _body
|
34
|
+
data, _status_code, _headers = cancel_order_with_http_info_impl(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, extra)
|
35
35
|
data
|
36
36
|
end
|
37
37
|
|
@@ -39,17 +39,17 @@ module SnapTrade
|
|
39
39
|
#
|
40
40
|
# Cancels an order in the specified account. Accepts order IDs for all asset types.
|
41
41
|
#
|
42
|
+
# @param brokerage_order_id [String] Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
42
43
|
# @param user_id [String]
|
43
44
|
# @param user_secret [String]
|
44
45
|
# @param account_id [String]
|
45
|
-
# @param
|
46
|
-
# @param body [TradingCancelUserAccountOrderRequest]
|
46
|
+
# @param body [AccountInformationGetUserAccountOrderDetailRequest]
|
47
47
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
48
|
-
def cancel_order_with_http_info(user_id:, user_secret:, account_id:,
|
48
|
+
def cancel_order_with_http_info(brokerage_order_id:, user_id:, user_secret:, account_id:, extra: {})
|
49
49
|
_body = {}
|
50
50
|
_body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
|
51
|
-
|
52
|
-
cancel_order_with_http_info_impl(user_id, user_secret, account_id,
|
51
|
+
account_information_get_user_account_order_detail_request = _body
|
52
|
+
cancel_order_with_http_info_impl(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, extra)
|
53
53
|
end
|
54
54
|
|
55
55
|
# Cancel order
|
@@ -57,11 +57,11 @@ module SnapTrade
|
|
57
57
|
# @param user_id [String]
|
58
58
|
# @param user_secret [String]
|
59
59
|
# @param account_id [String]
|
60
|
-
# @param
|
60
|
+
# @param account_information_get_user_account_order_detail_request [AccountInformationGetUserAccountOrderDetailRequest]
|
61
61
|
# @param [Hash] opts the optional parameters
|
62
62
|
# @return [CancelOrderResponse]
|
63
|
-
private def cancel_order_impl(user_id, user_secret, account_id,
|
64
|
-
data, _status_code, _headers = cancel_order_with_http_info(user_id, user_secret, account_id,
|
63
|
+
private def cancel_order_impl(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, opts = {})
|
64
|
+
data, _status_code, _headers = cancel_order_with_http_info(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, opts)
|
65
65
|
data
|
66
66
|
end
|
67
67
|
|
@@ -70,10 +70,10 @@ module SnapTrade
|
|
70
70
|
# @param user_id [String]
|
71
71
|
# @param user_secret [String]
|
72
72
|
# @param account_id [String]
|
73
|
-
# @param
|
73
|
+
# @param account_information_get_user_account_order_detail_request [AccountInformationGetUserAccountOrderDetailRequest]
|
74
74
|
# @param [Hash] opts the optional parameters
|
75
75
|
# @return [Array<(CancelOrderResponse, Integer, Hash)>] CancelOrderResponse data, response status code and response headers
|
76
|
-
private def cancel_order_with_http_info_impl(user_id, user_secret, account_id,
|
76
|
+
private def cancel_order_with_http_info_impl(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, opts = {})
|
77
77
|
if @api_client.config.debugging
|
78
78
|
@api_client.config.logger.debug 'Calling API: TradingApi.cancel_order ...'
|
79
79
|
end
|
@@ -89,9 +89,9 @@ module SnapTrade
|
|
89
89
|
if @api_client.config.client_side_validation && account_id.nil?
|
90
90
|
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.cancel_order"
|
91
91
|
end
|
92
|
-
# verify the required parameter '
|
93
|
-
if @api_client.config.client_side_validation &&
|
94
|
-
fail ArgumentError, "Missing the required parameter '
|
92
|
+
# verify the required parameter 'account_information_get_user_account_order_detail_request' is set
|
93
|
+
if @api_client.config.client_side_validation && account_information_get_user_account_order_detail_request.nil?
|
94
|
+
fail ArgumentError, "Missing the required parameter 'account_information_get_user_account_order_detail_request' when calling TradingApi.cancel_order"
|
95
95
|
end
|
96
96
|
# resource path
|
97
97
|
local_var_path = '/accounts/{accountId}/trading/cancel'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
@@ -115,7 +115,7 @@ module SnapTrade
|
|
115
115
|
form_params = opts[:form_params] || {}
|
116
116
|
|
117
117
|
# http body (model)
|
118
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
118
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(account_information_get_user_account_order_detail_request)
|
119
119
|
|
120
120
|
# return_type
|
121
121
|
return_type = opts[:debug_return_type] || 'CancelOrderResponse'
|
@@ -146,17 +146,17 @@ module SnapTrade
|
|
146
146
|
# **This endpoint is deprecated. Please switch to [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) **
|
147
147
|
# Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
|
148
148
|
#
|
149
|
+
# @param brokerage_order_id [String] Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
149
150
|
# @param user_id [String]
|
150
151
|
# @param user_secret [String]
|
151
152
|
# @param account_id [String]
|
152
|
-
# @param
|
153
|
-
# @param body [TradingCancelUserAccountOrderRequest]
|
153
|
+
# @param body [AccountInformationGetUserAccountOrderDetailRequest]
|
154
154
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
155
|
-
def cancel_user_account_order(user_id:, user_secret:, account_id:,
|
155
|
+
def cancel_user_account_order(brokerage_order_id:, user_id:, user_secret:, account_id:, extra: {})
|
156
156
|
_body = {}
|
157
157
|
_body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
|
158
|
-
|
159
|
-
data, _status_code, _headers = cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id,
|
158
|
+
account_information_get_user_account_order_detail_request = _body
|
159
|
+
data, _status_code, _headers = cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, extra)
|
160
160
|
data
|
161
161
|
end
|
162
162
|
|
@@ -165,17 +165,17 @@ module SnapTrade
|
|
165
165
|
# **This endpoint is deprecated. Please switch to [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) **
|
166
166
|
# Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
|
167
167
|
#
|
168
|
+
# @param brokerage_order_id [String] Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
168
169
|
# @param user_id [String]
|
169
170
|
# @param user_secret [String]
|
170
171
|
# @param account_id [String]
|
171
|
-
# @param
|
172
|
-
# @param body [TradingCancelUserAccountOrderRequest]
|
172
|
+
# @param body [AccountInformationGetUserAccountOrderDetailRequest]
|
173
173
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
174
|
-
def cancel_user_account_order_with_http_info(user_id:, user_secret:, account_id:,
|
174
|
+
def cancel_user_account_order_with_http_info(brokerage_order_id:, user_id:, user_secret:, account_id:, extra: {})
|
175
175
|
_body = {}
|
176
176
|
_body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
|
177
|
-
|
178
|
-
cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id,
|
177
|
+
account_information_get_user_account_order_detail_request = _body
|
178
|
+
cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, extra)
|
179
179
|
end
|
180
180
|
|
181
181
|
# Cancel equity order
|
@@ -183,11 +183,11 @@ module SnapTrade
|
|
183
183
|
# @param user_id [String]
|
184
184
|
# @param user_secret [String]
|
185
185
|
# @param account_id [String]
|
186
|
-
# @param
|
186
|
+
# @param account_information_get_user_account_order_detail_request [AccountInformationGetUserAccountOrderDetailRequest]
|
187
187
|
# @param [Hash] opts the optional parameters
|
188
188
|
# @return [AccountOrderRecord]
|
189
|
-
private def cancel_user_account_order_impl(user_id, user_secret, account_id,
|
190
|
-
data, _status_code, _headers = cancel_user_account_order_with_http_info(user_id, user_secret, account_id,
|
189
|
+
private def cancel_user_account_order_impl(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, opts = {})
|
190
|
+
data, _status_code, _headers = cancel_user_account_order_with_http_info(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, opts)
|
191
191
|
data
|
192
192
|
end
|
193
193
|
|
@@ -196,10 +196,10 @@ module SnapTrade
|
|
196
196
|
# @param user_id [String]
|
197
197
|
# @param user_secret [String]
|
198
198
|
# @param account_id [String]
|
199
|
-
# @param
|
199
|
+
# @param account_information_get_user_account_order_detail_request [AccountInformationGetUserAccountOrderDetailRequest]
|
200
200
|
# @param [Hash] opts the optional parameters
|
201
201
|
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
202
|
-
private def cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id,
|
202
|
+
private def cancel_user_account_order_with_http_info_impl(user_id, user_secret, account_id, account_information_get_user_account_order_detail_request, opts = {})
|
203
203
|
if @api_client.config.debugging
|
204
204
|
@api_client.config.logger.debug 'Calling API: TradingApi.cancel_user_account_order ...'
|
205
205
|
end
|
@@ -215,9 +215,9 @@ module SnapTrade
|
|
215
215
|
if @api_client.config.client_side_validation && account_id.nil?
|
216
216
|
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.cancel_user_account_order"
|
217
217
|
end
|
218
|
-
# verify the required parameter '
|
219
|
-
if @api_client.config.client_side_validation &&
|
220
|
-
fail ArgumentError, "Missing the required parameter '
|
218
|
+
# verify the required parameter 'account_information_get_user_account_order_detail_request' is set
|
219
|
+
if @api_client.config.client_side_validation && account_information_get_user_account_order_detail_request.nil?
|
220
|
+
fail ArgumentError, "Missing the required parameter 'account_information_get_user_account_order_detail_request' when calling TradingApi.cancel_user_account_order"
|
221
221
|
end
|
222
222
|
# resource path
|
223
223
|
local_var_path = '/accounts/{accountId}/orders/cancel'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
@@ -241,7 +241,7 @@ module SnapTrade
|
|
241
241
|
form_params = opts[:form_params] || {}
|
242
242
|
|
243
243
|
# http body (model)
|
244
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
244
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(account_information_get_user_account_order_detail_request)
|
245
245
|
|
246
246
|
# return_type
|
247
247
|
return_type = opts[:debug_return_type] || 'AccountOrderRecord'
|
@@ -14,9 +14,10 @@ module SnapTrade
|
|
14
14
|
class ConnectionType
|
15
15
|
READ = "read".freeze
|
16
16
|
TRADE = "trade".freeze
|
17
|
+
TRADE_IF_AVAILABLE = "trade-if-available".freeze
|
17
18
|
|
18
19
|
def self.all_vars
|
19
|
-
@all_vars ||= [READ, TRADE].freeze
|
20
|
+
@all_vars ||= [READ, TRADE, TRADE_IF_AVAILABLE].freeze
|
20
21
|
end
|
21
22
|
|
22
23
|
# Builds the enum from string
|
@@ -25,7 +25,7 @@ module SnapTrade
|
|
25
25
|
# The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the [guide on fixing broken connections](/docs/fix-broken-connections) for more information.
|
26
26
|
attr_accessor :reconnect
|
27
27
|
|
28
|
-
#
|
28
|
+
# Determines connection permissions (default: read) - `read`: Data access only. - `trade`: Data and trading access. - `trade-if-available`: Attempts to establish a trading connection if the brokerage supports it, otherwise falls back to read-only access automatically.
|
29
29
|
attr_accessor :connection_type
|
30
30
|
|
31
31
|
# Sets the connection portal version to render. Currently only v4 is supported and is the default. All other versions are deprecated and will automatically be set to v4.
|
@@ -11,7 +11,7 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# Takes in string value for stop_price and limit_price. stop_price is required, limit_price is optional
|
15
15
|
class StopLoss
|
16
16
|
attr_accessor :stop_price
|
17
17
|
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -158,7 +158,6 @@ require 'snaptrade/models/symbols_quotes_inner'
|
|
158
158
|
require 'snaptrade/models/take_profit'
|
159
159
|
require 'snaptrade/models/time_in_force_strict'
|
160
160
|
require 'snaptrade/models/timeframe'
|
161
|
-
require 'snaptrade/models/trading_cancel_user_account_order_request'
|
162
161
|
require 'snaptrade/models/trading_instrument'
|
163
162
|
require 'snaptrade/models/trading_instrument_type'
|
164
163
|
require 'snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response'
|
@@ -135,7 +135,7 @@ describe 'AccountInformationApi' do
|
|
135
135
|
|
136
136
|
# unit tests for get_user_account_recent_orders
|
137
137
|
# List account recent orders (last 24 hours only)
|
138
|
-
# A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account. 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 Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days By default only returns executed orders, but that can be changed by setting *only_executed* to false **
|
138
|
+
# A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account. 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 Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days By default only returns executed orders, but that can be changed by setting *only_executed* to false **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)**
|
139
139
|
# @param user_id
|
140
140
|
# @param user_secret
|
141
141
|
# @param account_id
|
@@ -70,7 +70,7 @@ describe 'ConnectionsApi' do
|
|
70
70
|
|
71
71
|
# unit tests for refresh_brokerage_authorization
|
72
72
|
# Refresh holdings for a connection
|
73
|
-
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Because of the cost of refreshing a connection, each call to this endpoint incurs
|
73
|
+
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Please contact support before use. Because of the cost of refreshing a connection, 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)**
|
74
74
|
# @param authorization_id
|
75
75
|
# @param user_id
|
76
76
|
# @param user_secret
|
@@ -33,7 +33,7 @@ describe 'TradingApi' do
|
|
33
33
|
# @param user_id
|
34
34
|
# @param user_secret
|
35
35
|
# @param account_id
|
36
|
-
# @param
|
36
|
+
# @param account_information_get_user_account_order_detail_request
|
37
37
|
# @param [Hash] opts the optional parameters
|
38
38
|
# @return [CancelOrderResponse]
|
39
39
|
describe 'cancel_order test' do
|
@@ -48,7 +48,7 @@ describe 'TradingApi' do
|
|
48
48
|
# @param user_id
|
49
49
|
# @param user_secret
|
50
50
|
# @param account_id
|
51
|
-
# @param
|
51
|
+
# @param account_information_get_user_account_order_detail_request
|
52
52
|
# @param [Hash] opts the optional parameters
|
53
53
|
# @return [AccountOrderRecord]
|
54
54
|
describe 'cancel_user_account_order test' do
|
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.
|
4
|
+
version: 2.0.132
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -237,7 +237,6 @@ files:
|
|
237
237
|
- lib/snaptrade/models/take_profit.rb
|
238
238
|
- lib/snaptrade/models/time_in_force_strict.rb
|
239
239
|
- lib/snaptrade/models/timeframe.rb
|
240
|
-
- lib/snaptrade/models/trading_cancel_user_account_order_request.rb
|
241
240
|
- lib/snaptrade/models/trading_instrument.rb
|
242
241
|
- lib/snaptrade/models/trading_instrument_type.rb
|
243
242
|
- lib/snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response.rb
|
@@ -406,7 +405,6 @@ files:
|
|
406
405
|
- spec/models/take_profit_spec.rb
|
407
406
|
- spec/models/time_in_force_strict_spec.rb
|
408
407
|
- spec/models/timeframe_spec.rb
|
409
|
-
- spec/models/trading_cancel_user_account_order_request_spec.rb
|
410
408
|
- spec/models/trading_instrument_spec.rb
|
411
409
|
- spec/models/trading_instrument_type_spec.rb
|
412
410
|
- spec/models/trading_search_cryptocurrency_pair_instruments200_response_spec.rb
|
@@ -595,7 +593,6 @@ test_files:
|
|
595
593
|
- spec/models/option_type_spec.rb
|
596
594
|
- spec/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner_spec.rb
|
597
595
|
- spec/models/validated_trade_body_spec.rb
|
598
|
-
- spec/models/trading_cancel_user_account_order_request_spec.rb
|
599
596
|
- spec/models/underlying_symbol_spec.rb
|
600
597
|
- spec/models/brokerage_authorization_type_read_only_brokerage_spec.rb
|
601
598
|
- spec/models/partner_data_spec.rb
|
@@ -1,217 +0,0 @@
|
|
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 TradingCancelUserAccountOrderRequest
|
15
|
-
# Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
16
|
-
attr_accessor :brokerage_order_id
|
17
|
-
|
18
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
-
def self.attribute_map
|
20
|
-
{
|
21
|
-
:'brokerage_order_id' => :'brokerage_order_id'
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
# Returns all the JSON keys this model knows about
|
26
|
-
def self.acceptable_attributes
|
27
|
-
attribute_map.values
|
28
|
-
end
|
29
|
-
|
30
|
-
# Attribute type mapping.
|
31
|
-
def self.openapi_types
|
32
|
-
{
|
33
|
-
:'brokerage_order_id' => :'String'
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
|
-
# List of attributes with nullable: true
|
38
|
-
def self.openapi_nullable
|
39
|
-
Set.new([
|
40
|
-
])
|
41
|
-
end
|
42
|
-
|
43
|
-
# Initializes the object
|
44
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
45
|
-
def initialize(attributes = {})
|
46
|
-
if (!attributes.is_a?(Hash))
|
47
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::TradingCancelUserAccountOrderRequest` initialize method"
|
48
|
-
end
|
49
|
-
|
50
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
51
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
52
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
53
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::TradingCancelUserAccountOrderRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
54
|
-
end
|
55
|
-
h[k.to_sym] = v
|
56
|
-
}
|
57
|
-
|
58
|
-
if attributes.key?(:'brokerage_order_id')
|
59
|
-
self.brokerage_order_id = attributes[:'brokerage_order_id']
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
64
|
-
# @return Array for valid properties with the reasons
|
65
|
-
def list_invalid_properties
|
66
|
-
invalid_properties = Array.new
|
67
|
-
invalid_properties
|
68
|
-
end
|
69
|
-
|
70
|
-
# Check to see if the all the properties in the model are valid
|
71
|
-
# @return true if the model is valid
|
72
|
-
def valid?
|
73
|
-
true
|
74
|
-
end
|
75
|
-
|
76
|
-
# Checks equality by comparing each attribute.
|
77
|
-
# @param [Object] Object to be compared
|
78
|
-
def ==(o)
|
79
|
-
return true if self.equal?(o)
|
80
|
-
self.class == o.class &&
|
81
|
-
brokerage_order_id == o.brokerage_order_id
|
82
|
-
end
|
83
|
-
|
84
|
-
# @see the `==` method
|
85
|
-
# @param [Object] Object to be compared
|
86
|
-
def eql?(o)
|
87
|
-
self == o
|
88
|
-
end
|
89
|
-
|
90
|
-
# Calculates hash code according to all attributes.
|
91
|
-
# @return [Integer] Hash code
|
92
|
-
def hash
|
93
|
-
[brokerage_order_id].hash
|
94
|
-
end
|
95
|
-
|
96
|
-
# Builds the object from hash
|
97
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
98
|
-
# @return [Object] Returns the model itself
|
99
|
-
def self.build_from_hash(attributes)
|
100
|
-
new.build_from_hash(attributes)
|
101
|
-
end
|
102
|
-
|
103
|
-
# Builds the object from hash
|
104
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
-
# @return [Object] Returns the model itself
|
106
|
-
def build_from_hash(attributes)
|
107
|
-
return nil unless attributes.is_a?(Hash)
|
108
|
-
attributes = attributes.transform_keys(&:to_sym)
|
109
|
-
self.class.openapi_types.each_pair do |key, type|
|
110
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
111
|
-
self.send("#{key}=", nil)
|
112
|
-
elsif type =~ /\AArray<(.*)>/i
|
113
|
-
# check to ensure the input is an array given that the attribute
|
114
|
-
# is documented as an array but the input is not
|
115
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
116
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
117
|
-
end
|
118
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
119
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
self
|
124
|
-
end
|
125
|
-
|
126
|
-
# Deserializes the data based on type
|
127
|
-
# @param string type Data type
|
128
|
-
# @param string value Value to be deserialized
|
129
|
-
# @return [Object] Deserialized data
|
130
|
-
def _deserialize(type, value)
|
131
|
-
case type.to_sym
|
132
|
-
when :Time
|
133
|
-
Time.parse(value)
|
134
|
-
when :Date
|
135
|
-
Date.parse(value)
|
136
|
-
when :String
|
137
|
-
value.to_s
|
138
|
-
when :Integer
|
139
|
-
value.to_i
|
140
|
-
when :Float
|
141
|
-
value.to_f
|
142
|
-
when :Boolean
|
143
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
144
|
-
true
|
145
|
-
else
|
146
|
-
false
|
147
|
-
end
|
148
|
-
when :Object
|
149
|
-
# generic object (usually a Hash), return directly
|
150
|
-
value
|
151
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
152
|
-
inner_type = Regexp.last_match[:inner_type]
|
153
|
-
value.map { |v| _deserialize(inner_type, v) }
|
154
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
155
|
-
k_type = Regexp.last_match[:k_type]
|
156
|
-
v_type = Regexp.last_match[:v_type]
|
157
|
-
{}.tap do |hash|
|
158
|
-
value.each do |k, v|
|
159
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
else # model
|
163
|
-
# models (e.g. Pet) or oneOf
|
164
|
-
klass = SnapTrade.const_get(type)
|
165
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
# Returns the string representation of the object
|
170
|
-
# @return [String] String presentation of the object
|
171
|
-
def to_s
|
172
|
-
to_hash.to_s
|
173
|
-
end
|
174
|
-
|
175
|
-
# to_body is an alias to to_hash (backward compatibility)
|
176
|
-
# @return [Hash] Returns the object in the form of hash
|
177
|
-
def to_body
|
178
|
-
to_hash
|
179
|
-
end
|
180
|
-
|
181
|
-
# Returns the object in the form of hash
|
182
|
-
# @return [Hash] Returns the object in the form of hash
|
183
|
-
def to_hash
|
184
|
-
hash = {}
|
185
|
-
self.class.attribute_map.each_pair do |attr, param|
|
186
|
-
value = self.send(attr)
|
187
|
-
if value.nil?
|
188
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
189
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
190
|
-
end
|
191
|
-
|
192
|
-
hash[param] = _to_hash(value)
|
193
|
-
end
|
194
|
-
hash
|
195
|
-
end
|
196
|
-
|
197
|
-
# Outputs non-array value in the form of hash
|
198
|
-
# For object, use to_hash. Otherwise, just return the value
|
199
|
-
# @param [Object] value Any valid value
|
200
|
-
# @return [Hash] Returns the value in the form of hash
|
201
|
-
def _to_hash(value)
|
202
|
-
if value.is_a?(Array)
|
203
|
-
value.compact.map { |v| _to_hash(v) }
|
204
|
-
elsif value.is_a?(Hash)
|
205
|
-
{}.tap do |hash|
|
206
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
207
|
-
end
|
208
|
-
elsif value.respond_to? :to_hash
|
209
|
-
value.to_hash
|
210
|
-
else
|
211
|
-
value
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
end
|
216
|
-
|
217
|
-
end
|
@@ -1,29 +0,0 @@
|
|
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::TradingCancelUserAccountOrderRequest
|
15
|
-
describe SnapTrade::TradingCancelUserAccountOrderRequest do
|
16
|
-
let(:instance) { SnapTrade::TradingCancelUserAccountOrderRequest.new }
|
17
|
-
|
18
|
-
describe 'test an instance of TradingCancelUserAccountOrderRequest' do
|
19
|
-
it 'should create an instance of TradingCancelUserAccountOrderRequest' do
|
20
|
-
expect(instance).to be_instance_of(SnapTrade::TradingCancelUserAccountOrderRequest)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
describe 'test attribute "brokerage_order_id"' 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
|
-
end
|