snaptrade 2.0.83 → 2.0.85

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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -6
  3. data/README.md +285 -2
  4. data/lib/snaptrade/api/crypto_spot_trading_api.rb +698 -0
  5. data/lib/snaptrade/models/brokerage_authorization_type_read_only.rb +1 -1
  6. data/lib/snaptrade/models/brokerage_authorization_type_read_only_type.rb +37 -0
  7. data/lib/snaptrade/models/crypto_spot_order_preview.rb +217 -0
  8. data/lib/snaptrade/models/crypto_spot_order_preview_estimated_fee.rb +237 -0
  9. data/lib/snaptrade/models/crypto_spot_order_request_body_time_in_force.rb +39 -0
  10. data/lib/snaptrade/models/crypto_spot_quote.rb +257 -0
  11. data/lib/snaptrade/models/cryptocurrency_pair.rb +238 -0
  12. data/lib/snaptrade/models/order_updated_response.rb +231 -0
  13. data/lib/snaptrade/models/trading_crypto_spot_cancel_order_request.rb +222 -0
  14. data/lib/snaptrade/models/trading_crypto_spot_place_order_request.rb +321 -0
  15. data/lib/snaptrade/models/trading_crypto_spot_symbols200_response.rb +224 -0
  16. data/lib/snaptrade/models/type.rb +7 -3
  17. data/lib/snaptrade/version.rb +1 -1
  18. data/lib/snaptrade.rb +13 -0
  19. data/spec/api/crypto_spot_trading_api_spec.rb +107 -0
  20. data/spec/models/brokerage_authorization_type_read_only_type_spec.rb +23 -0
  21. data/spec/models/crypto_spot_order_preview_estimated_fee_spec.rb +35 -0
  22. data/spec/models/crypto_spot_order_preview_spec.rb +29 -0
  23. data/spec/models/crypto_spot_order_request_body_time_in_force_spec.rb +23 -0
  24. data/spec/models/crypto_spot_quote_spec.rb +47 -0
  25. data/spec/models/cryptocurrency_pair_spec.rb +35 -0
  26. data/spec/models/order_updated_response_spec.rb +35 -0
  27. data/spec/models/trading_crypto_spot_cancel_order_request_spec.rb +29 -0
  28. data/spec/models/trading_crypto_spot_place_order_request_spec.rb +77 -0
  29. data/spec/models/trading_crypto_spot_symbols200_response_spec.rb +29 -0
  30. metadata +35 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95e13d763e275f59f1b34efd01c49cd1340ff31b1f33b8d91fefd64c9d5786f3
4
- data.tar.gz: d33c0c331dcc75296bffe8b92ae2e5039ae5fd669eccc7f6d04888940878df30
3
+ metadata.gz: 96b6ec054f8953dc847538e036a96d75adbfae706c402c18d9bfd7f28ee98f14
4
+ data.tar.gz: 0a64491e8b03059f220b0ad137713ff1b73d1511e1b74c1c0981572276058520
5
5
  SHA512:
6
- metadata.gz: 0e42cd8f7cc085c0c7d24fc13e73141df51fef33e85fc3755fc863262e3b1f212f4d742e36612a2a0a2da025f66585130d465733fecc87f37d03c3dec96a74d3
7
- data.tar.gz: bc2270b7e5c9e6eb1c7bdda5045b0a5bb1884201b38a4e135d6997085dc8a3499d792fb7de5e878e6ee2340c856d7e0ce3e7cb6d1066ab0de6ed7dbefebe4cc1
6
+ metadata.gz: cd299f2f0ec731b3935fb8f8e60b33dd0ca034bdb6e26926ebf43716a6a8b4971db47f19c84b74cf4adfedd33ece76c2ad844d7b742e46f89c5797f26f970d84
7
+ data.tar.gz: 022d939ff18f2b2878494097564af65cb1eb9898a49d39593e87cdf86157939b12f78fc2461fdf6a4fa861df6ada094cf71c76d29bff5bb5e8fefe6708b74c93
data/Gemfile.lock CHANGED
@@ -1,21 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.83)
4
+ snaptrade (2.0.85)
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.2)
11
+ ast (2.4.3)
12
12
  base64 (0.2.0)
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
- diff-lcs (1.6.0)
18
+ diff-lcs (1.6.1)
19
19
  faraday (2.8.1)
20
20
  base64
21
21
  faraday-net_http (>= 2.0, < 3.1)
@@ -29,9 +29,10 @@ 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.1)
32
+ parser (3.3.7.2)
33
33
  ast (~> 2.4.1)
34
34
  racc
35
+ prism (1.4.0)
35
36
  pry (0.14.2)
36
37
  coderay (~> 1.1)
37
38
  method_source (~> 1.0)
@@ -67,8 +68,9 @@ GEM
67
68
  rubocop-ast (>= 1.2.0, < 2.0)
68
69
  ruby-progressbar (~> 1.7)
69
70
  unicode-display_width (>= 1.4.0, < 3.0)
70
- rubocop-ast (1.40.0)
71
- parser (>= 3.3.1.0)
71
+ rubocop-ast (1.43.0)
72
+ parser (>= 3.3.7.2)
73
+ prism (~> 1.4)
72
74
  ruby-progressbar (1.13.0)
73
75
  ruby2_keywords (0.0.5)
74
76
  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
- [![npm](https://img.shields.io/badge/gem-v2.0.83-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.83)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.85-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.85)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](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)
@@ -75,7 +80,7 @@ Connect brokerage accounts to your app for live positions and trading
75
80
  Add to Gemfile:
76
81
 
77
82
  ```ruby
78
- gem 'snaptrade', '~> 2.0.83'
83
+ gem 'snaptrade', '~> 2.0.85'
79
84
  ```
80
85
 
81
86
  ## Getting Started<a id="getting-started"></a>
@@ -1040,6 +1045,284 @@ specific users
1040
1045
  ---
1041
1046
 
1042
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
+ [OrderUpdatedResponse](./lib/snaptrade/models/order_updated_response.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" => "USD",
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
+ Valid and required only for order type LIMIT. If true orders that would be
1151
+ filled immediately 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
+ [OrderUpdatedResponse](./lib/snaptrade/models/order_updated_response.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" => "USD",
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
+ Valid and required only for order type LIMIT. If true orders that would be
1232
+ filled immediately 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: "USD",
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: "USD",
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
+
1043
1326
  ### `snaptrade.options.get_option_strategy`<a id="snaptradeoptionsget_option_strategy"></a>
1044
1327
 
1045
1328
  Creates an option strategy object that will be used to place an option strategy order.