snaptrade 2.0.45 → 2.0.47

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: fd7125790c84e8e44aba10d60913ff137e061e6db99bf7e530c4dc8c25467d37
4
- data.tar.gz: 3a8080c128eaa83b08cdc9c624ff1b526699adeb5751bb14b6dabcf23b44a506
3
+ metadata.gz: 381201cb889178be618ef7274247035ffa049029330850b2d62225de4548cd4c
4
+ data.tar.gz: 8343e86aa03e76fb5531e65eb6916c7e540e0559186fcf82eee2cbbb8a12a4ec
5
5
  SHA512:
6
- metadata.gz: aea0aed32390f082fe6bf769cde8ff33715b354f750fdad75014226969e31bc60b8a686f28c64a8755c782234eba362755ee11336421e26cf47f8384751ff100
7
- data.tar.gz: '028b9ccca43fbe6d7391dd24283a585ba6e1232f18a89fec3f5533716e100dacf29f18cecf73360125bfc5cfb832afa362910d433f77bb7f671599473ae50961'
6
+ metadata.gz: 41f1146baccacf0bf2b4b052d6577f6898769eeea6865bd3337ef71a9059d5f00154befa1251b002c030b52391f79451929e58cf1d2618e9d35edd4cb587924c
7
+ data.tar.gz: e27c406ce2cf6cbcc25917a38cd5a794504b460ec5441de0222cd829a75d5fc571fd534dc70439b22ecf6792db8a203929b2cdf919d6763283f3f393866af2fc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.45)
4
+ snaptrade (2.0.47)
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.10)
46
46
  io-console (~> 0.5)
47
- rexml (3.3.7)
47
+ rexml (3.3.8)
48
48
  rspec (3.13.0)
49
49
  rspec-core (~> 3.13.0)
50
50
  rspec-expectations (~> 3.13.0)
@@ -54,7 +54,7 @@ GEM
54
54
  rspec-expectations (3.13.3)
55
55
  diff-lcs (>= 1.2.0, < 2.0)
56
56
  rspec-support (~> 3.13.0)
57
- rspec-mocks (3.13.1)
57
+ rspec-mocks (3.13.2)
58
58
  diff-lcs (>= 1.2.0, < 2.0)
59
59
  rspec-support (~> 3.13.0)
60
60
  rspec-support (3.13.1)
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.45-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.45)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.47-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.47)
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.45'
73
+ gem 'snaptrade', '~> 2.0.47'
74
74
  ```
75
75
 
76
76
  ## Getting Started<a id="getting-started"></a>
@@ -1436,7 +1436,7 @@ reference the account in SnapTrade.
1436
1436
 
1437
1437
  ##### action: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb)<a id="action-actionstrictlibsnaptrademodelsaction_strictrb"></a>
1438
1438
  The action describes the intent or side of a trade. This is either `BUY` or
1439
- `SELL`
1439
+ `SELL`.
1440
1440
 
1441
1441
  ##### universal_symbol_id: `String`<a id="universal_symbol_id-string"></a>
1442
1442
  Unique identifier for the symbol within SnapTrade. This is the ID used to
@@ -1535,11 +1535,12 @@ It's recommended to trigger a manual refresh of the account after placing an ord
1535
1535
  result = snaptrade.trading.place_force_order(
1536
1536
  account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
1537
1537
  action: "BUY",
1538
- universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1539
1538
  order_type: "Market",
1540
1539
  time_in_force: "FOK",
1541
1540
  user_id: "snaptrade-user-123",
1542
1541
  user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
1542
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1543
+ symbol: "AAPL 131124C00240000",
1543
1544
  price: 31.33,
1544
1545
  stop: 31.33,
1545
1546
  units: 10.5,
@@ -1554,13 +1555,10 @@ p result
1554
1555
  Unique identifier for the connected brokerage account. This is the UUID used to
1555
1556
  reference the account in SnapTrade.
1556
1557
 
1557
- ##### action: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb)<a id="action-actionstrictlibsnaptrademodelsaction_strictrb"></a>
1558
+ ##### action: [`ActionStrictWithOptions`](./lib/snaptrade/models/action_strict_with_options.rb)<a id="action-actionstrictwithoptionslibsnaptrademodelsaction_strict_with_optionsrb"></a>
1558
1559
  The action describes the intent or side of a trade. This is either `BUY` or
1559
- `SELL`
1560
-
1561
- ##### universal_symbol_id: `String`<a id="universal_symbol_id-string"></a>
1562
- Unique identifier for the symbol within SnapTrade. This is the ID used to
1563
- reference the symbol in SnapTrade API calls.
1560
+ `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or
1561
+ `SELL_TO_CLOSE` for Options.
1564
1562
 
1565
1563
  ##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
1566
1564
  The type of order to place. - For `Limit` and `StopLimit` orders, the `price`
@@ -1577,6 +1575,18 @@ immediately or be canceled completely.
1577
1575
 
1578
1576
  ##### user_id: `String`<a id="user_id-string"></a>
1579
1577
  ##### user_secret: `String`<a id="user_secret-string"></a>
