snaptrade 2.0.142 → 2.0.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -6
- data/README.md +13 -5
- data/lib/snaptrade/api/account_information_api.rb +4 -4
- data/lib/snaptrade/api/trading_api.rb +6 -2
- data/lib/snaptrade/models/account_order_record.rb +1 -1
- data/lib/snaptrade/models/account_universal_activity.rb +1 -1
- data/lib/snaptrade/models/manual_trade_form_with_options.rb +13 -1
- data/lib/snaptrade/models/trading_session.rb +37 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +1 -0
- data/spec/api/account_information_api_spec.rb +1 -1
- data/spec/models/manual_trade_form_with_options_spec.rb +6 -0
- data/spec/models/trading_session_spec.rb +23 -0
- 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: bcacc5a8b46727ebbe777a619976cbb2eef197fbb696a6efad1f160eab6c33da
|
|
4
|
+
data.tar.gz: a3564374de2c0264546a55bb63690447e61a6aa7663539ef65767004cc363833
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b9db5425f966f3586627ed6b4aedb9d390a563837136355cd23ff5c85afbe45759c50d668fd1d4ec40187d461d7b8b5b77e4afa74ced7b52cd4fc3b642e4c13a
|
|
7
|
+
data.tar.gz: 76f88da0eeea86e7d041fdc6b5de63ed357ce17c272695224f19ca8b582e3cae07c8933ef3e0d9019263cdc558fde7943e6a43e8545ad5644f03454d59eabc5f
|
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.144)
|
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
|
7
7
|
|
|
@@ -29,10 +29,10 @@ GEM
|
|
|
29
29
|
method_source (1.1.0)
|
|
30
30
|
multipart-post (2.4.1)
|
|
31
31
|
parallel (1.27.0)
|
|
32
|
-
parser (3.3.
|
|
32
|
+
parser (3.3.10.0)
|
|
33
33
|
ast (~> 2.4.1)
|
|
34
34
|
racc
|
|
35
|
-
prism (1.
|
|
35
|
+
prism (1.6.0)
|
|
36
36
|
pry (0.14.2)
|
|
37
37
|
coderay (~> 1.1)
|
|
38
38
|
method_source (~> 1.0)
|
|
@@ -46,16 +46,16 @@ GEM
|
|
|
46
46
|
reline (0.6.2)
|
|
47
47
|
io-console (~> 0.5)
|
|
48
48
|
rexml (3.4.4)
|
|
49
|
-
rspec (3.13.
|
|
49
|
+
rspec (3.13.2)
|
|
50
50
|
rspec-core (~> 3.13.0)
|
|
51
51
|
rspec-expectations (~> 3.13.0)
|
|
52
52
|
rspec-mocks (~> 3.13.0)
|
|
53
|
-
rspec-core (3.13.
|
|
53
|
+
rspec-core (3.13.6)
|
|
54
54
|
rspec-support (~> 3.13.0)
|
|
55
55
|
rspec-expectations (3.13.5)
|
|
56
56
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
57
57
|
rspec-support (~> 3.13.0)
|
|
58
|
-
rspec-mocks (3.13.
|
|
58
|
+
rspec-mocks (3.13.7)
|
|
59
59
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
60
60
|
rspec-support (~> 3.13.0)
|
|
61
61
|
rspec-support (3.13.6)
|
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
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.144)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -81,7 +81,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
81
81
|
Add to Gemfile:
|
|
82
82
|
|
|
83
83
|
```ruby
|
|
84
|
-
gem 'snaptrade', '~> 2.0.
|
|
84
|
+
gem 'snaptrade', '~> 2.0.144'
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -190,9 +190,10 @@ values. Here are some of the most popular values: - `BUY` - Asset bought. -
|
|
|
190
190
|
contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment.
|
|
191
191
|
- `STOCK_DIVIDEND` - A type of dividend where a company distributes shares
|
|
192
192
|
instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` -
|
|
193
|
-
Fee withdrawn from the account. - `
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
Fee withdrawn from the account. - `TAX`` - A tax related fee. -
|
|
194
|
+
`OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option
|
|
195
|
+
assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` -
|
|
196
|
+
Transfer of assets from one account to another. - `SPLIT` - A stock share split.
|
|
196
197
|
|
|
197
198
|
#### 🔄 Return<a id="🔄-return"></a>
|
|
198
199
|
|
|
@@ -1958,6 +1959,7 @@ result = snaptrade.trading.place_force_order(
|
|
|
1958
1959
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1959
1960
|
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
1960
1961
|
symbol: "AAPL",
|
|
1962
|
+
trading_session: "REGULAR",
|
|
1961
1963
|
price: 31.33,
|
|
1962
1964
|
stop: 31.33,
|
|
1963
1965
|
units: 10.5,
|
|
@@ -2002,6 +2004,12 @@ provided, otherwise must be provided.
|
|
|
2002
2004
|
The security's trading ticker symbol. If 'symbol' is provided, then
|
|
2003
2005
|
'universal_symbol_id' must be 'null'.
|
|
2004
2006
|
|
|
2007
|
+
##### trading_session: [`TradingSession`](./lib/snaptrade/models/trading_session.rb)<a id="trading_session-tradingsessionlibsnaptrademodelstrading_sessionrb"></a>
|
|
2008
|
+
The trading session for the order. This field indicates which market session the
|
|
2009
|
+
order will be placed in. This is only available for certain brokerages. Defaults
|
|
2010
|
+
to REGULAR. Here are the supported values: - `REGULAR` - Regular trading hours.
|
|
2011
|
+
- `EXTENDED` - Extended trading hours.
|
|
2012
|
+
|
|
2005
2013
|
##### price: `Float`<a id="price-float"></a>
|
|
2006
2014
|
The limit price for `Limit` and `StopLimit` orders.
|
|
2007
2015
|
|
|
@@ -36,7 +36,7 @@ module SnapTrade
|
|
|
36
36
|
# @param end_date [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`.
|
|
37
37
|
# @param offset [Integer] An integer that specifies the starting point of the paginated results. Default is 0.
|
|
38
38
|
# @param limit [Integer] An integer that specifies the maximum number of transactions to return. Default of 1000.
|
|
39
|
-
# @param type [String] 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. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another
|
|
39
|
+
# @param type [String] 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. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX`` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split.
|
|
40
40
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
41
41
|
def get_account_activities(account_id:, user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, offset: SENTINEL, limit: SENTINEL, type: SENTINEL, extra: {})
|
|
42
42
|
extra[:start_date] = start_date if start_date != SENTINEL
|
|
@@ -67,7 +67,7 @@ module SnapTrade
|
|
|
67
67
|
# @param end_date [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`.
|
|
68
68
|
# @param offset [Integer] An integer that specifies the starting point of the paginated results. Default is 0.
|
|
69
69
|
# @param limit [Integer] An integer that specifies the maximum number of transactions to return. Default of 1000.
|
|
70
|
-
# @param type [String] 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. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another
|
|
70
|
+
# @param type [String] 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. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX`` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split.
|
|
71
71
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
72
72
|
def get_account_activities_with_http_info(account_id:, user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, offset: SENTINEL, limit: SENTINEL, type: SENTINEL, extra: {})
|
|
73
73
|
extra[:start_date] = start_date if start_date != SENTINEL
|
|
@@ -88,7 +88,7 @@ module SnapTrade
|
|
|
88
88
|
# @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`.
|
|
89
89
|
# @option opts [Integer] :offset An integer that specifies the starting point of the paginated results. Default is 0.
|
|
90
90
|
# @option opts [Integer] :limit An integer that specifies the maximum number of transactions to return. Default of 1000.
|
|
91
|
-
# @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. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another
|
|
91
|
+
# @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. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX`` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split.
|
|
92
92
|
# @return [PaginatedUniversalActivity]
|
|
93
93
|
private def get_account_activities_impl(account_id, user_id, user_secret, opts = {})
|
|
94
94
|
data, _status_code, _headers = get_account_activities_with_http_info(account_id, user_id, user_secret, opts)
|
|
@@ -105,7 +105,7 @@ module SnapTrade
|
|
|
105
105
|
# @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`.
|
|
106
106
|
# @option opts [Integer] :offset An integer that specifies the starting point of the paginated results. Default is 0.
|
|
107
107
|
# @option opts [Integer] :limit An integer that specifies the maximum number of transactions to return. Default of 1000.
|
|
108
|
-
# @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. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another
|
|
108
|
+
# @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. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX`` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split.
|
|
109
109
|
# @return [Array<(PaginatedUniversalActivity, Integer, Hash)>] PaginatedUniversalActivity data, response status code and response headers
|
|
110
110
|
private def get_account_activities_with_http_info_impl(account_id, user_id, user_secret, opts = {})
|
|
111
111
|
if @api_client.config.debugging
|
|
@@ -989,13 +989,14 @@ module SnapTrade
|
|
|
989
989
|
# @param user_secret [String]
|
|
990
990
|
# @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.
|
|
991
991
|
# @param symbol [String] The security's trading ticker symbol. If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
|
|
992
|
+
# @param trading_session [TradingSession] The trading session for the order. This field indicates which market session the order will be placed in. This is only available for certain brokerages. Defaults to REGULAR. Here are the supported values: - `REGULAR` - Regular trading hours. - `EXTENDED` - Extended trading hours.
|
|
992
993
|
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
|
993
994
|
# @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
|
994
995
|
# @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).
|
|
995
996
|
# @param notional_value [ManualTradeFormNotionalValue]
|
|
996
997
|
# @param body [ManualTradeFormWithOptions]
|
|
997
998
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
998
|
-
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: {})
|
|
999
|
+
def place_force_order(account_id:, action:, order_type:, time_in_force:, user_id:, user_secret:, universal_symbol_id: SENTINEL, symbol: SENTINEL, trading_session: 'REGULAR', price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
|
|
999
1000
|
_body = {}
|
|
1000
1001
|
_body[:account_id] = account_id if account_id != SENTINEL
|
|
1001
1002
|
_body[:action] = action if action != SENTINEL
|
|
@@ -1003,6 +1004,7 @@ module SnapTrade
|
|
|
1003
1004
|
_body[:symbol] = symbol if symbol != SENTINEL
|
|
1004
1005
|
_body[:order_type] = order_type if order_type != SENTINEL
|
|
1005
1006
|
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
|
1007
|
+
_body[:trading_session] = trading_session if trading_session != SENTINEL
|
|
1006
1008
|
_body[:price] = price if price != SENTINEL
|
|
1007
1009
|
_body[:stop] = stop if stop != SENTINEL
|
|
1008
1010
|
_body[:units] = units if units != SENTINEL
|
|
@@ -1028,13 +1030,14 @@ module SnapTrade
|
|
|
1028
1030
|
# @param user_secret [String]
|
|
1029
1031
|
# @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.
|
|
1030
1032
|
# @param symbol [String] The security's trading ticker symbol. If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
|
|
1033
|
+
# @param trading_session [TradingSession] The trading session for the order. This field indicates which market session the order will be placed in. This is only available for certain brokerages. Defaults to REGULAR. Here are the supported values: - `REGULAR` - Regular trading hours. - `EXTENDED` - Extended trading hours.
|
|
1031
1034
|
# @param price [Float] The limit price for `Limit` and `StopLimit` orders.
|
|
1032
1035
|
# @param stop [Float] The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
|
1033
1036
|
# @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).
|
|
1034
1037
|
# @param notional_value [ManualTradeFormNotionalValue]
|
|
1035
1038
|
# @param body [ManualTradeFormWithOptions]
|
|
1036
1039
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
1037
|
-
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: {})
|
|
1040
|
+
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, trading_session: 'REGULAR', price: SENTINEL, stop: SENTINEL, units: SENTINEL, notional_value: SENTINEL, extra: {})
|
|
1038
1041
|
_body = {}
|
|
1039
1042
|
_body[:account_id] = account_id if account_id != SENTINEL
|
|
1040
1043
|
_body[:action] = action if action != SENTINEL
|
|
@@ -1042,6 +1045,7 @@ module SnapTrade
|
|
|
1042
1045
|
_body[:symbol] = symbol if symbol != SENTINEL
|
|
1043
1046
|
_body[:order_type] = order_type if order_type != SENTINEL
|
|
1044
1047
|
_body[:time_in_force] = time_in_force if time_in_force != SENTINEL
|
|
1048
|
+
_body[:trading_session] = trading_session if trading_session != SENTINEL
|
|
1045
1049
|
_body[:price] = price if price != SENTINEL
|
|
1046
1050
|
_body[:stop] = stop if stop != SENTINEL
|
|
1047
1051
|
_body[:units] = units if units != SENTINEL
|
|
@@ -16,7 +16,7 @@ module SnapTrade
|
|
|
16
16
|
# Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
|
17
17
|
attr_accessor :brokerage_order_id
|
|
18
18
|
|
|
19
|
-
# Indicates the status of an order. SnapTrade does a best effort to map brokerage statuses to statuses in this enum.
|
|
19
|
+
# Indicates the status of an order. SnapTrade does a best effort to map brokerage statuses to statuses in this enum. Possible values include: - NONE - PENDING - ACCEPTED - FAILED - REJECTED - CANCELED - PARTIAL_CANCELED - CANCEL_PENDING - EXECUTED - PARTIAL - REPLACE_PENDING - REPLACED - EXPIRED - QUEUED - TRIGGERED - ACTIVATED
|
|
20
20
|
attr_accessor :status
|
|
21
21
|
|
|
22
22
|
attr_accessor :universal_symbol
|
|
@@ -31,7 +31,7 @@ module SnapTrade
|
|
|
31
31
|
|
|
32
32
|
attr_accessor :currency
|
|
33
33
|
|
|
34
|
-
# 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. - `
|
|
34
|
+
# 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. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX`` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split.
|
|
35
35
|
attr_accessor :type
|
|
36
36
|
|
|
37
37
|
# 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
|
|
@@ -31,6 +31,9 @@ module SnapTrade
|
|
|
31
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. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
|
|
32
32
|
attr_accessor :time_in_force
|
|
33
33
|
|
|
34
|
+
# The trading session for the order. This field indicates which market session the order will be placed in. This is only available for certain brokerages. Defaults to REGULAR. Here are the supported values: - `REGULAR` - Regular trading hours. - `EXTENDED` - Extended trading hours.
|
|
35
|
+
attr_accessor :trading_session
|
|
36
|
+
|
|
34
37
|
# The limit price for `Limit` and `StopLimit` orders.
|
|
35
38
|
attr_accessor :price
|
|
36
39
|
|
|
@@ -51,6 +54,7 @@ module SnapTrade
|
|
|
51
54
|
:'symbol' => :'symbol',
|
|
52
55
|
:'order_type' => :'order_type',
|
|
53
56
|
:'time_in_force' => :'time_in_force',
|
|
57
|
+
:'trading_session' => :'trading_session',
|
|
54
58
|
:'price' => :'price',
|
|
55
59
|
:'stop' => :'stop',
|
|
56
60
|
:'units' => :'units',
|
|
@@ -72,6 +76,7 @@ module SnapTrade
|
|
|
72
76
|
:'symbol' => :'String',
|
|
73
77
|
:'order_type' => :'OrderTypeStrict',
|
|
74
78
|
:'time_in_force' => :'TimeInForceStrict',
|
|
79
|
+
:'trading_session' => :'TradingSession',
|
|
75
80
|
:'price' => :'Float',
|
|
76
81
|
:'stop' => :'Float',
|
|
77
82
|
:'units' => :'Float',
|
|
@@ -130,6 +135,12 @@ module SnapTrade
|
|
|
130
135
|
self.time_in_force = attributes[:'time_in_force']
|
|
131
136
|
end
|
|
132
137
|
|
|
138
|
+
if attributes.key?(:'trading_session')
|
|
139
|
+
self.trading_session = attributes[:'trading_session']
|
|
140
|
+
else
|
|
141
|
+
self.trading_session = 'REGULAR'
|
|
142
|
+
end
|
|
143
|
+
|
|
133
144
|
if attributes.key?(:'price')
|
|
134
145
|
self.price = attributes[:'price']
|
|
135
146
|
end
|
|
@@ -191,6 +202,7 @@ module SnapTrade
|
|
|
191
202
|
symbol == o.symbol &&
|
|
192
203
|
order_type == o.order_type &&
|
|
193
204
|
time_in_force == o.time_in_force &&
|
|
205
|
+
trading_session == o.trading_session &&
|
|
194
206
|
price == o.price &&
|
|
195
207
|
stop == o.stop &&
|
|
196
208
|
units == o.units &&
|
|
@@ -206,7 +218,7 @@ module SnapTrade
|
|
|
206
218
|
# Calculates hash code according to all attributes.
|
|
207
219
|
# @return [Integer] Hash code
|
|
208
220
|
def hash
|
|
209
|
-
[account_id, action, universal_symbol_id, symbol, order_type, time_in_force, price, stop, units, notional_value].hash
|
|
221
|
+
[account_id, action, universal_symbol_id, symbol, order_type, time_in_force, trading_session, price, stop, units, notional_value].hash
|
|
210
222
|
end
|
|
211
223
|
|
|
212
224
|
# Builds the object from hash
|
|
@@ -0,0 +1,37 @@
|
|
|
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 TradingSession
|
|
15
|
+
REGULAR = "REGULAR".freeze
|
|
16
|
+
EXTENDED = "EXTENDED".freeze
|
|
17
|
+
|
|
18
|
+
def self.all_vars
|
|
19
|
+
@all_vars ||= [REGULAR, EXTENDED].freeze
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Builds the enum from string
|
|
23
|
+
# @param [String] The enum value in the form of the string
|
|
24
|
+
# @return [String] The enum value
|
|
25
|
+
def self.build_from_hash(value)
|
|
26
|
+
new.build_from_hash(value)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Builds the enum from string
|
|
30
|
+
# @param [String] The enum value in the form of the string
|
|
31
|
+
# @return [String] The enum value
|
|
32
|
+
def build_from_hash(value)
|
|
33
|
+
return value if TradingSession.all_vars.include?(value)
|
|
34
|
+
raise "Invalid ENUM value #{value} for class #TradingSession"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
|
@@ -161,6 +161,7 @@ require 'snaptrade/models/timeframe'
|
|
|
161
161
|
require 'snaptrade/models/trading_instrument'
|
|
162
162
|
require 'snaptrade/models/trading_instrument_type'
|
|
163
163
|
require 'snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response'
|
|
164
|
+
require 'snaptrade/models/trading_session'
|
|
164
165
|
require 'snaptrade/models/transactions_status'
|
|
165
166
|
require 'snaptrade/models/type'
|
|
166
167
|
require 'snaptrade/models/us_exchange'
|
|
@@ -38,7 +38,7 @@ describe 'AccountInformationApi' do
|
|
|
38
38
|
# @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`.
|
|
39
39
|
# @option opts [Integer] :offset An integer that specifies the starting point of the paginated results. Default is 0.
|
|
40
40
|
# @option opts [Integer] :limit An integer that specifies the maximum number of transactions to return. Default of 1000.
|
|
41
|
-
# @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. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another
|
|
41
|
+
# @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. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX`` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split.
|
|
42
42
|
# @return [PaginatedUniversalActivity]
|
|
43
43
|
describe 'get_account_activities test' do
|
|
44
44
|
it 'should work' do
|
|
@@ -56,6 +56,12 @@ describe SnapTrade::ManualTradeFormWithOptions do
|
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
+
describe 'test attribute "trading_session"' 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
|
+
|
|
59
65
|
describe 'test attribute "price"' do
|
|
60
66
|
it 'should work' do
|
|
61
67
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
@@ -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::TradingSession
|
|
15
|
+
describe SnapTrade::TradingSession do
|
|
16
|
+
let(:instance) { SnapTrade::TradingSession.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of TradingSession' do
|
|
19
|
+
it 'should create an instance of TradingSession' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::TradingSession)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: snaptrade
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.144
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SnapTrade
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -240,6 +240,7 @@ files:
|
|
|
240
240
|
- lib/snaptrade/models/trading_instrument.rb
|
|
241
241
|
- lib/snaptrade/models/trading_instrument_type.rb
|
|
242
242
|
- lib/snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response.rb
|
|
243
|
+
- lib/snaptrade/models/trading_session.rb
|
|
243
244
|
- lib/snaptrade/models/transactions_status.rb
|
|
244
245
|
- lib/snaptrade/models/type.rb
|
|
245
246
|
- lib/snaptrade/models/underlying_symbol.rb
|
|
@@ -408,6 +409,7 @@ files:
|
|
|
408
409
|
- spec/models/trading_instrument_spec.rb
|
|
409
410
|
- spec/models/trading_instrument_type_spec.rb
|
|
410
411
|
- spec/models/trading_search_cryptocurrency_pair_instruments200_response_spec.rb
|
|
412
|
+
- spec/models/trading_session_spec.rb
|
|
411
413
|
- spec/models/transactions_status_spec.rb
|
|
412
414
|
- spec/models/type_spec.rb
|
|
413
415
|
- spec/models/underlying_symbol_exchange_spec.rb
|
|
@@ -585,6 +587,7 @@ test_files:
|
|
|
585
587
|
- spec/models/symbol_query_spec.rb
|
|
586
588
|
- spec/models/strategy_order_record_spec.rb
|
|
587
589
|
- spec/models/model403_feature_not_enabled_response_spec.rb
|
|
590
|
+
- spec/models/trading_session_spec.rb
|
|
588
591
|
- spec/models/action_strict_spec.rb
|
|
589
592
|
- spec/models/crypto_order_form_type_spec.rb
|
|
590
593
|
- spec/models/pagination_details_spec.rb
|