snaptrade 2.0.14 → 2.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +19 -17
- data/README.md +33 -55
- data/lib/snaptrade/api/account_information_api.rb +44 -0
- data/lib/snaptrade/api/authentication_api.rb +24 -0
- data/lib/snaptrade/api/reference_data_api.rb +16 -0
- data/lib/snaptrade/api/trading_api.rb +14 -114
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +0 -1
- data/spec/api/account_information_api_spec.rb +6 -0
- data/spec/api/authentication_api_spec.rb +3 -0
- data/spec/api/reference_data_api_spec.rb +2 -0
- data/spec/api/trading_api_spec.rb +2 -13
- metadata +3 -6
- data/lib/snaptrade/models/trading_place_oco_order_request.rb +0 -229
- data/spec/models/trading_place_oco_order_request_spec.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 637abf7203f1d51cb78a3589aabb665849863b360711a1c3b3fc8d8a010506f2
|
4
|
+
data.tar.gz: fed0e30bbdf6c59ff9468490e238efd3897669c13b857774cf7941af562062b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbc70ee35f670dbe9a00990ebdfb656ef15ecb28615147bb4f07ddfa502fdc92716d95e71d17c9907ee41f40bfd1924bd63626c3346ff6445087e84469e52156
|
7
|
+
data.tar.gz: 83fa560986aad17fed2f975e38116371a550f24d886fda46390dacab5c72c007122b23e8a296a13e6c3197bc6840a3495511b3cab277a88012b7851920c773d0
|
data/Gemfile.lock
CHANGED
@@ -9,40 +9,42 @@ GEM
|
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
ast (2.4.2)
|
12
|
+
base64 (0.1.1)
|
12
13
|
byebug (11.1.3)
|
13
14
|
coderay (1.1.3)
|
14
15
|
debug (1.8.0)
|
15
16
|
irb (>= 1.5.0)
|
16
17
|
reline (>= 0.3.1)
|
17
18
|
diff-lcs (1.5.0)
|
18
|
-
faraday (2.
|
19
|
-
|
19
|
+
faraday (2.7.11)
|
20
|
+
base64
|
21
|
+
faraday-net_http (>= 2.0, < 3.1)
|
22
|
+
ruby2_keywords (>= 0.0.4)
|
20
23
|
faraday-multipart (1.0.4)
|
21
24
|
multipart-post (~> 2)
|
22
|
-
faraday-net_http (3.
|
23
|
-
net-http
|
25
|
+
faraday-net_http (3.0.2)
|
24
26
|
io-console (0.6.0)
|
25
27
|
irb (1.6.4)
|
26
28
|
reline (>= 0.3.0)
|
27
29
|
method_source (1.0.0)
|
28
|
-
multipart-post (2.
|
29
|
-
net-http (0.4.1)
|
30
|
-
uri
|
30
|
+
multipart-post (2.3.0)
|
31
31
|
parallel (1.23.0)
|
32
|
-
parser (3.2.2.
|
32
|
+
parser (3.2.2.3)
|
33
33
|
ast (~> 2.4.1)
|
34
|
+
racc
|
34
35
|
pry (0.14.2)
|
35
36
|
coderay (~> 1.1)
|
36
37
|
method_source (~> 1.0)
|
37
38
|
pry-byebug (3.10.1)
|
38
39
|
byebug (~> 11.0)
|
39
40
|
pry (>= 0.13, < 0.15)
|
41
|
+
racc (1.7.1)
|
40
42
|
rainbow (3.1.1)
|
41
43
|
rake (13.0.6)
|
42
|
-
regexp_parser (2.8.
|
43
|
-
reline (0.3.
|
44
|
+
regexp_parser (2.8.1)
|
45
|
+
reline (0.3.8)
|
44
46
|
io-console (~> 0.5)
|
45
|
-
rexml (3.2.
|
47
|
+
rexml (3.2.6)
|
46
48
|
rspec (3.12.0)
|
47
49
|
rspec-core (~> 3.12.0)
|
48
50
|
rspec-expectations (~> 3.12.0)
|
@@ -52,10 +54,10 @@ GEM
|
|
52
54
|
rspec-expectations (3.12.3)
|
53
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
54
56
|
rspec-support (~> 3.12.0)
|
55
|
-
rspec-mocks (3.12.
|
57
|
+
rspec-mocks (3.12.6)
|
56
58
|
diff-lcs (>= 1.2.0, < 2.0)
|
57
59
|
rspec-support (~> 3.12.0)
|
58
|
-
rspec-support (3.12.
|
60
|
+
rspec-support (3.12.1)
|
59
61
|
rubocop (1.12.1)
|
60
62
|
parallel (~> 1.10)
|
61
63
|
parser (>= 3.0.0.0)
|
@@ -65,14 +67,14 @@ GEM
|
|
65
67
|
rubocop-ast (>= 1.2.0, < 2.0)
|
66
68
|
ruby-progressbar (~> 1.7)
|
67
69
|
unicode-display_width (>= 1.4.0, < 3.0)
|
68
|
-
rubocop-ast (1.
|
70
|
+
rubocop-ast (1.29.0)
|
69
71
|
parser (>= 3.2.1.0)
|
70
72
|
ruby-progressbar (1.13.0)
|
73
|
+
ruby2_keywords (0.0.5)
|
71
74
|
unicode-display_width (2.4.2)
|
72
|
-
uri (0.13.0)
|
73
75
|
|
74
76
|
PLATFORMS
|
75
|
-
arm64-darwin-
|
77
|
+
arm64-darwin-22
|
76
78
|
|
77
79
|
DEPENDENCIES
|
78
80
|
debug (~> 1.8)
|
@@ -84,4 +86,4 @@ DEPENDENCIES
|
|
84
86
|
snaptrade!
|
85
87
|
|
86
88
|
BUNDLED WITH
|
87
|
-
2.
|
89
|
+
2.4.19
|
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.
|
9
|
+
[![npm](https://img.shields.io/badge/gem-v2.0.15-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.15)
|
10
10
|
[![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -58,7 +58,6 @@ Connect brokerage accounts to your app for live positions and trading
|
|
58
58
|
* [`snaptrade.trading.get_order_impact`](#snaptradetradingget_order_impact)
|
59
59
|
* [`snaptrade.trading.get_user_account_quotes`](#snaptradetradingget_user_account_quotes)
|
60
60
|
* [`snaptrade.trading.place_force_order`](#snaptradetradingplace_force_order)
|
61
|
-
* [`snaptrade.trading.place_oco_order`](#snaptradetradingplace_oco_order)
|
62
61
|
* [`snaptrade.trading.place_order`](#snaptradetradingplace_order)
|
63
62
|
* [`snaptrade.transactions_and_reporting.get_activities`](#snaptradetransactions_and_reportingget_activities)
|
64
63
|
* [`snaptrade.transactions_and_reporting.get_reporting_custom_range`](#snaptradetransactions_and_reportingget_reporting_custom_range)
|
@@ -70,7 +69,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
70
69
|
Add to Gemfile:
|
71
70
|
|
72
71
|
```ruby
|
73
|
-
gem 'snaptrade', '~> 2.0.
|
72
|
+
gem 'snaptrade', '~> 2.0.15'
|
74
73
|
```
|
75
74
|
|
76
75
|
## Getting Started<a id="getting-started"></a>
|
@@ -111,7 +110,9 @@ p.result[3] # [Faraday::Response] Raw HTTP response
|
|
111
110
|
|
112
111
|
### `snaptrade.account_information.get_all_user_holdings`<a id="snaptradeaccount_informationget_all_user_holdings"></a>
|
113
112
|
|
114
|
-
|
113
|
+
Lists balances, positions and orders for the specified account. The data returned is similar to
|
114
|
+
the data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
115
|
+
|
115
116
|
|
116
117
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
117
118
|
|
@@ -182,7 +183,9 @@ The ID of the account to get balances.
|
|
182
183
|
|
183
184
|
### `snaptrade.account_information.get_user_account_details`<a id="snaptradeaccount_informationget_user_account_details"></a>
|
184
185
|
|
185
|
-
|
186
|
+
Returns an account object with details for the specified account,
|
187
|
+
including the total account market value.
|
188
|
+
|
186
189
|
|
187
190
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
188
191
|
|
@@ -261,7 +264,7 @@ Number of days in the past to fetch the most recent orders. Defaults to the last
|
|
261
264
|
|
262
265
|
### `snaptrade.account_information.get_user_account_positions`<a id="snaptradeaccount_informationget_user_account_positions"></a>
|
263
266
|
|
264
|
-
|
267
|
+
Returns a list of positions in the the specified account.
|
265
268
|
|
266
269
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
267
270
|
|
@@ -296,7 +299,10 @@ The ID of the account to get positions.
|
|
296
299
|
|
297
300
|
### `snaptrade.account_information.get_user_holdings`<a id="snaptradeaccount_informationget_user_holdings"></a>
|
298
301
|
|
299
|
-
|
302
|
+
Lists balances, positions and orders for the specified account as well as
|
303
|
+
option_positions and account metadata. The data returned is similar to the
|
304
|
+
data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
305
|
+
|
300
306
|
|
301
307
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
302
308
|
|
@@ -331,7 +337,7 @@ The ID of the account to fetch holdings for.
|
|
331
337
|
|
332
338
|
### `snaptrade.account_information.list_user_accounts`<a id="snaptradeaccount_informationlist_user_accounts"></a>
|
333
339
|
|
334
|
-
|
340
|
+
Get a list of all Account objects for the authenticated SnapTrade user.
|
335
341
|
|
336
342
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
337
343
|
|
@@ -362,7 +368,7 @@ p result
|
|
362
368
|
|
363
369
|
### `snaptrade.account_information.update_user_account`<a id="snaptradeaccount_informationupdate_user_account"></a>
|
364
370
|
|
365
|
-
|
371
|
+
Updates various properties of a specified account.
|
366
372
|
|
367
373
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
368
374
|
|
@@ -450,7 +456,9 @@ p result
|
|
450
456
|
|
451
457
|
### `snaptrade.authentication.get_user_jwt`<a id="snaptradeauthenticationget_user_jwt"></a>
|
452
458
|
|
453
|
-
|
459
|
+
This API is available to ClientIDs which have opted to use encrypted
|
460
|
+
JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
461
|
+
|
454
462
|
|
455
463
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
456
464
|
|
@@ -559,7 +567,9 @@ Sets the version of the connection portal to render, with a default to 'v2'
|
|
559
567
|
|
560
568
|
### `snaptrade.authentication.register_snap_trade_user`<a id="snaptradeauthenticationregister_snap_trade_user"></a>
|
561
569
|
|
562
|
-
|
570
|
+
Registers a new SnapTrade user under your ClientID.
|
571
|
+
Most SnapTrade operations require a user to be passed as a parameter.
|
572
|
+
|
563
573
|
|
564
574
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
565
575
|
|
@@ -591,7 +601,9 @@ it's unique to a user
|
|
591
601
|
|
592
602
|
### `snaptrade.authentication.reset_snap_trade_user_secret`<a id="snaptradeauthenticationreset_snap_trade_user_secret"></a>
|
593
603
|
|
594
|
-
|
604
|
+
This API is used to generate a new secret for a SnapTrade user. You might use this if a userSecret
|
605
|
+
is comprimised or lost among other reasons.
|
606
|
+
|
595
607
|
|
596
608
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
597
609
|
|
@@ -1007,7 +1019,7 @@ A currency pair based on currency code for example, {CAD-USD}
|
|
1007
1019
|
|
1008
1020
|
### `snaptrade.reference_data.get_partner_info`<a id="snaptradereference_dataget_partner_info"></a>
|
1009
1021
|
|
1010
|
-
|
1022
|
+
Returns useful data related to the specified ClientID, including allowed brokerages and data access.
|
1011
1023
|
|
1012
1024
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1013
1025
|
|
@@ -1242,7 +1254,10 @@ p result
|
|
1242
1254
|
|
1243
1255
|
### `snaptrade.reference_data.symbol_search_user_account`<a id="snaptradereference_datasymbol_search_user_account"></a>
|
1244
1256
|
|
1245
|
-
|
1257
|
+
Returns a list of universal symbols that are supported by
|
1258
|
+
the specificied account. Returned symbols are based on the
|
1259
|
+
provided search string, matching on ticker and name.
|
1260
|
+
|
1246
1261
|
|
1247
1262
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1248
1263
|
|
@@ -1279,7 +1294,9 @@ The ID of the account to search for symbols within.
|
|
1279
1294
|
|
1280
1295
|
### `snaptrade.trading.cancel_user_account_order`<a id="snaptradetradingcancel_user_account_order"></a>
|
1281
1296
|
|
1282
|
-
|
1297
|
+
Sends a signal to the brokerage to cancel the specified order.
|
1298
|
+
This will only work if the order has not yet been executed.
|
1299
|
+
|
1283
1300
|
|
1284
1301
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1285
1302
|
|
@@ -1376,7 +1393,7 @@ Canceled
|
|
1376
1393
|
|
1377
1394
|
### `snaptrade.trading.get_user_account_quotes`<a id="snaptradetradingget_user_account_quotes"></a>
|
1378
1395
|
|
1379
|
-
|
1396
|
+
Returns live quote(s) from the brokerage for the specified symbol(s).
|
1380
1397
|
|
1381
1398
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1382
1399
|
|
@@ -1477,45 +1494,6 @@ Canceled
|
|
1477
1494
|
---
|
1478
1495
|
|
1479
1496
|
|
1480
|
-
### `snaptrade.trading.place_oco_order`<a id="snaptradetradingplace_oco_order"></a>
|
1481
|
-
|
1482
|
-
Place a OCO (One Cancels Other) order
|
1483
|
-
|
1484
|
-
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1485
|
-
|
1486
|
-
```ruby
|
1487
|
-
result = snaptrade.trading.place_oco_order(
|
1488
|
-
user_id: "John.doe@snaptrade.com",
|
1489
|
-
user_secret: "USERSECRET123",
|
1490
|
-
first_trade_id: None,
|
1491
|
-
second_trade_id: None,
|
1492
|
-
)
|
1493
|
-
p result
|
1494
|
-
```
|
1495
|
-
|
1496
|
-
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1497
|
-
|
1498
|
-
##### user_id: `String`<a id="user_id-string"></a>
|
1499
|
-
##### user_secret: `String`<a id="user_secret-string"></a>
|
1500
|
-
##### first_trade_id: `Object`<a id="first_trade_id-object"></a>
|
1501
|
-
The ID of first trade object obtained from trade/impact endpoint
|
1502
|
-
|
1503
|
-
##### second_trade_id: `Object`<a id="second_trade_id-object"></a>
|
1504
|
-
The ID of second trade object obtained from trade/impact endpoint
|
1505
|
-
|
1506
|
-
#### 🔄 Return<a id="🔄-return"></a>
|
1507
|
-
|
1508
|
-
[AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
|
1509
|
-
|
1510
|
-
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
1511
|
-
|
1512
|
-
`/trade/oco` `POST`
|
1513
|
-
|
1514
|
-
[🔙 **Back to Table of Contents**](#table-of-contents)
|
1515
|
-
|
1516
|
-
---
|
1517
|
-
|
1518
|
-
|
1519
1497
|
### `snaptrade.trading.place_order`<a id="snaptradetradingplace_order"></a>
|
1520
1498
|
|
1521
1499
|
Place order
|
@@ -19,6 +19,9 @@ module SnapTrade
|
|
19
19
|
|
20
20
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
21
21
|
#
|
22
|
+
# Lists balances, positions and orders for the specified account. The data returned is similar to
|
23
|
+
# the data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
24
|
+
#
|
22
25
|
# @param user_id [String]
|
23
26
|
# @param user_secret [String]
|
24
27
|
# @param brokerage_authorizations [String] Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations).
|
@@ -31,6 +34,9 @@ module SnapTrade
|
|
31
34
|
|
32
35
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
33
36
|
#
|
37
|
+
# Lists balances, positions and orders for the specified account. The data returned is similar to
|
38
|
+
# the data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
39
|
+
#
|
34
40
|
# @param user_id [String]
|
35
41
|
# @param user_secret [String]
|
36
42
|
# @param brokerage_authorizations [String] Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations).
|
@@ -41,6 +47,7 @@ module SnapTrade
|
|
41
47
|
end
|
42
48
|
|
43
49
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
50
|
+
# Lists balances, positions and orders for the specified account. The data returned is similar to the data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
44
51
|
# @param user_id [String]
|
45
52
|
# @param user_secret [String]
|
46
53
|
# @param [Hash] opts the optional parameters
|
@@ -52,6 +59,7 @@ module SnapTrade
|
|
52
59
|
end
|
53
60
|
|
54
61
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
62
|
+
# Lists balances, positions and orders for the specified account. The data returned is similar to the data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
55
63
|
# @param user_id [String]
|
56
64
|
# @param user_secret [String]
|
57
65
|
# @param [Hash] opts the optional parameters
|
@@ -218,6 +226,9 @@ module SnapTrade
|
|
218
226
|
|
219
227
|
# Return details of a specific investment account
|
220
228
|
#
|
229
|
+
# Returns an account object with details for the specified account,
|
230
|
+
# including the total account market value.
|
231
|
+
#
|
221
232
|
# @param user_id [String]
|
222
233
|
# @param user_secret [String]
|
223
234
|
# @param account_id [String] The ID of the account to get detail of.
|
@@ -229,6 +240,9 @@ module SnapTrade
|
|
229
240
|
|
230
241
|
# Return details of a specific investment account
|
231
242
|
#
|
243
|
+
# Returns an account object with details for the specified account,
|
244
|
+
# including the total account market value.
|
245
|
+
#
|
232
246
|
# @param user_id [String]
|
233
247
|
# @param user_secret [String]
|
234
248
|
# @param account_id [String] The ID of the account to get detail of.
|
@@ -238,6 +252,7 @@ module SnapTrade
|
|
238
252
|
end
|
239
253
|
|
240
254
|
# Return details of a specific investment account
|
255
|
+
# Returns an account object with details for the specified account, including the total account market value.
|
241
256
|
# @param user_id [String]
|
242
257
|
# @param user_secret [String]
|
243
258
|
# @param account_id [String] The ID of the account to get detail of.
|
@@ -249,6 +264,7 @@ module SnapTrade
|
|
249
264
|
end
|
250
265
|
|
251
266
|
# Return details of a specific investment account
|
267
|
+
# Returns an account object with details for the specified account, including the total account market value.
|
252
268
|
# @param user_id [String]
|
253
269
|
# @param user_secret [String]
|
254
270
|
# @param account_id [String] The ID of the account to get detail of.
|
@@ -440,6 +456,8 @@ module SnapTrade
|
|
440
456
|
|
441
457
|
# List account positions
|
442
458
|
#
|
459
|
+
# Returns a list of positions in the the specified account.
|
460
|
+
#
|
443
461
|
# @param user_id [String]
|
444
462
|
# @param user_secret [String]
|
445
463
|
# @param account_id [String] The ID of the account to get positions.
|
@@ -451,6 +469,8 @@ module SnapTrade
|
|
451
469
|
|
452
470
|
# List account positions
|
453
471
|
#
|
472
|
+
# Returns a list of positions in the the specified account.
|
473
|
+
#
|
454
474
|
# @param user_id [String]
|
455
475
|
# @param user_secret [String]
|
456
476
|
# @param account_id [String] The ID of the account to get positions.
|
@@ -460,6 +480,7 @@ module SnapTrade
|
|
460
480
|
end
|
461
481
|
|
462
482
|
# List account positions
|
483
|
+
# Returns a list of positions in the the specified account.
|
463
484
|
# @param user_id [String]
|
464
485
|
# @param user_secret [String]
|
465
486
|
# @param account_id [String] The ID of the account to get positions.
|
@@ -471,6 +492,7 @@ module SnapTrade
|
|
471
492
|
end
|
472
493
|
|
473
494
|
# List account positions
|
495
|
+
# Returns a list of positions in the the specified account.
|
474
496
|
# @param user_id [String]
|
475
497
|
# @param user_secret [String]
|
476
498
|
# @param account_id [String] The ID of the account to get positions.
|
@@ -537,6 +559,10 @@ module SnapTrade
|
|
537
559
|
|
538
560
|
# List balances, positions and orders for the specified account
|
539
561
|
#
|
562
|
+
# Lists balances, positions and orders for the specified account as well as
|
563
|
+
# option_positions and account metadata. The data returned is similar to the
|
564
|
+
# data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
565
|
+
#
|
540
566
|
# @param account_id [String] The ID of the account to fetch holdings for.
|
541
567
|
# @param user_id [String]
|
542
568
|
# @param user_secret [String]
|
@@ -548,6 +574,10 @@ module SnapTrade
|
|
548
574
|
|
549
575
|
# List balances, positions and orders for the specified account
|
550
576
|
#
|
577
|
+
# Lists balances, positions and orders for the specified account as well as
|
578
|
+
# option_positions and account metadata. The data returned is similar to the
|
579
|
+
# data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
580
|
+
#
|
551
581
|
# @param account_id [String] The ID of the account to fetch holdings for.
|
552
582
|
# @param user_id [String]
|
553
583
|
# @param user_secret [String]
|
@@ -557,6 +587,7 @@ module SnapTrade
|
|
557
587
|
end
|
558
588
|
|
559
589
|
# List balances, positions and orders for the specified account
|
590
|
+
# Lists balances, positions and orders for the specified account as well as option_positions and account metadata. The data returned is similar to the data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
560
591
|
# @param account_id [String] The ID of the account to fetch holdings for.
|
561
592
|
# @param user_id [String]
|
562
593
|
# @param user_secret [String]
|
@@ -568,6 +599,7 @@ module SnapTrade
|
|
568
599
|
end
|
569
600
|
|
570
601
|
# List balances, positions and orders for the specified account
|
602
|
+
# Lists balances, positions and orders for the specified account as well as option_positions and account metadata. The data returned is similar to the data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
571
603
|
# @param account_id [String] The ID of the account to fetch holdings for.
|
572
604
|
# @param user_id [String]
|
573
605
|
# @param user_secret [String]
|
@@ -634,6 +666,8 @@ module SnapTrade
|
|
634
666
|
|
635
667
|
# List accounts
|
636
668
|
#
|
669
|
+
# Get a list of all Account objects for the authenticated SnapTrade user.
|
670
|
+
#
|
637
671
|
# @param user_id [String]
|
638
672
|
# @param user_secret [String]
|
639
673
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -644,6 +678,8 @@ module SnapTrade
|
|
644
678
|
|
645
679
|
# List accounts
|
646
680
|
#
|
681
|
+
# Get a list of all Account objects for the authenticated SnapTrade user.
|
682
|
+
#
|
647
683
|
# @param user_id [String]
|
648
684
|
# @param user_secret [String]
|
649
685
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -652,6 +688,7 @@ module SnapTrade
|
|
652
688
|
end
|
653
689
|
|
654
690
|
# List accounts
|
691
|
+
# Get a list of all Account objects for the authenticated SnapTrade user.
|
655
692
|
# @param user_id [String]
|
656
693
|
# @param user_secret [String]
|
657
694
|
# @param [Hash] opts the optional parameters
|
@@ -662,6 +699,7 @@ module SnapTrade
|
|
662
699
|
end
|
663
700
|
|
664
701
|
# List accounts
|
702
|
+
# Get a list of all Account objects for the authenticated SnapTrade user.
|
665
703
|
# @param user_id [String]
|
666
704
|
# @param user_secret [String]
|
667
705
|
# @param [Hash] opts the optional parameters
|
@@ -723,6 +761,8 @@ module SnapTrade
|
|
723
761
|
|
724
762
|
# Update details of an investment account
|
725
763
|
#
|
764
|
+
# Updates various properties of a specified account.
|
765
|
+
#
|
726
766
|
# @param user_id [String]
|
727
767
|
# @param user_secret [String]
|
728
768
|
# @param account_id [String] The ID of the account to update.
|
@@ -734,6 +774,8 @@ module SnapTrade
|
|
734
774
|
|
735
775
|
# Update details of an investment account
|
736
776
|
#
|
777
|
+
# Updates various properties of a specified account.
|
778
|
+
#
|
737
779
|
# @param user_id [String]
|
738
780
|
# @param user_secret [String]
|
739
781
|
# @param account_id [String] The ID of the account to update.
|
@@ -743,6 +785,7 @@ module SnapTrade
|
|
743
785
|
end
|
744
786
|
|
745
787
|
# Update details of an investment account
|
788
|
+
# Updates various properties of a specified account.
|
746
789
|
# @param user_id [String]
|
747
790
|
# @param user_secret [String]
|
748
791
|
# @param account_id [String] The ID of the account to update.
|
@@ -754,6 +797,7 @@ module SnapTrade
|
|
754
797
|
end
|
755
798
|
|
756
799
|
# Update details of an investment account
|
800
|
+
# Updates various properties of a specified account.
|
757
801
|
# @param user_id [String]
|
758
802
|
# @param user_secret [String]
|
759
803
|
# @param account_id [String] The ID of the account to update.
|
@@ -105,6 +105,9 @@ module SnapTrade
|
|
105
105
|
|
106
106
|
# Generate encrypted JWT token
|
107
107
|
#
|
108
|
+
# This API is available to ClientIDs which have opted to use encrypted
|
109
|
+
# JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
110
|
+
#
|
108
111
|
# @param user_id [String]
|
109
112
|
# @param user_secret [String]
|
110
113
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -115,6 +118,9 @@ module SnapTrade
|
|
115
118
|
|
116
119
|
# Generate encrypted JWT token
|
117
120
|
#
|
121
|
+
# This API is available to ClientIDs which have opted to use encrypted
|
122
|
+
# JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
123
|
+
#
|
118
124
|
# @param user_id [String]
|
119
125
|
# @param user_secret [String]
|
120
126
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -123,6 +129,7 @@ module SnapTrade
|
|
123
129
|
end
|
124
130
|
|
125
131
|
# Generate encrypted JWT token
|
132
|
+
# This API is available to ClientIDs which have opted to use encrypted JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
126
133
|
# @param user_id [String]
|
127
134
|
# @param user_secret [String]
|
128
135
|
# @param [Hash] opts the optional parameters
|
@@ -133,6 +140,7 @@ module SnapTrade
|
|
133
140
|
end
|
134
141
|
|
135
142
|
# Generate encrypted JWT token
|
143
|
+
# This API is available to ClientIDs which have opted to use encrypted JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
136
144
|
# @param user_id [String]
|
137
145
|
# @param user_secret [String]
|
138
146
|
# @param [Hash] opts the optional parameters
|
@@ -403,6 +411,9 @@ module SnapTrade
|
|
403
411
|
|
404
412
|
# Create SnapTrade user
|
405
413
|
#
|
414
|
+
# Registers a new SnapTrade user under your ClientID.
|
415
|
+
# Most SnapTrade operations require a user to be passed as a parameter.
|
416
|
+
#
|
406
417
|
# @param user_id [String] SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
|
407
418
|
# @param body [SnapTradeRegisterUserRequestBody]
|
408
419
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -416,6 +427,9 @@ module SnapTrade
|
|
416
427
|
|
417
428
|
# Create SnapTrade user
|
418
429
|
#
|
430
|
+
# Registers a new SnapTrade user under your ClientID.
|
431
|
+
# Most SnapTrade operations require a user to be passed as a parameter.
|
432
|
+
#
|
419
433
|
# @param user_id [String] SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
|
420
434
|
# @param body [SnapTradeRegisterUserRequestBody]
|
421
435
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -427,6 +441,7 @@ module SnapTrade
|
|
427
441
|
end
|
428
442
|
|
429
443
|
# Create SnapTrade user
|
444
|
+
# Registers a new SnapTrade user under your ClientID. Most SnapTrade operations require a user to be passed as a parameter.
|
430
445
|
# @param snap_trade_register_user_request_body [SnapTradeRegisterUserRequestBody]
|
431
446
|
# @param [Hash] opts the optional parameters
|
432
447
|
# @return [UserIDandSecret]
|
@@ -436,6 +451,7 @@ module SnapTrade
|
|
436
451
|
end
|
437
452
|
|
438
453
|
# Create SnapTrade user
|
454
|
+
# Registers a new SnapTrade user under your ClientID. Most SnapTrade operations require a user to be passed as a parameter.
|
439
455
|
# @param snap_trade_register_user_request_body [SnapTradeRegisterUserRequestBody]
|
440
456
|
# @param [Hash] opts the optional parameters
|
441
457
|
# @return [Array<(UserIDandSecret, Integer, Hash)>] UserIDandSecret data, response status code and response headers
|
@@ -495,6 +511,9 @@ module SnapTrade
|
|
495
511
|
|
496
512
|
# Obtain a new user secret for a user
|
497
513
|
#
|
514
|
+
# This API is used to generate a new secret for a SnapTrade user. You might use this if a userSecret
|
515
|
+
# is comprimised or lost among other reasons.
|
516
|
+
#
|
498
517
|
# @param user_id [String] SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
|
499
518
|
# @param user_secret [String] SnapTrade User Secret randomly generated by SnapTrade. This should be considered priviledged information and if compromised, you should delete and re-create this SnapTrade user.
|
500
519
|
# @param body [UserIDandSecret]
|
@@ -510,6 +529,9 @@ module SnapTrade
|
|
510
529
|
|
511
530
|
# Obtain a new user secret for a user
|
512
531
|
#
|
532
|
+
# This API is used to generate a new secret for a SnapTrade user. You might use this if a userSecret
|
533
|
+
# is comprimised or lost among other reasons.
|
534
|
+
#
|
513
535
|
# @param user_id [String] SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user
|
514
536
|
# @param user_secret [String] SnapTrade User Secret randomly generated by SnapTrade. This should be considered priviledged information and if compromised, you should delete and re-create this SnapTrade user.
|
515
537
|
# @param body [UserIDandSecret]
|
@@ -523,6 +545,7 @@ module SnapTrade
|
|
523
545
|
end
|
524
546
|
|
525
547
|
# Obtain a new user secret for a user
|
548
|
+
# This API is used to generate a new secret for a SnapTrade user. You might use this if a userSecret is comprimised or lost among other reasons.
|
526
549
|
# @param user_i_dand_secret [UserIDandSecret]
|
527
550
|
# @param [Hash] opts the optional parameters
|
528
551
|
# @return [UserIDandSecret]
|
@@ -532,6 +555,7 @@ module SnapTrade
|
|
532
555
|
end
|
533
556
|
|
534
557
|
# Obtain a new user secret for a user
|
558
|
+
# This API is used to generate a new secret for a SnapTrade user. You might use this if a userSecret is comprimised or lost among other reasons.
|
535
559
|
# @param user_i_dand_secret [UserIDandSecret]
|
536
560
|
# @param [Hash] opts the optional parameters
|
537
561
|
# @return [Array<(UserIDandSecret, Integer, Hash)>] UserIDandSecret data, response status code and response headers
|
@@ -98,6 +98,8 @@ module SnapTrade
|
|
98
98
|
|
99
99
|
# Get metadata related to Snaptrade partner
|
100
100
|
#
|
101
|
+
# Returns useful data related to the specified ClientID, including allowed brokerages and data access.
|
102
|
+
#
|
101
103
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
102
104
|
def get_partner_info(extra: {})
|
103
105
|
data, _status_code, _headers = get_partner_info_with_http_info_impl(extra)
|
@@ -106,12 +108,15 @@ module SnapTrade
|
|
106
108
|
|
107
109
|
# Get metadata related to Snaptrade partner
|
108
110
|
#
|
111
|
+
# Returns useful data related to the specified ClientID, including allowed brokerages and data access.
|
112
|
+
#
|
109
113
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
110
114
|
def get_partner_info_with_http_info(extra: {})
|
111
115
|
get_partner_info_with_http_info_impl(extra)
|
112
116
|
end
|
113
117
|
|
114
118
|
# Get metadata related to Snaptrade partner
|
119
|
+
# Returns useful data related to the specified ClientID, including allowed brokerages and data access.
|
115
120
|
# @param [Hash] opts the optional parameters
|
116
121
|
# @return [PartnerData]
|
117
122
|
private def get_partner_info_impl(opts = {})
|
@@ -120,6 +125,7 @@ module SnapTrade
|
|
120
125
|
end
|
121
126
|
|
122
127
|
# Get metadata related to Snaptrade partner
|
128
|
+
# Returns useful data related to the specified ClientID, including allowed brokerages and data access.
|
123
129
|
# @param [Hash] opts the optional parameters
|
124
130
|
# @return [Array<(PartnerData, Integer, Hash)>] PartnerData data, response status code and response headers
|
125
131
|
private def get_partner_info_with_http_info_impl(opts = {})
|
@@ -775,6 +781,10 @@ module SnapTrade
|
|
775
781
|
|
776
782
|
# Search for symbols available in an account
|
777
783
|
#
|
784
|
+
# Returns a list of universal symbols that are supported by
|
785
|
+
# the specificied account. Returned symbols are based on the
|
786
|
+
# provided search string, matching on ticker and name.
|
787
|
+
#
|
778
788
|
# @param user_id [String]
|
779
789
|
# @param user_secret [String]
|
780
790
|
# @param account_id [String] The ID of the account to search for symbols within.
|
@@ -791,6 +801,10 @@ module SnapTrade
|
|
791
801
|
|
792
802
|
# Search for symbols available in an account
|
793
803
|
#
|
804
|
+
# Returns a list of universal symbols that are supported by
|
805
|
+
# the specificied account. Returned symbols are based on the
|
806
|
+
# provided search string, matching on ticker and name.
|
807
|
+
#
|
794
808
|
# @param user_id [String]
|
795
809
|
# @param user_secret [String]
|
796
810
|
# @param account_id [String] The ID of the account to search for symbols within.
|
@@ -805,6 +819,7 @@ module SnapTrade
|
|
805
819
|
end
|
806
820
|
|
807
821
|
# Search for symbols available in an account
|
822
|
+
# Returns a list of universal symbols that are supported by the specificied account. Returned symbols are based on the provided search string, matching on ticker and name.
|
808
823
|
# @param user_id [String]
|
809
824
|
# @param user_secret [String]
|
810
825
|
# @param account_id [String] The ID of the account to search for symbols within.
|
@@ -817,6 +832,7 @@ module SnapTrade
|
|
817
832
|
end
|
818
833
|
|
819
834
|
# Search for symbols available in an account
|
835
|
+
# Returns a list of universal symbols that are supported by the specificied account. Returned symbols are based on the provided search string, matching on ticker and name.
|
820
836
|
# @param user_id [String]
|
821
837
|
# @param user_secret [String]
|
822
838
|
# @param account_id [String] The ID of the account to search for symbols within.
|
@@ -19,6 +19,9 @@ module SnapTrade
|
|
19
19
|
|
20
20
|
# Cancel open order in account
|
21
21
|
#
|
22
|
+
# Sends a signal to the brokerage to cancel the specified order.
|
23
|
+
# This will only work if the order has not yet been executed.
|
24
|
+
#
|
22
25
|
# @param user_id [String]
|
23
26
|
# @param user_secret [String]
|
24
27
|
# @param account_id [String] The ID of the account to cancel the order in.
|
@@ -35,6 +38,9 @@ module SnapTrade
|
|
35
38
|
|
36
39
|
# Cancel open order in account
|
37
40
|
#
|
41
|
+
# Sends a signal to the brokerage to cancel the specified order.
|
42
|
+
# This will only work if the order has not yet been executed.
|
43
|
+
#
|
38
44
|
# @param user_id [String]
|
39
45
|
# @param user_secret [String]
|
40
46
|
# @param account_id [String] The ID of the account to cancel the order in.
|
@@ -49,6 +55,7 @@ module SnapTrade
|
|
49
55
|
end
|
50
56
|
|
51
57
|
# Cancel open order in account
|
58
|
+
# Sends a signal to the brokerage to cancel the specified order. This will only work if the order has not yet been executed.
|
52
59
|
# @param user_id [String]
|
53
60
|
# @param user_secret [String]
|
54
61
|
# @param account_id [String] The ID of the account to cancel the order in.
|
@@ -61,6 +68,7 @@ module SnapTrade
|
|
61
68
|
end
|
62
69
|
|
63
70
|
# Cancel open order in account
|
71
|
+
# Sends a signal to the brokerage to cancel the specified order. This will only work if the order has not yet been executed.
|
64
72
|
# @param user_id [String]
|
65
73
|
# @param user_secret [String]
|
66
74
|
# @param account_id [String] The ID of the account to cancel the order in.
|
@@ -279,6 +287,8 @@ module SnapTrade
|
|
279
287
|
|
280
288
|
# Get symbol quotes
|
281
289
|
#
|
290
|
+
# Returns live quote(s) from the brokerage for the specified symbol(s).
|
291
|
+
#
|
282
292
|
# @param user_id [String]
|
283
293
|
# @param user_secret [String]
|
284
294
|
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
@@ -293,6 +303,8 @@ module SnapTrade
|
|
293
303
|
|
294
304
|
# Get symbol quotes
|
295
305
|
#
|
306
|
+
# Returns live quote(s) from the brokerage for the specified symbol(s).
|
307
|
+
#
|
296
308
|
# @param user_id [String]
|
297
309
|
# @param user_secret [String]
|
298
310
|
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
@@ -305,6 +317,7 @@ module SnapTrade
|
|
305
317
|
end
|
306
318
|
|
307
319
|
# Get symbol quotes
|
320
|
+
# Returns live quote(s) from the brokerage for the specified symbol(s).
|
308
321
|
# @param user_id [String]
|
309
322
|
# @param user_secret [String]
|
310
323
|
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
@@ -318,6 +331,7 @@ module SnapTrade
|
|
318
331
|
end
|
319
332
|
|
320
333
|
# Get symbol quotes
|
334
|
+
# Returns live quote(s) from the brokerage for the specified symbol(s).
|
321
335
|
# @param user_id [String]
|
322
336
|
# @param user_secret [String]
|
323
337
|
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
@@ -532,120 +546,6 @@ module SnapTrade
|
|
532
546
|
end
|
533
547
|
|
534
548
|
|
535
|
-
# Place a OCO (One Cancels Other) order
|
536
|
-
#
|
537
|
-
# @param user_id [String]
|
538
|
-
# @param user_secret [String]
|
539
|
-
# @param first_trade_id [Object] The ID of first trade object obtained from trade/impact endpoint
|
540
|
-
# @param second_trade_id [Object] The ID of second trade object obtained from trade/impact endpoint
|
541
|
-
# @param body [TradingPlaceOCOOrderRequest]
|
542
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
543
|
-
def place_oco_order(user_id:, user_secret:, first_trade_id: SENTINEL, second_trade_id: SENTINEL, extra: {})
|
544
|
-
_body = {}
|
545
|
-
_body[:first_trade_id] = first_trade_id if first_trade_id != SENTINEL
|
546
|
-
_body[:second_trade_id] = second_trade_id if second_trade_id != SENTINEL
|
547
|
-
trading_place_oco_order_request = _body
|
548
|
-
data, _status_code, _headers = place_oco_order_with_http_info_impl(user_id, user_secret, trading_place_oco_order_request, extra)
|
549
|
-
data
|
550
|
-
end
|
551
|
-
|
552
|
-
# Place a OCO (One Cancels Other) order
|
553
|
-
#
|
554
|
-
# @param user_id [String]
|
555
|
-
# @param user_secret [String]
|
556
|
-
# @param first_trade_id [Object] The ID of first trade object obtained from trade/impact endpoint
|
557
|
-
# @param second_trade_id [Object] The ID of second trade object obtained from trade/impact endpoint
|
558
|
-
# @param body [TradingPlaceOCOOrderRequest]
|
559
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
560
|
-
def place_oco_order_with_http_info(user_id:, user_secret:, first_trade_id: SENTINEL, second_trade_id: SENTINEL, extra: {})
|
561
|
-
_body = {}
|
562
|
-
_body[:first_trade_id] = first_trade_id if first_trade_id != SENTINEL
|
563
|
-
_body[:second_trade_id] = second_trade_id if second_trade_id != SENTINEL
|
564
|
-
trading_place_oco_order_request = _body
|
565
|
-
place_oco_order_with_http_info_impl(user_id, user_secret, trading_place_oco_order_request, extra)
|
566
|
-
end
|
567
|
-
|
568
|
-
# Place a OCO (One Cancels Other) order
|
569
|
-
# @param user_id [String]
|
570
|
-
# @param user_secret [String]
|
571
|
-
# @param trading_place_oco_order_request [TradingPlaceOCOOrderRequest]
|
572
|
-
# @param [Hash] opts the optional parameters
|
573
|
-
# @return [AccountOrderRecord]
|
574
|
-
private def place_oco_order_impl(user_id, user_secret, trading_place_oco_order_request, opts = {})
|
575
|
-
data, _status_code, _headers = place_oco_order_with_http_info(user_id, user_secret, trading_place_oco_order_request, opts)
|
576
|
-
data
|
577
|
-
end
|
578
|
-
|
579
|
-
# Place a OCO (One Cancels Other) order
|
580
|
-
# @param user_id [String]
|
581
|
-
# @param user_secret [String]
|
582
|
-
# @param trading_place_oco_order_request [TradingPlaceOCOOrderRequest]
|
583
|
-
# @param [Hash] opts the optional parameters
|
584
|
-
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
585
|
-
private def place_oco_order_with_http_info_impl(user_id, user_secret, trading_place_oco_order_request, opts = {})
|
586
|
-
if @api_client.config.debugging
|
587
|
-
@api_client.config.logger.debug 'Calling API: TradingApi.place_oco_order ...'
|
588
|
-
end
|
589
|
-
# verify the required parameter 'user_id' is set
|
590
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
591
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling TradingApi.place_oco_order"
|
592
|
-
end
|
593
|
-
# verify the required parameter 'user_secret' is set
|
594
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
595
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_oco_order"
|
596
|
-
end
|
597
|
-
# verify the required parameter 'trading_place_oco_order_request' is set
|
598
|
-
if @api_client.config.client_side_validation && trading_place_oco_order_request.nil?
|
599
|
-
fail ArgumentError, "Missing the required parameter 'trading_place_oco_order_request' when calling TradingApi.place_oco_order"
|
600
|
-
end
|
601
|
-
# resource path
|
602
|
-
local_var_path = '/trade/oco'
|
603
|
-
|
604
|
-
# query parameters
|
605
|
-
query_params = opts[:query_params] || {}
|
606
|
-
query_params[:'userId'] = user_id
|
607
|
-
query_params[:'userSecret'] = user_secret
|
608
|
-
|
609
|
-
# header parameters
|
610
|
-
header_params = opts[:header_params] || {}
|
611
|
-
# HTTP header 'Accept' (if needed)
|
612
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
613
|
-
# HTTP header 'Content-Type'
|
614
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
615
|
-
if !content_type.nil?
|
616
|
-
header_params['Content-Type'] = content_type
|
617
|
-
end
|
618
|
-
|
619
|
-
# form parameters
|
620
|
-
form_params = opts[:form_params] || {}
|
621
|
-
|
622
|
-
# http body (model)
|
623
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_place_oco_order_request)
|
624
|
-
|
625
|
-
# return_type
|
626
|
-
return_type = opts[:debug_return_type] || 'AccountOrderRecord'
|
627
|
-
|
628
|
-
# auth_names
|
629
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
630
|
-
|
631
|
-
new_options = opts.merge(
|
632
|
-
:operation => :"TradingApi.place_oco_order",
|
633
|
-
:header_params => header_params,
|
634
|
-
:query_params => query_params,
|
635
|
-
:form_params => form_params,
|
636
|
-
:body => post_body,
|
637
|
-
:auth_names => auth_names,
|
638
|
-
:return_type => return_type
|
639
|
-
)
|
640
|
-
|
641
|
-
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
642
|
-
if @api_client.config.debugging
|
643
|
-
@api_client.config.logger.debug "API called: TradingApi#place_oco_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
644
|
-
end
|
645
|
-
return data, status_code, headers, response
|
646
|
-
end
|
647
|
-
|
648
|
-
|
649
549
|
# Place order
|
650
550
|
#
|
651
551
|
# @param trade_id [String] The ID of trade object obtained from trade/impact endpoint
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -137,7 +137,6 @@ require 'snaptrade/models/trade_execution_status'
|
|
137
137
|
require 'snaptrade/models/trade_execution_status_action'
|
138
138
|
require 'snaptrade/models/trade_impact'
|
139
139
|
require 'snaptrade/models/trading_cancel_user_account_order_request'
|
140
|
-
require 'snaptrade/models/trading_place_oco_order_request'
|
141
140
|
require 'snaptrade/models/transactions_status'
|
142
141
|
require 'snaptrade/models/type'
|
143
142
|
require 'snaptrade/models/us_exchange'
|
@@ -29,6 +29,7 @@ describe 'AccountInformationApi' do
|
|
29
29
|
|
30
30
|
# unit tests for get_all_user_holdings
|
31
31
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
32
|
+
# Lists balances, positions and orders for the specified account. The data returned is similar to the data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
32
33
|
# @param user_id
|
33
34
|
# @param user_secret
|
34
35
|
# @param [Hash] opts the optional parameters
|
@@ -56,6 +57,7 @@ describe 'AccountInformationApi' do
|
|
56
57
|
|
57
58
|
# unit tests for get_user_account_details
|
58
59
|
# Return details of a specific investment account
|
60
|
+
# Returns an account object with details for the specified account, including the total account market value.
|
59
61
|
# @param user_id
|
60
62
|
# @param user_secret
|
61
63
|
# @param account_id The ID of the account to get detail of.
|
@@ -85,6 +87,7 @@ describe 'AccountInformationApi' do
|
|
85
87
|
|
86
88
|
# unit tests for get_user_account_positions
|
87
89
|
# List account positions
|
90
|
+
# Returns a list of positions in the the specified account.
|
88
91
|
# @param user_id
|
89
92
|
# @param user_secret
|
90
93
|
# @param account_id The ID of the account to get positions.
|
@@ -98,6 +101,7 @@ describe 'AccountInformationApi' do
|
|
98
101
|
|
99
102
|
# unit tests for get_user_holdings
|
100
103
|
# List balances, positions and orders for the specified account
|
104
|
+
# Lists balances, positions and orders for the specified account as well as option_positions and account metadata. The data returned is similar to the data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
101
105
|
# @param account_id The ID of the account to fetch holdings for.
|
102
106
|
# @param user_id
|
103
107
|
# @param user_secret
|
@@ -111,6 +115,7 @@ describe 'AccountInformationApi' do
|
|
111
115
|
|
112
116
|
# unit tests for list_user_accounts
|
113
117
|
# List accounts
|
118
|
+
# Get a list of all Account objects for the authenticated SnapTrade user.
|
114
119
|
# @param user_id
|
115
120
|
# @param user_secret
|
116
121
|
# @param [Hash] opts the optional parameters
|
@@ -123,6 +128,7 @@ describe 'AccountInformationApi' do
|
|
123
128
|
|
124
129
|
# unit tests for update_user_account
|
125
130
|
# Update details of an investment account
|
131
|
+
# Updates various properties of a specified account.
|
126
132
|
# @param user_id
|
127
133
|
# @param user_secret
|
128
134
|
# @param account_id The ID of the account to update.
|
@@ -41,6 +41,7 @@ describe 'AuthenticationApi' do
|
|
41
41
|
|
42
42
|
# unit tests for get_user_jwt
|
43
43
|
# Generate encrypted JWT token
|
44
|
+
# This API is available to ClientIDs which have opted to use encrypted JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
44
45
|
# @param user_id
|
45
46
|
# @param user_secret
|
46
47
|
# @param [Hash] opts the optional parameters
|
@@ -78,6 +79,7 @@ describe 'AuthenticationApi' do
|
|
78
79
|
|
79
80
|
# unit tests for register_snap_trade_user
|
80
81
|
# Create SnapTrade user
|
82
|
+
# Registers a new SnapTrade user under your ClientID. Most SnapTrade operations require a user to be passed as a parameter.
|
81
83
|
# @param snap_trade_register_user_request_body
|
82
84
|
# @param [Hash] opts the optional parameters
|
83
85
|
# @return [UserIDandSecret]
|
@@ -89,6 +91,7 @@ describe 'AuthenticationApi' do
|
|
89
91
|
|
90
92
|
# unit tests for reset_snap_trade_user_secret
|
91
93
|
# Obtain a new user secret for a user
|
94
|
+
# This API is used to generate a new secret for a SnapTrade user. You might use this if a userSecret is comprimised or lost among other reasons.
|
92
95
|
# @param user_i_dand_secret
|
93
96
|
# @param [Hash] opts the optional parameters
|
94
97
|
# @return [UserIDandSecret]
|
@@ -40,6 +40,7 @@ describe 'ReferenceDataApi' do
|
|
40
40
|
|
41
41
|
# unit tests for get_partner_info
|
42
42
|
# Get metadata related to Snaptrade partner
|
43
|
+
# Returns useful data related to the specified ClientID, including allowed brokerages and data access.
|
43
44
|
# @param [Hash] opts the optional parameters
|
44
45
|
# @return [PartnerData]
|
45
46
|
describe 'get_partner_info test' do
|
@@ -134,6 +135,7 @@ describe 'ReferenceDataApi' do
|
|
134
135
|
|
135
136
|
# unit tests for symbol_search_user_account
|
136
137
|
# Search for symbols available in an account
|
138
|
+
# Returns a list of universal symbols that are supported by the specificied account. Returned symbols are based on the provided search string, matching on ticker and name.
|
137
139
|
# @param user_id
|
138
140
|
# @param user_secret
|
139
141
|
# @param account_id The ID of the account to search for symbols within.
|
@@ -29,6 +29,7 @@ describe 'TradingApi' do
|
|
29
29
|
|
30
30
|
# unit tests for cancel_user_account_order
|
31
31
|
# Cancel open order in account
|
32
|
+
# Sends a signal to the brokerage to cancel the specified order. This will only work if the order has not yet been executed.
|
32
33
|
# @param user_id
|
33
34
|
# @param user_secret
|
34
35
|
# @param account_id The ID of the account to cancel the order in.
|
@@ -56,6 +57,7 @@ describe 'TradingApi' do
|
|
56
57
|
|
57
58
|
# unit tests for get_user_account_quotes
|
58
59
|
# Get symbol quotes
|
60
|
+
# Returns live quote(s) from the brokerage for the specified symbol(s).
|
59
61
|
# @param user_id
|
60
62
|
# @param user_secret
|
61
63
|
# @param symbols List of universal_symbol_id or tickers to get quotes for.
|
@@ -82,19 +84,6 @@ describe 'TradingApi' do
|
|
82
84
|
end
|
83
85
|
end
|
84
86
|
|
85
|
-
# unit tests for place_oco_order
|
86
|
-
# Place a OCO (One Cancels Other) order
|
87
|
-
# @param user_id
|
88
|
-
# @param user_secret
|
89
|
-
# @param trading_place_oco_order_request
|
90
|
-
# @param [Hash] opts the optional parameters
|
91
|
-
# @return [AccountOrderRecord]
|
92
|
-
describe 'place_oco_order test' do
|
93
|
-
it 'should work' do
|
94
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
87
|
# unit tests for place_order
|
99
88
|
# Place order
|
100
89
|
# @param trade_id The ID of trade object obtained from trade/impact endpoint
|
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.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -216,7 +216,6 @@ files:
|
|
216
216
|
- lib/snaptrade/models/trade_execution_status_action.rb
|
217
217
|
- lib/snaptrade/models/trade_impact.rb
|
218
218
|
- lib/snaptrade/models/trading_cancel_user_account_order_request.rb
|
219
|
-
- lib/snaptrade/models/trading_place_oco_order_request.rb
|
220
219
|
- lib/snaptrade/models/transactions_status.rb
|
221
220
|
- lib/snaptrade/models/type.rb
|
222
221
|
- lib/snaptrade/models/underlying_symbol.rb
|
@@ -361,7 +360,6 @@ files:
|
|
361
360
|
- spec/models/trade_impact_spec.rb
|
362
361
|
- spec/models/trade_spec.rb
|
363
362
|
- spec/models/trading_cancel_user_account_order_request_spec.rb
|
364
|
-
- spec/models/trading_place_oco_order_request_spec.rb
|
365
363
|
- spec/models/transactions_status_spec.rb
|
366
364
|
- spec/models/type_spec.rb
|
367
365
|
- spec/models/underlying_symbol_spec.rb
|
@@ -394,7 +392,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
394
392
|
- !ruby/object:Gem::Version
|
395
393
|
version: '0'
|
396
394
|
requirements: []
|
397
|
-
rubygems_version: 3.
|
395
|
+
rubygems_version: 3.4.10
|
398
396
|
signing_key:
|
399
397
|
specification_version: 4
|
400
398
|
summary: SnapTrade Ruby Gem
|
@@ -431,7 +429,6 @@ test_files:
|
|
431
429
|
- spec/models/net_dividend_spec.rb
|
432
430
|
- spec/models/encrypted_response_encrypted_message_data_spec.rb
|
433
431
|
- spec/models/sub_period_return_rate_spec.rb
|
434
|
-
- spec/models/trading_place_oco_order_request_spec.rb
|
435
432
|
- spec/models/monthly_dividends_spec.rb
|
436
433
|
- spec/models/model_portfolio_security_spec.rb
|
437
434
|
- spec/models/account_balance_total_spec.rb
|
@@ -1,229 +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 TradingPlaceOCOOrderRequest
|
15
|
-
# The ID of first trade object obtained from trade/impact endpoint
|
16
|
-
attr_accessor :first_trade_id
|
17
|
-
|
18
|
-
# The ID of second trade object obtained from trade/impact endpoint
|
19
|
-
attr_accessor :second_trade_id
|
20
|
-
|
21
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
-
def self.attribute_map
|
23
|
-
{
|
24
|
-
:'first_trade_id' => :'first_trade_id',
|
25
|
-
:'second_trade_id' => :'second_trade_id'
|
26
|
-
}
|
27
|
-
end
|
28
|
-
|
29
|
-
# Returns all the JSON keys this model knows about
|
30
|
-
def self.acceptable_attributes
|
31
|
-
attribute_map.values
|
32
|
-
end
|
33
|
-
|
34
|
-
# Attribute type mapping.
|
35
|
-
def self.openapi_types
|
36
|
-
{
|
37
|
-
:'first_trade_id' => :'Object',
|
38
|
-
:'second_trade_id' => :'Object'
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
# List of attributes with nullable: true
|
43
|
-
def self.openapi_nullable
|
44
|
-
Set.new([
|
45
|
-
:'first_trade_id',
|
46
|
-
:'second_trade_id'
|
47
|
-
])
|
48
|
-
end
|
49
|
-
|
50
|
-
# Initializes the object
|
51
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
-
def initialize(attributes = {})
|
53
|
-
if (!attributes.is_a?(Hash))
|
54
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::TradingPlaceOCOOrderRequest` initialize method"
|
55
|
-
end
|
56
|
-
|
57
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::TradingPlaceOCOOrderRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
-
end
|
62
|
-
h[k.to_sym] = v
|
63
|
-
}
|
64
|
-
|
65
|
-
if attributes.key?(:'first_trade_id')
|
66
|
-
self.first_trade_id = attributes[:'first_trade_id']
|
67
|
-
end
|
68
|
-
|
69
|
-
if attributes.key?(:'second_trade_id')
|
70
|
-
self.second_trade_id = attributes[:'second_trade_id']
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
75
|
-
# @return Array for valid properties with the reasons
|
76
|
-
def list_invalid_properties
|
77
|
-
invalid_properties = Array.new
|
78
|
-
invalid_properties
|
79
|
-
end
|
80
|
-
|
81
|
-
# Check to see if the all the properties in the model are valid
|
82
|
-
# @return true if the model is valid
|
83
|
-
def valid?
|
84
|
-
true
|
85
|
-
end
|
86
|
-
|
87
|
-
# Checks equality by comparing each attribute.
|
88
|
-
# @param [Object] Object to be compared
|
89
|
-
def ==(o)
|
90
|
-
return true if self.equal?(o)
|
91
|
-
self.class == o.class &&
|
92
|
-
first_trade_id == o.first_trade_id &&
|
93
|
-
second_trade_id == o.second_trade_id
|
94
|
-
end
|
95
|
-
|
96
|
-
# @see the `==` method
|
97
|
-
# @param [Object] Object to be compared
|
98
|
-
def eql?(o)
|
99
|
-
self == o
|
100
|
-
end
|
101
|
-
|
102
|
-
# Calculates hash code according to all attributes.
|
103
|
-
# @return [Integer] Hash code
|
104
|
-
def hash
|
105
|
-
[first_trade_id, second_trade_id].hash
|
106
|
-
end
|
107
|
-
|
108
|
-
# Builds the object from hash
|
109
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
110
|
-
# @return [Object] Returns the model itself
|
111
|
-
def self.build_from_hash(attributes)
|
112
|
-
new.build_from_hash(attributes)
|
113
|
-
end
|
114
|
-
|
115
|
-
# Builds the object from hash
|
116
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
117
|
-
# @return [Object] Returns the model itself
|
118
|
-
def build_from_hash(attributes)
|
119
|
-
return nil unless attributes.is_a?(Hash)
|
120
|
-
attributes = attributes.transform_keys(&:to_sym)
|
121
|
-
self.class.openapi_types.each_pair do |key, type|
|
122
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
123
|
-
self.send("#{key}=", nil)
|
124
|
-
elsif type =~ /\AArray<(.*)>/i
|
125
|
-
# check to ensure the input is an array given that the attribute
|
126
|
-
# is documented as an array but the input is not
|
127
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
128
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
129
|
-
end
|
130
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
131
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
self
|
136
|
-
end
|
137
|
-
|
138
|
-
# Deserializes the data based on type
|
139
|
-
# @param string type Data type
|
140
|
-
# @param string value Value to be deserialized
|
141
|
-
# @return [Object] Deserialized data
|
142
|
-
def _deserialize(type, value)
|
143
|
-
case type.to_sym
|
144
|
-
when :Time
|
145
|
-
Time.parse(value)
|
146
|
-
when :Date
|
147
|
-
Date.parse(value)
|
148
|
-
when :String
|
149
|
-
value.to_s
|
150
|
-
when :Integer
|
151
|
-
value.to_i
|
152
|
-
when :Float
|
153
|
-
value.to_f
|
154
|
-
when :Boolean
|
155
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
156
|
-
true
|
157
|
-
else
|
158
|
-
false
|
159
|
-
end
|
160
|
-
when :Object
|
161
|
-
# generic object (usually a Hash), return directly
|
162
|
-
value
|
163
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
164
|
-
inner_type = Regexp.last_match[:inner_type]
|
165
|
-
value.map { |v| _deserialize(inner_type, v) }
|
166
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
167
|
-
k_type = Regexp.last_match[:k_type]
|
168
|
-
v_type = Regexp.last_match[:v_type]
|
169
|
-
{}.tap do |hash|
|
170
|
-
value.each do |k, v|
|
171
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
else # model
|
175
|
-
# models (e.g. Pet) or oneOf
|
176
|
-
klass = SnapTrade.const_get(type)
|
177
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
# Returns the string representation of the object
|
182
|
-
# @return [String] String presentation of the object
|
183
|
-
def to_s
|
184
|
-
to_hash.to_s
|
185
|
-
end
|
186
|
-
|
187
|
-
# to_body is an alias to to_hash (backward compatibility)
|
188
|
-
# @return [Hash] Returns the object in the form of hash
|
189
|
-
def to_body
|
190
|
-
to_hash
|
191
|
-
end
|
192
|
-
|
193
|
-
# Returns the object in the form of hash
|
194
|
-
# @return [Hash] Returns the object in the form of hash
|
195
|
-
def to_hash
|
196
|
-
hash = {}
|
197
|
-
self.class.attribute_map.each_pair do |attr, param|
|
198
|
-
value = self.send(attr)
|
199
|
-
if value.nil?
|
200
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
201
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
202
|
-
end
|
203
|
-
|
204
|
-
hash[param] = _to_hash(value)
|
205
|
-
end
|
206
|
-
hash
|
207
|
-
end
|
208
|
-
|
209
|
-
# Outputs non-array value in the form of hash
|
210
|
-
# For object, use to_hash. Otherwise, just return the value
|
211
|
-
# @param [Object] value Any valid value
|
212
|
-
# @return [Hash] Returns the value in the form of hash
|
213
|
-
def _to_hash(value)
|
214
|
-
if value.is_a?(Array)
|
215
|
-
value.compact.map { |v| _to_hash(v) }
|
216
|
-
elsif value.is_a?(Hash)
|
217
|
-
{}.tap do |hash|
|
218
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
219
|
-
end
|
220
|
-
elsif value.respond_to? :to_hash
|
221
|
-
value.to_hash
|
222
|
-
else
|
223
|
-
value
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
end
|
228
|
-
|
229
|
-
end
|
@@ -1,35 +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::TradingPlaceOCOOrderRequest
|
15
|
-
describe SnapTrade::TradingPlaceOCOOrderRequest do
|
16
|
-
let(:instance) { SnapTrade::TradingPlaceOCOOrderRequest.new }
|
17
|
-
|
18
|
-
describe 'test an instance of TradingPlaceOCOOrderRequest' do
|
19
|
-
it 'should create an instance of TradingPlaceOCOOrderRequest' do
|
20
|
-
expect(instance).to be_instance_of(SnapTrade::TradingPlaceOCOOrderRequest)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
describe 'test attribute "first_trade_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
|
-
describe 'test attribute "second_trade_id"' 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
|
-
end
|