1578
+ ##### universal_symbol_id: [`String`](./lib/snaptrade/models/string.rb)<a id="universal_symbol_id-stringlibsnaptrademodelsstringrb"></a>
1579
+ The universal symbol ID of the security to trade. Must be 'null' if `symbol` is
1580
+ provided, otherwise must be provided.
1581
+
1582
+ ##### symbol: `String`<a id="symbol-string"></a>
1583
+ The security's trading ticker symbol. This currently only support Options
1584
+ symbols in the 21 character OCC format. For example \"AAPL 131124C00240000\"
1585
+ represents a call option on AAPL expiring on 2024-11-13 with a strike price of
1586
+ $240. For more information on the OCC format, see
1587
+ [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is
1588
+ provided, then 'universal_symbol_id' must be 'null'.
1589
+
1580
1590
  ##### price: `Float`<a id="price-float"></a>
1581
1591
  The limit price for `Limit` and `StopLimit` orders.
1582
1592
 
@@ -1584,6 +1594,11 @@ The limit price for `Limit` and `StopLimit` orders.
1584
1594
  The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
1585
1595
 
1586
1596
  ##### units: [`Float`](./lib/snaptrade/models/float.rb)<a id="units-floatlibsnaptrademodelsfloatrb"></a>
1597
+ For Equity orders, this represents the number of shares for the order. This can
1598
+ be a decimal for fractional orders. Must be `null` if `notional_value` is
1599
+ provided. If placing an Option order, this field represents the number of
1600
+ contracts to buy or sell. (e.g., 1 contract = 100 shares).
1601
+
1587
1602
  ##### notional_value: [`ManualTradeFormNotionalValue`](./lib/snaptrade/models/manual_trade_form_notional_value.rb)<a id="notional_value-manualtradeformnotionalvaluelibsnaptrademodelsmanual_trade_form_notional_valuerb"></a>
1588
1603
  #### 🔄 Return<a id="🔄-return"></a>
1589
1604
 
@@ -146,7 +146,7 @@ module SnapTrade
146
146
  # 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.
147
147
  #
148
148
  # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
149
- # @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`
149
+ # @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
150
150
  # @param universal_symbol_id [String] Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
151
151
  # @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.
152
152
  # @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.
@@ -179,7 +179,7 @@ module SnapTrade
179
179
  # 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.
180
180
  #
181
181
  # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
182
- # @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`
182
+ # @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
183
183
  # @param universal_symbol_id [String] Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
184
184
  # @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.
185
185
  # @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.
@@ -417,31 +417,33 @@ module SnapTrade
417
417
  # 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.
418
418
  #
419
419
  # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
420
- # @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`
421
- # @param universal_symbol_id [String] Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
420
+ # @param action [ActionStrictWithOptions] The action describes the intent or side of a trade. This is either `BUY` or `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or `SELL_TO_CLOSE` for Options.
422
421
  # @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.
423
422
  # @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.
424
423
  # @param user_id [String]
425
424
  # @param user_secret [String]
425
+ # @param universal_symbol_id [String] The universal symbol ID of the security to trade. Must be 'null' if `symbol` is provided, otherwise must be provided.
426
+ # @param symbol [String] The security's trading ticker symbol. This currently only support Options symbols in the 21 character OCC format. For example \"AAPL 131124C00240000\" represents a call option on AAPL expiring on 2024-11-13 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
426
427
  # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
427
428
  # @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
428
- # @param units [Float]
429
+ # @param units [Float] For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).
429
430
  # @param notional_value [ManualTradeFormNotionalValue]
430
- # @param body [ManualTradeForm]
431
+ # @param body [ManualTradeFormWithOptions]
431
432
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
432
- def place_force_order(account_id:, action:, universal_symbol_id:, order_type:, time_in_force:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
433
+ def place_force_order(account_id:, action:, order_type:, time_in_force:, user_id:, user_secret:, universal_symbol_id: SENTINEL, symbol: SENTINEL, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
433
434
  _body = {}
434
435
  _body[:account_id] = account_id if account_id != SENTINEL
435
436
  _body[:action] = action if action != SENTINEL
436
437
  _body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
438
+ _body[:symbol] = symbol if symbol != SENTINEL
437
439
  _body[:order_type] = order_type if order_type != SENTINEL
438
440
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
439
441
  _body[:price] = price if price != SENTINEL
440
442
  _body[:stop] = stop if stop != SENTINEL
441
443
  _body[:units] = units if units != SENTINEL
442
444
  _body[:notional_value] = notional_value if notional_value != SENTINEL
443
- manual_trade_form = _body
444
- data, _status_code, _headers = place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
445
+ manual_trade_form_with_options = _body
446
+ data, _status_code, _headers = place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form_with_options, extra)
445
447
  data
446
448
  end
447
449
 
@@ -454,42 +456,44 @@ module SnapTrade
454
456
  # 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.
455
457
  #
456
458
  # @param account_id [String] Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
457
- # @param action [ActionStrict] The action describes the intent or side of a trade. This is either `BUY` or `SELL`
458
- # @param universal_symbol_id [String] Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
459
+ # @param action [ActionStrictWithOptions] The action describes the intent or side of a trade. This is either `BUY` or `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or `SELL_TO_CLOSE` for Options.
459
460
  # @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.
460
461
  # @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.
461
462
  # @param user_id [String]
462
463
  # @param user_secret [String]
464
+ # @param universal_symbol_id [String] The universal symbol ID of the security to trade. Must be 'null' if `symbol` is provided, otherwise must be provided.
465
+ # @param symbol [String] The security's trading ticker symbol. This currently only support Options symbols in the 21 character OCC format. For example \"AAPL 131124C00240000\" represents a call option on AAPL expiring on 2024-11-13 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
463
466
  # @param price [Float] The limit price for `Limit` and `StopLimit` orders.
464
467
  # @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
465
- # @param units [Float]
468
+ # @param units [Float] For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).
466
469
  # @param notional_value [ManualTradeFormNotionalValue]
467
- # @param body [ManualTradeForm]
470
+ # @param body [ManualTradeFormWithOptions]
468
471
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
469
- def place_force_order_with_http_info(account_id:, action:, universal_symbol_id:, order_type:, time_in_force:, user_id:, user_secret:, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
472
+ def place_force_order_with_http_info(account_id:, action:, order_type:, time_in_force:, user_id:, user_secret:, universal_symbol_id: SENTINEL, symbol: SENTINEL, price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
470
473
  _body = {}
471
474
  _body[:account_id] = account_id if account_id != SENTINEL
472
475
  _body[:action] = action if action != SENTINEL
473
476
  _body[:universal_symbol_id] = universal_symbol_id if universal_symbol_id != SENTINEL
477
+ _body[:symbol] = symbol if symbol != SENTINEL
474
478
  _body[:order_type] = order_type if order_type != SENTINEL
475
479
  _body[:time_in_force] = time_in_force if time_in_force != SENTINEL
476
480
  _body[:price] = price if price != SENTINEL
477
481
  _body[:stop] = stop if stop != SENTINEL
478
482
  _body[:units] = units if units != SENTINEL
479
483
  _body[:notional_value] = notional_value if notional_value != SENTINEL
480
- manual_trade_form = _body
481
- place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, extra)
484
+ manual_trade_form_with_options = _body
485
+ place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form_with_options, extra)
482
486
  end
483
487
 
484
488
  # Place order
485
489
  # 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. 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). 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.
486
490
  # @param user_id [String]
487
491
  # @param user_secret [String]
488
- # @param manual_trade_form [ManualTradeForm]
492
+ # @param manual_trade_form_with_options [ManualTradeFormWithOptions]
489
493
  # @param [Hash] opts the optional parameters
490
494
  # @return [AccountOrderRecord]
491
- private def place_force_order_impl(user_id, user_secret, manual_trade_form, opts = {})
492
- data, _status_code, _headers = place_force_order_with_http_info(user_id, user_secret, manual_trade_form, opts)
495
+ private def place_force_order_impl(user_id, user_secret, manual_trade_form_with_options, opts = {})
496
+ data, _status_code, _headers = place_force_order_with_http_info(user_id, user_secret, manual_trade_form_with_options, opts)
493
497
  data
494
498
  end
495
499
 
@@ -497,10 +501,10 @@ module SnapTrade
497
501
  # 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. 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). It&#39;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.
498
502
  # @param user_id [String]
499
503
  # @param user_secret [String]
500
- # @param manual_trade_form [ManualTradeForm]
504
+ # @param manual_trade_form_with_options [ManualTradeFormWithOptions]
501
505
  # @param [Hash] opts the optional parameters
502
506
  # @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
503
- private def place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form, opts = {})
507
+ private def place_force_order_with_http_info_impl(user_id, user_secret, manual_trade_form_with_options, opts = {})
504
508
  if @api_client.config.debugging
505
509
  @api_client.config.logger.debug 'Calling API: TradingApi.place_force_order ...'
506
510
  end
@@ -512,9 +516,9 @@ module SnapTrade
512
516
  if @api_client.config.client_side_validation && user_secret.nil?
513
517
  fail ArgumentError, "Missing the required parameter 'user_secret' when calling TradingApi.place_force_order"
514
518
  end
515
- # verify the required parameter 'manual_trade_form' is set
516
- if @api_client.config.client_side_validation && manual_trade_form.nil?
517
- fail ArgumentError, "Missing the required parameter 'manual_trade_form' when calling TradingApi.place_force_order"
519
+ # verify the required parameter 'manual_trade_form_with_options' is set
520
+ if @api_client.config.client_side_validation && manual_trade_form_with_options.nil?
521
+ fail ArgumentError, "Missing the required parameter 'manual_trade_form_with_options' when calling TradingApi.place_force_order"
518
522
  end
519
523
  # resource path
520
524
  local_var_path = '/trade/place'
@@ -538,7 +542,7 @@ module SnapTrade
538
542
  form_params = opts[:form_params] || {}
539
543
 
540
544
  # http body (model)
541
- post_body = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_form)
545
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(manual_trade_form_with_options)
542
546
 
