snaptrade 2.0.38 → 2.0.39

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9395a7a9c5148bdb86a0b86e948181fef7189924188c4da86cf27a89ed75c57
4
- data.tar.gz: 5c1cca0121a0d496d6fb3be53b67a6e500104568b32276a13763f770d2f151f6
3
+ metadata.gz: 5de7a12dd5c2bcd10b37f4960afe06950c1bf6483efde545f9d58cbae981a842
4
+ data.tar.gz: 122df0c22545b0853927396d29c2698242873a686c71f4fda8aacff2bafeefd3
5
5
  SHA512:
6
- metadata.gz: 7c3294b628c979b2c77328aa2b6a04784ffd2b3135c4bc7744bf21321e86c13aabeeb358631d9d71df1a9f690f0773f70d28174e5b194e691490b410dee455de
7
- data.tar.gz: fb57f0a91a559a936fec3a109a0784d893ef9ac0d72a519efd527c4c1f5baf9f188d72692cd62808f823c90e88a12694b51c8505a994dade123f874e4550e66e
6
+ metadata.gz: f4022c9867722010ad4ea8df511108634b2b1501f68e3d3d8879bd1dcafc1091899b9eb775bf0e14db67f7b4d0e296ed32f95bb28e1f27c37265fa2ea6ab7216
7
+ data.tar.gz: e498b92a1f1c008739a54477c497cdf4cb42cb8806dafee45ee505024200067f3868060e645b72ff2fea7bc5459f7ba420cec1c007bac16b1b82d9ed3e9d3258
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.38)
4
+ snaptrade (2.0.39)
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.5)
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.38-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.38)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.39-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.39)
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.38'
73
+ gem 'snaptrade', '~> 2.0.39'
74
74
  ```
75
75
 
76
76
  ## Getting Started<a id="getting-started"></a>
@@ -1007,7 +1007,7 @@ Places the option strategy order and returns the order record received from the
1007
1007
 
1008
1008
  ```ruby
