snaptrade 2.0.38 → 2.0.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +105 -68
- data/lib/snaptrade/api/authentication_api.rb +18 -14
- data/lib/snaptrade/api/connections_api.rb +8 -8
- data/lib/snaptrade/api/options_api.rb +4 -4
- data/lib/snaptrade/api/trading_api.rb +114 -106
- data/lib/snaptrade/models/brokerage_authorization.rb +1 -1
- data/lib/snaptrade/models/manual_trade.rb +7 -5
- data/lib/snaptrade/models/manual_trade_and_impact.rb +2 -2
- data/lib/snaptrade/models/manual_trade_balance.rb +3 -3
- data/lib/snaptrade/models/manual_trade_form.rb +52 -25
- data/lib/snaptrade/models/manual_trade_impact.rb +260 -0
- data/lib/snaptrade/models/manual_trade_symbol.rb +6 -1
- data/lib/snaptrade/models/notional_value.rb +1 -1
- data/lib/snaptrade/models/options_place_option_strategy_request.rb +2 -2
- data/lib/snaptrade/models/snap_trade_login_user_request_body.rb +3 -3
- data/lib/snaptrade/models/symbols_quotes_inner.rb +15 -10
- data/lib/snaptrade/models/trading_cancel_user_account_order_request.rb +1 -0
- data/lib/snaptrade/models/validated_trade_body.rb +1 -2
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +1 -0
- data/spec/api/authentication_api_spec.rb +2 -2
- data/spec/api/connections_api_spec.rb +2 -2
- data/spec/api/trading_api_spec.rb +15 -15
- data/spec/models/manual_trade_form_spec.rb +6 -6
- data/spec/models/manual_trade_impact_spec.rb +53 -0
- data/spec/models/symbols_quotes_inner_spec.rb +3 -3
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c520ce3f1b49a19b06ea9a9691ee99f4d1abdcc9f7f497750daa603354ecd093
|
4
|
+
data.tar.gz: 37a836bd19e78f169b2acf5966dc62d8c817db8fd885f03fd8a6bf7d0fb39f23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c292778ce417b1d203301fe76b4e8cb7fe2d2b31e7c2e31401c02e042e1b9f478b16c1bf031eb28122d5489cd6ea48c0f6b10061fbc9b6b663a49919a3cacceb
|
7
|
+
data.tar.gz: 1a1eb1acd011d807fb6dea972ada10d2972910ca8c0fd525169d15cf85c588d786525d88aa9df8050f37d9baa9fc7cf5d4d0933131d429e305274c3ce41a090f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snaptrade (2.0.
|
4
|
+
snaptrade (2.0.40)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
@@ -44,7 +44,7 @@ GEM
|
|
44
44
|
regexp_parser (2.9.2)
|
45
45
|
reline (0.5.9)
|
46
46
|
io-console (~> 0.5)
|
47
|
-
rexml (3.3.
|
47
|
+
rexml (3.3.6)
|
48
48
|
strscan
|
49
49
|
rspec (3.13.0)
|
50
50
|
rspec-core (~> 3.13.0)
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
8
8
|
|
9
|
-
[![npm](https://img.shields.io/badge/gem-v2.0.
|
9
|
+
[![npm](https://img.shields.io/badge/gem-v2.0.40-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.40)
|
10
10
|
[![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -70,7 +70,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
70
70
|
Add to Gemfile:
|
71
71
|
|
72
72
|
```ruby
|
73
|
-
gem 'snaptrade', '~> 2.0.
|
73
|
+
gem 'snaptrade', '~> 2.0.40'
|
74
74
|
```
|
75
75
|
|
76
76
|
## Getting Started<a id="getting-started"></a>
|
@@ -483,7 +483,10 @@ p result
|
|
483
483
|
|
484
484
|
### `snaptrade.authentication.login_snap_trade_user`<a id="snaptradeauthenticationlogin_snap_trade_user"></a>
|
485
485
|
|
486
|
-
|
486
|
+
Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app.
|
487
|
+
|
488
|
+
Please note that the returned URL expires in 5 minutes.
|
489
|
+
|
487
490
|
|
488
491
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
489
492
|
|
@@ -514,22 +517,18 @@ for a list of supported brokerages and their slugs.
|
|
514
517
|
When set to `true`, user will be redirected back to the partner's site instead
|
515
518
|
of the connection portal. This parameter is ignored if the connection portal is
|
516
519
|
loaded inside an iframe. See the [guide on ways to integrate the connection
|
517
|
-
portal](
|
518
|
-
information.
|
520
|
+
portal](/docs/implement-connection-portal) for more information.
|
519
521
|
|
520
522
|
##### customRedirect: `String`<a id="customredirect-string"></a>
|
521
523
|
URL to redirect the user to after the user connects their brokerage account.
|
522
524
|
This parameter is ignored if the connection portal is loaded inside an iframe.
|
523
525
|
See the [guide on ways to integrate the connection
|
524
|
-
portal](
|
525
|
-
information.
|
526
|
+
portal](/docs/implement-connection-portal) for more information.
|
526
527
|
|
527
528
|
##### reconnect: `String`<a id="reconnect-string"></a>
|
528
529
|
The UUID of the brokerage connection to be reconnected. This parameter should be
|
529
530
|
left empty unless you are reconnecting a disabled connection. See the [guide on
|
530
|
-
fixing broken
|
531
|
-
connections](https://docs.snaptrade.com/docs/fix-broken-connections) for more
|
532
|
-
information.
|
531
|
+
fixing broken connections](/docs/fix-broken-connections) for more information.
|
533
532
|
|
534
533
|
##### connectionType: [`ConnectionType`](./lib/snaptrade/models/connection_type.rb)<a id="connectiontype-connectiontypelibsnaptrademodelsconnection_typerb"></a>
|
535
534
|
Sets whether the connection should be read-only or trade-enabled.
|
@@ -663,7 +662,7 @@ p result
|
|
663
662
|
### `snaptrade.connections.disable_brokerage_authorization`<a id="snaptradeconnectionsdisable_brokerage_authorization"></a>
|
664
663
|
|
665
664
|
Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections.
|
666
|
-
Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](
|
665
|
+
Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection.
|
667
666
|
|
668
667
|
*Please contact us in order to use this endpoint as it is disabled by default.*
|
669
668
|
|
@@ -735,7 +734,7 @@ p result
|
|
735
734
|
|
736
735
|
### `snaptrade.connections.refresh_brokerage_authorization`<a id="snaptradeconnectionsrefresh_brokerage_authorization"></a>
|
737
736
|
|
738
|
-
Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](
|
737
|
+
Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection.
|
739
738
|
|
740
739
|
*Please contact support for access as this endpoint is not enabled by default.*
|
741
740
|
|
@@ -1007,7 +1006,7 @@ Places the option strategy order and returns the order record received from the
|
|
1007
1006
|
|
1008
1007
|
```ruby
|
1009
1008
|
result = snaptrade.options.place_option_strategy(
|
1010
|
-
order_type: "
|
1009
|
+
order_type: "Market",
|
1011
1010
|
time_in_force: "FOK",
|
1012
1011
|
user_id: "snaptrade-user-123",
|
1013
1012
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
@@ -1021,11 +1020,17 @@ p result
|
|
1021
1020
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1022
1021
|
|
1023
1022
|
##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
|
1024
|
-
|
1023
|
+
The type of order to place. - For `Limit` and `StopLimit` orders, the `price`
|
1024
|
+
field is required. - For `Stop` and `StopLimit` orders, the `stop` field is
|
1025
|
+
required.
|
1025
1026
|
|
1026
1027
|
##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
|
1027
|
-
|
1028
|
-
|
1028
|
+
The Time in Force type for the order. This field indicates how long the order
|
1029
|
+
will remain active before it is executed or expires. Here are the supported
|
1030
|
+
values: - `Day` - Day. The order is valid only for the trading day on which it
|
1031
|
+
is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
|
1032
|
+
or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
|
1033
|
+
immediately or be canceled completely.
|
1029
1034
|
|
1030
1035
|
##### user_id: `String`<a id="user_id-string"></a>
|
1031
1036
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
@@ -1362,8 +1367,7 @@ The ID of the account to search for symbols within.
|
|
1362
1367
|
|
1363
1368
|
### `snaptrade.trading.cancel_user_account_order`<a id="snaptradetradingcancel_user_account_order"></a>
|
1364
1369
|
|
1365
|
-
|
1366
|
-
This will only work if the order has not yet been executed.
|
1370
|
+
Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
|
1367
1371
|
|
1368
1372
|
|
1369
1373
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
@@ -1373,7 +1377,7 @@ result = snaptrade.trading.cancel_user_account_order(
|
|
1373
1377
|
user_id: "snaptrade-user-123",
|
1374
1378
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1375
1379
|
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1376
|
-
brokerage_order_id: "
|
1380
|
+
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
1377
1381
|
)
|
1378
1382
|
p result
|
1379
1383
|
```
|
@@ -1383,9 +1387,10 @@ p result
|
|
1383
1387
|
##### user_id: `String`<a id="user_id-string"></a>
|
1384
1388
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
1385
1389
|
##### account_id: `String`<a id="account_id-string"></a>
|
1386
|
-
The ID of the account to cancel the order in.
|
1387
|
-
|
1388
1390
|
##### brokerage_order_id: `String`<a id="brokerage_order_id-string"></a>
|
1391
|
+
Order ID returned by brokerage. This is the unique identifier for the order in
|
1392
|
+
the brokerage system.
|
1393
|
+
|
1389
1394
|
#### 🔄 Return<a id="🔄-return"></a>
|
1390
1395
|
|
1391
1396
|
[AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
|
@@ -1401,22 +1406,22 @@ The ID of the account to cancel the order in.
|
|
1401
1406
|
|
1402
1407
|
### `snaptrade.trading.get_order_impact`<a id="snaptradetradingget_order_impact"></a>
|
1403
1408
|
|
1404
|
-
|
1409
|
+
Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
|
1405
1410
|
|
1406
1411
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1407
1412
|
|
1408
1413
|
```ruby
|
1409
1414
|
result = snaptrade.trading.get_order_impact(
|
1415
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1416
|
+
action: "BUY",
|
1417
|
+
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1418
|
+
order_type: "Market",
|
1419
|
+
time_in_force: "FOK",
|
1410
1420
|
user_id: "snaptrade-user-123",
|
1411
1421
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1412
|
-
account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1413
|
-
action: "BUY",
|
1414
|
-
order_type: "Limit",
|
1415
1422
|
price: 31.33,
|
1416
1423
|
stop: 31.33,
|
1417
|
-
|
1418
|
-
units: 3.14,
|
1419
|
-
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1424
|
+
units: 10.5,
|
1420
1425
|
notional_value: None,
|
1421
1426
|
)
|
1422
1427
|
p result
|
@@ -1424,27 +1429,40 @@ p result
|
|
1424
1429
|
|
1425
1430
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1426
1431
|
|
1427
|
-
##### user_id: `String`<a id="user_id-string"></a>
|
1428
|
-
##### user_secret: `String`<a id="user_secret-string"></a>
|
1429
1432
|
##### account_id: `String`<a id="account_id-string"></a>
|
1433
|
+
Unique identifier for the connected brokerage account. This is the UUID used to
|
1434
|
+
reference the account in SnapTrade.
|
1435
|
+
|
1430
1436
|
##### action: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb)<a id="action-actionstrictlibsnaptrademodelsaction_strictrb"></a>
|
1431
|
-
|
1437
|
+
The action describes the intent or side of a trade. This is either `BUY` or
|
1438
|
+
`SELL`
|
1439
|
+
|
1440
|
+
##### universal_symbol_id: `String`<a id="universal_symbol_id-string"></a>
|
1441
|
+
Unique identifier for the symbol within SnapTrade. This is the ID used to
|
1442
|
+
reference the symbol in SnapTrade API calls.
|
1432
1443
|
|
1433
1444
|
##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
|
1434
|
-
|
1445
|
+
The type of order to place. - For `Limit` and `StopLimit` orders, the `price`
|
1446
|
+
field is required. - For `Stop` and `StopLimit` orders, the `stop` field is
|
1447
|
+
required.
|
1435
1448
|
|
1449
|
+
##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
|
1450
|
+
The Time in Force type for the order. This field indicates how long the order
|
1451
|
+
will remain active before it is executed or expires. Here are the supported
|
1452
|
+
values: - `Day` - Day. The order is valid only for the trading day on which it
|
1453
|
+
is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
|
1454
|
+
or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
|
1455
|
+
immediately or be canceled completely.
|
1456
|
+
|
1457
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
1458
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
1436
1459
|
##### price: `Float`<a id="price-float"></a>
|
1437
|
-
|
1460
|
+
The limit price for `Limit` and `StopLimit` orders.
|
1438
1461
|
|
1439
1462
|
##### stop: `Float`<a id="stop-float"></a>
|
1440
|
-
|
1441
|
-
|
1442
|
-
##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
|
1443
|
-
Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til
|
1444
|
-
Canceled
|
1463
|
+
The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
1445
1464
|
|
1446
1465
|
##### units: [`Float`](./lib/snaptrade/models/float.rb)<a id="units-floatlibsnaptrademodelsfloatrb"></a>
|
1447
|
-
##### universal_symbol_id: `String`<a id="universal_symbol_id-string"></a>
|
1448
1466
|
##### notional_value: [`ManualTradeFormNotionalValue`](./lib/snaptrade/models/manual_trade_form_notional_value.rb)<a id="notional_value-manualtradeformnotionalvaluelibsnaptrademodelsmanual_trade_form_notional_valuerb"></a>
|
1449
1467
|
#### 🔄 Return<a id="🔄-return"></a>
|
1450
1468
|
|
@@ -1461,7 +1479,7 @@ Canceled
|
|
1461
1479
|
|
1462
1480
|
### `snaptrade.trading.get_user_account_quotes`<a id="snaptradetradingget_user_account_quotes"></a>
|
1463
1481
|
|
1464
|
-
Returns
|
1482
|
+
Returns quotes from the brokerage for the specified symbols and account. The quotes returned can be delayed depending on the brokerage the account belongs to. It is highly recommended that you use your own market data provider for real-time quotes instead of relying on this endpoint. This endpoint does not work for options quotes.
|
1465
1483
|
|
1466
1484
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1467
1485
|
|
@@ -1481,13 +1499,12 @@ p result
|
|
1481
1499
|
##### user_id: `String`<a id="user_id-string"></a>
|
1482
1500
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
1483
1501
|
##### symbols: `String`<a id="symbols-string"></a>
|
1484
|
-
List of
|
1502
|
+
List of Universal Symbol IDs or tickers to get quotes for.
|
1485
1503
|
|
1486
1504
|
##### account_id: `String`<a id="account_id-string"></a>
|
1487
|
-
The ID of the account to get quotes.
|
1488
|
-
|
1489
1505
|
##### use_ticker: `Boolean`<a id="use_ticker-boolean"></a>
|
1490
|
-
Should be set to True if
|
1506
|
+
Should be set to `True` if `symbols` are comprised of tickers. Defaults to
|
1507
|
+
`False` if not provided.
|
1491
1508
|
|
1492
1509
|
#### 🔄 Return<a id="🔄-return"></a>
|
1493
1510
|
|
@@ -1504,22 +1521,27 @@ Should be set to True if providing tickers.
|
|
1504
1521
|
|
1505
1522
|
### `snaptrade.trading.place_force_order`<a id="snaptradetradingplace_force_order"></a>
|
1506
1523
|
|
1507
|
-
Places a
|
1524
|
+
Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds.
|
1525
|
+
|
1526
|
+
This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact).
|
1527
|
+
|
1528
|
+
It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
1529
|
+
|
1508
1530
|
|
1509
1531
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1510
1532
|
|
1511
1533
|
```ruby
|
1512
1534
|
result = snaptrade.trading.place_force_order(
|
1535
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1536
|
+
action: "BUY",
|
1537
|
+
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1538
|
+
order_type: "Market",
|
1539
|
+
time_in_force: "FOK",
|
1513
1540
|
user_id: "snaptrade-user-123",
|
1514
1541
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1515
|
-
account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1516
|
-
action: "BUY",
|
1517
|
-
order_type: "Limit",
|
1518
1542
|
price: 31.33,
|
1519
1543
|
stop: 31.33,
|
1520
|
-
|
1521
|
-
units: 3.14,
|
1522
|
-
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
1544
|
+
units: 10.5,
|
1523
1545
|
notional_value: None,
|
1524
1546
|
)
|
1525
1547
|
p result
|
@@ -1527,27 +1549,40 @@ p result
|
|
1527
1549
|
|
1528
1550
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1529
1551
|
|
1530
|
-
##### user_id: `String`<a id="user_id-string"></a>
|
1531
|
-
##### user_secret: `String`<a id="user_secret-string"></a>
|
1532
1552
|
##### account_id: `String`<a id="account_id-string"></a>
|
1553
|
+
Unique identifier for the connected brokerage account. This is the UUID used to
|
1554
|
+
reference the account in SnapTrade.
|
1555
|
+
|
1533
1556
|
##### action: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb)<a id="action-actionstrictlibsnaptrademodelsaction_strictrb"></a>
|
1534
|
-
|
1557
|
+
The action describes the intent or side of a trade. This is either `BUY` or
|
1558
|
+
`SELL`
|
1559
|
+
|
1560
|
+
##### universal_symbol_id: `String`<a id="universal_symbol_id-string"></a>
|
1561
|
+
Unique identifier for the symbol within SnapTrade. This is the ID used to
|
1562
|
+
reference the symbol in SnapTrade API calls.
|
1535
1563
|
|
1536
1564
|
##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
|
1537
|
-
|
1565
|
+
The type of order to place. - For `Limit` and `StopLimit` orders, the `price`
|
1566
|
+
field is required. - For `Stop` and `StopLimit` orders, the `stop` field is
|
1567
|
+
required.
|
1538
1568
|
|
1569
|
+
##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
|
1570
|
+
The Time in Force type for the order. This field indicates how long the order
|
1571
|
+
will remain active before it is executed or expires. Here are the supported
|
1572
|
+
values: - `Day` - Day. The order is valid only for the trading day on which it
|
1573
|
+
is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
|
1574
|
+
or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
|
1575
|
+
immediately or be canceled completely.
|
1576
|
+
|
1577
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
1578
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
1539
1579
|
##### price: `Float`<a id="price-float"></a>
|
1540
|
-
|
1580
|
+
The limit price for `Limit` and `StopLimit` orders.
|
1541
1581
|
|
1542
1582
|
##### stop: `Float`<a id="stop-float"></a>
|
1543
|
-
|
1544
|
-
|
1545
|
-
##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
|
1546
|
-
Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til
|
1547
|
-
Canceled
|
1583
|
+
The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
1548
1584
|
|
1549
1585
|
##### units: [`Float`](./lib/snaptrade/models/float.rb)<a id="units-floatlibsnaptrademodelsfloatrb"></a>
|
1550
|
-
##### universal_symbol_id: `String`<a id="universal_symbol_id-string"></a>
|
1551
1586
|
##### notional_value: [`ManualTradeFormNotionalValue`](./lib/snaptrade/models/manual_trade_form_notional_value.rb)<a id="notional_value-manualtradeformnotionalvaluelibsnaptrademodelsmanual_trade_form_notional_valuerb"></a>
|
1552
1587
|
#### 🔄 Return<a id="🔄-return"></a>
|
1553
1588
|
|
@@ -1564,15 +1599,16 @@ Canceled
|
|
1564
1599
|
|
1565
1600
|
### `snaptrade.trading.place_order`<a id="snaptradetradingplace_order"></a>
|
1566
1601
|
|
1567
|
-
Places the
|
1568
|
-
|
1602
|
+
Places the previously checked order with the brokerage. The `tradeId` is obtained from the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). If you prefer to place the order without checking for impact first, you can use the [place order endpoint](/reference/Trading/Trading_placeForceOrder).
|
1603
|
+
|
1604
|
+
It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
|
1569
1605
|
|
1570
1606
|
|
1571
1607
|
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1572
1608
|
|
1573
1609
|
```ruby
|
1574
1610
|
result = snaptrade.trading.place_order(
|
1575
|
-
trade_id: "
|
1611
|
+
trade_id: "139e307a-82f7-4402-b39e-4da7baa87758",
|
1576
1612
|
user_id: "snaptrade-user-123",
|
1577
1613
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1578
1614
|
wait_to_confirm: true,
|
@@ -1583,15 +1619,16 @@ p result
|
|
1583
1619
|
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1584
1620
|
|
1585
1621
|
##### trade_id: `String`<a id="trade_id-string"></a>
|
1586
|
-
|
1622
|
+
Obtained from calling the [check order impact
|
1623
|
+
endpoint](/reference/Trading/Trading_getOrderImpact)
|
1587
1624
|
|
1588
1625
|
##### user_id: `String`<a id="user_id-string"></a>
|
1589
1626
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
1590
1627
|
##### wait_to_confirm: `Boolean`<a id="wait_to_confirm-boolean"></a>
|
1591
1628
|
Optional, defaults to true. Determines if a wait is performed to check on order
|
1592
1629
|
status. If false, latency will be reduced but orders returned will be more
|
1593
|
-
likely to be of status PENDING as we will not wait to check on the status
|
1594
|
-
responding to the request
|
1630
|
+
likely to be of status `PENDING` as we will not wait to check on the status
|
1631
|
+
before responding to the request.
|
1595
1632
|
|
1596
1633
|
#### 🔄 Return<a id="🔄-return"></a>
|
1597
1634
|
|
@@ -180,16 +180,18 @@ module SnapTrade
|
|
180
180
|
end
|
181
181
|
|
182
182
|
|
183
|
-
#
|
183
|
+
# Generate Connection Portal URL
|
184
184
|
#
|
185
|
-
#
|
185
|
+
# Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app.
|
186
|
+
#
|
187
|
+
# Please note that the returned URL expires in 5 minutes.
|
186
188
|
#
|
187
189
|
# @param user_id [String]
|
188
190
|
# @param user_secret [String]
|
189
191
|
# @param broker [String] Slug of the brokerage to connect the user to. See [the integrations page](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=3cfea70ef4254afc89704e47275a7a9a&pvs=4) for a list of supported brokerages and their slugs.
|
190
|
-
# @param immediate_redirect [Boolean] When set to `true`, user will be redirected back to the partner's site instead of the connection portal. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](
|
191
|
-
# @param custom_redirect [String] URL to redirect the user to after the user connects their brokerage account. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](
|
192
|
-
# @param reconnect [String] The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the [guide on fixing broken connections](
|
192
|
+
# @param immediate_redirect [Boolean] When set to `true`, user will be redirected back to the partner's site instead of the connection portal. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information.
|
193
|
+
# @param custom_redirect [String] URL to redirect the user to after the user connects their brokerage account. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information.
|
194
|
+
# @param reconnect [String] The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the [guide on fixing broken connections](/docs/fix-broken-connections) for more information.
|
193
195
|
# @param connection_type [ConnectionType] Sets whether the connection should be read-only or trade-enabled.
|
194
196
|
# @param connection_portal_version [ConnectionPortalVersion] Sets the version of the connection portal to render.
|
195
197
|
# @param body [SnapTradeLoginUserRequestBody]
|
@@ -207,16 +209,18 @@ module SnapTrade
|
|
207
209
|
data
|
208
210
|
end
|
209
211
|
|
210
|
-
#
|
212
|
+
# Generate Connection Portal URL
|
211
213
|
#
|
212
|
-
#
|
214
|
+
# Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app.
|
215
|
+
#
|
216
|
+
# Please note that the returned URL expires in 5 minutes.
|
213
217
|
#
|
214
218
|
# @param user_id [String]
|
215
219
|
# @param user_secret [String]
|
216
220
|
# @param broker [String] Slug of the brokerage to connect the user to. See [the integrations page](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=3cfea70ef4254afc89704e47275a7a9a&pvs=4) for a list of supported brokerages and their slugs.
|
217
|
-
# @param immediate_redirect [Boolean] When set to `true`, user will be redirected back to the partner's site instead of the connection portal. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](
|
218
|
-
# @param custom_redirect [String] URL to redirect the user to after the user connects their brokerage account. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](
|
219
|
-
# @param reconnect [String] The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the [guide on fixing broken connections](
|
221
|
+
# @param immediate_redirect [Boolean] When set to `true`, user will be redirected back to the partner's site instead of the connection portal. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information.
|
222
|
+
# @param custom_redirect [String] URL to redirect the user to after the user connects their brokerage account. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information.
|
223
|
+
# @param reconnect [String] The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the [guide on fixing broken connections](/docs/fix-broken-connections) for more information.
|
220
224
|
# @param connection_type [ConnectionType] Sets whether the connection should be read-only or trade-enabled.
|
221
225
|
# @param connection_portal_version [ConnectionPortalVersion] Sets the version of the connection portal to render.
|
222
226
|
# @param body [SnapTradeLoginUserRequestBody]
|
@@ -233,8 +237,8 @@ module SnapTrade
|
|
233
237
|
login_snap_trade_user_with_http_info_impl(user_id, user_secret, extra)
|
234
238
|
end
|
235
239
|
|
236
|
-
#
|
237
|
-
#
|
240
|
+
# Generate Connection Portal URL
|
241
|
+
# Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app. Please note that the returned URL expires in 5 minutes.
|
238
242
|
# @param user_id [String]
|
239
243
|
# @param user_secret [String]
|
240
244
|
# @param [Hash] opts the optional parameters
|
@@ -245,8 +249,8 @@ module SnapTrade
|
|
245
249
|
data
|
246
250
|
end
|
247
251
|
|
248
|
-
#
|
249
|
-
#
|
252
|
+
# Generate Connection Portal URL
|
253
|
+
# Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app. Please note that the returned URL expires in 5 minutes.
|
250
254
|
# @param user_id [String]
|
251
255
|
# @param user_secret [String]
|
252
256
|
# @param [Hash] opts the optional parameters
|
@@ -123,7 +123,7 @@ module SnapTrade
|
|
123
123
|
# Force disable connection
|
124
124
|
#
|
125
125
|
# Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections.
|
126
|
-
# Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](
|
126
|
+
# Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection.
|
127
127
|
#
|
128
128
|
# *Please contact us in order to use this endpoint as it is disabled by default.*
|
129
129
|
#
|
@@ -139,7 +139,7 @@ module SnapTrade
|
|
139
139
|
# Force disable connection
|
140
140
|
#
|
141
141
|
# Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections.
|
142
|
-
# Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](
|
142
|
+
# Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection.
|
143
143
|
#
|
144
144
|
# *Please contact us in order to use this endpoint as it is disabled by default.*
|
145
145
|
#
|
@@ -152,7 +152,7 @@ module SnapTrade
|
|
152
152
|
end
|
153
153
|
|
154
154
|
# Force disable connection
|
155
|
-
# Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](
|
155
|
+
# Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection. *Please contact us in order to use this endpoint as it is disabled by default.*
|
156
156
|
# @param authorization_id [String]
|
157
157
|
# @param user_id [String]
|
158
158
|
# @param user_secret [String]
|
@@ -164,7 +164,7 @@ module SnapTrade
|
|
164
164
|
end
|
165
165
|
|
166
166
|
# Force disable connection
|
167
|
-
# Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](
|
167
|
+
# Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection. *Please contact us in order to use this endpoint as it is disabled by default.*
|
168
168
|
# @param authorization_id [String]
|
169
169
|
# @param user_id [String]
|
170
170
|
# @param user_secret [String]
|
@@ -334,7 +334,7 @@ module SnapTrade
|
|
334
334
|
|
335
335
|
# Refresh holdings for a connection
|
336
336
|
#
|
337
|
-
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](
|
337
|
+
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection.
|
338
338
|
#
|
339
339
|
# *Please contact support for access as this endpoint is not enabled by default.*
|
340
340
|
#
|
@@ -349,7 +349,7 @@ module SnapTrade
|
|
349
349
|
|
350
350
|
# Refresh holdings for a connection
|
351
351
|
#
|
352
|
-
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](
|
352
|
+
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection.
|
353
353
|
#
|
354
354
|
# *Please contact support for access as this endpoint is not enabled by default.*
|
355
355
|
#
|
@@ -362,7 +362,7 @@ module SnapTrade
|
|
362
362
|
end
|
363
363
|
|
364
364
|
# Refresh holdings for a connection
|
365
|
-
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](
|
365
|
+
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. *Please contact support for access as this endpoint is not enabled by default.*
|
366
366
|
# @param authorization_id [String]
|
367
367
|
# @param user_id [String]
|
368
368
|
# @param user_secret [String]
|
@@ -374,7 +374,7 @@ module SnapTrade
|
|
374
374
|
end
|
375
375
|
|
376
376
|
# Refresh holdings for a connection
|
377
|
-
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](
|
377
|
+
# Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. *Please contact support for access as this endpoint is not enabled by default.*
|
378
378
|
# @param authorization_id [String]
|
379
379
|
# @param user_id [String]
|
380
380
|
# @param user_secret [String]
|
@@ -483,8 +483,8 @@ module SnapTrade
|
|
483
483
|
#
|
484
484
|
# Places the option strategy order and returns the order record received from the brokerage.
|
485
485
|
#
|
486
|
-
# @param order_type [OrderTypeStrict]
|
487
|
-
# @param time_in_force [TimeInForceStrict]
|
486
|
+
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
487
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
488
488
|
# @param user_id [String]
|
489
489
|
# @param user_secret [String]
|
490
490
|
# @param account_id [String] The ID of the account to execute the strategy in.
|
@@ -506,8 +506,8 @@ module SnapTrade
|
|
506
506
|
#
|
507
507
|
# Places the option strategy order and returns the order record received from the brokerage.
|
508
508
|
#
|
509
|
-
# @param order_type [OrderTypeStrict]
|
510
|
-
# @param time_in_force [TimeInForceStrict]
|
509
|
+
# @param order_type [OrderTypeStrict] The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
|
510
|
+
# @param time_in_force [TimeInForceStrict] The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely.
|
511
511
|
# @param user_id [String]
|
512
512
|
# @param user_secret [String]
|
513
513
|
# @param account_id [String] The ID of the account to execute the strategy in.
|