543
547
  # return_type
544
548
  return_type = opts[:debug_return_type] || 'AccountOrderRecord'
@@ -77,7 +77,7 @@ module SnapTrade
77
77
  # @option opts [Date] :end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`.
78
78
  # @option opts [String] :accounts Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter.
79
79
  # @option opts [String] :brokerage_authorizations Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter.
80
- # @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account.
80
+ # @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account.
81
81
  # @return [Array<UniversalActivity>]
82
82
  private def get_activities_impl(user_id, user_secret, opts = {})
83
83
  data, _status_code, _headers = get_activities_with_http_info(user_id, user_secret, opts)
@@ -93,7 +93,7 @@ module SnapTrade
93
93
  # @option opts [Date] :end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`.
94
94
  # @option opts [String] :accounts Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter.
95
95
  # @option opts [String] :brokerage_authorizations Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter.
96
- # @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account.
96
+ # @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account.
97
97
  # @return [Array<(Array<UniversalActivity>, Integer, Hash)>] Array<UniversalActivity> data, response status code and response headers
98
98
  private def get_activities_with_http_info_impl(user_id, user_secret, opts = {})
99
99
  if @api_client.config.debugging
@@ -19,9 +19,6 @@ module SnapTrade
19
19
  # Unique identifier for the connection. This is the UUID used to reference the connection in SnapTrade.
20
20
  attr_accessor :brokerage_authorization
21
21
 
22
- # Portfolio Group ID. Portfolio Groups have been deprecated. Please contact support if you have a usecase for it.
23
- attr_accessor :portfolio_group
24
-
25
22
  # A display name for the account. Either assigned by the user or by the brokerage itself. For certain brokerages, SnapTrade appends the brokerage name to the account name for clarity.
26
23
  attr_accessor :name
27
24
 
@@ -34,30 +31,33 @@ module SnapTrade
34
31
  # Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was created in SnapTrade. This is _not_ the account opening date at the brokerage.
35
32
  attr_accessor :created_date
36
33
 
34
+ attr_accessor :sync_status
35
+
36
+ attr_accessor :balance
37
+
37
38
  # Additional information about the account, such as account type, status, etc. This information is specific to the brokerage and there's no standard format for this data. This field is deprecated and subject to removal in a future version.
38
39
  attr_accessor :meta
39
40
 
