snaptrade 1.17.10 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +22 -14
- data/README.md +2 -3
- data/docs/BrokerageSymbolSymbol.md +3 -1
- data/docs/ManualTradeForm.md +3 -3
- data/docs/ReferenceDataApi.md +9 -14
- data/docs/Symbol.md +3 -1
- data/docs/TradingApi.md +4 -4
- data/docs/UnderlyingSymbol.md +3 -1
- data/docs/UniversalSymbol.md +3 -1
- data/lib/snaptrade/api/reference_data_api.rb +19 -26
- data/lib/snaptrade/api/trading_api.rb +8 -8
- data/lib/snaptrade/models/brokerage_symbol_symbol.rb +14 -4
- data/lib/snaptrade/models/manual_trade_form.rb +1 -2
- data/lib/snaptrade/models/symbol.rb +14 -4
- data/lib/snaptrade/models/underlying_symbol.rb +14 -4
- data/lib/snaptrade/models/universal_symbol.rb +14 -4
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +0 -1
- data/spec/api/reference_data_api_spec.rb +2 -3
- data/spec/models/brokerage_symbol_symbol_spec.rb +6 -0
- data/spec/models/symbol_spec.rb +6 -0
- data/spec/models/underlying_symbol_spec.rb +6 -0
- data/spec/models/universal_symbol_spec.rb +6 -0
- metadata +3 -7
- data/docs/UniversalSymbolTicker.md +0 -32
- data/lib/snaptrade/models/universal_symbol_ticker.rb +0 -283
- data/spec/models/universal_symbol_ticker_spec.rb +0 -72
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54248537533cc85b7e2a236fd171c32f6e4893f8c1e99af4a1d7edd14129c450
|
4
|
+
data.tar.gz: 913138150b71863d9a70fcb08fe78fc18717c565e0145026e4333b410b6d300f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2edd6fe7cdb16b1c4605f9dacba0c0f488c11758ebfb1efe75b008957919b57c271337b3e6c6a4ed67b077f66a2388eed232a219d78c0aa05f1aae2b690bc4bb
|
7
|
+
data.tar.gz: a674e881bb6caf2179f55e203616049f3faf4d8309666c771e24946f75c71fd1576a6ae487ae1421d6e33bcc80f33b40a235c42106144578fbb4bcda21e570d1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snaptrade (1.17.
|
4
|
+
snaptrade (1.17.13)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
@@ -9,14 +9,14 @@ GEM
|
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
ast (2.4.2)
|
12
|
-
base64 (0.
|
12
|
+
base64 (0.1.1)
|
13
13
|
byebug (11.1.3)
|
14
14
|
coderay (1.1.3)
|
15
15
|
debug (1.8.0)
|
16
16
|
irb (>= 1.5.0)
|
17
17
|
reline (>= 0.3.1)
|
18
18
|
diff-lcs (1.5.0)
|
19
|
-
faraday (2.
|
19
|
+
faraday (2.7.11)
|
20
20
|
base64
|
21
21
|
faraday-net_http (>= 2.0, < 3.1)
|
22
22
|
ruby2_keywords (>= 0.0.4)
|
@@ -24,25 +24,32 @@ GEM
|
|
24
24
|
multipart-post (~> 2)
|
25
25
|
faraday-net_http (3.0.2)
|
26
26
|
io-console (0.6.0)
|
27
|
-
irb (1.
|
28
|
-
|
27
|
+
irb (1.8.1)
|
28
|
+
rdoc
|
29
|
+
reline (>= 0.3.8)
|
29
30
|
method_source (1.0.0)
|
30
31
|
multipart-post (2.3.0)
|
31
32
|
parallel (1.23.0)
|
32
|
-
parser (3.2.2.
|
33
|
+
parser (3.2.2.3)
|
33
34
|
ast (~> 2.4.1)
|
35
|
+
racc
|
34
36
|
pry (0.14.2)
|
35
37
|
coderay (~> 1.1)
|
36
38
|
method_source (~> 1.0)
|
37
39
|
pry-byebug (3.10.1)
|
38
40
|
byebug (~> 11.0)
|
39
41
|
pry (>= 0.13, < 0.15)
|
42
|
+
psych (5.1.0)
|
43
|
+
stringio
|
44
|
+
racc (1.7.1)
|
40
45
|
rainbow (3.1.1)
|
41
46
|
rake (13.0.6)
|
42
|
-
|
43
|
-
|
47
|
+
rdoc (6.5.0)
|
48
|
+
psych (>= 4.0.0)
|
49
|
+
regexp_parser (2.8.1)
|
50
|
+
reline (0.3.8)
|
44
51
|
io-console (~> 0.5)
|
45
|
-
rexml (3.2.
|
52
|
+
rexml (3.2.6)
|
46
53
|
rspec (3.12.0)
|
47
54
|
rspec-core (~> 3.12.0)
|
48
55
|
rspec-expectations (~> 3.12.0)
|
@@ -52,10 +59,10 @@ GEM
|
|
52
59
|
rspec-expectations (3.12.3)
|
53
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
54
61
|
rspec-support (~> 3.12.0)
|
55
|
-
rspec-mocks (3.12.
|
62
|
+
rspec-mocks (3.12.6)
|
56
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
57
64
|
rspec-support (~> 3.12.0)
|
58
|
-
rspec-support (3.12.
|
65
|
+
rspec-support (3.12.1)
|
59
66
|
rubocop (1.12.1)
|
60
67
|
parallel (~> 1.10)
|
61
68
|
parser (>= 3.0.0.0)
|
@@ -65,14 +72,15 @@ GEM
|
|
65
72
|
rubocop-ast (>= 1.2.0, < 2.0)
|
66
73
|
ruby-progressbar (~> 1.7)
|
67
74
|
unicode-display_width (>= 1.4.0, < 3.0)
|
68
|
-
rubocop-ast (1.
|
75
|
+
rubocop-ast (1.29.0)
|
69
76
|
parser (>= 3.2.1.0)
|
70
77
|
ruby-progressbar (1.13.0)
|
71
78
|
ruby2_keywords (0.0.5)
|
79
|
+
stringio (3.0.8)
|
72
80
|
unicode-display_width (2.4.2)
|
73
81
|
|
74
82
|
PLATFORMS
|
75
|
-
arm64-darwin-
|
83
|
+
arm64-darwin-22
|
76
84
|
|
77
85
|
DEPENDENCIES
|
78
86
|
debug (~> 1.8)
|
@@ -83,4 +91,4 @@ DEPENDENCIES
|
|
83
91
|
snaptrade!
|
84
92
|
|
85
93
|
BUNDLED WITH
|
86
|
-
2.
|
94
|
+
2.4.19
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ For more information, please visit [https://snaptrade.com/](https://snaptrade.co
|
|
9
9
|
Add to Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'snaptrade', '~>
|
12
|
+
gem 'snaptrade', '~> 2.0.0'
|
13
13
|
```
|
14
14
|
|
15
15
|
## Getting Started
|
@@ -72,7 +72,7 @@ Class | Method | HTTP request | Description
|
|
72
72
|
*SnapTrade::ReferenceDataApi* | [**get_security_types**](docs/ReferenceDataApi.md#get_security_types) | **GET** /securityTypes | List of all security types
|
73
73
|
*SnapTrade::ReferenceDataApi* | [**get_stock_exchanges**](docs/ReferenceDataApi.md#get_stock_exchanges) | **GET** /exchanges | List exchanges
|
74
74
|
*SnapTrade::ReferenceDataApi* | [**get_symbols**](docs/ReferenceDataApi.md#get_symbols) | **POST** /symbols | Search for symbols
|
75
|
-
*SnapTrade::ReferenceDataApi* | [**get_symbols_by_ticker**](docs/ReferenceDataApi.md#get_symbols_by_ticker) | **GET** /symbols/{
|
75
|
+
*SnapTrade::ReferenceDataApi* | [**get_symbols_by_ticker**](docs/ReferenceDataApi.md#get_symbols_by_ticker) | **GET** /symbols/{query} | Get details of a symbol by the ticker or the universal_symbol_id
|
76
76
|
*SnapTrade::ReferenceDataApi* | [**list_all_brokerage_authorization_type**](docs/ReferenceDataApi.md#list_all_brokerage_authorization_type) | **GET** /brokerageAuthorizationTypes | List of all brokerage authorization types
|
77
77
|
*SnapTrade::ReferenceDataApi* | [**list_all_brokerages**](docs/ReferenceDataApi.md#list_all_brokerages) | **GET** /brokerages | List brokerages
|
78
78
|
*SnapTrade::ReferenceDataApi* | [**list_all_currencies**](docs/ReferenceDataApi.md#list_all_currencies) | **GET** /currencies | List currencies
|
@@ -216,7 +216,6 @@ Class | Method | HTTP request | Description
|
|
216
216
|
- [SnapTrade::UnderlyingSymbol](docs/UnderlyingSymbol.md)
|
217
217
|
- [SnapTrade::UniversalActivity](docs/UniversalActivity.md)
|
218
218
|
- [SnapTrade::UniversalSymbol](docs/UniversalSymbol.md)
|
219
|
-
- [SnapTrade::UniversalSymbolTicker](docs/UniversalSymbolTicker.md)
|
220
219
|
- [SnapTrade::UserErrorLog](docs/UserErrorLog.md)
|
221
220
|
- [SnapTrade::UserIDandSecret](docs/UserIDandSecret.md)
|
222
221
|
- [SnapTrade::UserSettings](docs/UserSettings.md)
|
@@ -12,6 +12,7 @@
|
|
12
12
|
| **exchange** | [**Exchange**](Exchange.md) | | [optional] |
|
13
13
|
| **type** | [**SecurityType**](SecurityType.md) | | |
|
14
14
|
| **currencies** | [**Array<Currency>**](Currency.md) | | |
|
15
|
+
| **figi_code** | **String** | | [optional] |
|
15
16
|
|
16
17
|
## Example
|
17
18
|
|
@@ -26,7 +27,8 @@ instance = SnapTrade::BrokerageSymbolSymbol.new(
|
|
26
27
|
currency: null,
|
27
28
|
exchange: null,
|
28
29
|
type: null,
|
29
|
-
currencies: null
|
30
|
+
currencies: null,
|
31
|
+
figi_code: BBG000B9XRY4
|
30
32
|
)
|
31
33
|
```
|
32
34
|
|
data/docs/ManualTradeForm.md
CHANGED
@@ -10,9 +10,9 @@
|
|
10
10
|
| **price** | **Float** | Trade Price if limit or stop limit order | [optional] |
|
11
11
|
| **stop** | **Float** | Stop Price. If stop loss or stop limit order, the price to trigger the stop | [optional] |
|
12
12
|
| **time_in_force** | [**TimeInForce**](TimeInForce.md) | | [optional] |
|
13
|
-
| **units** | **Float** |
|
13
|
+
| **units** | **Float** | | [optional] |
|
14
14
|
| **universal_symbol_id** | **String** | | [optional] |
|
15
|
-
| **notional_value** | **Float** |
|
15
|
+
| **notional_value** | **Float** | | [optional] |
|
16
16
|
|
17
17
|
## Example
|
18
18
|
|
@@ -28,7 +28,7 @@ instance = SnapTrade::ManualTradeForm.new(
|
|
28
28
|
time_in_force: null,
|
29
29
|
units: null,
|
30
30
|
universal_symbol_id: 2bcd7cc3-e922-4976-bce1-9858296801c3,
|
31
|
-
notional_value:
|
31
|
+
notional_value: null
|
32
32
|
)
|
33
33
|
```
|
34
34
|
|
data/docs/ReferenceDataApi.md
CHANGED
@@ -9,7 +9,7 @@ All URIs are relative to *https://api.snaptrade.com/api/v1*
|
|
9
9
|
| [**get_security_types**](ReferenceDataApi.md#get_security_types) | **GET** /securityTypes | List of all security types |
|
10
10
|
| [**get_stock_exchanges**](ReferenceDataApi.md#get_stock_exchanges) | **GET** /exchanges | List exchanges |
|
11
11
|
| [**get_symbols**](ReferenceDataApi.md#get_symbols) | **POST** /symbols | Search for symbols |
|
12
|
-
| [**get_symbols_by_ticker**](ReferenceDataApi.md#get_symbols_by_ticker) | **GET** /symbols/{
|
12
|
+
| [**get_symbols_by_ticker**](ReferenceDataApi.md#get_symbols_by_ticker) | **GET** /symbols/{query} | Get details of a symbol by the ticker or the universal_symbol_id |
|
13
13
|
| [**list_all_brokerage_authorization_type**](ReferenceDataApi.md#list_all_brokerage_authorization_type) | **GET** /brokerageAuthorizationTypes | List of all brokerage authorization types |
|
14
14
|
| [**list_all_brokerages**](ReferenceDataApi.md#list_all_brokerages) | **GET** /brokerages | List brokerages |
|
15
15
|
| [**list_all_currencies**](ReferenceDataApi.md#list_all_currencies) | **GET** /currencies | List currencies |
|
@@ -271,7 +271,7 @@ end
|
|
271
271
|
|
272
272
|
## get_symbols_by_ticker
|
273
273
|
|
274
|
-
Get details of a symbol by the ticker
|
274
|
+
Get details of a symbol by the ticker or the universal_symbol_id
|
275
275
|
|
276
276
|
### Example
|
277
277
|
|
@@ -281,14 +281,12 @@ require 'snaptrade'
|
|
281
281
|
SnapTrade.client_id = "YOUR_CLIENT_ID"
|
282
282
|
SnapTrade.consumer_key = "YOUR_CONSUMER_KEY"
|
283
283
|
|
284
|
-
|
285
|
-
symbol_id = "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
|
284
|
+
query = "query_example"
|
286
285
|
|
287
286
|
begin
|
288
|
-
# Get details of a symbol by the ticker
|
287
|
+
# Get details of a symbol by the ticker or the universal_symbol_id
|
289
288
|
result = SnapTrade::ReferenceData.get_symbols_by_ticker(
|
290
|
-
|
291
|
-
symbol_id: symbol_id,
|
289
|
+
query: query,
|
292
290
|
)
|
293
291
|
p result
|
294
292
|
rescue SnapTrade::ApiError => e
|
@@ -301,14 +299,12 @@ end
|
|
301
299
|
This returns an Array which contains the response data, status code and headers.
|
302
300
|
|
303
301
|
```ruby
|
304
|
-
|
305
|
-
symbol_id = "046b6c7f-0b8a-43b9-b35d-6489e6daee91"
|
302
|
+
query = "query_example"
|
306
303
|
|
307
304
|
begin
|
308
|
-
# Get details of a symbol by the ticker
|
305
|
+
# Get details of a symbol by the ticker or the universal_symbol_id
|
309
306
|
data, status_code, headers, response = SnapTrade::ReferenceData.get_symbols_by_ticker_with_http_info(
|
310
|
-
|
311
|
-
symbol_id: symbol_id,
|
307
|
+
query: query,
|
312
308
|
)
|
313
309
|
p status_code # => 2xx
|
314
310
|
p headers # => { ... }
|
@@ -322,8 +318,7 @@ end
|
|
322
318
|
|
323
319
|
| Name | Type | Description | Notes |
|
324
320
|
| ---- | ---- | ----------- | ----- |
|
325
|
-
| **
|
326
|
-
| **symbol_id** | **String** | OPTIONAL IN PATH Can be used instead of the ticker ; The ID of the UniversalSymbol to get. | [optional] |
|
321
|
+
| **query** | **String** | The ticker or universal_symbol_id of the UniversalSymbol to get. | |
|
327
322
|
|
328
323
|
### Return type
|
329
324
|
|
data/docs/Symbol.md
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
| **currency** | [**Currency**](Currency.md) | | [optional] |
|
12
12
|
| **exchange** | [**Exchange**](Exchange.md) | | [optional] |
|
13
13
|
| **type** | [**SecurityType**](SecurityType.md) | | [optional] |
|
14
|
+
| **figi_code** | **String** | | [optional] |
|
14
15
|
|
15
16
|
## Example
|
16
17
|
|
@@ -24,7 +25,8 @@ instance = SnapTrade::Symbol.new(
|
|
24
25
|
name: Vanguard Canadian Aggregate Bond Index ETF,
|
25
26
|
currency: null,
|
26
27
|
exchange: null,
|
27
|
-
type: null
|
28
|
+
type: null,
|
29
|
+
figi_code: BBG000B9XRY4
|
28
30
|
)
|
29
31
|
```
|
30
32
|
|
data/docs/TradingApi.md
CHANGED
@@ -103,7 +103,7 @@ stop = 31.33
|
|
103
103
|
time_in_force = "Day"
|
104
104
|
units = 3.14
|
105
105
|
universal_symbol_id = "2bcd7cc3-e922-4976-bce1-9858296801c3"
|
106
|
-
notional_value =
|
106
|
+
notional_value = 3.14
|
107
107
|
|
108
108
|
begin
|
109
109
|
# Check impact of trades on account.
|
@@ -141,7 +141,7 @@ stop = 31.33
|
|
141
141
|
time_in_force = "Day"
|
142
142
|
units = 3.14
|
143
143
|
universal_symbol_id = "2bcd7cc3-e922-4976-bce1-9858296801c3"
|
144
|
-
notional_value =
|
144
|
+
notional_value = 3.14
|
145
145
|
|
146
146
|
begin
|
147
147
|
# Check impact of trades on account.
|
@@ -275,7 +275,7 @@ stop = 31.33
|
|
275
275
|
time_in_force = "Day"
|
276
276
|
units = 3.14
|
277
277
|
universal_symbol_id = "2bcd7cc3-e922-4976-bce1-9858296801c3"
|
278
|
-
notional_value =
|
278
|
+
notional_value = 3.14
|
279
279
|
|
280
280
|
begin
|
281
281
|
# Place a trade with NO validation.
|
@@ -313,7 +313,7 @@ stop = 31.33
|
|
313
313
|
time_in_force = "Day"
|
314
314
|
units = 3.14
|
315
315
|
universal_symbol_id = "2bcd7cc3-e922-4976-bce1-9858296801c3"
|
316
|
-
notional_value =
|
316
|
+
notional_value = 3.14
|
317
317
|
|
318
318
|
begin
|
319
319
|
# Place a trade with NO validation.
|
data/docs/UnderlyingSymbol.md
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
| **exchange** | [**USExchange**](USExchange.md) | | [optional] |
|
12
12
|
| **type** | [**SecurityType**](SecurityType.md) | | [optional] |
|
13
13
|
| **currencies** | [**Array<Currency>**](Currency.md) | | [optional] |
|
14
|
+
| **figi_code** | **String** | | [optional] |
|
14
15
|
|
15
16
|
## Example
|
16
17
|
|
@@ -24,7 +25,8 @@ instance = SnapTrade::UnderlyingSymbol.new(
|
|
24
25
|
currency: null,
|
25
26
|
exchange: null,
|
26
27
|
type: null,
|
27
|
-
currencies: null
|
28
|
+
currencies: null,
|
29
|
+
figi_code: BBG000B9XRY4
|
28
30
|
)
|
29
31
|
```
|
30
32
|
|
data/docs/UniversalSymbol.md
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
| **exchange** | [**Exchange**](Exchange.md) | | [optional] |
|
13
13
|
| **type** | [**SecurityType**](SecurityType.md) | | |
|
14
14
|
| **currencies** | [**Array<Currency>**](Currency.md) | | |
|
15
|
+
| **figi_code** | **String** | | [optional] |
|
15
16
|
|
16
17
|
## Example
|
17
18
|
|
@@ -26,7 +27,8 @@ instance = SnapTrade::UniversalSymbol.new(
|
|
26
27
|
currency: null,
|
27
28
|
exchange: null,
|
28
29
|
type: null,
|
29
|
-
currencies: null
|
30
|
+
currencies: null,
|
31
|
+
figi_code: BBG000B9XRY4
|
30
32
|
)
|
31
33
|
```
|
32
34
|
|
@@ -392,54 +392,47 @@ module SnapTrade
|
|
392
392
|
end
|
393
393
|
|
394
394
|
|
395
|
-
# Get details of a symbol by the ticker
|
396
|
-
# @param
|
397
|
-
# @param symbol_id [String] OPTIONAL IN PATH Can be used instead of the ticker ; The ID of the UniversalSymbol to get.
|
395
|
+
# Get details of a symbol by the ticker or the universal_symbol_id
|
396
|
+
# @param query [String] The ticker or universal_symbol_id of the UniversalSymbol to get.
|
398
397
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
399
|
-
def get_symbols_by_ticker(
|
400
|
-
|
401
|
-
data, _status_code, _headers = get_symbols_by_ticker_with_http_info_impl(ticker, extra)
|
398
|
+
def get_symbols_by_ticker(query:, extra: {})
|
399
|
+
data, _status_code, _headers = get_symbols_by_ticker_with_http_info_impl(query, extra)
|
402
400
|
data
|
403
401
|
end
|
404
402
|
|
405
|
-
# Get details of a symbol by the ticker
|
406
|
-
# @param
|
407
|
-
# @param symbol_id [String] OPTIONAL IN PATH Can be used instead of the ticker ; The ID of the UniversalSymbol to get.
|
403
|
+
# Get details of a symbol by the ticker or the universal_symbol_id
|
404
|
+
# @param query [String] The ticker or universal_symbol_id of the UniversalSymbol to get.
|
408
405
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
409
|
-
def get_symbols_by_ticker_with_http_info(
|
410
|
-
extra
|
411
|
-
get_symbols_by_ticker_with_http_info_impl(ticker, extra)
|
406
|
+
def get_symbols_by_ticker_with_http_info(query:, extra: {})
|
407
|
+
get_symbols_by_ticker_with_http_info_impl(query, extra)
|
412
408
|
end
|
413
409
|
|
414
|
-
# Get details of a symbol by the ticker
|
415
|
-
# @param
|
410
|
+
# Get details of a symbol by the ticker or the universal_symbol_id
|
411
|
+
# @param query [String] The ticker or universal_symbol_id of the UniversalSymbol to get.
|
416
412
|
# @param [Hash] opts the optional parameters
|
417
|
-
# @option opts [String] :symbol_id OPTIONAL IN PATH Can be used instead of the ticker ; The ID of the UniversalSymbol to get.
|
418
413
|
# @return [UniversalSymbol]
|
419
|
-
def get_symbols_by_ticker_impl(
|
420
|
-
data, _status_code, _headers = get_symbols_by_ticker_with_http_info(
|
414
|
+
def get_symbols_by_ticker_impl(query, opts = {})
|
415
|
+
data, _status_code, _headers = get_symbols_by_ticker_with_http_info(query, opts)
|
421
416
|
data
|
422
417
|
end
|
423
418
|
|
424
|
-
# Get details of a symbol by the ticker
|
425
|
-
# @param
|
419
|
+
# Get details of a symbol by the ticker or the universal_symbol_id
|
420
|
+
# @param query [String] The ticker or universal_symbol_id of the UniversalSymbol to get.
|
426
421
|
# @param [Hash] opts the optional parameters
|
427
|
-
# @option opts [String] :symbol_id OPTIONAL IN PATH Can be used instead of the ticker ; The ID of the UniversalSymbol to get.
|
428
422
|
# @return [Array<(UniversalSymbol, Integer, Hash)>] UniversalSymbol data, response status code and response headers
|
429
|
-
def get_symbols_by_ticker_with_http_info_impl(
|
423
|
+
def get_symbols_by_ticker_with_http_info_impl(query, opts = {})
|
430
424
|
if @api_client.config.debugging
|
431
425
|
@api_client.config.logger.debug 'Calling API: ReferenceDataApi.get_symbols_by_ticker ...'
|
432
426
|
end
|
433
|
-
# verify the required parameter '
|
434
|
-
if @api_client.config.client_side_validation &&
|
435
|
-
fail ArgumentError, "Missing the required parameter '
|
427
|
+
# verify the required parameter 'query' is set
|
428
|
+
if @api_client.config.client_side_validation && query.nil?
|
429
|
+
fail ArgumentError, "Missing the required parameter 'query' when calling ReferenceDataApi.get_symbols_by_ticker"
|
436
430
|
end
|
437
431
|
# resource path
|
438
|
-
local_var_path = '/symbols/{
|
432
|
+
local_var_path = '/symbols/{query}'.sub('{' + 'query' + '}', CGI.escape(query.to_s))
|
439
433
|
|
440
434
|
# query parameters
|
441
435
|
query_params = opts[:query_params] || {}
|
442
|
-
query_params[:'symbolId'] = opts[:'symbol_id'] if !opts[:'symbol_id'].nil?
|
443
436
|
|
444
437
|
# header parameters
|
445
438
|
header_params = opts[:header_params] || {}
|
@@ -143,9 +143,9 @@ module SnapTrade
|
|
143
143
|
# @param price [Float] Trade Price if limit or stop limit order
|
144
144
|
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
145
145
|
# @param time_in_force [TimeInForce]
|
146
|
-
# @param units [Float]
|
146
|
+
# @param units [Float]
|
147
147
|
# @param universal_symbol_id [String]
|
148
|
-
# @param notional_value [Float]
|
148
|
+
# @param notional_value [Float]
|
149
149
|
# @param body [ManualTradeForm]
|
150
150
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
151
151
|
def get_order_impact(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, notional_value: SENTINEL, extra: {})
|
@@ -173,9 +173,9 @@ module SnapTrade
|
|
173
173
|
# @param price [Float] Trade Price if limit or stop limit order
|
174
174
|
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
175
175
|
# @param time_in_force [TimeInForce]
|
176
|
-
# @param units [Float]
|
176
|
+
# @param units [Float]
|
177
177
|
# @param universal_symbol_id [String]
|
178
|
-
# @param notional_value [Float]
|
178
|
+
# @param notional_value [Float]
|
179
179
|
# @param body [ManualTradeForm]
|
180
180
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
181
181
|
def get_order_impact_with_http_info(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, notional_value: SENTINEL, extra: {})
|
@@ -394,9 +394,9 @@ module SnapTrade
|
|
394
394
|
# @param price [Float] Trade Price if limit or stop limit order
|
395
395
|
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
396
396
|
# @param time_in_force [TimeInForce]
|
397
|
-
# @param units [Float]
|
397
|
+
# @param units [Float]
|
398
398
|
# @param universal_symbol_id [String]
|
399
|
-
# @param notional_value [Float]
|
399
|
+
# @param notional_value [Float]
|
400
400
|
# @param body [ManualTradeForm]
|
401
401
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
402
402
|
def place_force_order(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, notional_value: SENTINEL, extra: {})
|
@@ -424,9 +424,9 @@ module SnapTrade
|
|
424
424
|
# @param price [Float] Trade Price if limit or stop limit order
|
425
425
|
# @param stop [Float] Stop Price. If stop loss or stop limit order, the price to trigger the stop
|
426
426
|
# @param time_in_force [TimeInForce]
|
427
|
-
# @param units [Float]
|
427
|
+
# @param units [Float]
|
428
428
|
# @param universal_symbol_id [String]
|
429
|
-
# @param notional_value [Float]
|
429
|
+
# @param notional_value [Float]
|
430
430
|
# @param body [ManualTradeForm]
|
431
431
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
432
432
|
def place_force_order_with_http_info(user_id:, user_secret:, account_id: SENTINEL, action: SENTINEL, order_type: SENTINEL, price: SENTINEL, stop: SENTINEL, time_in_force: SENTINEL, units: SENTINEL, universal_symbol_id: SENTINEL, notional_value: SENTINEL, extra: {})
|
@@ -29,6 +29,8 @@ module SnapTrade
|
|
29
29
|
|
30
30
|
attr_accessor :currencies
|
31
31
|
|
32
|
+
attr_accessor :figi_code
|
33
|
+
|
32
34
|
# Attribute mapping from ruby-style variable name to JSON key.
|
33
35
|
def self.attribute_map
|
34
36
|
{
|
@@ -39,7 +41,8 @@ module SnapTrade
|
|
39
41
|
:'currency' => :'currency',
|
40
42
|
:'exchange' => :'exchange',
|
41
43
|
:'type' => :'type',
|
42
|
-
:'currencies' => :'currencies'
|
44
|
+
:'currencies' => :'currencies',
|
45
|
+
:'figi_code' => :'figi_code'
|
43
46
|
}
|
44
47
|
end
|
45
48
|
|
@@ -58,7 +61,8 @@ module SnapTrade
|
|
58
61
|
:'currency' => :'Currency',
|
59
62
|
:'exchange' => :'Exchange',
|
60
63
|
:'type' => :'SecurityType',
|
61
|
-
:'currencies' => :'Array<Currency>'
|
64
|
+
:'currencies' => :'Array<Currency>',
|
65
|
+
:'figi_code' => :'String'
|
62
66
|
}
|
63
67
|
end
|
64
68
|
|
@@ -66,6 +70,7 @@ module SnapTrade
|
|
66
70
|
def self.openapi_nullable
|
67
71
|
Set.new([
|
68
72
|
:'description',
|
73
|
+
:'figi_code'
|
69
74
|
])
|
70
75
|
end
|
71
76
|
|
@@ -124,6 +129,10 @@ module SnapTrade
|
|
124
129
|
self.currencies = value
|
125
130
|
end
|
126
131
|
end
|
132
|
+
|
133
|
+
if attributes.key?(:'figi_code')
|
134
|
+
self.figi_code = attributes[:'figi_code']
|
135
|
+
end
|
127
136
|
end
|
128
137
|
|
129
138
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -181,7 +190,8 @@ module SnapTrade
|
|
181
190
|
currency == o.currency &&
|
182
191
|
exchange == o.exchange &&
|
183
192
|
type == o.type &&
|
184
|
-
currencies == o.currencies
|
193
|
+
currencies == o.currencies &&
|
194
|
+
figi_code == o.figi_code
|
185
195
|
end
|
186
196
|
|
187
197
|
# @see the `==` method
|
@@ -193,7 +203,7 @@ module SnapTrade
|
|
193
203
|
# Calculates hash code according to all attributes.
|
194
204
|
# @return [Integer] Hash code
|
195
205
|
def hash
|
196
|
-
[id, symbol, raw_symbol, description, currency, exchange, type, currencies].hash
|
206
|
+
[id, symbol, raw_symbol, description, currency, exchange, type, currencies, figi_code].hash
|
197
207
|
end
|
198
208
|
|
199
209
|
# Builds the object from hash
|
@@ -28,12 +28,10 @@ module SnapTrade
|
|
28
28
|
|
29
29
|
attr_accessor :time_in_force
|
30
30
|
|
31
|
-
# Trade Units. Cannot work with notional value.
|
32
31
|
attr_accessor :units
|
33
32
|
|
34
33
|
attr_accessor :universal_symbol_id
|
35
34
|
|
36
|
-
# Dollar amount to trade. Cannot work with units. Can only work for market order types and day for time in force.
|
37
35
|
attr_accessor :notional_value
|
38
36
|
|
39
37
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -76,6 +74,7 @@ module SnapTrade
|
|
76
74
|
Set.new([
|
77
75
|
:'price',
|
78
76
|
:'stop',
|
77
|
+
:'units',
|
79
78
|
:'notional_value'
|
80
79
|
])
|
81
80
|
end
|
@@ -28,6 +28,8 @@ module SnapTrade
|
|
28
28
|
|
29
29
|
attr_accessor :type
|
30
30
|
|
31
|
+
attr_accessor :figi_code
|
32
|
+
|
31
33
|
# Attribute mapping from ruby-style variable name to JSON key.
|
32
34
|
def self.attribute_map
|
33
35
|
{
|
@@ -37,7 +39,8 @@ module SnapTrade
|
|
37
39
|
:'name' => :'name',
|
38
40
|
:'currency' => :'currency',
|
39
41
|
:'exchange' => :'exchange',
|
40
|
-
:'type' => :'type'
|
42
|
+
:'type' => :'type',
|
43
|
+
:'figi_code' => :'figi_code'
|
41
44
|
}
|
42
45
|
end
|
43
46
|
|
@@ -55,13 +58,15 @@ module SnapTrade
|
|
55
58
|
:'name' => :'String',
|
56
59
|
:'currency' => :'Currency',
|
57
60
|
:'exchange' => :'Exchange',
|
58
|
-
:'type' => :'SecurityType'
|
61
|
+
:'type' => :'SecurityType',
|
62
|
+
:'figi_code' => :'String'
|
59
63
|
}
|
60
64
|
end
|
61
65
|
|
62
66
|
# List of attributes with nullable: true
|
63
67
|
def self.openapi_nullable
|
64
68
|
Set.new([
|
69
|
+
:'figi_code'
|
65
70
|
])
|
66
71
|
end
|
67
72
|
|
@@ -107,6 +112,10 @@ module SnapTrade
|
|
107
112
|
if attributes.key?(:'type')
|
108
113
|
self.type = attributes[:'type']
|
109
114
|
end
|
115
|
+
|
116
|
+
if attributes.key?(:'figi_code')
|
117
|
+
self.figi_code = attributes[:'figi_code']
|
118
|
+
end
|
110
119
|
end
|
111
120
|
|
112
121
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -133,7 +142,8 @@ module SnapTrade
|
|
133
142
|
name == o.name &&
|
134
143
|
currency == o.currency &&
|
135
144
|
exchange == o.exchange &&
|
136
|
-
type == o.type
|
145
|
+
type == o.type &&
|
146
|
+
figi_code == o.figi_code
|
137
147
|
end
|
138
148
|
|
139
149
|
# @see the `==` method
|
@@ -145,7 +155,7 @@ module SnapTrade
|
|
145
155
|
# Calculates hash code according to all attributes.
|
146
156
|
# @return [Integer] Hash code
|
147
157
|
def hash
|
148
|
-
[id, symbol, raw_symbol, name, currency, exchange, type].hash
|
158
|
+
[id, symbol, raw_symbol, name, currency, exchange, type, figi_code].hash
|
149
159
|
end
|
150
160
|
|
151
161
|
# Builds the object from hash
|
@@ -28,6 +28,8 @@ module SnapTrade
|
|
28
28
|
|
29
29
|
attr_accessor :currencies
|
30
30
|
|
31
|
+
attr_accessor :figi_code
|
32
|
+
|
31
33
|
# Attribute mapping from ruby-style variable name to JSON key.
|
32
34
|
def self.attribute_map
|
33
35
|
{
|
@@ -37,7 +39,8 @@ module SnapTrade
|
|
37
39
|
:'currency' => :'currency',
|
38
40
|
:'exchange' => :'exchange',
|
39
41
|
:'type' => :'type',
|
40
|
-
:'currencies' => :'currencies'
|
42
|
+
:'currencies' => :'currencies',
|
43
|
+
:'figi_code' => :'figi_code'
|
41
44
|
}
|
42
45
|
end
|
43
46
|
|
@@ -55,7 +58,8 @@ module SnapTrade
|
|
55
58
|
:'currency' => :'Currency',
|
56
59
|
:'exchange' => :'USExchange',
|
57
60
|
:'type' => :'SecurityType',
|
58
|
-
:'currencies' => :'Array<Currency>'
|
61
|
+
:'currencies' => :'Array<Currency>',
|
62
|
+
:'figi_code' => :'String'
|
59
63
|
}
|
60
64
|
end
|
61
65
|
|
@@ -63,6 +67,7 @@ module SnapTrade
|
|
63
67
|
def self.openapi_nullable
|
64
68
|
Set.new([
|
65
69
|
:'description',
|
70
|
+
:'figi_code'
|
66
71
|
])
|
67
72
|
end
|
68
73
|
|
@@ -110,6 +115,10 @@ module SnapTrade
|
|
110
115
|
self.currencies = value
|
111
116
|
end
|
112
117
|
end
|
118
|
+
|
119
|
+
if attributes.key?(:'figi_code')
|
120
|
+
self.figi_code = attributes[:'figi_code']
|
121
|
+
end
|
113
122
|
end
|
114
123
|
|
115
124
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -136,7 +145,8 @@ module SnapTrade
|
|
136
145
|
currency == o.currency &&
|
137
146
|
exchange == o.exchange &&
|
138
147
|
type == o.type &&
|
139
|
-
currencies == o.currencies
|
148
|
+
currencies == o.currencies &&
|
149
|
+
figi_code == o.figi_code
|
140
150
|
end
|
141
151
|
|
142
152
|
# @see the `==` method
|
@@ -148,7 +158,7 @@ module SnapTrade
|
|
148
158
|
# Calculates hash code according to all attributes.
|
149
159
|
# @return [Integer] Hash code
|
150
160
|
def hash
|
151
|
-
[id, symbol, description, currency, exchange, type, currencies].hash
|
161
|
+
[id, symbol, description, currency, exchange, type, currencies, figi_code].hash
|
152
162
|
end
|
153
163
|
|
154
164
|
# Builds the object from hash
|
@@ -30,6 +30,8 @@ module SnapTrade
|
|
30
30
|
|
31
31
|
attr_accessor :currencies
|
32
32
|
|
33
|
+
attr_accessor :figi_code
|
34
|
+
|
33
35
|
# Attribute mapping from ruby-style variable name to JSON key.
|
34
36
|
def self.attribute_map
|
35
37
|
{
|
@@ -40,7 +42,8 @@ module SnapTrade
|
|
40
42
|
:'currency' => :'currency',
|
41
43
|
:'exchange' => :'exchange',
|
42
44
|
:'type' => :'type',
|
43
|
-
:'currencies' => :'currencies'
|
45
|
+
:'currencies' => :'currencies',
|
46
|
+
:'figi_code' => :'figi_code'
|
44
47
|
}
|
45
48
|
end
|
46
49
|
|
@@ -59,7 +62,8 @@ module SnapTrade
|
|
59
62
|
:'currency' => :'Currency',
|
60
63
|
:'exchange' => :'Exchange',
|
61
64
|
:'type' => :'SecurityType',
|
62
|
-
:'currencies' => :'Array<Currency>'
|
65
|
+
:'currencies' => :'Array<Currency>',
|
66
|
+
:'figi_code' => :'String'
|
63
67
|
}
|
64
68
|
end
|
65
69
|
|
@@ -67,6 +71,7 @@ module SnapTrade
|
|
67
71
|
def self.openapi_nullable
|
68
72
|
Set.new([
|
69
73
|
:'description',
|
74
|
+
:'figi_code'
|
70
75
|
])
|
71
76
|
end
|
72
77
|
|
@@ -118,6 +123,10 @@ module SnapTrade
|
|
118
123
|
self.currencies = value
|
119
124
|
end
|
120
125
|
end
|
126
|
+
|
127
|
+
if attributes.key?(:'figi_code')
|
128
|
+
self.figi_code = attributes[:'figi_code']
|
129
|
+
end
|
121
130
|
end
|
122
131
|
|
123
132
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -175,7 +184,8 @@ module SnapTrade
|
|
175
184
|
currency == o.currency &&
|
176
185
|
exchange == o.exchange &&
|
177
186
|
type == o.type &&
|
178
|
-
currencies == o.currencies
|
187
|
+
currencies == o.currencies &&
|
188
|
+
figi_code == o.figi_code
|
179
189
|
end
|
180
190
|
|
181
191
|
# @see the `==` method
|
@@ -187,7 +197,7 @@ module SnapTrade
|
|
187
197
|
# Calculates hash code according to all attributes.
|
188
198
|
# @return [Integer] Hash code
|
189
199
|
def hash
|
190
|
-
[id, symbol, raw_symbol, description, currency, exchange, type, currencies].hash
|
200
|
+
[id, symbol, raw_symbol, description, currency, exchange, type, currencies, figi_code].hash
|
191
201
|
end
|
192
202
|
|
193
203
|
# Builds the object from hash
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -143,7 +143,6 @@ require 'snaptrade/models/us_exchange'
|
|
143
143
|
require 'snaptrade/models/underlying_symbol'
|
144
144
|
require 'snaptrade/models/universal_activity'
|
145
145
|
require 'snaptrade/models/universal_symbol'
|
146
|
-
require 'snaptrade/models/universal_symbol_ticker'
|
147
146
|
require 'snaptrade/models/user_error_log'
|
148
147
|
require 'snaptrade/models/user_i_dand_secret'
|
149
148
|
require 'snaptrade/models/user_settings'
|
@@ -82,10 +82,9 @@ describe 'ReferenceDataApi' do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
# unit tests for get_symbols_by_ticker
|
85
|
-
# Get details of a symbol by the ticker
|
86
|
-
# @param
|
85
|
+
# Get details of a symbol by the ticker or the universal_symbol_id
|
86
|
+
# @param query The ticker or universal_symbol_id of the UniversalSymbol to get.
|
87
87
|
# @param [Hash] opts the optional parameters
|
88
|
-
# @option opts [String] :symbol_id OPTIONAL IN PATH Can be used instead of the ticker ; The ID of the UniversalSymbol to get.
|
89
88
|
# @return [UniversalSymbol]
|
90
89
|
describe 'get_symbols_by_ticker test' do
|
91
90
|
it 'should work' do
|
data/spec/models/symbol_spec.rb
CHANGED
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -216,7 +216,6 @@ files:
|
|
216
216
|
- docs/UnderlyingSymbol.md
|
217
217
|
- docs/UniversalActivity.md
|
218
218
|
- docs/UniversalSymbol.md
|
219
|
-
- docs/UniversalSymbolTicker.md
|
220
219
|
- docs/UserErrorLog.md
|
221
220
|
- docs/UserIDandSecret.md
|
222
221
|
- docs/UserSettings.md
|
@@ -360,7 +359,6 @@ files:
|
|
360
359
|
- lib/snaptrade/models/underlying_symbol.rb
|
361
360
|
- lib/snaptrade/models/universal_activity.rb
|
362
361
|
- lib/snaptrade/models/universal_symbol.rb
|
363
|
-
- lib/snaptrade/models/universal_symbol_ticker.rb
|
364
362
|
- lib/snaptrade/models/us_exchange.rb
|
365
363
|
- lib/snaptrade/models/user_error_log.rb
|
366
364
|
- lib/snaptrade/models/user_i_dand_secret.rb
|
@@ -504,7 +502,6 @@ files:
|
|
504
502
|
- spec/models/underlying_symbol_spec.rb
|
505
503
|
- spec/models/universal_activity_spec.rb
|
506
504
|
- spec/models/universal_symbol_spec.rb
|
507
|
-
- spec/models/universal_symbol_ticker_spec.rb
|
508
505
|
- spec/models/us_exchange_spec.rb
|
509
506
|
- spec/models/user_error_log_spec.rb
|
510
507
|
- spec/models/user_i_dand_secret_spec.rb
|
@@ -531,7 +528,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
531
528
|
- !ruby/object:Gem::Version
|
532
529
|
version: '0'
|
533
530
|
requirements: []
|
534
|
-
rubygems_version: 3.
|
531
|
+
rubygems_version: 3.4.10
|
535
532
|
signing_key:
|
536
533
|
specification_version: 4
|
537
534
|
summary: SnapTrade Ruby Gem
|
@@ -604,7 +601,6 @@ test_files:
|
|
604
601
|
- spec/models/manual_trade_balance_spec.rb
|
605
602
|
- spec/models/session_event_spec.rb
|
606
603
|
- spec/models/state_spec.rb
|
607
|
-
- spec/models/universal_symbol_ticker_spec.rb
|
608
604
|
- spec/models/strategy_order_place_orders_inner_spec.rb
|
609
605
|
- spec/models/connection_type_spec.rb
|
610
606
|
- spec/models/strategy_order_record_status_spec.rb
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# SnapTrade::UniversalSymbolTicker
|
2
|
-
|
3
|
-
## Properties
|
4
|
-
|
5
|
-
| Name | Type | Description | Notes |
|
6
|
-
| ---- | ---- | ----------- | ----- |
|
7
|
-
| **id** | **String** | | [optional] |
|
8
|
-
| **symbol** | **String** | | [optional] |
|
9
|
-
| **raw_symbol** | **String** | | [optional] |
|
10
|
-
| **description** | **String** | | [optional] |
|
11
|
-
| **currency** | [**Currency**](Currency.md) | | [optional] |
|
12
|
-
| **exchange** | [**Exchange**](Exchange.md) | | [optional] |
|
13
|
-
| **type** | [**SecurityType**](SecurityType.md) | | [optional] |
|
14
|
-
| **currencies** | [**Array<Currency>**](Currency.md) | | [optional] |
|
15
|
-
|
16
|
-
## Example
|
17
|
-
|
18
|
-
```ruby
|
19
|
-
require 'snaptrade'
|
20
|
-
|
21
|
-
instance = SnapTrade::UniversalSymbolTicker.new(
|
22
|
-
id: 2bcd7cc3-e922-4976-bce1-9858296801c3,
|
23
|
-
symbol: VAB.TO,
|
24
|
-
raw_symbol: VAB,
|
25
|
-
description: VANGUARD CDN AGGREGATE BOND INDEX ETF,
|
26
|
-
currency: null,
|
27
|
-
exchange: null,
|
28
|
-
type: null,
|
29
|
-
currencies: null
|
30
|
-
)
|
31
|
-
```
|
32
|
-
|
@@ -1,283 +0,0 @@
|
|
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
|
-
|
9
|
-
=end
|
10
|
-
|
11
|
-
require 'date'
|
12
|
-
require 'time'
|
13
|
-
|
14
|
-
module SnapTrade
|
15
|
-
# Universal symbol
|
16
|
-
class UniversalSymbolTicker
|
17
|
-
attr_accessor :id
|
18
|
-
|
19
|
-
attr_accessor :symbol
|
20
|
-
|
21
|
-
attr_accessor :raw_symbol
|
22
|
-
|
23
|
-
attr_accessor :description
|
24
|
-
|
25
|
-
attr_accessor :currency
|
26
|
-
|
27
|
-
attr_accessor :exchange
|
28
|
-
|
29
|
-
attr_accessor :type
|
30
|
-
|
31
|
-
attr_accessor :currencies
|
32
|
-
|
33
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
34
|
-
def self.attribute_map
|
35
|
-
{
|
36
|
-
:'id' => :'id',
|
37
|
-
:'symbol' => :'symbol',
|
38
|
-
:'raw_symbol' => :'raw_symbol',
|
39
|
-
:'description' => :'description',
|
40
|
-
:'currency' => :'currency',
|
41
|
-
:'exchange' => :'exchange',
|
42
|
-
:'type' => :'type',
|
43
|
-
:'currencies' => :'currencies'
|
44
|
-
}
|
45
|
-
end
|
46
|
-
|
47
|
-
# Returns all the JSON keys this model knows about
|
48
|
-
def self.acceptable_attributes
|
49
|
-
attribute_map.values
|
50
|
-
end
|
51
|
-
|
52
|
-
# Attribute type mapping.
|
53
|
-
def self.openapi_types
|
54
|
-
{
|
55
|
-
:'id' => :'String',
|
56
|
-
:'symbol' => :'String',
|
57
|
-
:'raw_symbol' => :'String',
|
58
|
-
:'description' => :'String',
|
59
|
-
:'currency' => :'Currency',
|
60
|
-
:'exchange' => :'Exchange',
|
61
|
-
:'type' => :'SecurityType',
|
62
|
-
:'currencies' => :'Array<Currency>'
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
|
-
# List of attributes with nullable: true
|
67
|
-
def self.openapi_nullable
|
68
|
-
Set.new([
|
69
|
-
])
|
70
|
-
end
|
71
|
-
|
72
|
-
# Initializes the object
|
73
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
74
|
-
def initialize(attributes = {})
|
75
|
-
if (!attributes.is_a?(Hash))
|
76
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::UniversalSymbolTicker` initialize method"
|
77
|
-
end
|
78
|
-
|
79
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
80
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
81
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
82
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::UniversalSymbolTicker`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
83
|
-
end
|
84
|
-
h[k.to_sym] = v
|
85
|
-
}
|
86
|
-
|
87
|
-
if attributes.key?(:'id')
|
88
|
-
self.id = attributes[:'id']
|
89
|
-
end
|
90
|
-
|
91
|
-
if attributes.key?(:'symbol')
|
92
|
-
self.symbol = attributes[:'symbol']
|
93
|
-
end
|
94
|
-
|
95
|
-
if attributes.key?(:'raw_symbol')
|
96
|
-
self.raw_symbol = attributes[:'raw_symbol']
|
97
|
-
end
|
98
|
-
|
99
|
-
if attributes.key?(:'description')
|
100
|
-
self.description = attributes[:'description']
|
101
|
-
end
|
102
|
-
|
103
|
-
if attributes.key?(:'currency')
|
104
|
-
self.currency = attributes[:'currency']
|
105
|
-
end
|
106
|
-
|
107
|
-
if attributes.key?(:'exchange')
|
108
|
-
self.exchange = attributes[:'exchange']
|
109
|
-
end
|
110
|
-
|
111
|
-
if attributes.key?(:'type')
|
112
|
-
self.type = attributes[:'type']
|
113
|
-
end
|
114
|
-
|
115
|
-
if attributes.key?(:'currencies')
|
116
|
-
if (value = attributes[:'currencies']).is_a?(Array)
|
117
|
-
self.currencies = value
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
123
|
-
# @return Array for valid properties with the reasons
|
124
|
-
def list_invalid_properties
|
125
|
-
invalid_properties = Array.new
|
126
|
-
invalid_properties
|
127
|
-
end
|
128
|
-
|
129
|
-
# Check to see if the all the properties in the model are valid
|
130
|
-
# @return true if the model is valid
|
131
|
-
def valid?
|
132
|
-
true
|
133
|
-
end
|
134
|
-
|
135
|
-
# Checks equality by comparing each attribute.
|
136
|
-
# @param [Object] Object to be compared
|
137
|
-
def ==(o)
|
138
|
-
return true if self.equal?(o)
|
139
|
-
self.class == o.class &&
|
140
|
-
id == o.id &&
|
141
|
-
symbol == o.symbol &&
|
142
|
-
raw_symbol == o.raw_symbol &&
|
143
|
-
description == o.description &&
|
144
|
-
currency == o.currency &&
|
145
|
-
exchange == o.exchange &&
|
146
|
-
type == o.type &&
|
147
|
-
currencies == o.currencies
|
148
|
-
end
|
149
|
-
|
150
|
-
# @see the `==` method
|
151
|
-
# @param [Object] Object to be compared
|
152
|
-
def eql?(o)
|
153
|
-
self == o
|
154
|
-
end
|
155
|
-
|
156
|
-
# Calculates hash code according to all attributes.
|
157
|
-
# @return [Integer] Hash code
|
158
|
-
def hash
|
159
|
-
[id, symbol, raw_symbol, description, currency, exchange, type, currencies].hash
|
160
|
-
end
|
161
|
-
|
162
|
-
# Builds the object from hash
|
163
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
164
|
-
# @return [Object] Returns the model itself
|
165
|
-
def self.build_from_hash(attributes)
|
166
|
-
new.build_from_hash(attributes)
|
167
|
-
end
|
168
|
-
|
169
|
-
# Builds the object from hash
|
170
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
171
|
-
# @return [Object] Returns the model itself
|
172
|
-
def build_from_hash(attributes)
|
173
|
-
return nil unless attributes.is_a?(Hash)
|
174
|
-
attributes = attributes.transform_keys(&:to_sym)
|
175
|
-
self.class.openapi_types.each_pair do |key, type|
|
176
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
177
|
-
self.send("#{key}=", nil)
|
178
|
-
elsif type =~ /\AArray<(.*)>/i
|
179
|
-
# check to ensure the input is an array given that the attribute
|
180
|
-
# is documented as an array but the input is not
|
181
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
182
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
183
|
-
end
|
184
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
185
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
self
|
190
|
-
end
|
191
|
-
|
192
|
-
# Deserializes the data based on type
|
193
|
-
# @param string type Data type
|
194
|
-
# @param string value Value to be deserialized
|
195
|
-
# @return [Object] Deserialized data
|
196
|
-
def _deserialize(type, value)
|
197
|
-
case type.to_sym
|
198
|
-
when :Time
|
199
|
-
Time.parse(value)
|
200
|
-
when :Date
|
201
|
-
Date.parse(value)
|
202
|
-
when :String
|
203
|
-
value.to_s
|
204
|
-
when :Integer
|
205
|
-
value.to_i
|
206
|
-
when :Float
|
207
|
-
value.to_f
|
208
|
-
when :Boolean
|
209
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
210
|
-
true
|
211
|
-
else
|
212
|
-
false
|
213
|
-
end
|
214
|
-
when :Object
|
215
|
-
# generic object (usually a Hash), return directly
|
216
|
-
value
|
217
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
218
|
-
inner_type = Regexp.last_match[:inner_type]
|
219
|
-
value.map { |v| _deserialize(inner_type, v) }
|
220
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
221
|
-
k_type = Regexp.last_match[:k_type]
|
222
|
-
v_type = Regexp.last_match[:v_type]
|
223
|
-
{}.tap do |hash|
|
224
|
-
value.each do |k, v|
|
225
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
226
|
-
end
|
227
|
-
end
|
228
|
-
else # model
|
229
|
-
# models (e.g. Pet) or oneOf
|
230
|
-
klass = SnapTrade.const_get(type)
|
231
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
# Returns the string representation of the object
|
236
|
-
# @return [String] String presentation of the object
|
237
|
-
def to_s
|
238
|
-
to_hash.to_s
|
239
|
-
end
|
240
|
-
|
241
|
-
# to_body is an alias to to_hash (backward compatibility)
|
242
|
-
# @return [Hash] Returns the object in the form of hash
|
243
|
-
def to_body
|
244
|
-
to_hash
|
245
|
-
end
|
246
|
-
|
247
|
-
# Returns the object in the form of hash
|
248
|
-
# @return [Hash] Returns the object in the form of hash
|
249
|
-
def to_hash
|
250
|
-
hash = {}
|
251
|
-
self.class.attribute_map.each_pair do |attr, param|
|
252
|
-
value = self.send(attr)
|
253
|
-
if value.nil?
|
254
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
255
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
256
|
-
end
|
257
|
-
|
258
|
-
hash[param] = _to_hash(value)
|
259
|
-
end
|
260
|
-
hash
|
261
|
-
end
|
262
|
-
|
263
|
-
# Outputs non-array value in the form of hash
|
264
|
-
# For object, use to_hash. Otherwise, just return the value
|
265
|
-
# @param [Object] value Any valid value
|
266
|
-
# @return [Hash] Returns the value in the form of hash
|
267
|
-
def _to_hash(value)
|
268
|
-
if value.is_a?(Array)
|
269
|
-
value.compact.map { |v| _to_hash(v) }
|
270
|
-
elsif value.is_a?(Hash)
|
271
|
-
{}.tap do |hash|
|
272
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
273
|
-
end
|
274
|
-
elsif value.respond_to? :to_hash
|
275
|
-
value.to_hash
|
276
|
-
else
|
277
|
-
value
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
end
|
282
|
-
|
283
|
-
end
|
@@ -1,72 +0,0 @@
|
|
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
|
-
|
9
|
-
=end
|
10
|
-
|
11
|
-
require 'spec_helper'
|
12
|
-
require 'json'
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
# Unit tests for SnapTrade::UniversalSymbolTicker
|
16
|
-
describe SnapTrade::UniversalSymbolTicker do
|
17
|
-
let(:instance) { SnapTrade::UniversalSymbolTicker.new }
|
18
|
-
|
19
|
-
describe 'test an instance of UniversalSymbolTicker' do
|
20
|
-
it 'should create an instance of UniversalSymbolTicker' do
|
21
|
-
expect(instance).to be_instance_of(SnapTrade::UniversalSymbolTicker)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
describe 'test attribute "id"' do
|
25
|
-
it 'should work' do
|
26
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe 'test attribute "symbol"' do
|
31
|
-
it 'should work' do
|
32
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe 'test attribute "raw_symbol"' do
|
37
|
-
it 'should work' do
|
38
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe 'test attribute "description"' do
|
43
|
-
it 'should work' do
|
44
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe 'test attribute "currency"' do
|
49
|
-
it 'should work' do
|
50
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe 'test attribute "exchange"' do
|
55
|
-
it 'should work' do
|
56
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe 'test attribute "type"' do
|
61
|
-
it 'should work' do
|
62
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe 'test attribute "currencies"' do
|
67
|
-
it 'should work' do
|
68
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|