snaptrade 2.0.19 → 2.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +45 -41
- data/lib/snaptrade/api/authentication_api.rb +4 -4
- data/lib/snaptrade/api/trading_api.rb +8 -8
- data/lib/snaptrade/models/account_order_record.rb +2 -2
- data/lib/snaptrade/models/{action.rb → action_strict.rb} +3 -3
- data/lib/snaptrade/models/connections_session_events200_response_inner.rb +1 -1
- data/lib/snaptrade/models/delete_user_response.rb +1 -1
- data/lib/snaptrade/models/manual_trade.rb +1 -1
- data/lib/snaptrade/models/manual_trade_form.rb +2 -2
- data/lib/snaptrade/models/manual_trade_form_notional_value.rb +214 -0
- data/lib/snaptrade/models/notional_value.rb +103 -0
- data/lib/snaptrade/models/session_event.rb +1 -1
- data/lib/snaptrade/models/session_event_type.rb +11 -3
- data/lib/snaptrade/models/snap_trade_register_user_request_body.rb +1 -1
- data/lib/snaptrade/models/user_i_dand_secret.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +3 -1
- data/spec/models/action_strict_spec.rb +23 -0
- data/spec/models/manual_trade_form_notional_value_spec.rb +23 -0
- data/spec/models/notional_value_spec.rb +26 -0
- metadata +11 -5
- data/spec/models/action_spec.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acd08ff642c28a4f723b0b5e860f88cd83a5ee7e899da6bf8f3ce56baee065fb
|
4
|
+
data.tar.gz: 0032e58d20662cbca08a153dad8bd1a1f0e6deab65f50f1329bf31544063fd1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 950bbd3e6c291bd7d51d057b1916f499fa5050501b4b170756ac4db7403c0117990cde8027b842ef0626af26daac611f5f91ecf494f8314933a14b62e4e8d77b
|
7
|
+
data.tar.gz: cab64b4ced9708b773afee7e22b5a3235fc116c620d98e9fd3db57f00b25366484b905a9440a919abe34f6c241e39e3bcd3e6a8a9181c17195d4d44cf3b75042
|
data/Gemfile.lock
CHANGED
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.21-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.21)
|
10
10
|
[![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -69,7 +69,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
69
69
|
Add to Gemfile:
|
70
70
|
|
71
71
|
```ruby
|
72
|
-
gem 'snaptrade', '~> 2.0.
|
72
|
+
gem 'snaptrade', '~> 2.0.21'
|
73
73
|
```
|
74
74
|
|
75
75
|
## Getting Started<a id="getting-started"></a>
|
@@ -82,7 +82,7 @@ configuration.client_id = ENV["SNAPTRADE_CLIENT_ID"]
|
|
82
82
|
configuration.consumer_key = ENV["SNAPTRADE_CONSUMER_KEY"]
|
83
83
|
snaptrade = SnapTrade::Client.new(configuration)
|
84
84
|
result = snaptrade.account_information.get_all_user_holdings(
|
85
|
-
user_id: "
|
85
|
+
user_id: "snaptrade-user-123",
|
86
86
|
user_secret: "USERSECRET123",
|
87
87
|
brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
88
88
|
)
|
@@ -95,7 +95,7 @@ To access the raw HTTP response, suffix any method with `_with_http_info`.
|
|
95
95
|
|
96
96
|
```ruby
|
97
97
|
result = snaptrade.account_information.get_all_user_holdings_with_http_info(
|
98
|
-
user_id: "
|
98
|
+
user_id: "snaptrade-user-123",
|
99
99
|
user_secret: "USERSECRET123",
|
100
100
|
brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
101
101
|
)
|
@@ -119,7 +119,7 @@ the data returned over the more fine-grained **positions**, **orders** and **bal
|
|
119
119
|
|
120
120
|
```ruby
|
121
121
|
result = snaptrade.account_information.get_all_user_holdings(
|
122
|
-
user_id: "
|
122
|
+
user_id: "snaptrade-user-123",
|
123
123
|
user_secret: "USERSECRET123",
|
124
124
|
brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
125
125
|
)
|
@@ -155,7 +155,7 @@ A list of account balances for the specified account (one per currency that the
|
|
155
155
|
|
156
156
|
```ruby
|
157
157
|
result = snaptrade.account_information.get_user_account_balance(
|
158
|
-
user_id: "
|
158
|
+
user_id: "snaptrade-user-123",
|
159
159
|
user_secret: "USERSECRET123",
|
160
160
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
161
161
|
)
|
@@ -192,7 +192,7 @@ including the total account market value.
|
|
192
192
|
|
193
193
|
```ruby
|
194
194
|
result = snaptrade.account_information.get_user_account_details(
|
195
|
-
user_id: "
|
195
|
+
user_id: "snaptrade-user-123",
|
196
196
|
user_secret: "USERSECRET123",
|
197
197
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
198
198
|
)
|
@@ -227,7 +227,7 @@ Fetch all recent orders from a user's account.
|
|
227
227
|
|
228
228
|
```ruby
|
229
229
|
result = snaptrade.account_information.get_user_account_orders(
|
230
|
-
user_id: "
|
230
|
+
user_id: "snaptrade-user-123",
|
231
231
|
user_secret: "USERSECRET123",
|
232
232
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
233
233
|
state: "all",
|
@@ -271,7 +271,7 @@ Returns a list of positions in the specified account.
|
|
271
271
|
|
272
272
|
```ruby
|
273
273
|
result = snaptrade.account_information.get_user_account_positions(
|
274
|
-
user_id: "
|
274
|
+
user_id: "snaptrade-user-123",
|
275
275
|
user_secret: "USERSECRET123",
|
276
276
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
277
277
|
)
|
@@ -310,7 +310,7 @@ data returned over the more fine-grained **positions**, **orders** and **balance
|
|
310
310
|
```ruby
|
311
311
|
result = snaptrade.account_information.get_user_holdings(
|
312
312
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
313
|
-
user_id: "
|
313
|
+
user_id: "snaptrade-user-123",
|
314
314
|
user_secret: "USERSECRET123",
|
315
315
|
)
|
316
316
|
p result
|
@@ -344,7 +344,7 @@ Get a list of all Account objects for the authenticated SnapTrade user.
|
|
344
344
|
|
345
345
|
```ruby
|
346
346
|
result = snaptrade.account_information.list_user_accounts(
|
347
|
-
user_id: "
|
347
|
+
user_id: "snaptrade-user-123",
|
348
348
|
user_secret: "USERSECRET123",
|
349
349
|
)
|
350
350
|
p result
|
@@ -375,7 +375,7 @@ Updates various properties of a specified account.
|
|
375
375
|
|
376
376
|
```ruby
|
377
377
|
result = snaptrade.account_information.update_user_account(
|
378
|
-
user_id: "
|
378
|
+
user_id: "snaptrade-user-123",
|
379
379
|
user_secret: "USERSECRET123",
|
380
380
|
account_id: "accountId_example",
|
381
381
|
)
|
@@ -434,7 +434,7 @@ Deletes a user you've registered over the SnapTrade API, and any data associated
|
|
434
434
|
|
435
435
|
```ruby
|
436
436
|
result = snaptrade.authentication.delete_snap_trade_user(
|
437
|
-
user_id: "
|
437
|
+
user_id: "snaptrade-user-123",
|
438
438
|
)
|
439
439
|
p result
|
440
440
|
```
|
@@ -465,7 +465,7 @@ JWTs (JSON Web Tokens) instead of standard SnapTrade signature verification.
|
|
465
465
|
|
466
466
|
```ruby
|
467
467
|
result = snaptrade.authentication.get_user_jwt(
|
468
|
-
user_id: "
|
468
|
+
user_id: "snaptrade-user-123",
|
469
469
|
user_secret: "USERSECRET123",
|
470
470
|
)
|
471
471
|
p result
|
@@ -516,7 +516,7 @@ Logs in a SnapTrade user and returns an authenticated connection portal URL for
|
|
516
516
|
|
517
517
|
```ruby
|
518
518
|
result = snaptrade.authentication.login_snap_trade_user(
|
519
|
-
user_id: "
|
519
|
+
user_id: "snaptrade-user-123",
|
520
520
|
user_secret: "USERSECRET123",
|
521
521
|
broker: "ALPACA",
|
522
522
|
immediate_redirect: true,
|
@@ -584,8 +584,10 @@ p result
|
|
584
584
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
585
585
|
|
586
586
|
##### userId: `String`<a id="userid-string"></a>
|
587
|
-
SnapTrade User ID.
|
588
|
-
|
587
|
+
SnapTrade User ID. This is chosen by the API partner and can be any string that
|
588
|
+
is a) unique to the user, and b) immutable for the user. It is recommended to
|
589
|
+
NOT use email addresses for this property because they are usually not
|
590
|
+
immutable.
|
589
591
|
|
590
592
|
#### 🔄 Return<a id="🔄-return"></a>
|
591
593
|
|
@@ -619,8 +621,10 @@ p result
|
|
619
621
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
620
622
|
|
621
623
|
##### userId: `String`<a id="userid-string"></a>
|
622
|
-
SnapTrade User ID.
|
623
|
-
|
624
|
+
SnapTrade User ID. This is chosen by the API partner and can be any string that
|
625
|
+
is a) unique to the user, and b) immutable for the user. It is recommended to
|
626
|
+
NOT use email addresses for this property because they are usually not
|
627
|
+
immutable.
|
624
628
|
|
625
629
|
##### userSecret: `String`<a id="usersecret-string"></a>
|
626
630
|
SnapTrade User Secret randomly generated by SnapTrade. This should be considered
|
@@ -649,7 +653,7 @@ Returns a single brokerage authorization object for the specified ID.
|
|
649
653
|
```ruby
|
650
654
|
result = snaptrade.connections.detail_brokerage_authorization(
|
651
655
|
authorization_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
652
|
-
user_id: "
|
656
|
+
user_id: "snaptrade-user-123",
|
653
657
|
user_secret: "USERSECRET123",
|
654
658
|
)
|
655
659
|
p result
|
@@ -683,7 +687,7 @@ Returns a list of Brokerage Authorization objects for the user
|
|
683
687
|
|
684
688
|
```ruby
|
685
689
|
result = snaptrade.connections.list_brokerage_authorizations(
|
686
|
-
user_id: "
|
690
|
+
user_id: "snaptrade-user-123",
|
687
691
|
user_secret: "USERSECRET123",
|
688
692
|
)
|
689
693
|
p result
|
@@ -715,7 +719,7 @@ Deletes a specified brokerage authorization given by the ID.
|
|
715
719
|
```ruby
|
716
720
|
snaptrade.connections.remove_brokerage_authorization(
|
717
721
|
authorization_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
718
|
-
user_id: "
|
722
|
+
user_id: "snaptrade-user-123",
|
719
723
|
user_secret: "USERSECRET123",
|
720
724
|
)
|
721
725
|
```
|
@@ -793,7 +797,7 @@ result = snaptrade.options.get_option_strategy(
|
|
793
797
|
}
|
794
798
|
],
|
795
799
|
strategy_type: "CUSTOM",
|
796
|
-
user_id: "
|
800
|
+
user_id: "snaptrade-user-123",
|
797
801
|
user_secret: "USERSECRET123",
|
798
802
|
account_id: "accountId_example",
|
799
803
|
)
|
@@ -831,7 +835,7 @@ Returns the option chain for the specified symbol in the specified account.
|
|
831
835
|
|
832
836
|
```ruby
|
833
837
|
result = snaptrade.options.get_options_chain(
|
834
|
-
user_id: "
|
838
|
+
user_id: "snaptrade-user-123",
|
835
839
|
user_secret: "USERSECRET123",
|
836
840
|
account_id: "accountId_example",
|
837
841
|
symbol: "symbol_example",
|
@@ -871,7 +875,7 @@ Returns a Strategy Quotes object which has latest market data of the specified o
|
|
871
875
|
|
872
876
|
```ruby
|
873
877
|
result = snaptrade.options.get_options_strategy_quote(
|
874
|
-
user_id: "
|
878
|
+
user_id: "snaptrade-user-123",
|
875
879
|
user_secret: "USERSECRET123",
|
876
880
|
account_id: "accountId_example",
|
877
881
|
option_strategy_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
@@ -911,7 +915,7 @@ Returns a list of Options Positions.
|
|
911
915
|
|
912
916
|
```ruby
|
913
917
|
result = snaptrade.options.list_option_holdings(
|
914
|
-
user_id: "
|
918
|
+
user_id: "snaptrade-user-123",
|
915
919
|
user_secret: "USERSECRET123",
|
916
920
|
account_id: "accountId_example",
|
917
921
|
)
|
@@ -948,7 +952,7 @@ Places the option strategy order and returns the order record received from the
|
|
948
952
|
result = snaptrade.options.place_option_strategy(
|
949
953
|
order_type: "Limit",
|
950
954
|
time_in_force: "FOK",
|
951
|
-
user_id: "
|
955
|
+
user_id: "snaptrade-user-123",
|
952
956
|
user_secret: "USERSECRET123",
|
953
957
|
account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
954
958
|
option_strategy_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
@@ -1270,7 +1274,7 @@ provided search string, matching on ticker and name.
|
|
1270
1274
|
|
1271
1275
|
```ruby
|
1272
1276
|
result = snaptrade.reference_data.symbol_search_user_account(
|
1273
|
-
user_id: "
|
1277
|
+
user_id: "snaptrade-user-123",
|
1274
1278
|
user_secret: "USERSECRET123",
|
1275
1279
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1276
1280
|
substring: "apple",
|
@@ -1309,7 +1313,7 @@ This will only work if the order has not yet been executed.
|
|
1309
1313
|
|
1310
1314
|
```ruby
|
1311
1315
|
result = snaptrade.trading.cancel_user_account_order(
|
1312
|
-
user_id: "
|
1316
|
+
user_id: "snaptrade-user-123",
|
1313
1317
|
user_secret: "USERSECRET123",
|
1314
1318
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1315
1319
|
brokerage_order_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
@@ -1346,7 +1350,7 @@ Return the trade object and it's impact on the account for the specified order.
|
|
1346
1350
|
|
1347
1351
|
```ruby
|
1348
1352
|
result = snaptrade.trading.get_order_impact(
|
1349
|
-
user_id: "
|
1353
|
+
user_id: "snaptrade-user-123",
|
1350
1354
|
user_secret: "USERSECRET123",
|
1351
1355
|
account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1352
1356
|
action: "BUY",
|
@@ -1356,7 +1360,7 @@ result = snaptrade.trading.get_order_impact(
|
|
1356
1360
|
time_in_force: "FOK",
|
1357
1361
|
units: 3.14,
|
1358
1362
|
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1359
|
-
notional_value:
|
1363
|
+
notional_value: None,
|
1360
1364
|
)
|
1361
1365
|
p result
|
1362
1366
|
```
|
@@ -1366,7 +1370,7 @@ p result
|
|
1366
1370
|
##### user_id: `String`<a id="user_id-string"></a>
|
1367
1371
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
1368
1372
|
##### account_id: `String`<a id="account_id-string"></a>
|
1369
|
-
##### action: [`
|
1373
|
+
##### action: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb)<a id="action-actionstrictlibsnaptrademodelsaction_strictrb"></a>
|
1370
1374
|
Trade Action
|
1371
1375
|
|
1372
1376
|
##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
|
@@ -1384,7 +1388,7 @@ Canceled
|
|
1384
1388
|
|
1385
1389
|
##### units: [`Float`](./lib/snaptrade/models/float.rb)<a id="units-floatlibsnaptrademodelsfloatrb"></a>
|
1386
1390
|
##### universal_symbol_id: `String`<a id="universal_symbol_id-string"></a>
|
1387
|
-
##### notional_value: [`
|
1391
|
+
##### notional_value: [`ManualTradeFormNotionalValue`](./lib/snaptrade/models/manual_trade_form_notional_value.rb)<a id="notional_value-manualtradeformnotionalvaluelibsnaptrademodelsmanual_trade_form_notional_valuerb"></a>
|
1388
1392
|
#### 🔄 Return<a id="🔄-return"></a>
|
1389
1393
|
|
1390
1394
|
[ManualTradeAndImpact](./lib/snaptrade/models/manual_trade_and_impact.rb)
|
@@ -1406,7 +1410,7 @@ Returns live quote(s) from the brokerage for the specified symbol(s).
|
|
1406
1410
|
|
1407
1411
|
```ruby
|
1408
1412
|
result = snaptrade.trading.get_user_account_quotes(
|
1409
|
-
user_id: "
|
1413
|
+
user_id: "snaptrade-user-123",
|
1410
1414
|
user_secret: "USERSECRET123",
|
1411
1415
|
symbols: "symbols_example",
|
1412
1416
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
@@ -1449,7 +1453,7 @@ Places a specified trade in the specified account.
|
|
1449
1453
|
|
1450
1454
|
```ruby
|
1451
1455
|
result = snaptrade.trading.place_force_order(
|
1452
|
-
user_id: "
|
1456
|
+
user_id: "snaptrade-user-123",
|
1453
1457
|
user_secret: "USERSECRET123",
|
1454
1458
|
account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1455
1459
|
action: "BUY",
|
@@ -1459,7 +1463,7 @@ result = snaptrade.trading.place_force_order(
|
|
1459
1463
|
time_in_force: "FOK",
|
1460
1464
|
units: 3.14,
|
1461
1465
|
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1462
|
-
notional_value:
|
1466
|
+
notional_value: None,
|
1463
1467
|
)
|
1464
1468
|
p result
|
1465
1469
|
```
|
@@ -1469,7 +1473,7 @@ p result
|
|
1469
1473
|
##### user_id: `String`<a id="user_id-string"></a>
|
1470
1474
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
1471
1475
|
##### account_id: `String`<a id="account_id-string"></a>
|
1472
|
-
##### action: [`
|
1476
|
+
##### action: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb)<a id="action-actionstrictlibsnaptrademodelsaction_strictrb"></a>
|
1473
1477
|
Trade Action
|
1474
1478
|
|
1475
1479
|
##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
|
@@ -1487,7 +1491,7 @@ Canceled
|
|
1487
1491
|
|
1488
1492
|
##### units: [`Float`](./lib/snaptrade/models/float.rb)<a id="units-floatlibsnaptrademodelsfloatrb"></a>
|
1489
1493
|
##### universal_symbol_id: `String`<a id="universal_symbol_id-string"></a>
|
1490
|
-
##### notional_value: [`
|
1494
|
+
##### notional_value: [`ManualTradeFormNotionalValue`](./lib/snaptrade/models/manual_trade_form_notional_value.rb)<a id="notional_value-manualtradeformnotionalvaluelibsnaptrademodelsmanual_trade_form_notional_valuerb"></a>
|
1491
1495
|
#### 🔄 Return<a id="🔄-return"></a>
|
1492
1496
|
|
1493
1497
|
[AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
|
@@ -1512,7 +1516,7 @@ returns the status of the order from the brokerage.
|
|
1512
1516
|
```ruby
|
1513
1517
|
result = snaptrade.trading.place_order(
|
1514
1518
|
trade_id: "tradeId_example",
|
1515
|
-
user_id: "
|
1519
|
+
user_id: "snaptrade-user-123",
|
1516
1520
|
user_secret: "USERSECRET123",
|
1517
1521
|
wait_to_confirm: true,
|
1518
1522
|
)
|
@@ -1553,7 +1557,7 @@ Returns activities (transactions) for a user. Specifying start and end date is h
|
|
1553
1557
|
|
1554
1558
|
```ruby
|
1555
1559
|
result = snaptrade.transactions_and_reporting.get_activities(
|
1556
|
-
user_id: "
|
1560
|
+
user_id: "snaptrade-user-123",
|
1557
1561
|
user_secret: "USERSECRET123",
|
1558
1562
|
start_date: "2022-01-24",
|
1559
1563
|
end_date: "2022-01-24",
|
@@ -1612,7 +1616,7 @@ Returns performance information (contributions, dividends, rate of return, etc)
|
|
1612
1616
|
result = snaptrade.transactions_and_reporting.get_reporting_custom_range(
|
1613
1617
|
start_date: "2022-01-24",
|
1614
1618
|
end_date: "2022-01-24",
|
1615
|
-
user_id: "
|
1619
|
+
user_id: "snaptrade-user-123",
|
1616
1620
|
user_secret: "USERSECRET123",
|
1617
1621
|
accounts: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
|
1618
1622
|
detailed: true,
|
@@ -414,7 +414,7 @@ module SnapTrade
|
|
414
414
|
# Registers a new SnapTrade user under your ClientID.
|
415
415
|
# Most SnapTrade operations require a user to be passed as a parameter.
|
416
416
|
#
|
417
|
-
# @param user_id [String] SnapTrade User ID.
|
417
|
+
# @param user_id [String] SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
418
418
|
# @param body [SnapTradeRegisterUserRequestBody]
|
419
419
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
420
420
|
def register_snap_trade_user(user_id: SENTINEL, extra: {})
|
@@ -430,7 +430,7 @@ module SnapTrade
|
|
430
430
|
# Registers a new SnapTrade user under your ClientID.
|
431
431
|
# Most SnapTrade operations require a user to be passed as a parameter.
|
432
432
|
#
|
433
|
-
# @param user_id [String] SnapTrade User ID.
|
433
|
+
# @param user_id [String] SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
434
434
|
# @param body [SnapTradeRegisterUserRequestBody]
|
435
435
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
436
436
|
def register_snap_trade_user_with_http_info(user_id: SENTINEL, extra: {})
|
@@ -514,7 +514,7 @@ module SnapTrade
|
|
514
514
|
# This API is used to generate a new secret for a SnapTrade user. You might use this if a userSecret
|
515
515
|
# is comprimised or lost among other reasons.
|
516
516
|
#
|
517
|
-
# @param user_id [String] SnapTrade User ID.
|
517
|
+
# @param user_id [String] SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
518
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.
|
519
519
|
# @param body [UserIDandSecret]
|
520
520
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -532,7 +532,7 @@ module SnapTrade
|
|
532
532
|
# This API is used to generate a new secret for a SnapTrade user. You might use this if a userSecret
|
533
533
|
# is comprimised or lost among other reasons.
|
534
534
|
#
|
535
|
-
# @param user_id [String] SnapTrade User ID.
|
535
|
+
# @param user_id [String] SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
536
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.
|
537
537
|
# @param body [UserIDandSecret]
|
538
538
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -150,14 +150,14 @@ module SnapTrade
|
|
150
150
|
# @param user_id [String]
|
151
151
|
# @param user_secret [String]
|
152
152
|
# @param account_id [String]
|
153
|
-
# @param action [
|
153
|
+
# @param action [ActionStrict] Trade Action
|
154
154
|
# @param order_type [OrderTypeStrict] Order Type
|
155
155
|
# @param price [Float] Trade Price if limit or stop limit order
|
156
156
|
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
157
157
|
# @param time_in_force [TimeInForceStrict] Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
|
158
158
|
# @param units [Float]
|
159
159
|
# @param universal_symbol_id [String]
|
160
|
-
# @param notional_value [
|
160
|
+
# @param notional_value [ManualTradeFormNotionalValue]
|
161
161
|
# @param body [ManualTradeForm]
|
162
162
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
163
163
|
def get_order_impact(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, notional_value: SENTINEL, extra: {})
|
@@ -183,14 +183,14 @@ module SnapTrade
|
|
183
183
|
# @param user_id [String]
|
184
184
|
# @param user_secret [String]
|
185
185
|
# @param account_id [String]
|
186
|
-
# @param action [
|
186
|
+
# @param action [ActionStrict] Trade Action
|
187
187
|
# @param order_type [OrderTypeStrict] Order Type
|
188
188
|
# @param price [Float] Trade Price if limit or stop limit order
|
189
189
|
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
190
190
|
# @param time_in_force [TimeInForceStrict] Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
|
191
191
|
# @param units [Float]
|
192
192
|
# @param universal_symbol_id [String]
|
193
|
-
# @param notional_value [
|
193
|
+
# @param notional_value [ManualTradeFormNotionalValue]
|
194
194
|
# @param body [ManualTradeForm]
|
195
195
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
196
196
|
def get_order_impact_with_http_info(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, notional_value: SENTINEL, extra: {})
|
@@ -417,14 +417,14 @@ module SnapTrade
|
|
417
417
|
# @param user_id [String]
|
418
418
|
# @param user_secret [String]
|
419
419
|
# @param account_id [String]
|
420
|
-
# @param action [
|
420
|
+
# @param action [ActionStrict] Trade Action
|
421
421
|
# @param order_type [OrderTypeStrict] Order Type
|
422
422
|
# @param price [Float] Trade Price if limit or stop limit order
|
423
423
|
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
424
424
|
# @param time_in_force [TimeInForceStrict] Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
|
425
425
|
# @param units [Float]
|
426
426
|
# @param universal_symbol_id [String]
|
427
|
-
# @param notional_value [
|
427
|
+
# @param notional_value [ManualTradeFormNotionalValue]
|
428
428
|
# @param body [ManualTradeForm]
|
429
429
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
430
430
|
def place_force_order(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, notional_value: SENTINEL, extra: {})
|
@@ -450,14 +450,14 @@ module SnapTrade
|
|
450
450
|
# @param user_id [String]
|
451
451
|
# @param user_secret [String]
|
452
452
|
# @param account_id [String]
|
453
|
-
# @param action [
|
453
|
+
# @param action [ActionStrict] Trade Action
|
454
454
|
# @param order_type [OrderTypeStrict] Order Type
|
455
455
|
# @param price [Float] Trade Price if limit or stop limit order
|
456
456
|
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
457
457
|
# @param time_in_force [TimeInForceStrict] Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
|
458
458
|
# @param units [Float]
|
459
459
|
# @param universal_symbol_id [String]
|
460
|
-
# @param notional_value [
|
460
|
+
# @param notional_value [ManualTradeFormNotionalValue]
|
461
461
|
# @param body [ManualTradeForm]
|
462
462
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
463
463
|
def place_force_order_with_http_info(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, notional_value: SENTINEL, extra: {})
|
@@ -24,7 +24,7 @@ module SnapTrade
|
|
24
24
|
|
25
25
|
attr_accessor :option_symbol
|
26
26
|
|
27
|
-
# Trade Action
|
27
|
+
# Trade Action potential values include (but are not limited to) - BUY - SELL - BUY_COVER - SELL_SHORT - BUY_OPEN - BUY_CLOSE - SELL_OPEN - SELL_CLOSE
|
28
28
|
attr_accessor :action
|
29
29
|
|
30
30
|
attr_accessor :total_quantity
|
@@ -101,7 +101,7 @@ module SnapTrade
|
|
101
101
|
:'symbol' => :'String',
|
102
102
|
:'universal_symbol' => :'UniversalSymbol',
|
103
103
|
:'option_symbol' => :'OptionsSymbol',
|
104
|
-
:'action' => :'
|
104
|
+
:'action' => :'String',
|
105
105
|
:'total_quantity' => :'Float',
|
106
106
|
:'open_quantity' => :'Float',
|
107
107
|
:'canceled_quantity' => :'Float',
|
@@ -11,7 +11,7 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
class
|
14
|
+
class ActionStrict
|
15
15
|
BUY = "BUY".freeze
|
16
16
|
SELL = "SELL".freeze
|
17
17
|
|
@@ -30,8 +30,8 @@ module SnapTrade
|
|
30
30
|
# @param [String] The enum value in the form of the string
|
31
31
|
# @return [String] The enum value
|
32
32
|
def build_from_hash(value)
|
33
|
-
return value if
|
34
|
-
raise "Invalid ENUM value #{value} for class #
|
33
|
+
return value if ActionStrict.all_vars.include?(value)
|
34
|
+
raise "Invalid ENUM value #{value} for class #ActionStrict"
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -18,7 +18,7 @@ module SnapTrade
|
|
18
18
|
|
19
19
|
attr_accessor :session_id
|
20
20
|
|
21
|
-
# SnapTrade User ID.
|
21
|
+
# SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
22
22
|
attr_accessor :user_id
|
23
23
|
|
24
24
|
# Time
|
@@ -16,7 +16,7 @@ module SnapTrade
|
|
16
16
|
# Delete status
|
17
17
|
attr_accessor :status
|
18
18
|
|
19
|
-
# SnapTrade User ID.
|
19
|
+
# SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
20
20
|
attr_accessor :user_id
|
21
21
|
|
22
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -60,14 +60,14 @@ module SnapTrade
|
|
60
60
|
def self.openapi_types
|
61
61
|
{
|
62
62
|
:'account_id' => :'String',
|
63
|
-
:'action' => :'
|
63
|
+
:'action' => :'ActionStrict',
|
64
64
|
:'order_type' => :'OrderTypeStrict',
|
65
65
|
:'price' => :'Float',
|
66
66
|
:'stop' => :'Float',
|
67
67
|
:'time_in_force' => :'TimeInForceStrict',
|
68
68
|
:'units' => :'Float',
|
69
69
|
:'universal_symbol_id' => :'String',
|
70
|
-
:'notional_value' => :'
|
70
|
+
:'notional_value' => :'ManualTradeFormNotionalValue'
|
71
71
|
}
|
72
72
|
end
|
73
73
|
|
@@ -0,0 +1,214 @@
|
|
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 ManualTradeFormNotionalValue
|
15
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
16
|
+
def self.attribute_map
|
17
|
+
{
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# Returns all the JSON keys this model knows about
|
22
|
+
def self.acceptable_attributes
|
23
|
+
attribute_map.values
|
24
|
+
end
|
25
|
+
|
26
|
+
# Attribute type mapping.
|
27
|
+
def self.openapi_types
|
28
|
+
{
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# List of attributes with nullable: true
|
33
|
+
def self.openapi_nullable
|
34
|
+
Set.new([
|
35
|
+
])
|
36
|
+
end
|
37
|
+
|
38
|
+
# List of class defined in allOf (OpenAPI v3)
|
39
|
+
def self.openapi_all_of
|
40
|
+
[
|
41
|
+
:'NotionalValue'
|
42
|
+
]
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::ManualTradeFormNotionalValue` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::ManualTradeFormNotionalValue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properties with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
invalid_properties = Array.new
|
65
|
+
invalid_properties
|
66
|
+
end
|
67
|
+
|
68
|
+
# Check to see if the all the properties in the model are valid
|
69
|
+
# @return true if the model is valid
|
70
|
+
def valid?
|
71
|
+
true
|
72
|
+
end
|
73
|
+
|
74
|
+
# Checks equality by comparing each attribute.
|
75
|
+
# @param [Object] Object to be compared
|
76
|
+
def ==(o)
|
77
|
+
return true if self.equal?(o)
|
78
|
+
self.class == o.class
|
79
|
+
end
|
80
|
+
|
81
|
+
# @see the `==` method
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def eql?(o)
|
84
|
+
self == o
|
85
|
+
end
|
86
|
+
|
87
|
+
# Calculates hash code according to all attributes.
|
88
|
+
# @return [Integer] Hash code
|
89
|
+
def hash
|
90
|
+
[].hash
|
91
|
+
end
|
92
|
+
|
93
|
+
# Builds the object from hash
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
# @return [Object] Returns the model itself
|
96
|
+
def self.build_from_hash(attributes)
|
97
|
+
new.build_from_hash(attributes)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Builds the object from hash
|
101
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
102
|
+
# @return [Object] Returns the model itself
|
103
|
+
def build_from_hash(attributes)
|
104
|
+
return nil unless attributes.is_a?(Hash)
|
105
|
+
attributes = attributes.transform_keys(&:to_sym)
|
106
|
+
self.class.openapi_types.each_pair do |key, type|
|
107
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
108
|
+
self.send("#{key}=", nil)
|
109
|
+
elsif type =~ /\AArray<(.*)>/i
|
110
|
+
# check to ensure the input is an array given that the attribute
|
111
|
+
# is documented as an array but the input is not
|
112
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
113
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
114
|
+
end
|
115
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
116
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
self
|
121
|
+
end
|
122
|
+
|
123
|
+
# Deserializes the data based on type
|
124
|
+
# @param string type Data type
|
125
|
+
# @param string value Value to be deserialized
|
126
|
+
# @return [Object] Deserialized data
|
127
|
+
def _deserialize(type, value)
|
128
|
+
case type.to_sym
|
129
|
+
when :Time
|
130
|
+
Time.parse(value)
|
131
|
+
when :Date
|
132
|
+
Date.parse(value)
|
133
|
+
when :String
|
134
|
+
value.to_s
|
135
|
+
when :Integer
|
136
|
+
value.to_i
|
137
|
+
when :Float
|
138
|
+
value.to_f
|
139
|
+
when :Boolean
|
140
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
141
|
+
true
|
142
|
+
else
|
143
|
+
false
|
144
|
+
end
|
145
|
+
when :Object
|
146
|
+
# generic object (usually a Hash), return directly
|
147
|
+
value
|
148
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
149
|
+
inner_type = Regexp.last_match[:inner_type]
|
150
|
+
value.map { |v| _deserialize(inner_type, v) }
|
151
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
152
|
+
k_type = Regexp.last_match[:k_type]
|
153
|
+
v_type = Regexp.last_match[:v_type]
|
154
|
+
{}.tap do |hash|
|
155
|
+
value.each do |k, v|
|
156
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
else # model
|
160
|
+
# models (e.g. Pet) or oneOf
|
161
|
+
klass = SnapTrade.const_get(type)
|
162
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the string representation of the object
|
167
|
+
# @return [String] String presentation of the object
|
168
|
+
def to_s
|
169
|
+
to_hash.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
174
|
+
def to_body
|
175
|
+
to_hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the object in the form of hash
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_hash
|
181
|
+
hash = {}
|
182
|
+
self.class.attribute_map.each_pair do |attr, param|
|
183
|
+
value = self.send(attr)
|
184
|
+
if value.nil?
|
185
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
186
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
187
|
+
end
|
188
|
+
|
189
|
+
hash[param] = _to_hash(value)
|
190
|
+
end
|
191
|
+
hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Outputs non-array value in the form of hash
|
195
|
+
# For object, use to_hash. Otherwise, just return the value
|
196
|
+
# @param [Object] value Any valid value
|
197
|
+
# @return [Hash] Returns the value in the form of hash
|
198
|
+
def _to_hash(value)
|
199
|
+
if value.is_a?(Array)
|
200
|
+
value.compact.map { |v| _to_hash(v) }
|
201
|
+
elsif value.is_a?(Hash)
|
202
|
+
{}.tap do |hash|
|
203
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
204
|
+
end
|
205
|
+
elsif value.respond_to? :to_hash
|
206
|
+
value.to_hash
|
207
|
+
else
|
208
|
+
value
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
@@ -0,0 +1,103 @@
|
|
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
|
+
# Dollar amount to trade. Cannot work with units. Can only work for market order types and day for time in force. **Only available for Alpaca, Alpaca Paper, and Robinhood.**
|
15
|
+
module NotionalValue
|
16
|
+
class << self
|
17
|
+
# List of class defined in oneOf (OpenAPI v3)
|
18
|
+
def openapi_one_of
|
19
|
+
[
|
20
|
+
:'Float',
|
21
|
+
:'String'
|
22
|
+
]
|
23
|
+
end
|
24
|
+
|
25
|
+
# Builds the object
|
26
|
+
# @param [Mixed] Data to be matched against the list of oneOf items
|
27
|
+
# @return [Object] Returns the model or the data itself
|
28
|
+
def build(data)
|
29
|
+
# Go through the list of oneOf items and attempt to identify the appropriate one.
|
30
|
+
# Note:
|
31
|
+
# - We do not attempt to check whether exactly one item matches.
|
32
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
33
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
34
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
35
|
+
# - TODO: logging when debugging is set.
|
36
|
+
openapi_one_of.each do |klass|
|
37
|
+
begin
|
38
|
+
next if klass == :AnyType # "nullable: true"
|
39
|
+
typed_data = find_and_cast_into_type(klass, data)
|
40
|
+
return typed_data if typed_data
|
41
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
openapi_one_of.include?(:AnyType) ? data : nil
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
SchemaMismatchError = Class.new(StandardError)
|
51
|
+
|
52
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
53
|
+
def find_and_cast_into_type(klass, data)
|
54
|
+
return if data.nil?
|
55
|
+
|
56
|
+
case klass.to_s
|
57
|
+
when 'Boolean'
|
58
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
59
|
+
when 'Float'
|
60
|
+
return data if data.instance_of?(Float)
|
61
|
+
when 'Integer'
|
62
|
+
return data if data.instance_of?(Integer)
|
63
|
+
when 'Time'
|
64
|
+
return Time.parse(data)
|
65
|
+
when 'Date'
|
66
|
+
return Date.parse(data)
|
67
|
+
when 'String'
|
68
|
+
return data if data.instance_of?(String)
|
69
|
+
when 'Object' # "type: object"
|
70
|
+
return data if data.instance_of?(Hash)
|
71
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
72
|
+
if data.instance_of?(Array)
|
73
|
+
sub_type = Regexp.last_match[:sub_type]
|
74
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
75
|
+
end
|
76
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
77
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
78
|
+
sub_type = Regexp.last_match[:sub_type]
|
79
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
80
|
+
end
|
81
|
+
else # model
|
82
|
+
const = SnapTrade.const_get(klass)
|
83
|
+
if const
|
84
|
+
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
85
|
+
model = const.build(data)
|
86
|
+
return model if model
|
87
|
+
else
|
88
|
+
# raise if data contains keys that are not known to the model
|
89
|
+
raise unless (data.keys - const.acceptable_attributes).empty?
|
90
|
+
model = const.build_from_hash(data)
|
91
|
+
return model if model && model.valid?
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
raise # if no match by now, raise
|
97
|
+
rescue
|
98
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
@@ -18,7 +18,7 @@ module SnapTrade
|
|
18
18
|
|
19
19
|
attr_accessor :session_id
|
20
20
|
|
21
|
-
# SnapTrade User ID.
|
21
|
+
# SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
22
22
|
attr_accessor :user_id
|
23
23
|
|
24
24
|
# Time
|
@@ -12,16 +12,24 @@ require 'time'
|
|
12
12
|
|
13
13
|
module SnapTrade
|
14
14
|
class SessionEventType
|
15
|
-
|
15
|
+
OAUTH_REDIRECT = "OAUTH_REDIRECT".freeze
|
16
16
|
DISCLAIMER_ACCEPTED = "DISCLAIMER_ACCEPTED".freeze
|
17
17
|
BROKERAGE_CONNECTION_INITIATED = "BROKERAGE_CONNECTION_INITIATED".freeze
|
18
|
+
BROKERAGE_RECONNECT_INITIATED = "BROKERAGE_RECONNECT_INITIATED".freeze
|
18
19
|
BROKERAGE_AUTHENTICATION = "BROKERAGE_AUTHENTICATION".freeze
|
19
|
-
|
20
|
+
OAUTH_BROKERAGE_AUTHENTICATION = "OAUTH_BROKERAGE_AUTHENTICATION".freeze
|
21
|
+
MFA_REQUESTED = "MFA_REQUESTED".freeze
|
22
|
+
MFA_SUBMITTED = "MFA_SUBMITTED".freeze
|
23
|
+
MFA_CHOICE_REQUESTED = "MFA_CHOICE_REQUESTED".freeze
|
24
|
+
MFA_CHOICE_SUBMITTED = "MFA_CHOICE_SUBMITTED".freeze
|
20
25
|
CONNECTION_SUCCESSFUL = "CONNECTION_SUCCESSFUL".freeze
|
26
|
+
CONNECTION_FAILED = "CONNECTION_FAILED".freeze
|
21
27
|
PARTNER_REDIRECT = "PARTNER_REDIRECT".freeze
|
28
|
+
CONNECTION_ABORTED = "CONNECTION_ABORTED".freeze
|
29
|
+
SESSION_STARTED = "SESSION_STARTED".freeze
|
22
30
|
|
23
31
|
def self.all_vars
|
24
|
-
@all_vars ||= [
|
32
|
+
@all_vars ||= [OAUTH_REDIRECT, DISCLAIMER_ACCEPTED, BROKERAGE_CONNECTION_INITIATED, BROKERAGE_RECONNECT_INITIATED, BROKERAGE_AUTHENTICATION, OAUTH_BROKERAGE_AUTHENTICATION, MFA_REQUESTED, MFA_SUBMITTED, MFA_CHOICE_REQUESTED, MFA_CHOICE_SUBMITTED, CONNECTION_SUCCESSFUL, CONNECTION_FAILED, PARTNER_REDIRECT, CONNECTION_ABORTED, SESSION_STARTED].freeze
|
25
33
|
end
|
26
34
|
|
27
35
|
# Builds the enum from string
|
@@ -13,7 +13,7 @@ require 'time'
|
|
13
13
|
module SnapTrade
|
14
14
|
# Data required to register a user via SnapTrade Partner
|
15
15
|
class SnapTradeRegisterUserRequestBody
|
16
|
-
# SnapTrade User ID.
|
16
|
+
# SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
17
17
|
attr_accessor :user_id
|
18
18
|
|
19
19
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -13,7 +13,7 @@ require 'time'
|
|
13
13
|
module SnapTrade
|
14
14
|
# Response when register user is successful
|
15
15
|
class UserIDandSecret
|
16
|
-
# SnapTrade User ID.
|
16
|
+
# SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
17
17
|
attr_accessor :user_id
|
18
18
|
|
19
19
|
# 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.
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -25,7 +25,7 @@ require 'snaptrade/models/account_order_record'
|
|
25
25
|
require 'snaptrade/models/account_order_record_status'
|
26
26
|
require 'snaptrade/models/account_simple'
|
27
27
|
require 'snaptrade/models/account_sync_status'
|
28
|
-
require 'snaptrade/models/
|
28
|
+
require 'snaptrade/models/action_strict'
|
29
29
|
require 'snaptrade/models/amount'
|
30
30
|
require 'snaptrade/models/auth_type'
|
31
31
|
require 'snaptrade/models/authentication_login_snap_trade_user200_response'
|
@@ -61,6 +61,7 @@ require 'snaptrade/models/manual_trade'
|
|
61
61
|
require 'snaptrade/models/manual_trade_and_impact'
|
62
62
|
require 'snaptrade/models/manual_trade_balance'
|
63
63
|
require 'snaptrade/models/manual_trade_form'
|
64
|
+
require 'snaptrade/models/manual_trade_form_notional_value'
|
64
65
|
require 'snaptrade/models/manual_trade_symbol'
|
65
66
|
require 'snaptrade/models/model400_failed_request_response'
|
66
67
|
require 'snaptrade/models/model401_failed_request_response'
|
@@ -78,6 +79,7 @@ require 'snaptrade/models/model_type'
|
|
78
79
|
require 'snaptrade/models/monthly_dividends'
|
79
80
|
require 'snaptrade/models/net_contributions'
|
80
81
|
require 'snaptrade/models/net_dividend'
|
82
|
+
require 'snaptrade/models/notional_value'
|
81
83
|
require 'snaptrade/models/option_chain_inner'
|
82
84
|
require 'snaptrade/models/option_chain_inner_chain_per_root_inner'
|
83
85
|
require 'snaptrade/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner'
|
@@ -0,0 +1,23 @@
|
|
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::ActionStrict
|
15
|
+
describe SnapTrade::ActionStrict do
|
16
|
+
let(:instance) { SnapTrade::ActionStrict.new }
|
17
|
+
|
18
|
+
describe 'test an instance of ActionStrict' do
|
19
|
+
it 'should create an instance of ActionStrict' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::ActionStrict)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
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::ManualTradeFormNotionalValue
|
15
|
+
describe SnapTrade::ManualTradeFormNotionalValue do
|
16
|
+
let(:instance) { SnapTrade::ManualTradeFormNotionalValue.new }
|
17
|
+
|
18
|
+
describe 'test an instance of ManualTradeFormNotionalValue' do
|
19
|
+
it 'should create an instance of ManualTradeFormNotionalValue' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::ManualTradeFormNotionalValue)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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::NotionalValue
|
15
|
+
describe SnapTrade::NotionalValue do
|
16
|
+
describe '.openapi_one_of' do
|
17
|
+
it 'lists the items referenced in the oneOf array' do
|
18
|
+
expect(described_class.openapi_one_of).to_not be_empty
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '.build' do
|
23
|
+
it 'returns the correct model' do
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snaptrade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05
|
11
|
+
date: 2024-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -104,7 +104,7 @@ files:
|
|
104
104
|
- lib/snaptrade/models/account_order_record_status.rb
|
105
105
|
- lib/snaptrade/models/account_simple.rb
|
106
106
|
- lib/snaptrade/models/account_sync_status.rb
|
107
|
-
- lib/snaptrade/models/
|
107
|
+
- lib/snaptrade/models/action_strict.rb
|
108
108
|
- lib/snaptrade/models/amount.rb
|
109
109
|
- lib/snaptrade/models/auth_type.rb
|
110
110
|
- lib/snaptrade/models/authentication_login_snap_trade_user200_response.rb
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/snaptrade/models/manual_trade_and_impact.rb
|
141
141
|
- lib/snaptrade/models/manual_trade_balance.rb
|
142
142
|
- lib/snaptrade/models/manual_trade_form.rb
|
143
|
+
- lib/snaptrade/models/manual_trade_form_notional_value.rb
|
143
144
|
- lib/snaptrade/models/manual_trade_symbol.rb
|
144
145
|
- lib/snaptrade/models/model400_failed_request_response.rb
|
145
146
|
- lib/snaptrade/models/model401_failed_request_response.rb
|
@@ -157,6 +158,7 @@ files:
|
|
157
158
|
- lib/snaptrade/models/monthly_dividends.rb
|
158
159
|
- lib/snaptrade/models/net_contributions.rb
|
159
160
|
- lib/snaptrade/models/net_dividend.rb
|
161
|
+
- lib/snaptrade/models/notional_value.rb
|
160
162
|
- lib/snaptrade/models/option_chain_inner.rb
|
161
163
|
- lib/snaptrade/models/option_chain_inner_chain_per_root_inner.rb
|
162
164
|
- lib/snaptrade/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner.rb
|
@@ -248,7 +250,7 @@ files:
|
|
248
250
|
- spec/models/account_simple_spec.rb
|
249
251
|
- spec/models/account_spec.rb
|
250
252
|
- spec/models/account_sync_status_spec.rb
|
251
|
-
- spec/models/
|
253
|
+
- spec/models/action_strict_spec.rb
|
252
254
|
- spec/models/amount_spec.rb
|
253
255
|
- spec/models/auth_type_spec.rb
|
254
256
|
- spec/models/authentication_login_snap_trade_user200_response_spec.rb
|
@@ -282,6 +284,7 @@ files:
|
|
282
284
|
- spec/models/login_redirect_uri_spec.rb
|
283
285
|
- spec/models/manual_trade_and_impact_spec.rb
|
284
286
|
- spec/models/manual_trade_balance_spec.rb
|
287
|
+
- spec/models/manual_trade_form_notional_value_spec.rb
|
285
288
|
- spec/models/manual_trade_form_spec.rb
|
286
289
|
- spec/models/manual_trade_spec.rb
|
287
290
|
- spec/models/manual_trade_symbol_spec.rb
|
@@ -301,6 +304,7 @@ files:
|
|
301
304
|
- spec/models/monthly_dividends_spec.rb
|
302
305
|
- spec/models/net_contributions_spec.rb
|
303
306
|
- spec/models/net_dividend_spec.rb
|
307
|
+
- spec/models/notional_value_spec.rb
|
304
308
|
- spec/models/option_chain_inner_chain_per_root_inner_chain_per_strike_price_inner_spec.rb
|
305
309
|
- spec/models/option_chain_inner_chain_per_root_inner_spec.rb
|
306
310
|
- spec/models/option_chain_inner_spec.rb
|
@@ -424,6 +428,7 @@ test_files:
|
|
424
428
|
- spec/models/model400_failed_request_response_spec.rb
|
425
429
|
- spec/models/strategy_quotes_greek_spec.rb
|
426
430
|
- spec/models/account_spec.rb
|
431
|
+
- spec/models/action_strict_spec.rb
|
427
432
|
- spec/models/net_contributions_spec.rb
|
428
433
|
- spec/models/delete_user_response_spec.rb
|
429
434
|
- spec/models/net_dividend_spec.rb
|
@@ -443,6 +448,7 @@ test_files:
|
|
443
448
|
- spec/models/brokerage_authorization_type_read_only_type_spec.rb
|
444
449
|
- spec/models/manual_trade_symbol_spec.rb
|
445
450
|
- spec/models/position_spec.rb
|
451
|
+
- spec/models/notional_value_spec.rb
|
446
452
|
- spec/models/trade_action_spec.rb
|
447
453
|
- spec/models/authentication_login_snap_trade_user200_response_spec.rb
|
448
454
|
- spec/models/model_portfolio_details_spec.rb
|
@@ -501,11 +507,11 @@ test_files:
|
|
501
507
|
- spec/models/options_symbol_spec.rb
|
502
508
|
- spec/models/options_place_option_strategy_request_spec.rb
|
503
509
|
- spec/models/account_balance_spec.rb
|
504
|
-
- spec/models/action_spec.rb
|
505
510
|
- spec/models/options_get_option_strategy_request_spec.rb
|
506
511
|
- spec/models/currency_spec.rb
|
507
512
|
- spec/models/option_type_spec.rb
|
508
513
|
- spec/models/security_type_spec.rb
|
514
|
+
- spec/models/manual_trade_form_notional_value_spec.rb
|
509
515
|
- spec/models/login_redirect_uri_spec.rb
|
510
516
|
- spec/models/calculated_trade_spec.rb
|
511
517
|
- spec/models/target_asset_spec.rb
|
data/spec/models/action_spec.rb
DELETED
@@ -1,23 +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::Action
|
15
|
-
describe SnapTrade::Action do
|
16
|
-
let(:instance) { SnapTrade::Action.new }
|
17
|
-
|
18
|
-
describe 'test an instance of Action' do
|
19
|
-
it 'should create an instance of Action' do
|
20
|
-
expect(instance).to be_instance_of(SnapTrade::Action)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|