41
+ # Portfolio Group ID. Portfolio Groups have been deprecated. Please contact support if you have a usecase for it.
42
+ attr_accessor :portfolio_group
43
+
40
44
  # This field is deprecated.
41
45
  attr_accessor :cash_restrictions
42
46
 
43
- attr_accessor :sync_status
44
-
45
- attr_accessor :balance
46
-
47
47
  # Attribute mapping from ruby-style variable name to JSON key.
48
48
  def self.attribute_map
49
49
  {
50
50
  :'id' => :'id',
51
51
  :'brokerage_authorization' => :'brokerage_authorization',
52
- :'portfolio_group' => :'portfolio_group',
53
52
  :'name' => :'name',
54
53
  :'number' => :'number',
55
54
  :'institution_name' => :'institution_name',
56
55
  :'created_date' => :'created_date',
57
- :'meta' => :'meta',
58
- :'cash_restrictions' => :'cash_restrictions',
59
56
  :'sync_status' => :'sync_status',
60
- :'balance' => :'balance'
57
+ :'balance' => :'balance',
58
+ :'meta' => :'meta',
59
+ :'portfolio_group' => :'portfolio_group',
60
+ :'cash_restrictions' => :'cash_restrictions'
61
61
  }
62
62
  end
63
63
 
@@ -71,15 +71,15 @@ module SnapTrade
71
71
  {
72
72
  :'id' => :'String',
73
73
  :'brokerage_authorization' => :'String',
74
- :'portfolio_group' => :'String',
75
74
  :'name' => :'String',
76
75
  :'number' => :'String',
77
76
  :'institution_name' => :'String',
78
77
  :'created_date' => :'Time',
79
- :'meta' => :'Hash<String, Object>',
80
- :'cash_restrictions' => :'Array<String>',
81
78
  :'sync_status' => :'AccountSyncStatus',
82
- :'balance' => :'AccountBalance'
79
+ :'balance' => :'AccountBalance',
80
+ :'meta' => :'Hash<String, Object>',
81
+ :'portfolio_group' => :'String',
82
+ :'cash_restrictions' => :'Array<String>'
83
83
  }
84
84
  end
85
85
 
@@ -113,10 +113,6 @@ module SnapTrade
113
113
  self.brokerage_authorization = attributes[:'brokerage_authorization']
114
114
  end
115
115
 
116
- if attributes.key?(:'portfolio_group')
117
- self.portfolio_group = attributes[:'portfolio_group']
118
- end
119
-
120
116
  if attributes.key?(:'name')
121
117
  self.name = attributes[:'name']
122
118
  end
@@ -133,37 +129,76 @@ module SnapTrade
133
129
  self.created_date = attributes[:'created_date']
134
130
  end
135
131
 
132
+ if attributes.key?(:'sync_status')
133
+ self.sync_status = attributes[:'sync_status']
134
+ end
135
+
136
+ if attributes.key?(:'balance')
137
+ self.balance = attributes[:'balance']
138
+ end
139
+
136
140
  if attributes.key?(:'meta')
137
141
  if (value = attributes[:'meta']).is_a?(Hash)
138
142
  self.meta = value
139
143
  end
140
144
  end
141
145
 
146
+ if attributes.key?(:'portfolio_group')
147
+ self.portfolio_group = attributes[:'portfolio_group']
148
+ end
149
+
142
150
  if attributes.key?(:'cash_restrictions')
143
151
  if (value = attributes[:'cash_restrictions']).is_a?(Array)
144
152
  self.cash_restrictions = value
145
153
  end
146
154
  end
147
-
148
- if attributes.key?(:'sync_status')
149
- self.sync_status = attributes[:'sync_status']
150
- end
151
-
152
- if attributes.key?(:'balance')
153
- self.balance = attributes[:'balance']
154
- end
155
155
  end
156
156
 
157
157
  # Show invalid properties with the reasons. Usually used together with valid?
158
158
  # @return Array for valid properties with the reasons
159
159
  def list_invalid_properties
160
160
  invalid_properties = Array.new
161
+ if @id.nil?
162
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
163
+ end
164
+
165
+ if @brokerage_authorization.nil?
166
+ invalid_properties.push('invalid value for "brokerage_authorization", brokerage_authorization cannot be nil.')
167
+ end
168
+
169
+ if @number.nil?
170
+ invalid_properties.push('invalid value for "number", number cannot be nil.')
171
+ end
172
+
173
+ if @institution_name.nil?
174
+ invalid_properties.push('invalid value for "institution_name", institution_name cannot be nil.')
175
+ end
176
+
177
+ if @created_date.nil?
178
+ invalid_properties.push('invalid value for "created_date", created_date cannot be nil.')
179
+ end
180
+
181
+ if @sync_status.nil?
182
+ invalid_properties.push('invalid value for "sync_status", sync_status cannot be nil.')
183
+ end
184
+
185
+ if @balance.nil?
186
+ invalid_properties.push('invalid value for "balance", balance cannot be nil.')
187
+ end
188
+
161
189
  invalid_properties
162
190
  end
163
191
 
164
192
  # Check to see if the all the properties in the model are valid
165
193
  # @return true if the model is valid
166
194
  def valid?
195
+ return false if @id.nil?
196
+ return false if @brokerage_authorization.nil?
197
+ return false if @number.nil?
198
+ return false if @institution_name.nil?
199
+ return false if @created_date.nil?
200
+ return false if @sync_status.nil?
201
+ return false if @balance.nil?
167
202
  true
168
203
  end
169
204
 
@@ -174,15 +209,15 @@ module SnapTrade
174
209
  self.class == o.class &&
175
210
  id == o.id &&
176
211
  brokerage_authorization == o.brokerage_authorization &&
177
- portfolio_group == o.portfolio_group &&
178
212
  name == o.name &&
179
213
  number == o.number &&
