snaptrade 2.0.142 → 2.0.143
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 +5 -5
- data/README.md +9 -2
- data/lib/snaptrade/api/trading_api.rb +6 -2
- 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/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: 65b010b4913c7e0ea2e411b6dc193e138d0d81b943a8643db10f2d23828db24c
|
|
4
|
+
data.tar.gz: ee19782bd513cb8b552201a936fed7cdb029a3a87a8a09f012cb1913db229a57
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2134c15eae825485a0258eefc04ec891a9e756b219e0b28f588dbc508005e41832447dc7588eeb508601cf3db8de904adb27b1db18cb269815fb839acfcd7453
|
|
7
|
+
data.tar.gz: f028758a9b8ccced84885cb0c7da9b9985d6588e3677e7ed851538ccf039a8c6b3f0393a850e8e3f36ce42415acc4613c5819523aef2516bb8bde84e48ba76fb
|
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.143)
|
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
|
7
7
|
|
|
@@ -32,7 +32,7 @@ GEM
|
|
|
32
32
|
parser (3.3.9.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.6)
|
|
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.143)
|
|
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.143'
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -1958,6 +1958,7 @@ result = snaptrade.trading.place_force_order(
|
|
|
1958
1958
|
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1959
1959
|
universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
|
1960
1960
|
symbol: "AAPL",
|
|
1961
|
+
trading_session: "REGULAR",
|
|
1961
1962
|
price: 31.33,
|
|
1962
1963
|
stop: 31.33,
|
|
1963
1964
|
units: 10.5,
|
|
@@ -2002,6 +2003,12 @@ provided, otherwise must be provided.
|
|
|
2002
2003
|
The security's trading ticker symbol. If 'symbol' is provided, then
|
|
2003
2004
|
'universal_symbol_id' must be 'null'.
|
|
2004
2005
|
|
|
2006
|
+
##### trading_session: [`TradingSession`](./lib/snaptrade/models/trading_session.rb)<a id="trading_session-tradingsessionlibsnaptrademodelstrading_sessionrb"></a>
|
|
2007
|
+
The trading session for the order. This field indicates which market session the
|
|
2008
|
+
order will be placed in. This is only available for certain brokerages. Defaults
|
|
2009
|
+
to REGULAR. Here are the supported values: - `REGULAR` - Regular trading hours.
|
|
2010
|
+
- `EXTENDED` - Extended trading hours.
|
|
2011
|
+
|
|
2005
2012
|
##### price: `Float`<a id="price-float"></a>
|
|
2006
2013
|
The limit price for `Limit` and `StopLimit` orders.
|
|
2007
2014
|
|
|
@@ -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
|
|
@@ -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'
|
|
@@ -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.143
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SnapTrade
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-10-
|
|
11
|
+
date: 2025-10-24 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
|