1009
1009
  result = snaptrade.options.place_option_strategy(
1010
- order_type: "Limit",
1010
+ order_type: "Market",
1011
1011
  time_in_force: "FOK",
1012
1012
  user_id: "snaptrade-user-123",
1013
1013
  user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
@@ -1021,11 +1021,17 @@ p result
1021
1021
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1022
1022
 
1023
1023
  ##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
1024
- Order Type
1024
+ The type of order to place. - For `Limit` and `StopLimit` orders, the `price`
1025
+ field is required. - For `Stop` and `StopLimit` orders, the `stop` field is
1026
+ required.
1025
1027
 
1026
1028
  ##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
1027
- Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til
1028
- Canceled
1029
+ The Time in Force type for the order. This field indicates how long the order
1030
+ will remain active before it is executed or expires. Here are the supported
1031
+ values: - `Day` - Day. The order is valid only for the trading day on which it
1032
+ is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
1033
+ or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
1034
+ immediately or be canceled completely.
1029
1035
 
1030
1036
  ##### user_id: `String`<a id="user_id-string"></a>
1031
1037
  ##### user_secret: `String`<a id="user_secret-string"></a>
@@ -1362,8 +1368,7 @@ The ID of the account to search for symbols within.
1362
1368
 
1363
1369
  ### `snaptrade.trading.cancel_user_account_order`<a id="snaptradetradingcancel_user_account_order"></a>
1364
1370
 
1365
- Sends a signal to the brokerage to cancel the specified order.
1366
- This will only work if the order has not yet been executed.
1371
+ Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
1367
1372
 
1368
1373
 
1369
1374
  #### 🛠️ Usage<a id="🛠️-usage"></a>
@@ -1373,7 +1378,7 @@ result = snaptrade.trading.cancel_user_account_order(
1373
1378
  user_id: "snaptrade-user-123",
1374
1379
  user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1375
1380
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1376
- brokerage_order_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1381
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
1377
1382
  )
1378
1383
  p result
1379
1384
  ```
@@ -1383,9 +1388,10 @@ p result
1383
1388
  ##### user_id: `String`<a id="user_id-string"></a>
1384
1389
  ##### user_secret: `String`<a id="user_secret-string"></a>
1385
1390
  ##### account_id: `String`<a id="account_id-string"></a>
1386
- The ID of the account to cancel the order in.
1387
-
1388
1391
  ##### brokerage_order_id: `String`<a id="brokerage_order_id-string"></a>
1392
+ Order ID returned by brokerage. This is the unique identifier for the order in
1393
+ the brokerage system.
1394
+
1389
1395
  #### 🔄 Return<a id="🔄-return"></a>
1390
1396
 
1391
1397
  [AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
@@ -1401,22 +1407,22 @@ The ID of the account to cancel the order in.
1401
1407
 
1402
1408
  ### `snaptrade.trading.get_order_impact`<a id="snaptradetradingget_order_impact"></a>
1403
1409
 
1404
- Return the trade object and it's impact on the account for the specified order.
1410
+ 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
1411
 
1406
1412
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1407
1413
 
1408
1414
  ```ruby
1409
1415
  result = snaptrade.trading.get_order_impact(
1416
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1417
+ action: "BUY",
1418
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1419
+ order_type: "Market",
1420
+ time_in_force: "FOK",
1410
1421
  user_id: "snaptrade-user-123",
1411
1422
  user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1412
- account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1413
- action: "BUY",
1414
- order_type: "Limit",
1415
1423
  price: 31.33,
1416
1424
  stop: 31.33,
1417
- time_in_force: "FOK",
1418
- units: 3.14,
1419
- universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1425
+ units: 10.5,
1420
1426
  notional_value: None,
1421
1427
  )
1422
1428
  p result
@@ -1424,27 +1430,40 @@ p result
1424
1430
 
1425
1431
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1426
1432
 
1427
- ##### user_id: `String`<a id="user_id-string"></a>
1428
- ##### user_secret: `String`<a id="user_secret-string"></a>
1429
1433
  ##### account_id: `String`<a id="account_id-string"></a>
1434
+ Unique identifier for the connected brokerage account. This is the UUID used to
1435
+ reference the account in SnapTrade.
1436
+
1430
1437
  ##### action: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb)<a id="action-actionstrictlibsnaptrademodelsaction_strictrb"></a>
1431
- Trade Action
1438
+ The action describes the intent or side of a trade. This is either `BUY` or
1439
+ `SELL`
1440
+
1441
+ ##### universal_symbol_id: `String`<a id="universal_symbol_id-string"></a>
1442
+ Unique identifier for the symbol within SnapTrade. This is the ID used to
1443
+ reference the symbol in SnapTrade API calls.
1432
1444
 
1433
1445
  ##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
1434
- Order Type
1446
+ The type of order to place. - For `Limit` and `StopLimit` orders, the `price`
1447
+ field is required. - For `Stop` and `StopLimit` orders, the `stop` field is
1448
+ required.
1435
1449
 
1450
+ ##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
1451
+ The Time in Force type for the order. This field indicates how long the order
1452
+ will remain active before it is executed or expires. Here are the supported
1453
+ values: - `Day` - Day. The order is valid only for the trading day on which it
1454
+ is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
1455
+ or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
1456
+ immediately or be canceled completely.
1457
+
1458
+ ##### user_id: `String`<a id="user_id-string"></a>
1459
+ ##### user_secret: `String`<a id="user_secret-string"></a>
1436
1460
  ##### price: `Float`<a id="price-float"></a>
1437
- Trade Price if limit or stop limit order
1461
+ The limit price for `Limit` and `StopLimit` orders.
1438
1462
 
1439
1463
  ##### stop: `Float`<a id="stop-float"></a>
1440
- Stop Price. If stop loss or stop limit order, the price to trigger the stop
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
1464
+ The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
1445
1465
 
1446
1466
  ##### 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
1467
  ##### notional_value: [`ManualTradeFormNotionalValue`](./lib/snaptrade/models/manual_trade_form_notional_value.rb)<a id="notional_value-manualtradeformnotionalvaluelibsnaptrademodelsmanual_trade_form_notional_valuerb"></a>
1449
1468
  #### 🔄 Return<a id="🔄-return"></a>
1450
1469
 
@@ -1461,7 +1480,7 @@ Canceled
1461
1480
 
1462
1481
  ### `snaptrade.trading.get_user_account_quotes`<a id="snaptradetradingget_user_account_quotes"></a>
1463
1482
 
1464
- Returns quote(s) from the brokerage for the specified symbol(s).
1483
+ 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
1484
 
1466
1485
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1467
1486
 
@@ -1481,13 +1500,12 @@ p result
1481
1500
  ##### user_id: `String`<a id="user_id-string"></a>
1482
1501
  ##### user_secret: `String`<a id="user_secret-string"></a>
1483
1502
  ##### symbols: `String`<a id="symbols-string"></a>
1484
- List of universal_symbol_id or tickers to get quotes for.
1503
+ List of Universal Symbol IDs or tickers to get quotes for.
1485
1504
 
1486
1505
  ##### account_id: `String`<a id="account_id-string"></a>
1487
- The ID of the account to get quotes.
1488
-
1489
1506
  ##### use_ticker: `Boolean`<a id="use_ticker-boolean"></a>
1490
- Should be set to True if providing tickers.
1507
+ Should be set to `True` if `symbols` are comprised of tickers. Defaults to
1508
+ `False` if not provided.
1491
1509
 
1492
1510
  #### 🔄 Return<a id="🔄-return"></a>
1493
1511
 
@@ -1504,22 +1522,25 @@ Should be set to True if providing tickers.
1504
1522
 
1505
1523
  ### `snaptrade.trading.place_force_order`<a id="snaptradetradingplace_force_order"></a>
1506
1524
 
1507
- Places a specified trade in the specified account.
1525
+ 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.
1526
+
1527
+ 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).
1528
+
1508
1529
 
1509
1530
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1510
1531
 