180
214
  institution_name == o.institution_name &&
181
215
  created_date == o.created_date &&
182
- meta == o.meta &&
183
- cash_restrictions == o.cash_restrictions &&
184
216
  sync_status == o.sync_status &&
185
- balance == o.balance
217
+ balance == o.balance &&
218
+ meta == o.meta &&
219
+ portfolio_group == o.portfolio_group &&
220
+ cash_restrictions == o.cash_restrictions
186
221
  end
187
222
 
188
223
  # @see the `==` method
@@ -194,7 +229,7 @@ module SnapTrade
194
229
  # Calculates hash code according to all attributes.
195
230
  # @return [Integer] Hash code
196
231
  def hash
197
- [id, brokerage_authorization, portfolio_group, name, number, institution_name, created_date, meta, cash_restrictions, sync_status, balance].hash
232
+ [id, brokerage_authorization, name, number, institution_name, created_date, sync_status, balance, meta, portfolio_group, cash_restrictions].hash
198
233
  end
199
234
 
200
235
  # Builds the object from hash
@@ -0,0 +1,41 @@
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 ActionStrictWithOptions
15
+ BUY = "BUY".freeze
16
+ SELL = "SELL".freeze
17
+ BUY_TO_OPEN = "BUY_TO_OPEN".freeze
18
+ BUY_TO_CLOSE = "BUY_TO_CLOSE".freeze
19
+ SELL_TO_OPEN = "SELL_TO_OPEN".freeze
20
+ SELL_TO_CLOSE = "SELL_TO_CLOSE".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [BUY, SELL, BUY_TO_OPEN, BUY_TO_CLOSE, SELL_TO_OPEN, SELL_TO_CLOSE].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if ActionStrictWithOptions.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #ActionStrictWithOptions"
39
+ end
40
+ end
41
+ end
@@ -43,6 +43,7 @@ module SnapTrade
43
43
  # List of attributes with nullable: true
44
44
  def self.openapi_nullable
45
45
  Set.new([
46
+ :'last_successful_sync'
46
47
  ])
47
48
  end
48
49
 
@@ -27,7 +27,7 @@ module SnapTrade
27
27
 
28
28
  attr_accessor :symbol
29
29
 
30
- # The action describes the intent or side of a trade. This is either `BUY` or `SELL`
30
+ # The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
31
31
  attr_accessor :action
32
32
 
33
33
  attr_accessor :units
@@ -16,7 +16,7 @@ module SnapTrade
16
16
  # Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
17
17
  attr_accessor :account_id
18
18
 
19
- # The action describes the intent or side of a trade. This is either `BUY` or `SELL`
19
+ # The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
20
20
  attr_accessor :action
21
21
 
22
22
  # Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
