snaptrade 2.0.82 → 2.0.84
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 +375 -23
- data/lib/snaptrade/api/crypto_spot_trading_api.rb +698 -0
- data/lib/snaptrade/api/trading_api.rb +158 -16
- data/lib/snaptrade/models/account_order_record.rb +14 -4
- data/lib/snaptrade/models/account_order_record_child_brokerage_order_ids.rb +234 -0
- data/lib/snaptrade/models/brokerage_authorization_type_read_only.rb +1 -1
- data/lib/snaptrade/models/{order_class.rb → brokerage_authorization_type_read_only_type.rb} +6 -6
- data/lib/snaptrade/models/child_brokerage_order_ids.rb +227 -0
- data/lib/snaptrade/models/{manual_trade_form_with_options_take_profit.rb → crypto_spot_order_preview.rb} +11 -17
- data/lib/snaptrade/models/crypto_spot_order_preview_estimated_fee.rb +237 -0
- data/lib/snaptrade/models/crypto_spot_order_request_body_time_in_force.rb +39 -0
- data/lib/snaptrade/models/crypto_spot_quote.rb +257 -0
- data/lib/snaptrade/models/cryptocurrency_pair.rb +238 -0
- data/lib/snaptrade/models/manual_trade_form_bracket.rb +343 -0
- data/lib/snaptrade/models/manual_trade_form_with_options.rb +6 -37
- data/lib/snaptrade/models/{manual_trade_form_with_options_stop_loss.rb → trading_crypto_spot_cancel_order_request.rb} +16 -27
- data/lib/snaptrade/models/trading_crypto_spot_place_order_request.rb +321 -0
- data/lib/snaptrade/models/trading_crypto_spot_symbols200_response.rb +224 -0
- data/lib/snaptrade/models/type.rb +7 -3
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +15 -3
- data/spec/api/crypto_spot_trading_api_spec.rb +107 -0
- data/spec/api/trading_api_spec.rb +14 -0
- data/spec/models/account_order_record_child_brokerage_order_ids_spec.rb +35 -0
- data/spec/models/account_order_record_spec.rb +6 -0
- data/spec/models/brokerage_authorization_type_read_only_type_spec.rb +23 -0
- data/spec/models/child_brokerage_order_ids_spec.rb +35 -0
- data/spec/models/{manual_trade_form_with_options_stop_loss_spec.rb → crypto_spot_order_preview_estimated_fee_spec.rb} +8 -8
- data/spec/models/crypto_spot_order_preview_spec.rb +29 -0
- data/spec/models/crypto_spot_order_request_body_time_in_force_spec.rb +23 -0
- data/spec/models/crypto_spot_quote_spec.rb +47 -0
- data/spec/models/cryptocurrency_pair_spec.rb +35 -0
- data/spec/models/manual_trade_form_bracket_spec.rb +83 -0
- data/spec/models/manual_trade_form_with_options_spec.rb +0 -18
- data/spec/models/trading_crypto_spot_cancel_order_request_spec.rb +29 -0
- data/spec/models/trading_crypto_spot_place_order_request_spec.rb +77 -0
- data/spec/models/trading_crypto_spot_symbols200_response_spec.rb +29 -0
- metadata +41 -11
- data/spec/models/manual_trade_form_with_options_take_profit_spec.rb +0 -29
- data/spec/models/order_class_spec.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 583adcc593c29b41d711763b74c93535e0d3cf8f58955cbb9c8ffe200cdfab92
|
4
|
+
data.tar.gz: aeab145caf7e7ef0d8ee0daba7189dcbbb33a7f9a2db652536435e3e57228c7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1ae9a060459430356ac374f2b6ef1a9f2df3a725e3e7cbd96ca6551509deae5e346d8ea04f64a8a1433399d354f19b57a1dd9f5fd3607fc86808869fc15afee
|
7
|
+
data.tar.gz: b71c4ec3a4eabe5298f79554b551cabc4b182db2c09b418b2111df75a7cf43f188bef7c438daae08547391a913e4819e37c42464b9058a60fbf8e336e95632a8
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snaptrade (2.0.
|
4
|
+
snaptrade (2.0.84)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
ast (2.4.
|
11
|
+
ast (2.4.3)
|
12
12
|
base64 (0.2.0)
|
13
13
|
byebug (11.1.3)
|
14
14
|
coderay (1.1.3)
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
method_source (1.1.0)
|
30
30
|
multipart-post (2.4.1)
|
31
31
|
parallel (1.26.3)
|
32
|
-
parser (3.3.7.
|
32
|
+
parser (3.3.7.2)
|
33
33
|
ast (~> 2.4.1)
|
34
34
|
racc
|
35
35
|
pry (0.14.2)
|
@@ -67,8 +67,8 @@ GEM
|
|
67
67
|
rubocop-ast (>= 1.2.0, < 2.0)
|
68
68
|
ruby-progressbar (~> 1.7)
|
69
69
|
unicode-display_width (>= 1.4.0, < 3.0)
|
70
|
-
rubocop-ast (1.
|
71
|
-
parser (>= 3.3.
|
70
|
+
rubocop-ast (1.41.0)
|
71
|
+
parser (>= 3.3.7.2)
|
72
72
|
ruby-progressbar (1.13.0)
|
73
73
|
ruby2_keywords (0.0.5)
|
74
74
|
unicode-display_width (2.6.0)
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
8
8
|
|
9
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.84)
|
10
10
|
[](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -43,6 +43,11 @@ Connect brokerage accounts to your app for live positions and trading
|
|
43
43
|
* [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
|
44
44
|
* [`snaptrade.connections.return_rates`](#snaptradeconnectionsreturn_rates)
|
45
45
|
* [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
|
46
|
+
* [`snaptrade.crypto_spot_trading.crypto_spot_cancel_order`](#snaptradecrypto_spot_tradingcrypto_spot_cancel_order)
|
47
|
+
* [`snaptrade.crypto_spot_trading.crypto_spot_place_order`](#snaptradecrypto_spot_tradingcrypto_spot_place_order)
|
48
|
+
* [`snaptrade.crypto_spot_trading.crypto_spot_preview_order`](#snaptradecrypto_spot_tradingcrypto_spot_preview_order)
|
49
|
+
* [`snaptrade.crypto_spot_trading.crypto_spot_quote`](#snaptradecrypto_spot_tradingcrypto_spot_quote)
|
50
|
+
* [`snaptrade.crypto_spot_trading.crypto_spot_symbols`](#snaptradecrypto_spot_tradingcrypto_spot_symbols)
|
46
51
|
* [`snaptrade.options.get_option_strategy`](#snaptradeoptionsget_option_strategy)
|
47
52
|
* [`snaptrade.options.get_options_chain`](#snaptradeoptionsget_options_chain)
|
48
53
|
* [`snaptrade.options.get_options_strategy_quote`](#snaptradeoptionsget_options_strategy_quote)
|
@@ -62,6 +67,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
62
67
|
* [`snaptrade.trading.cancel_user_account_order`](#snaptradetradingcancel_user_account_order)
|
63
68
|
* [`snaptrade.trading.get_order_impact`](#snaptradetradingget_order_impact)
|
64
69
|
* [`snaptrade.trading.get_user_account_quotes`](#snaptradetradingget_user_account_quotes)
|
70
|
+
* [`snaptrade.trading.place_bracket_order`](#snaptradetradingplace_bracket_order)
|
65
71
|
* [`snaptrade.trading.place_force_order`](#snaptradetradingplace_force_order)
|
66
72
|
* [`snaptrade.trading.place_order`](#snaptradetradingplace_order)
|
67
73
|
* [`snaptrade.transactions_and_reporting.get_activities`](#snaptradetransactions_and_reportingget_activities)
|
@@ -74,7 +80,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
74
80
|
Add to Gemfile:
|
75
81
|
|
76
82
|
```ruby
|
77
|
-
gem 'snaptrade', '~> 2.0.
|
83
|
+
gem 'snaptrade', '~> 2.0.84'
|
78
84
|
```
|
79
85
|
|
80
86
|
## Getting Started<a id="getting-started"></a>
|
@@ -1039,6 +1045,284 @@ specific users
|
|
1039
1045
|
---
|
1040
1046
|
|
1041
1047
|
|
1048
|
+
### `snaptrade.crypto_spot_trading.crypto_spot_cancel_order`<a id="snaptradecrypto_spot_tradingcrypto_spot_cancel_order"></a>
|
1049
|
+
|
1050
|
+
Cancels a cryptocurrency spot order in the specified account.
|
1051
|
+
|
1052
|
+
|
1053
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1054
|
+
|
1055
|
+
```ruby
|
1056
|
+
result = snaptrade.crypto_spot_trading.crypto_spot_cancel_order(
|
1057
|
+
brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
|
1058
|
+
user_id: "snaptrade-user-123",
|
1059
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1060
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1061
|
+
)
|
1062
|
+
p result
|
1063
|
+
```
|
1064
|
+
|
1065
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1066
|
+
|
1067
|
+
##### brokerage_order_id: `String`<a id="brokerage_order_id-string"></a>
|
1068
|
+
Order ID returned by brokerage. This is the unique identifier for the order in
|
1069
|
+
the brokerage system.
|
1070
|
+
|
1071
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
1072
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
1073
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
1074
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
1075
|
+
|
1076
|
+
[AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
|
1077
|
+
|
1078
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
1079
|
+
|
1080
|
+
`/accounts/{accountId}/trading/crypto/spot/cancelOrder` `POST`
|
1081
|
+
|
1082
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
1083
|
+
|
1084
|
+
---
|
1085
|
+
|
1086
|
+
|
1087
|
+
### `snaptrade.crypto_spot_trading.crypto_spot_place_order`<a id="snaptradecrypto_spot_tradingcrypto_spot_place_order"></a>
|
1088
|
+
|
1089
|
+
Places a spot cryptocurrency order in the specified account.
|
1090
|
+
This endpoint does not compute the impact to the account balance from the order before submitting the order to the exchange.
|
1091
|
+
|
1092
|
+
|
1093
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1094
|
+
|
1095
|
+
```ruby
|
1096
|
+
result = snaptrade.crypto_spot_trading.crypto_spot_place_order(
|
1097
|
+
symbol: {
|
1098
|
+
"base" => "BTC",
|
1099
|
+
"quote" => "BTC",
|
1100
|
+
},
|
1101
|
+
side: "BUY",
|
1102
|
+
type: "MARKET",
|
1103
|
+
time_in_force: "GTC",
|
1104
|
+
amount: "123.45",
|
1105
|
+
user_id: "snaptrade-user-123",
|
1106
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1107
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1108
|
+
limit_price: "123.45",
|
1109
|
+
stop_price: "123.45",
|
1110
|
+
post_only: false,
|
1111
|
+
expiration_date: "2024-01-01T00:00:00Z",
|
1112
|
+
)
|
1113
|
+
p result
|
1114
|
+
```
|
1115
|
+
|
1116
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1117
|
+
|
1118
|
+
##### symbol: [`CryptocurrencyPair`](./lib/snaptrade/models/cryptocurrency_pair.rb)<a id="symbol-cryptocurrencypairlibsnaptrademodelscryptocurrency_pairrb"></a>
|
1119
|
+
##### side: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb)<a id="side-actionstrictlibsnaptrademodelsaction_strictrb"></a>
|
1120
|
+
The action describes the intent or side of a trade. This is either `BUY` or
|
1121
|
+
`SELL`.
|
1122
|
+
|
1123
|
+
##### type: [`Type`](./lib/snaptrade/models/type.rb)<a id="type-typelibsnaptrademodelstyperb"></a>
|
1124
|
+
The type of order to place.
|
1125
|
+
|
1126
|
+
##### time_in_force: [`CryptoSpotOrderRequestBodyTimeInForce`](./lib/snaptrade/models/crypto_spot_order_request_body_time_in_force.rb)<a id="time_in_force-cryptospotorderrequestbodytimeinforcelibsnaptrademodelscrypto_spot_order_request_body_time_in_forcerb"></a>
|
1127
|
+
The Time in Force type for the order. This field indicates how long the order
|
1128
|
+
will remain active before it is executed or expires. - `GTC` - Good Til
|
1129
|
+
Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or
|
1130
|
+
Kill. The order must be executed in its entirety immediately or be canceled
|
1131
|
+
completely. - `IOC` - Immediate Or Cancel. The order must be executed
|
1132
|
+
immediately. Any portion of the order that cannot be filled immediately will be
|
1133
|
+
canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
|
1134
|
+
|
1135
|
+
##### amount: `Float`<a id="amount-float"></a>
|
1136
|
+
The amount of the base currency to buy or sell.
|
1137
|
+
|
1138
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
1139
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
1140
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
1141
|
+
##### limit_price: `Float`<a id="limit_price-float"></a>
|
1142
|
+
The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or
|
1143
|
+
TAKE_PROFIT_LIMIT.
|
1144
|
+
|
1145
|
+
##### stop_price: `Float`<a id="stop_price-float"></a>
|
1146
|
+
The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT,
|
1147
|
+
TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
|
1148
|
+
|
1149
|
+
##### post_only: `Boolean`<a id="post_only-boolean"></a>
|
1150
|
+
Required for order type LIMIT. If true orders that would be filled immediately
|
1151
|
+
are rejected to avoid incurring TAKER fees.
|
1152
|
+
|
1153
|
+
##### expiration_date: `Time`<a id="expiration_date-time"></a>
|
1154
|
+
The expiration date of the order. Required if the time_in_force is GTD.
|
1155
|
+
|
1156
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
1157
|
+
|
1158
|
+
[AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
|
1159
|
+
|
1160
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
1161
|
+
|
1162
|
+
`/accounts/{accountId}/trading/crypto/spot/placeOrder` `POST`
|
1163
|
+
|
1164
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
1165
|
+
|
1166
|
+
---
|
1167
|
+
|
1168
|
+
|
1169
|
+
### `snaptrade.crypto_spot_trading.crypto_spot_preview_order`<a id="snaptradecrypto_spot_tradingcrypto_spot_preview_order"></a>
|
1170
|
+
|
1171
|
+
Previews a cryptocurrency spot order using the specified account.
|
1172
|
+
|
1173
|
+
|
1174
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1175
|
+
|
1176
|
+
```ruby
|
1177
|
+
result = snaptrade.crypto_spot_trading.crypto_spot_preview_order(
|
1178
|
+
symbol: {
|
1179
|
+
"base" => "BTC",
|
1180
|
+
"quote" => "BTC",
|
1181
|
+
},
|
1182
|
+
side: "BUY",
|
1183
|
+
type: "MARKET",
|
1184
|
+
time_in_force: "GTC",
|
1185
|
+
amount: "123.45",
|
1186
|
+
user_id: "snaptrade-user-123",
|
1187
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1188
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1189
|
+
limit_price: "123.45",
|
1190
|
+
stop_price: "123.45",
|
1191
|
+
post_only: false,
|
1192
|
+
expiration_date: "2024-01-01T00:00:00Z",
|
1193
|
+
)
|
1194
|
+
p result
|
1195
|
+
```
|
1196
|
+
|
1197
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1198
|
+
|
1199
|
+
##### symbol: [`CryptocurrencyPair`](./lib/snaptrade/models/cryptocurrency_pair.rb)<a id="symbol-cryptocurrencypairlibsnaptrademodelscryptocurrency_pairrb"></a>
|
1200
|
+
##### side: [`ActionStrict`](./lib/snaptrade/models/action_strict.rb)<a id="side-actionstrictlibsnaptrademodelsaction_strictrb"></a>
|
1201
|
+
The action describes the intent or side of a trade. This is either `BUY` or
|
1202
|
+
`SELL`.
|
1203
|
+
|
1204
|
+
##### type: [`Type`](./lib/snaptrade/models/type.rb)<a id="type-typelibsnaptrademodelstyperb"></a>
|
1205
|
+
The type of order to place.
|
1206
|
+
|
1207
|
+
##### time_in_force: [`CryptoSpotOrderRequestBodyTimeInForce`](./lib/snaptrade/models/crypto_spot_order_request_body_time_in_force.rb)<a id="time_in_force-cryptospotorderrequestbodytimeinforcelibsnaptrademodelscrypto_spot_order_request_body_time_in_forcerb"></a>
|
1208
|
+
The Time in Force type for the order. This field indicates how long the order
|
1209
|
+
will remain active before it is executed or expires. - `GTC` - Good Til
|
1210
|
+
Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or
|
1211
|
+
Kill. The order must be executed in its entirety immediately or be canceled
|
1212
|
+
completely. - `IOC` - Immediate Or Cancel. The order must be executed
|
1213
|
+
immediately. Any portion of the order that cannot be filled immediately will be
|
1214
|
+
canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
|
1215
|
+
|
1216
|
+
##### amount: `Float`<a id="amount-float"></a>
|
1217
|
+
The amount of the base currency to buy or sell.
|
1218
|
+
|
1219
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
1220
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
1221
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
1222
|
+
##### limit_price: `Float`<a id="limit_price-float"></a>
|
1223
|
+
The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or
|
1224
|
+
TAKE_PROFIT_LIMIT.
|
1225
|
+
|
1226
|
+
##### stop_price: `Float`<a id="stop_price-float"></a>
|
1227
|
+
The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT,
|
1228
|
+
TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
|
1229
|
+
|
1230
|
+
##### post_only: `Boolean`<a id="post_only-boolean"></a>
|
1231
|
+
Required for order type LIMIT. If true orders that would be filled immediately
|
1232
|
+
are rejected to avoid incurring TAKER fees.
|
1233
|
+
|
1234
|
+
##### expiration_date: `Time`<a id="expiration_date-time"></a>
|
1235
|
+
The expiration date of the order. Required if the time_in_force is GTD.
|
1236
|
+
|
1237
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
1238
|
+
|
1239
|
+
[CryptoSpotOrderPreview](./lib/snaptrade/models/crypto_spot_order_preview.rb)
|
1240
|
+
|
1241
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
1242
|
+
|
1243
|
+
`/accounts/{accountId}/trading/crypto/spot/previewOrder` `POST`
|
1244
|
+
|
1245
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
1246
|
+
|
1247
|
+
---
|
1248
|
+
|
1249
|
+
|
1250
|
+
### `snaptrade.crypto_spot_trading.crypto_spot_quote`<a id="snaptradecrypto_spot_tradingcrypto_spot_quote"></a>
|
1251
|
+
|
1252
|
+
Gets a quote for the specified account.
|
1253
|
+
|
1254
|
+
|
1255
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1256
|
+
|
1257
|
+
```ruby
|
1258
|
+
result = snaptrade.crypto_spot_trading.crypto_spot_quote(
|
1259
|
+
user_id: "snaptrade-user-123",
|
1260
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1261
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1262
|
+
base: "BTC",
|
1263
|
+
quote: "BTC",
|
1264
|
+
)
|
1265
|
+
p result
|
1266
|
+
```
|
1267
|
+
|
1268
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1269
|
+
|
1270
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
1271
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
1272
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
1273
|
+
##### base: `String`<a id="base-string"></a>
|
1274
|
+
##### quote: `String`<a id="quote-string"></a>
|
1275
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
1276
|
+
|
1277
|
+
[CryptoSpotQuote](./lib/snaptrade/models/crypto_spot_quote.rb)
|
1278
|
+
|
1279
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
1280
|
+
|
1281
|
+
`/accounts/{accountId}/trading/crypto/spot/quote` `GET`
|
1282
|
+
|
1283
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
1284
|
+
|
1285
|
+
---
|
1286
|
+
|
1287
|
+
|
1288
|
+
### `snaptrade.crypto_spot_trading.crypto_spot_symbols`<a id="snaptradecrypto_spot_tradingcrypto_spot_symbols"></a>
|
1289
|
+
|
1290
|
+
Searches cryptocurrency spot symbols accessible to the specified account.
|
1291
|
+
|
1292
|
+
|
1293
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
1294
|
+
|
1295
|
+
```ruby
|
1296
|
+
result = snaptrade.crypto_spot_trading.crypto_spot_symbols(
|
1297
|
+
user_id: "snaptrade-user-123",
|
1298
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
1299
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
1300
|
+
base: "BTC",
|
1301
|
+
quote: "BTC",
|
1302
|
+
)
|
1303
|
+
p result
|
1304
|
+
```
|
1305
|
+
|
1306
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
1307
|
+
|
1308
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
1309
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
1310
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
1311
|
+
##### base: `String`<a id="base-string"></a>
|
1312
|
+
##### quote: `String`<a id="quote-string"></a>
|
1313
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
1314
|
+
|
1315
|
+
[TradingCryptoSpotSymbols200Response](./lib/snaptrade/models/trading_crypto_spot_symbols200_response.rb)
|
1316
|
+
|
1317
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
1318
|
+
|
1319
|
+
`/accounts/{accountId}/trading/crypto/spot/symbols` `GET`
|
1320
|
+
|
1321
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
1322
|
+
|
1323
|
+
---
|
1324
|
+
|
1325
|
+
|
1042
1326
|
### `snaptrade.options.get_option_strategy`<a id="snaptradeoptionsget_option_strategy"></a>
|
1043
1327
|
|
1044
1328
|
Creates an option strategy object that will be used to place an option strategy order.
|
@@ -1725,6 +2009,91 @@ Should be set to `True` if `symbols` are comprised of tickers. Defaults to
|
|
1725
2009
|
---
|
1726
2010
|
|
1727
2011
|
|
2012
|
+
### `snaptrade.trading.place_bracket_order`<a id="snaptradetradingplace_bracket_order"></a>
|
2013
|
+
|
2014
|
+
Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for
|
2015
|
+
use. Only supported on certain brokerages
|
2016
|
+
|
2017
|
+
|
2018
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
2019
|
+
|
2020
|
+
```ruby
|
2021
|
+
result = snaptrade.trading.place_bracket_order(
|
2022
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
2023
|
+
action: "BUY",
|
2024
|
+
symbol: "AAPL",
|
2025
|
+
order_type: "Market",
|
2026
|
+
time_in_force: "FOK",
|
2027
|
+
stop_loss: {
|
2028
|
+
"stop_price" => "48.55",
|
2029
|
+
"limit_price" => "48.50",
|
2030
|
+
},
|
2031
|
+
take_profit: {
|
2032
|
+
"limit_price" => "49.95",
|
2033
|
+
},
|
2034
|
+
user_id: "snaptrade-user-123",
|
2035
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
2036
|
+
price: 31.33,
|
2037
|
+
stop: 31.33,
|
2038
|
+
units: 10.5,
|
2039
|
+
)
|
2040
|
+
p result
|
2041
|
+
```
|
2042
|
+
|
2043
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
2044
|
+
|
2045
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
2046
|
+
Unique identifier for the connected brokerage account. This is the UUID used to
|
2047
|
+
reference the account in SnapTrade.
|
2048
|
+
|
2049
|
+
##### action: [`ActionStrictWithOptions`](./lib/snaptrade/models/action_strict_with_options.rb)<a id="action-actionstrictwithoptionslibsnaptrademodelsaction_strict_with_optionsrb"></a>
|
2050
|
+
The action describes the intent or side of a trade. This is either `BUY` or
|
2051
|
+
`SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or
|
2052
|
+
`SELL_TO_CLOSE` for Options.
|
2053
|
+
|
2054
|
+
##### symbol: `String`<a id="symbol-string"></a>
|
2055
|
+
The security's trading ticker symbol.
|
2056
|
+
|
2057
|
+
##### order_type: [`OrderTypeStrict`](./lib/snaptrade/models/order_type_strict.rb)<a id="order_type-ordertypestrictlibsnaptrademodelsorder_type_strictrb"></a>
|
2058
|
+
The type of order to place. - For `Limit` and `StopLimit` orders, the `price`
|
2059
|
+
field is required. - For `Stop` and `StopLimit` orders, the `stop` field is
|
2060
|
+
required.
|
2061
|
+
|
2062
|
+
##### time_in_force: [`TimeInForceStrict`](./lib/snaptrade/models/time_in_force_strict.rb)<a id="time_in_force-timeinforcestrictlibsnaptrademodelstime_in_force_strictrb"></a>
|
2063
|
+
The Time in Force type for the order. This field indicates how long the order
|
2064
|
+
will remain active before it is executed or expires. Here are the supported
|
2065
|
+
values: - `Day` - Day. The order is valid only for the trading day on which it
|
2066
|
+
is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed
|
2067
|
+
or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety
|
2068
|
+
immediately or be canceled completely.
|
2069
|
+
|
2070
|
+
##### stop_loss: [`StopLoss`](./lib/snaptrade/models/stop_loss.rb)<a id="stop_loss-stoplosslibsnaptrademodelsstop_lossrb"></a>
|
2071
|
+
##### take_profit: [`TakeProfit`](./lib/snaptrade/models/take_profit.rb)<a id="take_profit-takeprofitlibsnaptrademodelstake_profitrb"></a>
|
2072
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
2073
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
2074
|
+
##### price: `Float`<a id="price-float"></a>
|
2075
|
+
The limit price for `Limit` and `StopLimit` orders.
|
2076
|
+
|
2077
|
+
##### stop: `Float`<a id="stop-float"></a>
|
2078
|
+
The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
|
2079
|
+
|
2080
|
+
##### units: `Float`<a id="units-float"></a>
|
2081
|
+
Number of shares for the order. This can be a decimal for fractional orders.
|
2082
|
+
Must be `null` if `notional_value` is provided.
|
2083
|
+
|
2084
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
2085
|
+
|
2086
|
+
[AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
|
2087
|
+
|
2088
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
2089
|
+
|
2090
|
+
`/trade/placeBracketOrder` `POST`
|
2091
|
+
|
2092
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
2093
|
+
|
2094
|
+
---
|
2095
|
+
|
2096
|
+
|
1728
2097
|
### `snaptrade.trading.place_force_order`<a id="snaptradetradingplace_force_order"></a>
|
1729
2098
|
|
1730
2099
|
Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds.
|
@@ -1750,14 +2119,6 @@ result = snaptrade.trading.place_force_order(
|
|
1750
2119
|
stop: 31.33,
|
1751
2120
|
units: 10.5,
|
1752
2121
|
notional_value: None,
|
1753
|
-
order_class: "BRACKET",
|
1754
|
-
stop_loss: {
|
1755
|
-
"stop_price" => "48.55",
|
1756
|
-
"limit_price" => "48.50",
|
1757
|
-
},
|
1758
|
-
take_profit: {
|
1759
|
-
"limit_price" => "49.95",
|
1760
|
-
},
|
1761
2122
|
)
|
1762
2123
|
p result
|
1763
2124
|
```
|
@@ -1793,10 +2154,10 @@ The universal symbol ID of the security to trade. Must be 'null' if `symbol` is
|
|
1793
2154
|
provided, otherwise must be provided.
|
1794
2155
|
|
1795
2156
|
##### symbol: `String`<a id="symbol-string"></a>
|
1796
|
-
The security's trading ticker symbol. This currently
|
1797
|
-
symbols in the 21 character OCC format. For example \"AAPL
|
1798
|
-
represents a call option on AAPL expiring on 2024-11-13 with a
|
1799
|
-
$240. For more information on the OCC format, see
|
2157
|
+
The security's trading ticker symbol. This currently supports stock symbols and
|
2158
|
+
Options symbols in the 21 character OCC format. For example \"AAPL
|
2159
|
+
131124C00240000\" represents a call option on AAPL expiring on 2024-11-13 with a
|
2160
|
+
strike price of $240. For more information on the OCC format, see
|
1800
2161
|
[here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format). If 'symbol' is
|
1801
2162
|
provided, then 'universal_symbol_id' must be 'null'.
|
1802
2163
|
|
@@ -1813,15 +2174,6 @@ provided. If placing an Option order, this field represents the number of
|
|
1813
2174
|
contracts to buy or sell. (e.g., 1 contract = 100 shares).
|
1814
2175
|
|
1815
2176
|
##### notional_value: [`ManualTradeFormNotionalValue`](./lib/snaptrade/models/manual_trade_form_notional_value.rb)<a id="notional_value-manualtradeformnotionalvaluelibsnaptrademodelsmanual_trade_form_notional_valuerb"></a>
|
1816
|
-
##### order_class: [`OrderClass`](./lib/snaptrade/models/order_class.rb)<a id="order_class-orderclasslibsnaptrademodelsorder_classrb"></a>
|
1817
|
-
The class of order intended to be placed. Defaults to SIMPLE for regular, one
|
1818
|
-
legged trades. Set to BRACKET if looking to place a bracket
|
1819
|
-
(One-triggers-a-one-cancels-the-other) order, then specify take profit and stop
|
1820
|
-
loss conditions. Bracket orders currently only supported on Alpaca, Tradier, and
|
1821
|
-
Tradestation, contact us for more details
|
1822
|
-
|
1823
|
-
##### stop_loss: [`ManualTradeFormWithOptionsStopLoss`](./lib/snaptrade/models/manual_trade_form_with_options_stop_loss.rb)<a id="stop_loss-manualtradeformwithoptionsstoplosslibsnaptrademodelsmanual_trade_form_with_options_stop_lossrb"></a>
|
1824
|
-
##### take_profit: [`ManualTradeFormWithOptionsTakeProfit`](./lib/snaptrade/models/manual_trade_form_with_options_take_profit.rb)<a id="take_profit-manualtradeformwithoptionstakeprofitlibsnaptrademodelsmanual_trade_form_with_options_take_profitrb"></a>
|
1825
2177
|
#### 🔄 Return<a id="🔄-return"></a>
|
1826
2178
|
|
1827
2179
|
[AccountOrderRecord](./lib/snaptrade/models/account_order_record.rb)
|