1511
1532
  ```ruby
1512
1533
  result = snaptrade.trading.place_force_order(
1534
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1535
+ action: "BUY",
1536
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1537
+ order_type: "Market",
1538
+ time_in_force: "FOK",
1513
1539
  user_id: "snaptrade-user-123",
1514
1540
  user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1515
- account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1516
- action: "BUY",
1517
- order_type: "Limit",
1518
1541
  price: 31.33,
1519
1542
  stop: 31.33,
1520
- time_in_force: "FOK",
1521
- units: 3.14,
1522
- universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1543
+ units: 10.5,
1523
1544
  notional_value: None,
1524
1545
  )
1525
1546
  p result
@@ -1527,27 +1548,40 @@ p result
1527
1548
 
1528
1549
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1529
1550
 
1530
- ##### user_id: `String`<a id="user_id-string"></a>
1531
- ##### user_secret: `String`<a id="user_secret-string"></a>
1532
1551
  ##### account_id: `String`<a id="account_id-string"></a>
1552
+ Unique identifier for the connected brokerage account. This is the UUID used to
1553
+ reference the account in SnapTrade.
1554
+
1533
1555
  ##### action: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb)<a id="action-actionstrictlibsnaptrademodelsaction_strictrb"></a>
1534
- Trade Action
1556
+ The action describes the intent or side of a trade. This is either `BUY` or
1557
+ `SELL`
1558
+
1559
+ ##### universal_symbol_id: `String`<a id="universal_symbol_id-string"></a>
1560
+ Unique identifier for the symbol within SnapTrade. This is the ID used to
1561
+ reference the symbol in SnapTrade API calls.
1535
1562
 
1536
1563
  ##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
1537
- Order Type
1564
+ The type of order to place. - For `Limit` and `StopLimit` orders, the `price`
1565
+ field is required. - For `Stop` and `StopLimit` orders, the `stop` field is
1566
+ required.
1538
1567
 
1568
+ ##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
1569
+ The Time in Force type for the order. This field indicates how long the order
1570
+ will remain active before it is executed or expires. Here are the supported
1571
+ values: - `Day` - Day. The order is valid only for the trading day on which it
1572
+ is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
1573
+ or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
1574
+ immediately or be canceled completely.
1575
+
1576
+ ##### user_id: `String`<a id="user_id-string"></a>
1577
+ ##### user_secret: `String`<a id="user_secret-string"></a>
1539
1578
  ##### price: `Float`<a id="price-float"></a>
1540
- Trade Price if limit or stop limit order
1579
+ The limit price for `Limit` and `StopLimit` orders.
1541
1580
 
1542
1581
  ##### stop: `Float`<a id="stop-float"></a>
1543
- Stop Price. If stop loss or stop limit order, the price to trigger the stop
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
1582
+ The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
1548
1583
 
1549
1584
  ##### 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
1585
  ##### notional_value: [`ManualTradeFormNotionalValue`](./lib/snaptrade/models/manual_trade_form_notional_value.rb)<a id="notional_value-manualtradeformnotionalvaluelibsnaptrademodelsmanual_trade_form_notional_valuerb"></a>
1552
1586
  #### 🔄 Return<a id="🔄-return"></a>
1553
1587
 
@@ -1564,15 +1598,14 @@ Canceled
1564
1598
 
1565
1599
  ### `snaptrade.trading.place_order`<a id="snaptradetradingplace_order"></a>
1566
1600
 
1567
- Places the specified trade object. This places the order in the account and
1568
- returns the status of the order from the brokerage.
1601
+ 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).
1569
1602
 
1570
1603
 
1571
1604
  #### 🛠️ Usage<a id="🛠️-usage"></a>
1572
1605
 
1573
1606
  ```ruby
1574
1607
  result = snaptrade.trading.place_order(
1575
- trade_id: "tradeId_example",
1608
+ trade_id: "139e307a-82f7-4402-b39e-4da7baa87758",
1576
1609
  user_id: "snaptrade-user-123",
1577
1610
  user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1578
1611
  wait_to_confirm: true,
@@ -1583,15 +1616,16 @@ p result
1583
1616
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
1584
1617
 
1585
1618
  ##### trade_id: `String`<a id="trade_id-string"></a>
1586
- The ID of trade object obtained from trade/impact endpoint
1619
+ Obtained from calling the [check order impact
1620
+ endpoint](/reference/Trading/Trading_getOrderImpact)
1587
1621
 
1588
1622
  ##### user_id: `String`<a id="user_id-string"></a>
1589
1623
  ##### user_secret: `String`<a id="user_secret-string"></a>
1590
1624
  ##### wait_to_confirm: `Boolean`<a id="wait_to_confirm-boolean"></a>
1591
1625
  Optional, defaults to true. Determines if a wait is performed to check on order
1592
1626
  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 before
1594
- responding to the request
1627
+ likely to be of status `PENDING` as we will not wait to check on the status
1628
+ before responding to the request.
1595
1629
 
1596
1630
  #### 🔄 Return<a id="🔄-return"></a>
1597
1631
 
@@ -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] Order Type
487
- # @param time_in_force [TimeInForceStrict] Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
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] Order Type
510
- # @param time_in_force [TimeInForceStrict] Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
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.