@@ -0,0 +1,333 @@
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
+ # Inputs for placing an order with the brokerage.
15
+ class ManualTradeFormWithOptions
16
+ # Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
17
+ attr_accessor :account_id
18
+
19
+ # The action describes the intent or side of a trade. This is either `BUY` or `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or `SELL_TO_CLOSE` for Options.
20
+ attr_accessor :action
21
+
22
+ # The universal symbol ID of the security to trade. Must be 'null' if `symbol` is provided, otherwise must be provided.
23
+ attr_accessor :universal_symbol_id
24
+
25
+ # The security's trading ticker symbol. This currently only support Options symbols in the 21 character OCC format. For example \"AAPL 131124C00240000\" represents a call option on AAPL expiring on 2024-11-13 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
26
+ attr_accessor :symbol
27
+
28
+ # 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.
29
+ attr_accessor :order_type
30
+
31
+ # 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.
32
+ attr_accessor :time_in_force
33
+
34
+ # The limit price for `Limit` and `StopLimit` orders.
35
+ attr_accessor :price
36
+
37
+ # The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
38
+ attr_accessor :stop
39
+
40
+ # For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).
41
+ attr_accessor :units
42
+
43
+ attr_accessor :notional_value
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'account_id' => :'account_id',
49
+ :'action' => :'action',
50
+ :'universal_symbol_id' => :'universal_symbol_id',
51
+ :'symbol' => :'symbol',
52
+ :'order_type' => :'order_type',
53
+ :'time_in_force' => :'time_in_force',
54
+ :'price' => :'price',
55
+ :'stop' => :'stop',
56
+ :'units' => :'units',
57
+ :'notional_value' => :'notional_value'
58
+ }
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'account_id' => :'String',
70
+ :'action' => :'ActionStrictWithOptions',
71
+ :'universal_symbol_id' => :'String',
72
+ :'symbol' => :'String',
73
+ :'order_type' => :'OrderTypeStrict',
74
+ :'time_in_force' => :'TimeInForceStrict',
75
+ :'price' => :'Float',
76
+ :'stop' => :'Float',
77
+ :'units' => :'Float',
78
+ :'notional_value' => :'ManualTradeFormNotionalValue'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ :'universal_symbol_id',
86
+ :'symbol',
87
+ :'price',
88
+ :'stop',
89
+ :'units',
90
+ :'notional_value'
91
+ ])
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::ManualTradeFormWithOptions` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ attributes = attributes.each_with_object({}) { |(k, v), h|
103
+ if (!self.class.attribute_map.key?(k.to_sym))
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::ManualTradeFormWithOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
105
+ end
106
+ h[k.to_sym] = v
107
+ }
108
+
109
+ if attributes.key?(:'account_id')
110
+ self.account_id = attributes[:'account_id']
111
+ end
112
+
113
+ if attributes.key?(:'action')
114
+ self.action = attributes[:'action']
115
+ end
116
+
117
+ if attributes.key?(:'universal_symbol_id')
118
+ self.universal_symbol_id = attributes[:'universal_symbol_id']
119
+ end
120
+
121
+ if attributes.key?(:'symbol')
122
+ self.symbol = attributes[:'symbol']
123
+ end
124
+
125
+ if attributes.key?(:'order_type')
126
+ self.order_type = attributes[:'order_type']
127
+ end
128
+
129
+ if attributes.key?(:'time_in_force')
130
+ self.time_in_force = attributes[:'time_in_force']
131
+ end
132
+
133
+ if attributes.key?(:'price')
134
+ self.price = attributes[:'price']
135
+ end
136
+
137
+ if attributes.key?(:'stop')
138
+ self.stop = attributes[:'stop']
139
+ end
140
+
141
+ if attributes.key?(:'units')
142
+ self.units = attributes[:'units']
143
+ end
144
+
145
+ if attributes.key?(:'notional_value')
146
+ self.notional_value = attributes[:'notional_value']
147
+ end
148
+ end
149
+
150
+ # Show invalid properties with the reasons. Usually used together with valid?
151
+ # @return Array for valid properties with the reasons
152
+ def list_invalid_properties
153
+ invalid_properties = Array.new
154
+ if @account_id.nil?
155
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
156
+ end
157
+
158
+ if @action.nil?
159
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
160
+ end
161
+
162
+ if @order_type.nil?
163
+ invalid_properties.push('invalid value for "order_type", order_type cannot be nil.')
164
+ end
165
+
166
+ if @time_in_force.nil?
167
+ invalid_properties.push('invalid value for "time_in_force", time_in_force cannot be nil.')
168
+ end
169
+
170
+ invalid_properties
171
+ end
172
+
173
+ # Check to see if the all the properties in the model are valid
174
+ # @return true if the model is valid
175
+ def valid?
176
+ return false if @account_id.nil?
177
+ return false if @action.nil?
178
+ return false if @order_type.nil?
179
+ return false if @time_in_force.nil?
180
+ true
181
+ end
182
+
183
+ # Checks equality by comparing each attribute.
184
+ # @param [Object] Object to be compared
185
+ def ==(o)
186
+ return true if self.equal?(o)
187
+ self.class == o.class &&
188
+ account_id == o.account_id &&
189
+ action == o.action &&
190
+ universal_symbol_id == o.universal_symbol_id &&
191
+ symbol == o.symbol &&
192
+ order_type == o.order_type &&
193
+ time_in_force == o.time_in_force &&
194
+ price == o.price &&
195
+ stop == o.stop &&
196
+ units == o.units &&
197
+ notional_value == o.notional_value
198
+ end
199
+
200
+ # @see the `==` method
201
+ # @param [Object] Object to be compared
202
+ def eql?(o)
203
+ self == o
204
+ end
205
+
206
+ # Calculates hash code according to all attributes.
207
+ # @return [Integer] Hash code
208
+ def hash
209
+ [account_id, action, universal_symbol_id, symbol, order_type, time_in_force, price, stop, units, notional_value].hash
210
+ end
211
+
212
+ # Builds the object from hash
213
+ # @param [Hash] attributes Model attributes in the form of hash
214
+ # @return [Object] Returns the model itself
215
+ def self.build_from_hash(attributes)
216
+ new.build_from_hash(attributes)
217
+ end
218
+
219
+ # Builds the object from hash
220
+ # @param [Hash] attributes Model attributes in the form of hash
221
+ # @return [Object] Returns the model itself
222
+ def build_from_hash(attributes)
223
+ return nil unless attributes.is_a?(Hash)
224
+ attributes = attributes.transform_keys(&:to_sym)
225
+ self.class.openapi_types.each_pair do |key, type|
226
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
227
+ self.send("#{key}=", nil)
228
+ elsif type =~ /\AArray<(.*)>/i
229
+ # check to ensure the input is an array given that the attribute
230
+ # is documented as an array but the input is not
231
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
232
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
233
+ end
234
+ elsif !attributes[self.class.attribute_map[key]].nil?
235
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
236
+ end
237
+ end
238
+
239
+ self
240
+ end
241
+
242
+ # Deserializes the data based on type
243
+ # @param string type Data type
244
+ # @param string value Value to be deserialized
245
+ # @return [Object] Deserialized data
246
+ def _deserialize(type, value)
247
+ case type.to_sym
248
+ when :Time
249
+ Time.parse(value)
250
+ when :Date
251
+ Date.parse(value)
252
+ when :String
253
+ value.to_s
254
+ when :Integer
255
+ value.to_i
256
+ when :Float
257
+ value.to_f
258
+ when :Boolean
259
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
260
+ true
261
+ else
262
+ false
263
+ end
264
+ when :Object
265
+ # generic object (usually a Hash), return directly
266
+ value
267
+ when /\AArray<(?<inner_type>.+)>\z/
268
+ inner_type = Regexp.last_match[:inner_type]
269
+ value.map { |v| _deserialize(inner_type, v) }
270
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
271
+ k_type = Regexp.last_match[:k_type]
272
+ v_type = Regexp.last_match[:v_type]
273
+ {}.tap do |hash|
274
+ value.each do |k, v|
275
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
276
+ end
277
+ end
278
+ else # model
279
+ # models (e.g. Pet) or oneOf
280
+ klass = SnapTrade.const_get(type)
281
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
282
+ end
283
+ end
284
+
285
+ # Returns the string representation of the object
286
+ # @return [String] String presentation of the object
287
+ def to_s
288
+ to_hash.to_s
289
+ end
290
+
291
+ # to_body is an alias to to_hash (backward compatibility)
292
+ # @return [Hash] Returns the object in the form of hash
293
+ def to_body
294
+ to_hash
295
+ end
296
+
297
+ # Returns the object in the form of hash
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_hash
300
+ hash = {}
301
+ self.class.attribute_map.each_pair do |attr, param|
302
+ value = self.send(attr)
303
+ if value.nil?
304
+ is_nullable = self.class.openapi_nullable.include?(attr)
305
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
306
+ end
307
+
308
+ hash[param] = _to_hash(value)
309
+ end
310
+ hash
311
+ end
312
+
313
+ # Outputs non-array value in the form of hash
314
+ # For object, use to_hash. Otherwise, just return the value
315
+ # @param [Object] value Any valid value
316
+ # @return [Hash] Returns the value in the form of hash
317
+ def _to_hash(value)
318
+ if value.is_a?(Array)
319
+ value.compact.map { |v| _to_hash(v) }
320
+ elsif value.is_a?(Hash)
321
+ {}.tap do |hash|
322
+ value.each { |k, v| hash[k] = _to_hash(v) }
323
+ end
324
+ elsif value.respond_to? :to_hash
325
+ value.to_hash
326
+ else
327
+ value
328
+ end
329
+ end
330
+
331
+ end
332
+
333
+ end
@@ -48,6 +48,7 @@ module SnapTrade
48
48
  # List of attributes with nullable: true
49
49
  def self.openapi_nullable
50
50
  Set.new([
51
+ :'last_successful_sync',
51
52
  ])
52
53
  end
53
54
 
@@ -33,7 +33,7 @@ module SnapTrade
33
33
 
34
34
  attr_accessor :currency
35
35
 
36
- # A string representing the type of transaction. SnapTrade does a best effort to categorize the brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account.
36
+ # A string representing the type of transaction. SnapTrade does a best effort to categorize the brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account.
37
37
  attr_accessor :type
38
38
 
39
39
  # If an option `BUY` or `SELL` transaction, this further specifies the type of action. The possible values are: - BUY_TO_OPEN - BUY_TO_CLOSE - SELL_TO_OPEN - SELL_TO_CLOSE
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.45'
11
+ VERSION = '2.0.47'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -28,6 +28,7 @@ require 'snaptrade/models/account_order_record_universal_symbol'
28
28
  require 'snaptrade/models/account_simple'
29
29
  require 'snaptrade/models/account_sync_status'
30
30
  require 'snaptrade/models/action_strict'
31
+ require 'snaptrade/models/action_strict_with_options'
31
32
  require 'snaptrade/models/auth_type'
32
33
  require 'snaptrade/models/authentication_login_snap_trade_user200_response'
33
34
  require 'snaptrade/models/balance'
@@ -57,6 +58,7 @@ require 'snaptrade/models/manual_trade_and_impact'
57
58
  require 'snaptrade/models/manual_trade_balance'
58
59
  require 'snaptrade/models/manual_trade_form'
59
60
  require 'snaptrade/models/manual_trade_form_notional_value'
61
+ require 'snaptrade/models/manual_trade_form_with_options'
60
62
  require 'snaptrade/models/manual_trade_impact'
61
63
  require 'snaptrade/models/manual_trade_symbol'
62
64
  require 'snaptrade/models/model400_failed_request_response'
@@ -77,7 +77,7 @@ describe 'TradingApi' do
77
77
  # 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. 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). It&#39;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.
78
78
  # @param user_id
79
79
  # @param user_secret
80
- # @param manual_trade_form
80
+ # @param manual_trade_form_with_options
81
81
  # @param [Hash] opts the optional parameters
82
82
  # @return [AccountOrderRecord]
83
83
  describe 'place_force_order test' do
@@ -37,7 +37,7 @@ describe 'TransactionsAndReportingApi' do
37
37
  # @option opts [Date] :end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on &#x60;trade_date&#x60;.
38
38
  # @option opts [String] :accounts Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The &#x60;brokerageAuthorizations&#x60; parameter takes precedence over this parameter.
39
39
  # @option opts [String] :brokerage_authorizations Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the &#x60;accounts&#x60; parameter.
40
- # @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - &#x60;BUY&#x60; - Asset bought. - &#x60;SELL&#x60; - Asset sold. - &#x60;DIVIDEND&#x60; - Dividend payout. - &#x60;CONTRIBUTION&#x60; - Cash contribution. - &#x60;WITHDRAWAL&#x60; - Cash withdrawal. - &#x60;REI&#x60; - Dividend reinvestment. - &#x60;INTEREST&#x60; - Interest deposited into the account. - &#x60;FEE&#x60; - Fee withdrawn from the account.
40
+ # @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - &#x60;BUY&#x60; - Asset bought. - &#x60;SELL&#x60; - Asset sold. - &#x60;DIVIDEND&#x60; - Dividend payout. - &#x60;CONTRIBUTION&#x60; - Cash contribution. - &#x60;WITHDRAWAL&#x60; - Cash withdrawal. - &#x60;REI&#x60; - Dividend reinvestment. - &#x60;INTEREST&#x60; - Interest deposited into the account. - &#x60;FEE&#x60; - Fee withdrawn from the account.
41
41
  # @return [Array<UniversalActivity>]
42
42
  describe 'get_activities test' do
43
43
  it 'should work' do
@@ -32,55 +32,55 @@ describe SnapTrade::Account do
32
32
  end
33
33
  end
34
34
 
35
- describe 'test attribute "portfolio_group"' do
35
+ describe 'test attribute "name"' do
36
36
  it 'should work' do
37
37
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
38
  end
39
39
  end
40
40
 
41
- describe 'test attribute "name"' do
41
+ describe 'test attribute "number"' do
42
42
  it 'should work' do
43
43
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
44
  end
45
45
  end
46
46
 
47
- describe 'test attribute "number"' do
47
+ describe 'test attribute "institution_name"' do
48
48
  it 'should work' do
49
49
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
50
  end
51
51
  end
52
52
 
53
- describe 'test attribute "institution_name"' do
53
+ describe 'test attribute "created_date"' do
54
54
  it 'should work' do
55
55
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
56
  end
57
57
  end
58
58
 
59
- describe 'test attribute "created_date"' do
59
+ describe 'test attribute "sync_status"' do
60
60
  it 'should work' do
61
61
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
62
  end
63
63
  end
64
64
 
65
- describe 'test attribute "meta"' do
65
+ describe 'test attribute "balance"' do
66
66
  it 'should work' do
67
67
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
68
  end
69
69
  end
70
70
 
71
- describe 'test attribute "cash_restrictions"' do
71
+ describe 'test attribute "meta"' do
72
72
  it 'should work' do
73
73
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
74
  end
75
75
  end
76
76
 
77
- describe 'test attribute "sync_status"' do
77
+ describe 'test attribute "portfolio_group"' do
78
78
  it 'should work' do
79
79
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
80
80
  end
81
81
  end
82
82
 
83
- describe 'test attribute "balance"' do
83
+ describe 'test attribute "cash_restrictions"' do
84
84
  it 'should work' do
85
85
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
86
86
  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::ActionStrictWithOptions
15
+ describe SnapTrade::ActionStrictWithOptions do
16
+ let(:instance) { SnapTrade::ActionStrictWithOptions.new }
17
+
18
+ describe 'test an instance of ActionStrictWithOptions' do
19
+ it 'should create an instance of ActionStrictWithOptions' do
20
+ expect(instance).to be_instance_of(SnapTrade::ActionStrictWithOptions)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,83 @@
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::ManualTradeFormWithOptions
15
+ describe SnapTrade::ManualTradeFormWithOptions do
16
+ let(:instance) { SnapTrade::ManualTradeFormWithOptions.new }
17
+
18
+ describe 'test an instance of ManualTradeFormWithOptions' do
19
+ it 'should create an instance of ManualTradeFormWithOptions' do
20
+ expect(instance).to be_instance_of(SnapTrade::ManualTradeFormWithOptions)
21
+ end
22
+ end
23
+ describe 'test attribute "account_id"' do
24
+ it 'should work' do
25
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
+ end
27
+ end
28
+
29
+ describe 'test attribute "action"' do
30
+ it 'should work' do
31
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
+ end
33
+ end
34
+
35
+ describe 'test attribute "universal_symbol_id"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "symbol"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "order_type"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ describe 'test attribute "time_in_force"' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ describe 'test attribute "price"' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
65
+ describe 'test attribute "stop"' do
66
+ it 'should work' do
67
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
+ end
69
+ end
70
+
71
+ describe 'test attribute "units"' do
72
+ it 'should work' do
73
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
+ end
75
+ end
76
+
77
+ describe 'test attribute "notional_value"' do
78
+ it 'should work' do
79
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
80
+ end
81
+ end
82
+
83
+ 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.45
4
+ version: 2.0.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - SnapTrade
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-21 00:00:00.000000000 Z
11
+ date: 2024-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -107,6 +107,7 @@ files:
107
107
  - lib/snaptrade/models/account_simple.rb
108
108
  - lib/snaptrade/models/account_sync_status.rb
109
109
  - lib/snaptrade/models/action_strict.rb
110
+ - lib/snaptrade/models/action_strict_with_options.rb
110
111
  - lib/snaptrade/models/auth_type.rb
111
112
  - lib/snaptrade/models/authentication_login_snap_trade_user200_response.rb
112
113
  - lib/snaptrade/models/balance.rb
@@ -136,6 +137,7 @@ files:
136
137
  - lib/snaptrade/models/manual_trade_balance.rb
137
138
  - lib/snaptrade/models/manual_trade_form.rb
138
139
  - lib/snaptrade/models/manual_trade_form_notional_value.rb
140
+ - lib/snaptrade/models/manual_trade_form_with_options.rb
139
141
  - lib/snaptrade/models/manual_trade_impact.rb
140
142
  - lib/snaptrade/models/manual_trade_symbol.rb
141
143
  - lib/snaptrade/models/model400_failed_request_response.rb
@@ -230,6 +232,7 @@ files:
230
232
  - spec/models/account_spec.rb
231
233
  - spec/models/account_sync_status_spec.rb
232
234
  - spec/models/action_strict_spec.rb
235
+ - spec/models/action_strict_with_options_spec.rb
233
236
  - spec/models/auth_type_spec.rb
234
237
  - spec/models/authentication_login_snap_trade_user200_response_spec.rb
235
238
  - spec/models/balance_currency_spec.rb
@@ -258,6 +261,7 @@ files:
258
261
  - spec/models/manual_trade_balance_spec.rb
259
262
  - spec/models/manual_trade_form_notional_value_spec.rb
260
263
  - spec/models/manual_trade_form_spec.rb
264
+ - spec/models/manual_trade_form_with_options_spec.rb
261
265
  - spec/models/manual_trade_impact_spec.rb
262
266
  - spec/models/manual_trade_spec.rb
263
267
  - spec/models/manual_trade_symbol_spec.rb
@@ -418,6 +422,7 @@ test_files:
418
422
  - spec/models/underlying_symbol_exchange_spec.rb
419
423
  - spec/models/manual_trade_and_impact_spec.rb
420
424
  - spec/models/monthly_dividends_spec.rb
425
+ - spec/models/manual_trade_form_with_options_spec.rb
421
426
  - spec/models/strategy_order_record_spec.rb
422
427
  - spec/models/account_simple_spec.rb
423
428
  - spec/models/universal_symbol_spec.rb
@@ -458,6 +463,7 @@ test_files:
458
463
  - spec/models/model402_brokerage_auth_already_disabled_exception_spec.rb
459
464
  - spec/models/position_spec.rb
460
465
  - spec/models/notional_value_spec.rb
466
+ - spec/models/action_strict_with_options_spec.rb
461
467
  - spec/models/options_get_option_strategy_request_spec.rb
462
468
  - spec/models/option_chain_inner_chain_per_root_inner_spec.rb
463
469
  - spec/models/trading_cancel_user_account_order_request_spec.rb