snaptrade-typescript-sdk 8.28.1 → 8.29.0

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 (297) hide show
  1. package/README.md +1719 -152
  2. package/dist/api/account-information-api-generated.d.ts +519 -529
  3. package/dist/api/account-information-api-generated.js +769 -769
  4. package/dist/api/account-information-api.d.ts +4 -4
  5. package/dist/api/account-information-api.js +22 -22
  6. package/dist/api/api-status-api-generated.d.ts +59 -69
  7. package/dist/api/api-status-api-generated.js +131 -131
  8. package/dist/api/api-status-api.d.ts +4 -4
  9. package/dist/api/api-status-api.js +22 -22
  10. package/dist/api/authentication-api-generated.d.ts +256 -266
  11. package/dist/api/authentication-api-generated.js +461 -461
  12. package/dist/api/authentication-api.d.ts +4 -4
  13. package/dist/api/authentication-api.js +22 -22
  14. package/dist/api/connections-api-generated.d.ts +264 -274
  15. package/dist/api/connections-api-generated.js +411 -411
  16. package/dist/api/connections-api.d.ts +4 -4
  17. package/dist/api/connections-api.js +22 -22
  18. package/dist/api/error-logs-api-generated.d.ts +83 -93
  19. package/dist/api/error-logs-api-generated.js +152 -152
  20. package/dist/api/error-logs-api.d.ts +4 -4
  21. package/dist/api/error-logs-api.js +22 -22
  22. package/dist/api/options-api-generated.d.ts +358 -368
  23. package/dist/api/options-api-generated.js +530 -530
  24. package/dist/api/options-api.d.ts +4 -4
  25. package/dist/api/options-api.js +22 -22
  26. package/dist/api/reference-data-api-generated.d.ts +457 -467
  27. package/dist/api/reference-data-api-generated.js +872 -872
  28. package/dist/api/reference-data-api.d.ts +4 -4
  29. package/dist/api/reference-data-api.js +22 -22
  30. package/dist/api/trading-api-generated.d.ts +392 -402
  31. package/dist/api/trading-api-generated.js +613 -613
  32. package/dist/api/trading-api.d.ts +4 -4
  33. package/dist/api/trading-api.js +22 -22
  34. package/dist/api/transactions-and-reporting-api-generated.d.ts +207 -217
  35. package/dist/api/transactions-and-reporting-api-generated.js +287 -287
  36. package/dist/api/transactions-and-reporting-api.d.ts +4 -4
  37. package/dist/api/transactions-and-reporting-api.js +22 -22
  38. package/dist/api.d.ts +9 -19
  39. package/dist/api.js +37 -37
  40. package/dist/base.d.ts +44 -54
  41. package/dist/base.js +60 -60
  42. package/dist/browser.js +1 -1
  43. package/dist/client-custom.d.ts +4 -4
  44. package/dist/client-custom.js +7 -7
  45. package/dist/client.d.ts +15 -25
  46. package/dist/client.js +32 -32
  47. package/dist/common.d.ts +61 -71
  48. package/dist/common.js +207 -207
  49. package/dist/configuration.d.ts +89 -99
  50. package/dist/configuration.js +53 -53
  51. package/dist/error.d.ts +46 -56
  52. package/dist/error.js +104 -104
  53. package/dist/index.d.ts +5 -15
  54. package/dist/index.js +33 -33
  55. package/dist/jest.config.d.ts +3 -3
  56. package/dist/jest.config.js +13 -13
  57. package/dist/mock.test.d.ts +1 -1
  58. package/dist/mock.test.js +29 -29
  59. package/dist/models/account-holdings-account.d.ts +43 -53
  60. package/dist/models/account-holdings-account.js +12 -14
  61. package/dist/models/account-holdings.d.ts +36 -46
  62. package/dist/models/account-holdings.js +12 -14
  63. package/dist/models/account-order-record-status.d.ts +6 -16
  64. package/dist/models/account-order-record-status.js +12 -14
  65. package/dist/models/account-order-record.d.ts +122 -132
  66. package/dist/models/account-order-record.js +12 -14
  67. package/dist/models/account-simple.d.ts +33 -43
  68. package/dist/models/account-simple.js +12 -14
  69. package/dist/models/account-sync-status.d.ts +14 -24
  70. package/dist/models/account-sync-status.js +12 -14
  71. package/dist/models/account.d.ts +72 -82
  72. package/dist/models/account.js +12 -14
  73. package/dist/models/action.d.ts +6 -16
  74. package/dist/models/action.js +12 -14
  75. package/dist/models/authentication-login-snap-trade-user200-response.d.ts +7 -17
  76. package/dist/models/authentication-login-snap-trade-user200-response.js +12 -14
  77. package/dist/models/balance.d.ts +21 -31
  78. package/dist/models/balance.js +12 -14
  79. package/dist/models/brokerage-authorization-type-read-only-brokerage.d.ts +26 -36
  80. package/dist/models/brokerage-authorization-type-read-only-brokerage.js +12 -14
  81. package/dist/models/brokerage-authorization-type-read-only.d.ts +36 -46
  82. package/dist/models/brokerage-authorization-type-read-only.js +12 -14
  83. package/dist/models/brokerage-authorization-type.d.ts +16 -26
  84. package/dist/models/brokerage-authorization-type.js +12 -14
  85. package/dist/models/brokerage-authorization.d.ts +65 -75
  86. package/dist/models/brokerage-authorization.js +12 -14
  87. package/dist/models/brokerage-symbol-option-symbol.d.ts +64 -66
  88. package/dist/models/brokerage-symbol-option-symbol.js +12 -14
  89. package/dist/models/brokerage-symbol-symbol.d.ts +58 -68
  90. package/dist/models/brokerage-symbol-symbol.js +12 -14
  91. package/dist/models/brokerage-symbol.d.ts +47 -57
  92. package/dist/models/brokerage-symbol.js +12 -14
  93. package/dist/models/brokerage-type.d.ts +20 -30
  94. package/dist/models/brokerage-type.js +12 -14
  95. package/dist/models/brokerage.d.ts +117 -127
  96. package/dist/models/brokerage.js +12 -14
  97. package/dist/models/calculated-trade.d.ts +21 -31
  98. package/dist/models/calculated-trade.js +12 -14
  99. package/dist/models/cash-restriction.d.ts +40 -50
  100. package/dist/models/cash-restriction.js +12 -14
  101. package/dist/models/connections-session-events200-response-inner.d.ts +6 -16
  102. package/dist/models/connections-session-events200-response-inner.js +12 -14
  103. package/dist/models/currency.d.ts +26 -36
  104. package/dist/models/currency.js +12 -14
  105. package/dist/models/delete-user-response.d.ts +20 -30
  106. package/dist/models/delete-user-response.js +12 -14
  107. package/dist/models/dividend-at-date.d.ts +26 -36
  108. package/dist/models/dividend-at-date.js +12 -14
  109. package/dist/models/encrypted-response-encrypted-message-data.d.ts +26 -36
  110. package/dist/models/encrypted-response-encrypted-message-data.js +12 -14
  111. package/dist/models/encrypted-response.d.ts +20 -30
  112. package/dist/models/encrypted-response.js +12 -14
  113. package/dist/models/exchange-rate-pairs.d.ts +27 -37
  114. package/dist/models/exchange-rate-pairs.js +12 -14
  115. package/dist/models/exchange.d.ts +56 -66
  116. package/dist/models/exchange.js +12 -14
  117. package/dist/models/excluded-asset.d.ts +15 -25
  118. package/dist/models/excluded-asset.js +12 -14
  119. package/dist/models/index.d.ts +111 -111
  120. package/dist/models/index.js +127 -127
  121. package/dist/models/jwt.d.ts +14 -24
  122. package/dist/models/jwt.js +12 -14
  123. package/dist/models/login-redirect-uri.d.ts +19 -29
  124. package/dist/models/login-redirect-uri.js +12 -14
  125. package/dist/models/manual-trade-and-impact.d.ts +28 -38
  126. package/dist/models/manual-trade-and-impact.js +12 -14
  127. package/dist/models/manual-trade-balance.d.ts +28 -38
  128. package/dist/models/manual-trade-balance.js +12 -14
  129. package/dist/models/manual-trade-form.d.ts +58 -68
  130. package/dist/models/manual-trade-form.js +12 -14
  131. package/dist/models/manual-trade-symbol.d.ts +45 -55
  132. package/dist/models/manual-trade-symbol.js +12 -14
  133. package/dist/models/manual-trade.d.ts +60 -70
  134. package/dist/models/manual-trade.js +12 -14
  135. package/dist/models/model-asset-class-details.d.ts +22 -32
  136. package/dist/models/model-asset-class-details.js +12 -14
  137. package/dist/models/model-asset-class-target.d.ts +15 -25
  138. package/dist/models/model-asset-class-target.js +12 -14
  139. package/dist/models/model-asset-class.d.ts +20 -30
  140. package/dist/models/model-asset-class.js +12 -14
  141. package/dist/models/model-portfolio-asset-class.d.ts +21 -31
  142. package/dist/models/model-portfolio-asset-class.js +12 -14
  143. package/dist/models/model-portfolio-details.d.ts +29 -39
  144. package/dist/models/model-portfolio-details.js +12 -14
  145. package/dist/models/model-portfolio-security.d.ts +21 -31
  146. package/dist/models/model-portfolio-security.js +12 -14
  147. package/dist/models/model-portfolio.d.ts +28 -38
  148. package/dist/models/model-portfolio.js +12 -14
  149. package/dist/models/model400-failed-request-response.d.ts +20 -30
  150. package/dist/models/model400-failed-request-response.js +12 -14
  151. package/dist/models/model401-failed-request-response.d.ts +20 -30
  152. package/dist/models/model401-failed-request-response.js +12 -14
  153. package/dist/models/model403-failed-request-response.d.ts +20 -30
  154. package/dist/models/model403-failed-request-response.js +12 -14
  155. package/dist/models/model404-failed-request-response.d.ts +20 -30
  156. package/dist/models/model404-failed-request-response.js +12 -14
  157. package/dist/models/monthly-dividends.d.ts +21 -31
  158. package/dist/models/monthly-dividends.js +12 -14
  159. package/dist/models/net-contributions.d.ts +26 -36
  160. package/dist/models/net-contributions.js +12 -14
  161. package/dist/models/net-dividend.d.ts +27 -37
  162. package/dist/models/net-dividend.js +12 -14
  163. package/dist/models/option-chain-inner-chain-per-root-inner-chain-per-strike-price-inner.d.ts +26 -36
  164. package/dist/models/option-chain-inner-chain-per-root-inner-chain-per-strike-price-inner.js +12 -14
  165. package/dist/models/option-chain-inner-chain-per-root-inner.d.ts +27 -37
  166. package/dist/models/option-chain-inner-chain-per-root-inner.js +12 -14
  167. package/dist/models/option-chain-inner.d.ts +39 -49
  168. package/dist/models/option-chain-inner.js +12 -14
  169. package/dist/models/option-leg.d.ts +28 -38
  170. package/dist/models/option-leg.js +12 -14
  171. package/dist/models/option-strategy-legs-inner.d.ts +31 -41
  172. package/dist/models/option-strategy-legs-inner.js +12 -14
  173. package/dist/models/option-strategy.d.ts +40 -50
  174. package/dist/models/option-strategy.js +12 -14
  175. package/dist/models/options-get-option-strategy-request.d.ts +28 -38
  176. package/dist/models/options-get-option-strategy-request.js +12 -14
  177. package/dist/models/options-holdings.d.ts +46 -56
  178. package/dist/models/options-holdings.js +12 -14
  179. package/dist/models/options-place-option-strategy-request.d.ts +28 -38
  180. package/dist/models/options-place-option-strategy-request.js +12 -14
  181. package/dist/models/options-position-currency.d.ts +25 -35
  182. package/dist/models/options-position-currency.js +12 -14
  183. package/dist/models/options-position.d.ts +52 -62
  184. package/dist/models/options-position.js +12 -14
  185. package/dist/models/options-symbol.d.ts +65 -67
  186. package/dist/models/options-symbol.js +12 -14
  187. package/dist/models/order-type.d.ts +6 -16
  188. package/dist/models/order-type.js +12 -14
  189. package/dist/models/partner-data.d.ts +81 -91
  190. package/dist/models/partner-data.js +12 -14
  191. package/dist/models/past-value.d.ts +26 -36
  192. package/dist/models/past-value.js +12 -14
  193. package/dist/models/performance-custom.d.ts +127 -137
  194. package/dist/models/performance-custom.js +12 -14
  195. package/dist/models/portfolio-group-info.d.ts +82 -92
  196. package/dist/models/portfolio-group-info.js +12 -14
  197. package/dist/models/portfolio-group-position.d.ts +27 -37
  198. package/dist/models/portfolio-group-position.js +12 -14
  199. package/dist/models/portfolio-group-settings.d.ts +39 -49
  200. package/dist/models/portfolio-group-settings.js +12 -14
  201. package/dist/models/portfolio-group.d.ts +20 -30
  202. package/dist/models/portfolio-group.js +12 -14
  203. package/dist/models/position-symbol.d.ts +45 -55
  204. package/dist/models/position-symbol.js +12 -14
  205. package/dist/models/position.d.ts +45 -55
  206. package/dist/models/position.js +12 -14
  207. package/dist/models/redirect-tokenand-pin.d.ts +20 -30
  208. package/dist/models/redirect-tokenand-pin.js +12 -14
  209. package/dist/models/security-type.d.ts +32 -42
  210. package/dist/models/security-type.js +12 -14
  211. package/dist/models/session-event.d.ts +52 -62
  212. package/dist/models/session-event.js +12 -14
  213. package/dist/models/snap-trade-apidisclaimer-accept-status.d.ts +20 -30
  214. package/dist/models/snap-trade-apidisclaimer-accept-status.js +12 -14
  215. package/dist/models/snap-trade-holdings-account-account-id.d.ts +65 -75
  216. package/dist/models/snap-trade-holdings-account-account-id.js +12 -14
  217. package/dist/models/snap-trade-holdings-account.d.ts +60 -70
  218. package/dist/models/snap-trade-holdings-account.js +12 -14
  219. package/dist/models/snap-trade-holdings-total-value.d.ts +20 -30
  220. package/dist/models/snap-trade-holdings-total-value.js +12 -14
  221. package/dist/models/snap-trade-login-user-request-body.d.ts +39 -49
  222. package/dist/models/snap-trade-login-user-request-body.js +12 -14
  223. package/dist/models/snap-trade-register-user-request-body.d.ts +19 -29
  224. package/dist/models/snap-trade-register-user-request-body.js +12 -14
  225. package/dist/models/status.d.ts +26 -36
  226. package/dist/models/status.js +12 -14
  227. package/dist/models/strategy-impact-legs-inner.d.ts +50 -60
  228. package/dist/models/strategy-impact-legs-inner.js +12 -14
  229. package/dist/models/strategy-impact.d.ts +75 -85
  230. package/dist/models/strategy-impact.js +12 -14
  231. package/dist/models/strategy-order-place-orders-inner-legs-inner.d.ts +50 -60
  232. package/dist/models/strategy-order-place-orders-inner-legs-inner.js +12 -14
  233. package/dist/models/strategy-order-place-orders-inner.d.ts +267 -277
  234. package/dist/models/strategy-order-place-orders-inner.js +12 -14
  235. package/dist/models/strategy-order-place.d.ts +21 -31
  236. package/dist/models/strategy-order-place.js +12 -14
  237. package/dist/models/strategy-order-record.d.ts +79 -89
  238. package/dist/models/strategy-order-record.js +12 -14
  239. package/dist/models/strategy-quotes-greek.d.ts +38 -48
  240. package/dist/models/strategy-quotes-greek.js +12 -14
  241. package/dist/models/strategy-quotes.d.ts +46 -56
  242. package/dist/models/strategy-quotes.js +12 -14
  243. package/dist/models/sub-period-return-rate.d.ts +26 -36
  244. package/dist/models/sub-period-return-rate.js +12 -14
  245. package/dist/models/symbol-query.d.ts +13 -23
  246. package/dist/models/symbol-query.js +12 -14
  247. package/dist/models/symbol.d.ts +53 -63
  248. package/dist/models/symbol.js +12 -14
  249. package/dist/models/symbols-quotes-inner.d.ts +44 -54
  250. package/dist/models/symbols-quotes-inner.js +12 -14
  251. package/dist/models/target-asset.d.ts +47 -57
  252. package/dist/models/target-asset.js +12 -14
  253. package/dist/models/time-in-force.d.ts +6 -16
  254. package/dist/models/time-in-force.js +12 -14
  255. package/dist/models/trade-execution-status.d.ts +70 -80
  256. package/dist/models/trade-execution-status.js +12 -14
  257. package/dist/models/trade-impact.d.ts +40 -50
  258. package/dist/models/trade-impact.js +12 -14
  259. package/dist/models/trade.d.ts +61 -71
  260. package/dist/models/trade.js +12 -14
  261. package/dist/models/trading-cancel-user-account-order-request.d.ts +13 -23
  262. package/dist/models/trading-cancel-user-account-order-request.js +12 -14
  263. package/dist/models/trading-place-ocoorder-request.d.ts +19 -29
  264. package/dist/models/trading-place-ocoorder-request.js +12 -14
  265. package/dist/models/transactions-status.d.ts +19 -29
  266. package/dist/models/transactions-status.js +12 -14
  267. package/dist/models/underlying-symbol.d.ts +53 -63
  268. package/dist/models/underlying-symbol.js +12 -14
  269. package/dist/models/universal-activity.d.ts +114 -124
  270. package/dist/models/universal-activity.js +12 -14
  271. package/dist/models/universal-symbol-ticker.d.ts +59 -69
  272. package/dist/models/universal-symbol-ticker.js +12 -14
  273. package/dist/models/universal-symbol.d.ts +59 -69
  274. package/dist/models/universal-symbol.js +12 -14
  275. package/dist/models/user-error-log.d.ts +44 -54
  276. package/dist/models/user-error-log.js +12 -14
  277. package/dist/models/user-idand-secret.d.ts +20 -30
  278. package/dist/models/user-idand-secret.js +12 -14
  279. package/dist/models/user-settings.d.ts +69 -79
  280. package/dist/models/user-settings.js +12 -14
  281. package/dist/models/usexchange.d.ts +62 -72
  282. package/dist/models/usexchange.js +12 -14
  283. package/dist/pagination/page-types.d.ts +16 -26
  284. package/dist/pagination/page-types.js +12 -12
  285. package/dist/pagination/page.d.ts +25 -35
  286. package/dist/pagination/page.js +32 -32
  287. package/dist/pagination/pageable.d.ts +47 -57
  288. package/dist/pagination/pageable.js +70 -70
  289. package/dist/pagination/paginate.d.ts +6 -16
  290. package/dist/pagination/paginate.js +39 -39
  291. package/dist/requestAfterHook.d.ts +8 -8
  292. package/dist/requestAfterHook.js +82 -82
  293. package/dist/requestBeforeHook.d.ts +9 -9
  294. package/dist/requestBeforeHook.js +8 -8
  295. package/dist/requestBeforeUrlHook.d.ts +7 -7
  296. package/dist/requestBeforeUrlHook.js +5 -5
  297. package/package.json +48 -45
package/README.md CHANGED
@@ -1,152 +1,1719 @@
1
- # snaptrade-typescript-sdk
2
-
3
- [![npm](https://img.shields.io/badge/npm-v8.28.1-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/8.28.1)
4
- [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
5
-
6
- Connect brokerage accounts to your app for live positions and trading
7
- ## Installing
8
-
9
- ### npm
10
- ```
11
- npm install snaptrade-typescript-sdk --save
12
- ```
13
-
14
- ### yarn
15
- ```
16
- yarn add snaptrade-typescript-sdk
17
- ```
18
-
19
- **Important note: this library can be used in both the client-side or server-side, but using it
20
- in client-side browser code is not recommended as you would expose security credentials.**
21
-
22
-
23
-
24
- ## Getting Started
25
-
26
- ```typescript
27
- const { Snaptrade } = require("snaptrade-typescript-sdk");
28
-
29
- async function main() {
30
- // 1) Initialize a client with your clientID and consumerKey.
31
- const snaptrade = new Snaptrade({
32
- consumerKey: process.env.SNAPTRADE_CONSUMER_KEY,
33
- clientId: process.env.SNAPTRADE_CLIENT_ID,
34
- });
35
-
36
- // 2) Check that the client is able to make a request to the API server.
37
- const status = await snaptrade.apiStatus.check();
38
- console.log("status:", status.data);
39
-
40
- // 3) Create a new user on SnapTrade
41
- const userId = uuid();
42
- const { userSecret } = (
43
- await snaptrade.authentication.registerSnapTradeUser({
44
- userId,
45
- })
46
- ).data;
47
-
48
- // Note: A user secret is only generated once. It's required to access
49
- // resources for certain endpoints.
50
- console.log("userSecret:", userSecret);
51
-
52
- // 4) Get a redirect URI. Users will need this to connect
53
- const data = (
54
- await snaptrade.authentication.loginSnapTradeUser({ userId, userSecret })
55
- ).data;
56
- if (!("redirectURI" in data)) throw Error("Should have gotten redirect URI");
57
- console.log("redirectURI:", data.redirectURI);
58
-
59
- // 5) Obtaining account holdings data
60
- const holdings = (
61
- await snaptrade.accountInformation.getAllUserHoldings({
62
- userId,
63
- userSecret,
64
- })
65
- ).data;
66
- console.log("holdings:", holdings);
67
-
68
- // 6) Deleting a user
69
- const deleteResponse = (
70
- await snaptrade.authentication.deleteSnapTradeUser({ userId })
71
- ).data;
72
- console.log("deleteResponse:", deleteResponse);
73
- }
74
-
75
- // Should be replaced with function to get user ID
76
- function getUserId() {
77
- var d = new Date().getTime(); //Timestamp
78
- var d2 =
79
- (typeof performance !== "undefined" &&
80
- performance.now &&
81
- performance.now() * 1000) ||
82
- 0; //Time in microseconds since page-load or 0 if unsupported
83
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
84
- var r = Math.random() * 16; //random number between 0 and 16
85
- if (d > 0) {
86
- //Use timestamp until depleted
87
- r = (d + r) % 16 | 0;
88
- d = Math.floor(d / 16);
89
- } else {
90
- //Use microseconds since page-load if supported
91
- r = (d2 + r) % 16 | 0;
92
- d2 = Math.floor(d2 / 16);
93
- }
94
- return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
95
- });
96
- }
97
-
98
- main();
99
- ```
100
-
101
- ## Documentation for API Endpoints
102
-
103
- All URIs are relative to *https://api.snaptrade.com/api/v1*
104
-
105
- Tag | Method | HTTP request | Description
106
- ------------ | ------------- | ------------- | -------------
107
- *Account Information* | [**getAllUserHoldings**](docs/AccountInformationApi.md#getAllUserHoldings) | **GET** /holdings | List all accounts for the user, plus balances, positions, and orders for each account.
108
- *Account Information* | [**getUserAccountBalance**](docs/AccountInformationApi.md#getUserAccountBalance) | **GET** /accounts/{accountId}/balances | List account balances
109
- *Account Information* | [**getUserAccountDetails**](docs/AccountInformationApi.md#getUserAccountDetails) | **GET** /accounts/{accountId} | Return details of a specific investment account
110
- *Account Information* | [**getUserAccountOrders**](docs/AccountInformationApi.md#getUserAccountOrders) | **GET** /accounts/{accountId}/orders | Get history of orders placed in account
111
- *Account Information* | [**getUserAccountPositions**](docs/AccountInformationApi.md#getUserAccountPositions) | **GET** /accounts/{accountId}/positions | List account positions
112
- *Account Information* | [**getUserHoldings**](docs/AccountInformationApi.md#getUserHoldings) | **GET** /accounts/{accountId}/holdings | List balances, positions and orders for the specified account.
113
- *Account Information* | [**listUserAccounts**](docs/AccountInformationApi.md#listUserAccounts) | **GET** /accounts | List accounts
114
- *Account Information* | [**updateUserAccount**](docs/AccountInformationApi.md#updateUserAccount) | **PUT** /accounts/{accountId} | Update details of an investment account
115
- *API Status* | [**check**](docs/ApiStatusApi.md#check) | **GET** / | Get API Status
116
- *Authentication* | [**deleteSnapTradeUser**](docs/AuthenticationApi.md#deleteSnapTradeUser) | **DELETE** /snapTrade/deleteUser | Delete SnapTrade user
117
- *Authentication* | [**getUserJWT**](docs/AuthenticationApi.md#getUserJWT) | **GET** /snapTrade/encryptedJWT | Generate encrypted JWT token
118
- *Authentication* | [**listSnapTradeUsers**](docs/AuthenticationApi.md#listSnapTradeUsers) | **GET** /snapTrade/listUsers | List SnapTrade users
119
- *Authentication* | [**loginSnapTradeUser**](docs/AuthenticationApi.md#loginSnapTradeUser) | **POST** /snapTrade/login | Login user & generate connection link
120
- *Authentication* | [**registerSnapTradeUser**](docs/AuthenticationApi.md#registerSnapTradeUser) | **POST** /snapTrade/registerUser | Create SnapTrade user
121
- *Connections* | [**detailBrokerageAuthorization**](docs/ConnectionsApi.md#detailBrokerageAuthorization) | **GET** /authorizations/{authorizationId} | Get brokerage authorization details
122
- *Connections* | [**listBrokerageAuthorizations**](docs/ConnectionsApi.md#listBrokerageAuthorizations) | **GET** /authorizations | List all brokerage authorizations for the user
123
- *Connections* | [**removeBrokerageAuthorization**](docs/ConnectionsApi.md#removeBrokerageAuthorization) | **DELETE** /authorizations/{authorizationId} | Delete brokerage authorization
124
- *Connections* | [**sessionEvents**](docs/ConnectionsApi.md#sessionEvents) | **GET** /sessionEvents | List all session events for the partner
125
- *Error Logs* | [**listUserErrors**](docs/ErrorLogsApi.md#listUserErrors) | **GET** /snapTrade/listUserErrors | Retrieve error logs on behalf of your SnapTrade users
126
- *Options* | [**getOptionStrategy**](docs/OptionsApi.md#getOptionStrategy) | **POST** /accounts/{accountId}/optionStrategy | Creates an option strategy object that will be used to place an option strategy order
127
- *Options* | [**getOptionsChain**](docs/OptionsApi.md#getOptionsChain) | **GET** /accounts/{accountId}/optionsChain | Get the options chain
128
- *Options* | [**getOptionsStrategyQuote**](docs/OptionsApi.md#getOptionsStrategyQuote) | **GET** /accounts/{accountId}/optionStrategy/{optionStrategyId} | Get latest market data of option strategy
129
- *Options* | [**listOptionHoldings**](docs/OptionsApi.md#listOptionHoldings) | **GET** /accounts/{accountId}/options | Get the options holdings in the account
130
- *Options* | [**placeOptionStrategy**](docs/OptionsApi.md#placeOptionStrategy) | **POST** /accounts/{accountId}/optionStrategy/{optionStrategyId}/execute | Place an option strategy order on the brokerage
131
- *Reference Data* | [**getCurrencyExchangeRatePair**](docs/ReferenceDataApi.md#getCurrencyExchangeRatePair) | **GET** /currencies/rates/{currencyPair} | Return the exchange rate of a currency pair
132
- *Reference Data* | [**getPartnerInfo**](docs/ReferenceDataApi.md#getPartnerInfo) | **GET** /snapTrade/partners | Get metadata related to Snaptrade partner
133
- *Reference Data* | [**getSecurityTypes**](docs/ReferenceDataApi.md#getSecurityTypes) | **GET** /securityTypes | List of all security types.
134
- *Reference Data* | [**getStockExchanges**](docs/ReferenceDataApi.md#getStockExchanges) | **GET** /exchanges | List exchanges
135
- *Reference Data* | [**getSymbols**](docs/ReferenceDataApi.md#getSymbols) | **POST** /symbols | Search for symbols
136
- *Reference Data* | [**getSymbolsByTicker**](docs/ReferenceDataApi.md#getSymbolsByTicker) | **GET** /symbols/{ticker} | Get details of a symbol by the ticker
137
- *Reference Data* | [**listAllBrokerageAuthorizationType**](docs/ReferenceDataApi.md#listAllBrokerageAuthorizationType) | **GET** /brokerageAuthorizationTypes | List of all brokerage authorization types
138
- *Reference Data* | [**listAllBrokerages**](docs/ReferenceDataApi.md#listAllBrokerages) | **GET** /brokerages | List brokerages
139
- *Reference Data* | [**listAllCurrencies**](docs/ReferenceDataApi.md#listAllCurrencies) | **GET** /currencies | List currencies
140
- *Reference Data* | [**listAllCurrenciesRates**](docs/ReferenceDataApi.md#listAllCurrenciesRates) | **GET** /currencies/rates | List currency exchange rates
141
- *Reference Data* | [**symbolSearchUserAccount**](docs/ReferenceDataApi.md#symbolSearchUserAccount) | **POST** /accounts/{accountId}/symbols | Search for symbols available in an account
142
- *Trading* | [**cancelUserAccountOrder**](docs/TradingApi.md#cancelUserAccountOrder) | **POST** /accounts/{accountId}/orders/cancel | Cancel open order in account
143
- *Trading* | [**getOrderImpact**](docs/TradingApi.md#getOrderImpact) | **POST** /trade/impact | Check impact of trades on account.
144
- *Trading* | [**getUserAccountQuotes**](docs/TradingApi.md#getUserAccountQuotes) | **GET** /accounts/{accountId}/quotes | Get symbol quotes
145
- *Trading* | [**placeForceOrder**](docs/TradingApi.md#placeForceOrder) | **POST** /trade/place | Place a trade with NO validation.
146
- *Trading* | [**placeOCOOrder**](docs/TradingApi.md#placeOCOOrder) | **POST** /trade/oco | Place a OCO (One Cancels Other) order
147
- *Trading* | [**placeOrder**](docs/TradingApi.md#placeOrder) | **POST** /trade/{tradeId} | Place order
148
- *Transactions And Reporting* | [**getActivities**](docs/TransactionsAndReportingApi.md#getActivities) | **GET** /activities | Get transaction history for a user
149
- *Transactions And Reporting* | [**getReportingCustomRange**](docs/TransactionsAndReportingApi.md#getReportingCustomRange) | **GET** /performance/custom | Get performance information for a specific timeframe
150
-
151
- ## Author
152
- This TypeScript package is automatically generated by [Konfig](https://konfigthis.com)
1
+ <div align="center">
2
+
3
+ [![Visit SnapTrade](./header.png)](https://snaptrade.com)
4
+
5
+ # [SnapTrade](https://snaptrade.com)
6
+
7
+ Connect brokerage accounts to your app for live positions and trading
8
+
9
+ [![npm](https://img.shields.io/badge/npm-v8.29.0-blue)](https://www.npmjs.com/package/snaptrade-typescript-sdk/v/8.29.0)
10
+ [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
+
12
+ </div>
13
+
14
+ ## Table of Contents
15
+
16
+ <!-- toc -->
17
+
18
+ - [Installing](#installing)
19
+ * [npm](#npm)
20
+ * [yarn](#yarn)
21
+ - [Getting Started](#getting-started)
22
+ - [Reference](#reference)
23
+ * [`snaptrade.accountInformation.getAllUserHoldings`](#snaptradeaccountinformationgetalluserholdings)
24
+ * [`snaptrade.accountInformation.getUserAccountBalance`](#snaptradeaccountinformationgetuseraccountbalance)
25
+ * [`snaptrade.accountInformation.getUserAccountDetails`](#snaptradeaccountinformationgetuseraccountdetails)
26
+ * [`snaptrade.accountInformation.getUserAccountOrders`](#snaptradeaccountinformationgetuseraccountorders)
27
+ * [`snaptrade.accountInformation.getUserAccountPositions`](#snaptradeaccountinformationgetuseraccountpositions)
28
+ * [`snaptrade.accountInformation.getUserHoldings`](#snaptradeaccountinformationgetuserholdings)
29
+ * [`snaptrade.accountInformation.listUserAccounts`](#snaptradeaccountinformationlistuseraccounts)
30
+ * [`snaptrade.accountInformation.updateUserAccount`](#snaptradeaccountinformationupdateuseraccount)
31
+ * [`snaptrade.apiStatus.check`](#snaptradeapistatuscheck)
32
+ * [`snaptrade.authentication.deleteSnapTradeUser`](#snaptradeauthenticationdeletesnaptradeuser)
33
+ * [`snaptrade.authentication.getUserJWT`](#snaptradeauthenticationgetuserjwt)
34
+ * [`snaptrade.authentication.listSnapTradeUsers`](#snaptradeauthenticationlistsnaptradeusers)
35
+ * [`snaptrade.authentication.loginSnapTradeUser`](#snaptradeauthenticationloginsnaptradeuser)
36
+ * [`snaptrade.authentication.registerSnapTradeUser`](#snaptradeauthenticationregistersnaptradeuser)
37
+ * [`snaptrade.connections.detailBrokerageAuthorization`](#snaptradeconnectionsdetailbrokerageauthorization)
38
+ * [`snaptrade.connections.listBrokerageAuthorizations`](#snaptradeconnectionslistbrokerageauthorizations)
39
+ * [`snaptrade.connections.removeBrokerageAuthorization`](#snaptradeconnectionsremovebrokerageauthorization)
40
+ * [`snaptrade.connections.sessionEvents`](#snaptradeconnectionssessionevents)
41
+ * [`snaptrade.errorLogs.listUserErrors`](#snaptradeerrorlogslistusererrors)
42
+ * [`snaptrade.options.getOptionStrategy`](#snaptradeoptionsgetoptionstrategy)
43
+ * [`snaptrade.options.getOptionsChain`](#snaptradeoptionsgetoptionschain)
44
+ * [`snaptrade.options.getOptionsStrategyQuote`](#snaptradeoptionsgetoptionsstrategyquote)
45
+ * [`snaptrade.options.listOptionHoldings`](#snaptradeoptionslistoptionholdings)
46
+ * [`snaptrade.options.placeOptionStrategy`](#snaptradeoptionsplaceoptionstrategy)
47
+ * [`snaptrade.referenceData.getCurrencyExchangeRatePair`](#snaptradereferencedatagetcurrencyexchangeratepair)
48
+ * [`snaptrade.referenceData.getPartnerInfo`](#snaptradereferencedatagetpartnerinfo)
49
+ * [`snaptrade.referenceData.getSecurityTypes`](#snaptradereferencedatagetsecuritytypes)
50
+ * [`snaptrade.referenceData.getStockExchanges`](#snaptradereferencedatagetstockexchanges)
51
+ * [`snaptrade.referenceData.getSymbols`](#snaptradereferencedatagetsymbols)
52
+ * [`snaptrade.referenceData.getSymbolsByTicker`](#snaptradereferencedatagetsymbolsbyticker)
53
+ * [`snaptrade.referenceData.listAllBrokerageAuthorizationType`](#snaptradereferencedatalistallbrokerageauthorizationtype)
54
+ * [`snaptrade.referenceData.listAllBrokerages`](#snaptradereferencedatalistallbrokerages)
55
+ * [`snaptrade.referenceData.listAllCurrencies`](#snaptradereferencedatalistallcurrencies)
56
+ * [`snaptrade.referenceData.listAllCurrenciesRates`](#snaptradereferencedatalistallcurrenciesrates)
57
+ * [`snaptrade.referenceData.symbolSearchUserAccount`](#snaptradereferencedatasymbolsearchuseraccount)
58
+ * [`snaptrade.trading.cancelUserAccountOrder`](#snaptradetradingcanceluseraccountorder)
59
+ * [`snaptrade.trading.getOrderImpact`](#snaptradetradinggetorderimpact)
60
+ * [`snaptrade.trading.getUserAccountQuotes`](#snaptradetradinggetuseraccountquotes)
61
+ * [`snaptrade.trading.placeForceOrder`](#snaptradetradingplaceforceorder)
62
+ * [`snaptrade.trading.placeOCOOrder`](#snaptradetradingplaceocoorder)
63
+ * [`snaptrade.trading.placeOrder`](#snaptradetradingplaceorder)
64
+ * [`snaptrade.transactionsAndReporting.getActivities`](#snaptradetransactionsandreportinggetactivities)
65
+ * [`snaptrade.transactionsAndReporting.getReportingCustomRange`](#snaptradetransactionsandreportinggetreportingcustomrange)
66
+
67
+ <!-- tocstop -->
68
+
69
+ ## Installing
70
+
71
+ ### npm
72
+ ```
73
+ npm install snaptrade-typescript-sdk --save
74
+ ```
75
+
76
+ ### yarn
77
+ ```
78
+ yarn add snaptrade-typescript-sdk
79
+ ```
80
+
81
+ ## Getting Started
82
+
83
+ ```typescript
84
+ const { Snaptrade } = require("snaptrade-typescript-sdk");
85
+
86
+ async function main() {
87
+ // 1) Initialize a client with your clientID and consumerKey.
88
+ const snaptrade = new Snaptrade({
89
+ consumerKey: process.env.SNAPTRADE_CONSUMER_KEY,
90
+ clientId: process.env.SNAPTRADE_CLIENT_ID,
91
+ });
92
+
93
+ // 2) Check that the client is able to make a request to the API server.
94
+ const status = await snaptrade.apiStatus.check();
95
+ console.log("status:", status.data);
96
+
97
+ // 3) Create a new user on SnapTrade
98
+ const userId = uuid();
99
+ const { userSecret } = (
100
+ await snaptrade.authentication.registerSnapTradeUser({
101
+ userId,
102
+ })
103
+ ).data;
104
+
105
+ // Note: A user secret is only generated once. It's required to access
106
+ // resources for certain endpoints.
107
+ console.log("userSecret:", userSecret);
108
+
109
+ // 4) Get a redirect URI. Users will need this to connect
110
+ const data = (
111
+ await snaptrade.authentication.loginSnapTradeUser({ userId, userSecret })
112
+ ).data;
113
+ if (!("redirectURI" in data)) throw Error("Should have gotten redirect URI");
114
+ console.log("redirectURI:", data.redirectURI);
115
+
116
+ // 5) Obtaining account holdings data
117
+ const holdings = (
118
+ await snaptrade.accountInformation.getAllUserHoldings({
119
+ userId,
120
+ userSecret,
121
+ })
122
+ ).data;
123
+ console.log("holdings:", holdings);
124
+
125
+ // 6) Deleting a user
126
+ const deleteResponse = (
127
+ await snaptrade.authentication.deleteSnapTradeUser({ userId })
128
+ ).data;
129
+ console.log("deleteResponse:", deleteResponse);
130
+ }
131
+
132
+ // Should be replaced with function to get user ID
133
+ function getUserId() {
134
+ var d = new Date().getTime(); //Timestamp
135
+ var d2 =
136
+ (typeof performance !== "undefined" &&
137
+ performance.now &&
138
+ performance.now() * 1000) ||
139
+ 0; //Time in microseconds since page-load or 0 if unsupported
140
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
141
+ var r = Math.random() * 16; //random number between 0 and 16
142
+ if (d > 0) {
143
+ //Use timestamp until depleted
144
+ r = (d + r) % 16 | 0;
145
+ d = Math.floor(d / 16);
146
+ } else {
147
+ //Use microseconds since page-load if supported
148
+ r = (d2 + r) % 16 | 0;
149
+ d2 = Math.floor(d2 / 16);
150
+ }
151
+ return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
152
+ });
153
+ }
154
+
155
+ main();
156
+ ```
157
+
158
+ ## Reference
159
+
160
+
161
+ ### `snaptrade.accountInformation.getAllUserHoldings`
162
+
163
+ List all accounts for the user, plus balances, positions, and orders for each account.
164
+
165
+ #### 🛠️ Usage
166
+
167
+ ```typescript
168
+ const getAllUserHoldingsResponse =
169
+ await snaptrade.accountInformation.getAllUserHoldings({
170
+ userId: "John.doe@snaptrade.com",
171
+ userSecret: "USERSECRET123",
172
+ brokerageAuthorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
173
+ });
174
+ ```
175
+
176
+ #### ⚙️ Parameters
177
+
178
+ ##### userId: `string`
179
+
180
+ ##### userSecret: `string`
181
+
182
+ ##### brokerageAuthorizations: `string`
183
+
184
+ Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations).
185
+
186
+ #### 🔄 Return
187
+ [AccountHoldings](./models/account-holdings.ts)
188
+
189
+ #### 🌐 Endpoint
190
+
191
+ `/holdings` `GET`
192
+
193
+ [🔙 Back to Table of Contents](#table-of-contents)
194
+
195
+ ---
196
+
197
+
198
+ ### `snaptrade.accountInformation.getUserAccountBalance`
199
+
200
+ List account balances
201
+
202
+ #### 🛠️ Usage
203
+
204
+ ```typescript
205
+ const getUserAccountBalanceResponse =
206
+ await snaptrade.accountInformation.getUserAccountBalance({
207
+ userId: "John.doe@snaptrade.com",
208
+ userSecret: "USERSECRET123",
209
+ accountId: "accountId_example",
210
+ });
211
+ ```
212
+
213
+ #### ⚙️ Parameters
214
+
215
+ ##### userId: `string`
216
+
217
+ ##### userSecret: `string`
218
+
219
+ ##### accountId: `string`
220
+
221
+ The ID of the account get positions.
222
+
223
+ #### 🔄 Return
224
+ [Balance](./models/balance.ts)
225
+
226
+ #### 🌐 Endpoint
227
+
228
+ `/accounts/{accountId}/balances` `GET`
229
+
230
+ [🔙 Back to Table of Contents](#table-of-contents)
231
+
232
+ ---
233
+
234
+
235
+ ### `snaptrade.accountInformation.getUserAccountDetails`
236
+
237
+ Return details of a specific investment account
238
+
239
+ #### 🛠️ Usage
240
+
241
+ ```typescript
242
+ const getUserAccountDetailsResponse =
243
+ await snaptrade.accountInformation.getUserAccountDetails({
244
+ userId: "John.doe@snaptrade.com",
245
+ userSecret: "USERSECRET123",
246
+ accountId: "accountId_example",
247
+ });
248
+ ```
249
+
250
+ #### ⚙️ Parameters
251
+
252
+ ##### userId: `string`
253
+
254
+ ##### userSecret: `string`
255
+
256
+ ##### accountId: `string`
257
+
258
+ The ID of the account to get detail of.
259
+
260
+ #### 🔄 Return
261
+ [Account](./models/account.ts)
262
+
263
+ #### 🌐 Endpoint
264
+
265
+ `/accounts/{accountId}` `GET`
266
+
267
+ [🔙 Back to Table of Contents](#table-of-contents)
268
+
269
+ ---
270
+
271
+
272
+ ### `snaptrade.accountInformation.getUserAccountOrders`
273
+
274
+ Get history of orders placed in account
275
+
276
+ #### 🛠️ Usage
277
+
278
+ ```typescript
279
+ const getUserAccountOrdersResponse =
280
+ await snaptrade.accountInformation.getUserAccountOrders({
281
+ userId: "John.doe@snaptrade.com",
282
+ userSecret: "USERSECRET123",
283
+ state: "all",
284
+ accountId: "accountId_example",
285
+ });
286
+ ```
287
+
288
+ #### ⚙️ Parameters
289
+
290
+ ##### userId: `string`
291
+
292
+ ##### userSecret: `string`
293
+
294
+ ##### accountId: `string`
295
+
296
+ The ID of the account get positions.
297
+
298
+ ##### state: `'all' | 'open' | 'executed'`
299
+
300
+ defaults value is set to \"all\"
301
+
302
+ #### 🔄 Return
303
+ [AccountOrderRecord](./models/account-order-record.ts)
304
+
305
+ #### 🌐 Endpoint
306
+
307
+ `/accounts/{accountId}/orders` `GET`
308
+
309
+ [🔙 Back to Table of Contents](#table-of-contents)
310
+
311
+ ---
312
+
313
+
314
+ ### `snaptrade.accountInformation.getUserAccountPositions`
315
+
316
+ List account positions
317
+
318
+ #### 🛠️ Usage
319
+
320
+ ```typescript
321
+ const getUserAccountPositionsResponse =
322
+ await snaptrade.accountInformation.getUserAccountPositions({
323
+ userId: "John.doe@snaptrade.com",
324
+ userSecret: "USERSECRET123",
325
+ accountId: "accountId_example",
326
+ });
327
+ ```
328
+
329
+ #### ⚙️ Parameters
330
+
331
+ ##### userId: `string`
332
+
333
+ ##### userSecret: `string`
334
+
335
+ ##### accountId: `string`
336
+
337
+ The ID of the account get positions.
338
+
339
+ #### 🔄 Return
340
+ [Position](./models/position.ts)
341
+
342
+ #### 🌐 Endpoint
343
+
344
+ `/accounts/{accountId}/positions` `GET`
345
+
346
+ [🔙 Back to Table of Contents](#table-of-contents)
347
+
348
+ ---
349
+
350
+
351
+ ### `snaptrade.accountInformation.getUserHoldings`
352
+
353
+ List balances, positions and orders for the specified account.
354
+
355
+ #### 🛠️ Usage
356
+
357
+ ```typescript
358
+ const getUserHoldingsResponse =
359
+ await snaptrade.accountInformation.getUserHoldings({
360
+ accountId: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
361
+ userId: "John.doe@snaptrade.com",
362
+ userSecret: "USERSECRET123",
363
+ });
364
+ ```
365
+
366
+ #### ⚙️ Parameters
367
+
368
+ ##### accountId: `string`
369
+
370
+ The ID of the account to fetch holdings for.
371
+
372
+ ##### userId: `string`
373
+
374
+ ##### userSecret: `string`
375
+
376
+ #### 🔄 Return
377
+ [AccountHoldingsAccount](./models/account-holdings-account.ts)
378
+
379
+ #### 🌐 Endpoint
380
+
381
+ `/accounts/{accountId}/holdings` `GET`
382
+
383
+ [🔙 Back to Table of Contents](#table-of-contents)
384
+
385
+ ---
386
+
387
+
388
+ ### `snaptrade.accountInformation.listUserAccounts`
389
+
390
+ List accounts
391
+
392
+ #### 🛠️ Usage
393
+
394
+ ```typescript
395
+ const listUserAccountsResponse =
396
+ await snaptrade.accountInformation.listUserAccounts({
397
+ userId: "John.doe@snaptrade.com",
398
+ userSecret: "USERSECRET123",
399
+ });
400
+ ```
401
+
402
+ #### ⚙️ Parameters
403
+
404
+ ##### userId: `string`
405
+
406
+ ##### userSecret: `string`
407
+
408
+ #### 🔄 Return
409
+ [Account](./models/account.ts)
410
+
411
+ #### 🌐 Endpoint
412
+
413
+ `/accounts` `GET`
414
+
415
+ [🔙 Back to Table of Contents](#table-of-contents)
416
+
417
+ ---
418
+
419
+
420
+ ### `snaptrade.accountInformation.updateUserAccount`
421
+
422
+ Update details of an investment account
423
+
424
+ #### 🛠️ Usage
425
+
426
+ ```typescript
427
+ const updateUserAccountResponse =
428
+ await snaptrade.accountInformation.updateUserAccount({
429
+ userId: "John.doe@snaptrade.com",
430
+ userSecret: "USERSECRET123",
431
+ accountId: "accountId_example",
432
+ });
433
+ ```
434
+
435
+ #### ⚙️ Parameters
436
+
437
+ ##### userId: `string`
438
+
439
+ ##### userSecret: `string`
440
+
441
+ ##### accountId: `string`
442
+
443
+ The ID of the account to update.
444
+
445
+ #### 🔄 Return
446
+ [Account](./models/account.ts)
447
+
448
+ #### 🌐 Endpoint
449
+
450
+ `/accounts/{accountId}` `PUT`
451
+
452
+ [🔙 Back to Table of Contents](#table-of-contents)
453
+
454
+ ---
455
+
456
+
457
+ ### `snaptrade.apiStatus.check`
458
+
459
+ Check whether the API is operational and verify timestamps.
460
+
461
+ #### 🛠️ Usage
462
+
463
+ ```typescript
464
+ const checkResponse = await snaptrade.apiStatus.check();
465
+ ```
466
+
467
+ #### 🔄 Return
468
+ [Status](./models/status.ts)
469
+
470
+ #### 🌐 Endpoint
471
+
472
+ `/` `GET`
473
+
474
+ [🔙 Back to Table of Contents](#table-of-contents)
475
+
476
+ ---
477
+
478
+
479
+ ### `snaptrade.authentication.deleteSnapTradeUser`
480
+
481
+ Delete SnapTrade user
482
+
483
+ #### 🛠️ Usage
484
+
485
+ ```typescript
486
+ const deleteSnapTradeUserResponse =
487
+ await snaptrade.authentication.deleteSnapTradeUser({
488
+ userId: "John.doe@snaptrade.com",
489
+ });
490
+ ```
491
+
492
+ #### ⚙️ Parameters
493
+
494
+ ##### userId: `string`
495
+
496
+ #### 🔄 Return
497
+ [DeleteUserResponse](./models/delete-user-response.ts)
498
+
499
+ #### 🌐 Endpoint
500
+
501
+ `/snapTrade/deleteUser` `DELETE`
502
+
503
+ [🔙 Back to Table of Contents](#table-of-contents)
504
+
505
+ ---
506
+
507
+
508
+ ### `snaptrade.authentication.getUserJWT`
509
+
510
+ Generate encrypted JWT token
511
+
512
+ #### 🛠️ Usage
513
+
514
+ ```typescript
515
+ const getUserJWTResponse = await snaptrade.authentication.getUserJWT({
516
+ userId: "John.doe@snaptrade.com",
517
+ userSecret: "USERSECRET123",
518
+ });
519
+ ```
520
+
521
+ #### ⚙️ Parameters
522
+
523
+ ##### userId: `string`
524
+
525
+ ##### userSecret: `string`
526
+
527
+ #### 🌐 Endpoint
528
+
529
+ `/snapTrade/encryptedJWT` `GET`
530
+
531
+ [🔙 Back to Table of Contents](#table-of-contents)
532
+
533
+ ---
534
+
535
+
536
+ ### `snaptrade.authentication.listSnapTradeUsers`
537
+
538
+ List SnapTrade users
539
+
540
+ #### 🛠️ Usage
541
+
542
+ ```typescript
543
+ const listSnapTradeUsersResponse =
544
+ await snaptrade.authentication.listSnapTradeUsers();
545
+ ```
546
+
547
+ #### 🌐 Endpoint
548
+
549
+ `/snapTrade/listUsers` `GET`
550
+
551
+ [🔙 Back to Table of Contents](#table-of-contents)
552
+
553
+ ---
554
+
555
+
556
+ ### `snaptrade.authentication.loginSnapTradeUser`
557
+
558
+ Login user &amp; generate connection link
559
+
560
+ #### 🛠️ Usage
561
+
562
+ ```typescript
563
+ const loginSnapTradeUserResponse =
564
+ await snaptrade.authentication.loginSnapTradeUser({
565
+ userId: "John.doe@snaptrade.com",
566
+ userSecret: "USERSECRET123",
567
+ broker: "ALPACA",
568
+ immediateRedirect: true,
569
+ customRedirect: "https://snaptrade.com",
570
+ reconnect: "8b5f262d-4bb9-365d-888a-202bd3b15fa1",
571
+ connectionType: "read",
572
+ });
573
+ ```
574
+
575
+ #### ⚙️ Parameters
576
+
577
+ ##### userId: `string`
578
+
579
+ ##### userSecret: `string`
580
+
581
+ ##### broker: `string`
582
+
583
+ ##### immediateRedirect: `boolean`
584
+
585
+ ##### customRedirect: `string`
586
+
587
+ ##### reconnect: `string`
588
+
589
+ ##### connectionType: `string`
590
+
591
+ #### 🌐 Endpoint
592
+
593
+ `/snapTrade/login` `POST`
594
+
595
+ [🔙 Back to Table of Contents](#table-of-contents)
596
+
597
+ ---
598
+
599
+
600
+ ### `snaptrade.authentication.registerSnapTradeUser`
601
+
602
+ Create SnapTrade user
603
+
604
+ #### 🛠️ Usage
605
+
606
+ ```typescript
607
+ const registerSnapTradeUserResponse =
608
+ await snaptrade.authentication.registerSnapTradeUser({
609
+ userId: "snaptrade-user-123",
610
+ rsaPublicKey:
611
+ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC7vbqajDw4o6gJy8UtmIbkcpnkO3Kwc4qsEnSZp/TR+fQi62F79RHWmwKOtFmwteURgLbj7D/WGuNLGOfa/2vse3G2eHnHl5CB8ruRX9fBl/KgwCVr2JaEuUm66bBQeP5XeBotdR4cvX38uPYivCDdPjJ1QWPdspTBKcxeFbccDw==",
612
+ });
613
+ ```
614
+
615
+ #### ⚙️ Parameters
616
+
617
+ ##### userId: `string`
618
+
619
+ SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it\\\'s unique to a user
620
+
621
+ ##### rsaPublicKey: `string`
622
+
623
+ Open SSH RSA public key
624
+
625
+ #### 🔄 Return
626
+ [UserIDandSecret](./models/user-idand-secret.ts)
627
+
628
+ #### 🌐 Endpoint
629
+
630
+ `/snapTrade/registerUser` `POST`
631
+
632
+ [🔙 Back to Table of Contents](#table-of-contents)
633
+
634
+ ---
635
+
636
+
637
+ ### `snaptrade.connections.detailBrokerageAuthorization`
638
+
639
+ Get brokerage authorization details
640
+
641
+ #### 🛠️ Usage
642
+
643
+ ```typescript
644
+ const detailBrokerageAuthorizationResponse =
645
+ await snaptrade.connections.detailBrokerageAuthorization({
646
+ authorizationId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
647
+ userId: "John.doe@snaptrade.com",
648
+ userSecret: "USERSECRET123",
649
+ });
650
+ ```
651
+
652
+ #### ⚙️ Parameters
653
+
654
+ ##### authorizationId: `string`
655
+
656
+ The ID of a brokerage authorization object.
657
+
658
+ ##### userId: `string`
659
+
660
+ ##### userSecret: `string`
661
+
662
+ #### 🔄 Return
663
+ [BrokerageAuthorization](./models/brokerage-authorization.ts)
664
+
665
+ #### 🌐 Endpoint
666
+
667
+ `/authorizations/{authorizationId}` `GET`
668
+
669
+ [🔙 Back to Table of Contents](#table-of-contents)
670
+
671
+ ---
672
+
673
+
674
+ ### `snaptrade.connections.listBrokerageAuthorizations`
675
+
676
+ List all brokerage authorizations for the user
677
+
678
+ #### 🛠️ Usage
679
+
680
+ ```typescript
681
+ const listBrokerageAuthorizationsResponse =
682
+ await snaptrade.connections.listBrokerageAuthorizations({
683
+ userId: "John.doe@snaptrade.com",
684
+ userSecret: "USERSECRET123",
685
+ });
686
+ ```
687
+
688
+ #### ⚙️ Parameters
689
+
690
+ ##### userId: `string`
691
+
692
+ ##### userSecret: `string`
693
+
694
+ #### 🔄 Return
695
+ [BrokerageAuthorization](./models/brokerage-authorization.ts)
696
+
697
+ #### 🌐 Endpoint
698
+
699
+ `/authorizations` `GET`
700
+
701
+ [🔙 Back to Table of Contents](#table-of-contents)
702
+
703
+ ---
704
+
705
+
706
+ ### `snaptrade.connections.removeBrokerageAuthorization`
707
+
708
+ Delete brokerage authorization
709
+
710
+ #### 🛠️ Usage
711
+
712
+ ```typescript
713
+ const removeBrokerageAuthorizationResponse =
714
+ await snaptrade.connections.removeBrokerageAuthorization({
715
+ authorizationId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
716
+ userId: "John.doe@snaptrade.com",
717
+ userSecret: "USERSECRET123",
718
+ });
719
+ ```
720
+
721
+ #### ⚙️ Parameters
722
+
723
+ ##### authorizationId: `string`
724
+
725
+ The ID of the Authorization to delete.
726
+
727
+ ##### userId: `string`
728
+
729
+ ##### userSecret: `string`
730
+
731
+ #### 🌐 Endpoint
732
+
733
+ `/authorizations/{authorizationId}` `DELETE`
734
+
735
+ [🔙 Back to Table of Contents](#table-of-contents)
736
+
737
+ ---
738
+
739
+
740
+ ### `snaptrade.connections.sessionEvents`
741
+
742
+ List all session events for the partner
743
+
744
+ #### 🛠️ Usage
745
+
746
+ ```typescript
747
+ const sessionEventsResponse = await snaptrade.connections.sessionEvents({
748
+ partnerClientId: "SNAPTRADETEST",
749
+ userId:
750
+ "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
751
+ sessionId:
752
+ "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
753
+ });
754
+ ```
755
+
756
+ #### ⚙️ Parameters
757
+
758
+ ##### partnerClientId: `string`
759
+
760
+ ##### userId: `string`
761
+
762
+ Optional comma seperated list of user IDs used to filter the request on specific users
763
+
764
+ ##### sessionId: `string`
765
+
766
+ Optional comma seperated list of session IDs used to filter the request on specific users
767
+
768
+ #### 🌐 Endpoint
769
+
770
+ `/sessionEvents` `GET`
771
+
772
+ [🔙 Back to Table of Contents](#table-of-contents)
773
+
774
+ ---
775
+
776
+
777
+ ### `snaptrade.errorLogs.listUserErrors`
778
+
779
+ Retrieve error logs on behalf of your SnapTrade users
780
+
781
+ #### 🛠️ Usage
782
+
783
+ ```typescript
784
+ const listUserErrorsResponse = await snaptrade.errorLogs.listUserErrors({
785
+ userId: "John.doe@snaptrade.com",
786
+ userSecret: "USERSECRET123",
787
+ });
788
+ ```
789
+
790
+ #### ⚙️ Parameters
791
+
792
+ ##### userId: `string`
793
+
794
+ ##### userSecret: `string`
795
+
796
+ #### 🔄 Return
797
+ [UserErrorLog](./models/user-error-log.ts)
798
+
799
+ #### 🌐 Endpoint
800
+
801
+ `/snapTrade/listUserErrors` `GET`
802
+
803
+ [🔙 Back to Table of Contents](#table-of-contents)
804
+
805
+ ---
806
+
807
+
808
+ ### `snaptrade.options.getOptionStrategy`
809
+
810
+ Creates an option strategy object that will be used to place an option strategy order
811
+
812
+ #### 🛠️ Usage
813
+
814
+ ```typescript
815
+ const getOptionStrategyResponse = await snaptrade.options.getOptionStrategy({
816
+ userId: "John.doe@snaptrade.com",
817
+ userSecret: "USERSECRET123",
818
+ accountId: "accountId_example",
819
+ underlying_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
820
+ legs: [
821
+ {
822
+ action: "BUY_TO_OPEN",
823
+ option_symbol_id: "SPY220819P00200000",
824
+ quantity: 1,
825
+ },
826
+ ],
827
+ strategy_type: "CUSTOM",
828
+ });
829
+ ```
830
+
831
+ #### ⚙️ Parameters
832
+
833
+ ##### underlyingSymbolId: `string`
834
+
835
+ ##### legs: [`OptionLeg`](./models/option-leg.ts)[]
836
+
837
+ ##### strategyType: `string`
838
+
839
+ ##### userId: `string`
840
+
841
+ ##### userSecret: `string`
842
+
843
+ ##### accountId: `string`
844
+
845
+ The ID of the account get positions.
846
+
847
+ #### 🔄 Return
848
+ [StrategyQuotes](./models/strategy-quotes.ts)
849
+
850
+ #### 🌐 Endpoint
851
+
852
+ `/accounts/{accountId}/optionStrategy` `POST`
853
+
854
+ [🔙 Back to Table of Contents](#table-of-contents)
855
+
856
+ ---
857
+
858
+
859
+ ### `snaptrade.options.getOptionsChain`
860
+
861
+ Get the options chain
862
+
863
+ #### 🛠️ Usage
864
+
865
+ ```typescript
866
+ const getOptionsChainResponse = await snaptrade.options.getOptionsChain({
867
+ userId: "John.doe@snaptrade.com",
868
+ userSecret: "USERSECRET123",
869
+ accountId: "accountId_example",
870
+ symbol: "symbol_example",
871
+ });
872
+ ```
873
+
874
+ #### ⚙️ Parameters
875
+
876
+ ##### userId: `string`
877
+
878
+ ##### userSecret: `string`
879
+
880
+ ##### accountId: `string`
881
+
882
+ The ID of the account get positions.
883
+
884
+ ##### symbol: `string`
885
+
886
+ Universal symbol ID if symbol
887
+
888
+ #### 🌐 Endpoint
889
+
890
+ `/accounts/{accountId}/optionsChain` `GET`
891
+
892
+ [🔙 Back to Table of Contents](#table-of-contents)
893
+
894
+ ---
895
+
896
+
897
+ ### `snaptrade.options.getOptionsStrategyQuote`
898
+
899
+ Get latest market data of option strategy
900
+
901
+ #### 🛠️ Usage
902
+
903
+ ```typescript
904
+ const getOptionsStrategyQuoteResponse =
905
+ await snaptrade.options.getOptionsStrategyQuote({
906
+ userId: "John.doe@snaptrade.com",
907
+ userSecret: "USERSECRET123",
908
+ accountId: "accountId_example",
909
+ optionStrategyId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
910
+ });
911
+ ```
912
+
913
+ #### ⚙️ Parameters
914
+
915
+ ##### userId: `string`
916
+
917
+ ##### userSecret: `string`
918
+
919
+ ##### accountId: `string`
920
+
921
+ The ID of the account get positions.
922
+
923
+ ##### optionStrategyId: `string`
924
+
925
+ Option strategy id obtained from response when creating option strategy object
926
+
927
+ #### 🔄 Return
928
+ [StrategyQuotes](./models/strategy-quotes.ts)
929
+
930
+ #### 🌐 Endpoint
931
+
932
+ `/accounts/{accountId}/optionStrategy/{optionStrategyId}` `GET`
933
+
934
+ [🔙 Back to Table of Contents](#table-of-contents)
935
+
936
+ ---
937
+
938
+
939
+ ### `snaptrade.options.listOptionHoldings`
940
+
941
+ Get the options holdings in the account
942
+
943
+ #### 🛠️ Usage
944
+
945
+ ```typescript
946
+ const listOptionHoldingsResponse = await snaptrade.options.listOptionHoldings({
947
+ userId: "John.doe@snaptrade.com",
948
+ userSecret: "USERSECRET123",
949
+ accountId: "accountId_example",
950
+ });
951
+ ```
952
+
953
+ #### ⚙️ Parameters
954
+
955
+ ##### userId: `string`
956
+
957
+ ##### userSecret: `string`
958
+
959
+ ##### accountId: `string`
960
+
961
+ The ID of the account get positions.
962
+
963
+ #### 🔄 Return
964
+ [OptionsPosition](./models/options-position.ts)
965
+
966
+ #### 🌐 Endpoint
967
+
968
+ `/accounts/{accountId}/options` `GET`
969
+
970
+ [🔙 Back to Table of Contents](#table-of-contents)
971
+
972
+ ---
973
+
974
+
975
+ ### `snaptrade.options.placeOptionStrategy`
976
+
977
+ Place an option strategy order on the brokerage
978
+
979
+ #### 🛠️ Usage
980
+
981
+ ```typescript
982
+ const placeOptionStrategyResponse = await snaptrade.options.placeOptionStrategy(
983
+ {
984
+ userId: "John.doe@snaptrade.com",
985
+ userSecret: "USERSECRET123",
986
+ accountId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
987
+ optionStrategyId: "2bcd7cc3-e922-4976-bce1-9858296801c3",
988
+ order_type: "Limit",
989
+ time_in_force: "DAY",
990
+ price: 31.33,
991
+ }
992
+ );
993
+ ```
994
+
995
+ #### ⚙️ Parameters
996
+
997
+ ##### orderType: `string`
998
+
999
+ ##### timeInForce: `string`
1000
+
1001
+ ##### price: `number`
1002
+
1003
+ Trade Price if limit or stop limit order
1004
+
1005
+ ##### userId: `string`
1006
+
1007
+ ##### userSecret: `string`
1008
+
1009
+ ##### accountId: `string`
1010
+
1011
+ The ID of the account get positions.
1012
+
1013
+ ##### optionStrategyId: `string`
1014
+
1015
+ Option strategy id obtained from response when creating option strategy object
1016
+
1017
+ #### 🔄 Return
1018
+ [StrategyOrderRecord](./models/strategy-order-record.ts)
1019
+
1020
+ #### 🌐 Endpoint
1021
+
1022
+ `/accounts/{accountId}/optionStrategy/{optionStrategyId}/execute` `POST`
1023
+
1024
+ [🔙 Back to Table of Contents](#table-of-contents)
1025
+
1026
+ ---
1027
+
1028
+
1029
+ ### `snaptrade.referenceData.getCurrencyExchangeRatePair`
1030
+
1031
+ Return the exchange rate of a currency pair
1032
+
1033
+ #### 🛠️ Usage
1034
+
1035
+ ```typescript
1036
+ const getCurrencyExchangeRatePairResponse =
1037
+ await snaptrade.referenceData.getCurrencyExchangeRatePair({
1038
+ currencyPair: "currencyPair_example",
1039
+ });
1040
+ ```
1041
+
1042
+ #### ⚙️ Parameters
1043
+
1044
+ ##### currencyPair: `string`
1045
+
1046
+ A currency pair based on currency code for example, {CAD-USD}
1047
+
1048
+ #### 🔄 Return
1049
+ [ExchangeRatePairs](./models/exchange-rate-pairs.ts)
1050
+
1051
+ #### 🌐 Endpoint
1052
+
1053
+ `/currencies/rates/{currencyPair}` `GET`
1054
+
1055
+ [🔙 Back to Table of Contents](#table-of-contents)
1056
+
1057
+ ---
1058
+
1059
+
1060
+ ### `snaptrade.referenceData.getPartnerInfo`
1061
+
1062
+ Get metadata related to Snaptrade partner
1063
+
1064
+ #### 🛠️ Usage
1065
+
1066
+ ```typescript
1067
+ const getPartnerInfoResponse = await snaptrade.referenceData.getPartnerInfo();
1068
+ ```
1069
+
1070
+ #### 🔄 Return
1071
+ [PartnerData](./models/partner-data.ts)
1072
+
1073
+ #### 🌐 Endpoint
1074
+
1075
+ `/snapTrade/partners` `GET`
1076
+
1077
+ [🔙 Back to Table of Contents](#table-of-contents)
1078
+
1079
+ ---
1080
+
1081
+
1082
+ ### `snaptrade.referenceData.getSecurityTypes`
1083
+
1084
+ List of all security types.
1085
+
1086
+ #### 🛠️ Usage
1087
+
1088
+ ```typescript
1089
+ const getSecurityTypesResponse =
1090
+ await snaptrade.referenceData.getSecurityTypes();
1091
+ ```
1092
+
1093
+ #### 🔄 Return
1094
+ [SecurityType](./models/security-type.ts)
1095
+
1096
+ #### 🌐 Endpoint
1097
+
1098
+ `/securityTypes` `GET`
1099
+
1100
+ [🔙 Back to Table of Contents](#table-of-contents)
1101
+
1102
+ ---
1103
+
1104
+
1105
+ ### `snaptrade.referenceData.getStockExchanges`
1106
+
1107
+ List exchanges
1108
+
1109
+ #### 🛠️ Usage
1110
+
1111
+ ```typescript
1112
+ const getStockExchangesResponse =
1113
+ await snaptrade.referenceData.getStockExchanges();
1114
+ ```
1115
+
1116
+ #### 🔄 Return
1117
+ [Exchange](./models/exchange.ts)
1118
+
1119
+ #### 🌐 Endpoint
1120
+
1121
+ `/exchanges` `GET`
1122
+
1123
+ [🔙 Back to Table of Contents](#table-of-contents)
1124
+
1125
+ ---
1126
+
1127
+
1128
+ ### `snaptrade.referenceData.getSymbols`
1129
+
1130
+ Search for symbols
1131
+
1132
+ #### 🛠️ Usage
1133
+
1134
+ ```typescript
1135
+ const getSymbolsResponse = await snaptrade.referenceData.getSymbols({
1136
+ substring: "apple",
1137
+ });
1138
+ ```
1139
+
1140
+ #### ⚙️ Parameters
1141
+
1142
+ ##### substring: `string`
1143
+
1144
+ #### 🔄 Return
1145
+ [UniversalSymbol](./models/universal-symbol.ts)
1146
+
1147
+ #### 🌐 Endpoint
1148
+
1149
+ `/symbols` `POST`
1150
+
1151
+ [🔙 Back to Table of Contents](#table-of-contents)
1152
+
1153
+ ---
1154
+
1155
+
1156
+ ### `snaptrade.referenceData.getSymbolsByTicker`
1157
+
1158
+ Get details of a symbol by the ticker
1159
+
1160
+ #### 🛠️ Usage
1161
+
1162
+ ```typescript
1163
+ const getSymbolsByTickerResponse =
1164
+ await snaptrade.referenceData.getSymbolsByTicker({
1165
+ ticker: "ticker_example",
1166
+ });
1167
+ ```
1168
+
1169
+ #### ⚙️ Parameters
1170
+
1171
+ ##### ticker: `string`
1172
+
1173
+ The ticker of the UniversalSymbol to get.
1174
+
1175
+ ##### symbolId: `string`
1176
+
1177
+ OPTIONAL IN PATH Can be used instead of the ticker ; The ID of the UniversalSymbol to get.
1178
+
1179
+ #### 🔄 Return
1180
+ [UniversalSymbol](./models/universal-symbol.ts)
1181
+
1182
+ #### 🌐 Endpoint
1183
+
1184
+ `/symbols/{ticker}` `GET`
1185
+
1186
+ [🔙 Back to Table of Contents](#table-of-contents)
1187
+
1188
+ ---
1189
+
1190
+
1191
+ ### `snaptrade.referenceData.listAllBrokerageAuthorizationType`
1192
+
1193
+ List of all brokerage authorization types
1194
+
1195
+ #### 🛠️ Usage
1196
+
1197
+ ```typescript
1198
+ const listAllBrokerageAuthorizationTypeResponse =
1199
+ await snaptrade.referenceData.listAllBrokerageAuthorizationType({
1200
+ brokerage: "QUESTRADE,ALPACA",
1201
+ });
1202
+ ```
1203
+
1204
+ #### ⚙️ Parameters
1205
+
1206
+ ##### brokerage: `string`
1207
+
1208
+ Comma separated value of brokerage slugs
1209
+
1210
+ #### 🔄 Return
1211
+ [BrokerageAuthorizationTypeReadOnly](./models/brokerage-authorization-type-read-only.ts)
1212
+
1213
+ #### 🌐 Endpoint
1214
+
1215
+ `/brokerageAuthorizationTypes` `GET`
1216
+
1217
+ [🔙 Back to Table of Contents](#table-of-contents)
1218
+
1219
+ ---
1220
+
1221
+
1222
+ ### `snaptrade.referenceData.listAllBrokerages`
1223
+
1224
+ List brokerages
1225
+
1226
+ #### 🛠️ Usage
1227
+
1228
+ ```typescript
1229
+ const listAllBrokeragesResponse =
1230
+ await snaptrade.referenceData.listAllBrokerages();
1231
+ ```
1232
+
1233
+ #### 🔄 Return
1234
+ [Brokerage](./models/brokerage.ts)
1235
+
1236
+ #### 🌐 Endpoint
1237
+
1238
+ `/brokerages` `GET`
1239
+
1240
+ [🔙 Back to Table of Contents](#table-of-contents)
1241
+
1242
+ ---
1243
+
1244
+
1245
+ ### `snaptrade.referenceData.listAllCurrencies`
1246
+
1247
+ List currencies
1248
+
1249
+ #### 🛠️ Usage
1250
+
1251
+ ```typescript
1252
+ const listAllCurrenciesResponse =
1253
+ await snaptrade.referenceData.listAllCurrencies();
1254
+ ```
1255
+
1256
+ #### 🔄 Return
1257
+ [Currency](./models/currency.ts)
1258
+
1259
+ #### 🌐 Endpoint
1260
+
1261
+ `/currencies` `GET`
1262
+
1263
+ [🔙 Back to Table of Contents](#table-of-contents)
1264
+
1265
+ ---
1266
+
1267
+
1268
+ ### `snaptrade.referenceData.listAllCurrenciesRates`
1269
+
1270
+ List currency exchange rates
1271
+
1272
+ #### 🛠️ Usage
1273
+
1274
+ ```typescript
1275
+ const listAllCurrenciesRatesResponse =
1276
+ await snaptrade.referenceData.listAllCurrenciesRates();
1277
+ ```
1278
+
1279
+ #### 🔄 Return
1280
+ [ExchangeRatePairs](./models/exchange-rate-pairs.ts)
1281
+
1282
+ #### 🌐 Endpoint
1283
+
1284
+ `/currencies/rates` `GET`
1285
+
1286
+ [🔙 Back to Table of Contents](#table-of-contents)
1287
+
1288
+ ---
1289
+
1290
+
1291
+ ### `snaptrade.referenceData.symbolSearchUserAccount`
1292
+
1293
+ Search for symbols available in an account
1294
+
1295
+ #### 🛠️ Usage
1296
+
1297
+ ```typescript
1298
+ const symbolSearchUserAccountResponse =
1299
+ await snaptrade.referenceData.symbolSearchUserAccount({
1300
+ userId: "John.doe@snaptrade.com",
1301
+ userSecret: "USERSECRET123",
1302
+ accountId: "accountId_example",
1303
+ substring: "apple",
1304
+ });
1305
+ ```
1306
+
1307
+ #### ⚙️ Parameters
1308
+
1309
+ ##### userId: `string`
1310
+
1311
+ ##### userSecret: `string`
1312
+
1313
+ ##### accountId: `string`
1314
+
1315
+ The ID of the account get positions.
1316
+
1317
+ ##### substring: `string`
1318
+
1319
+ #### 🔄 Return
1320
+ [UniversalSymbol](./models/universal-symbol.ts)
1321
+
1322
+ #### 🌐 Endpoint
1323
+
1324
+ `/accounts/{accountId}/symbols` `POST`
1325
+
1326
+ [🔙 Back to Table of Contents](#table-of-contents)
1327
+
1328
+ ---
1329
+
1330
+
1331
+ ### `snaptrade.trading.cancelUserAccountOrder`
1332
+
1333
+ Cancel open order in account
1334
+
1335
+ #### 🛠️ Usage
1336
+
1337
+ ```typescript
1338
+ const cancelUserAccountOrderResponse =
1339
+ await snaptrade.trading.cancelUserAccountOrder({
1340
+ userId: "John.doe@snaptrade.com",
1341
+ userSecret: "USERSECRET123",
1342
+ accountId: "accountId_example",
1343
+ brokerage_order_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1344
+ });
1345
+ ```
1346
+
1347
+ #### ⚙️ Parameters
1348
+
1349
+ ##### userId: `string`
1350
+
1351
+ ##### userSecret: `string`
1352
+
1353
+ ##### accountId: `string`
1354
+
1355
+ The ID of the account get positions.
1356
+
1357
+ ##### brokerageOrderId: `string`
1358
+
1359
+ #### 🔄 Return
1360
+ [AccountOrderRecord](./models/account-order-record.ts)
1361
+
1362
+ #### 🌐 Endpoint
1363
+
1364
+ `/accounts/{accountId}/orders/cancel` `POST`
1365
+
1366
+ [🔙 Back to Table of Contents](#table-of-contents)
1367
+
1368
+ ---
1369
+
1370
+
1371
+ ### `snaptrade.trading.getOrderImpact`
1372
+
1373
+ Check impact of trades on account.
1374
+
1375
+ #### 🛠️ Usage
1376
+
1377
+ ```typescript
1378
+ const getOrderImpactResponse = await snaptrade.trading.getOrderImpact({
1379
+ userId: "John.doe@snaptrade.com",
1380
+ userSecret: "USERSECRET123",
1381
+ account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1382
+ action: "BUY",
1383
+ order_type: "Limit",
1384
+ price: 31.33,
1385
+ stop: 31.33,
1386
+ time_in_force: "Day",
1387
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1388
+ });
1389
+ ```
1390
+
1391
+ #### ⚙️ Parameters
1392
+
1393
+ ##### userId: `string`
1394
+
1395
+ ##### userSecret: `string`
1396
+
1397
+ ##### accountId: `string`
1398
+
1399
+ ##### action:
1400
+
1401
+ ##### orderType:
1402
+
1403
+ ##### price: `number`
1404
+
1405
+ Trade Price if limit or stop limit order
1406
+
1407
+ ##### stop: `number`
1408
+
1409
+ Stop Price. If stop loss or stop limit order, the price to trigger the stop
1410
+
1411
+ ##### timeInForce:
1412
+
1413
+ ##### units: `number`
1414
+
1415
+ Trade Units
1416
+
1417
+ ##### universalSymbolId: `string`
1418
+
1419
+ #### 🔄 Return
1420
+ [ManualTradeAndImpact](./models/manual-trade-and-impact.ts)
1421
+
1422
+ #### 🌐 Endpoint
1423
+
1424
+ `/trade/impact` `POST`
1425
+
1426
+ [🔙 Back to Table of Contents](#table-of-contents)
1427
+
1428
+ ---
1429
+
1430
+
1431
+ ### `snaptrade.trading.getUserAccountQuotes`
1432
+
1433
+ Get symbol quotes
1434
+
1435
+ #### 🛠️ Usage
1436
+
1437
+ ```typescript
1438
+ const getUserAccountQuotesResponse =
1439
+ await snaptrade.trading.getUserAccountQuotes({
1440
+ userId: "John.doe@snaptrade.com",
1441
+ userSecret: "USERSECRET123",
1442
+ symbols: "symbols_example",
1443
+ accountId: "accountId_example",
1444
+ });
1445
+ ```
1446
+
1447
+ #### ⚙️ Parameters
1448
+
1449
+ ##### userId: `string`
1450
+
1451
+ ##### userSecret: `string`
1452
+
1453
+ ##### symbols: `string`
1454
+
1455
+ List of universal_symbol_id or tickers to get quotes for.
1456
+
1457
+ ##### accountId: `string`
1458
+
1459
+ The ID of the account to get quotes.
1460
+
1461
+ ##### useTicker: `boolean`
1462
+
1463
+ Should be set to True if providing tickers.
1464
+
1465
+ #### 🌐 Endpoint
1466
+
1467
+ `/accounts/{accountId}/quotes` `GET`
1468
+
1469
+ [🔙 Back to Table of Contents](#table-of-contents)
1470
+
1471
+ ---
1472
+
1473
+
1474
+ ### `snaptrade.trading.placeForceOrder`
1475
+
1476
+ Place a trade with NO validation.
1477
+
1478
+ #### 🛠️ Usage
1479
+
1480
+ ```typescript
1481
+ const placeForceOrderResponse = await snaptrade.trading.placeForceOrder({
1482
+ userId: "John.doe@snaptrade.com",
1483
+ userSecret: "USERSECRET123",
1484
+ account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1485
+ action: "BUY",
1486
+ order_type: "Limit",
1487
+ price: 31.33,
1488
+ stop: 31.33,
1489
+ time_in_force: "Day",
1490
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
1491
+ });
1492
+ ```
1493
+
1494
+ #### ⚙️ Parameters
1495
+
1496
+ ##### userId: `string`
1497
+
1498
+ ##### userSecret: `string`
1499
+
1500
+ ##### accountId: `string`
1501
+
1502
+ ##### action:
1503
+
1504
+ ##### orderType:
1505
+
1506
+ ##### price: `number`
1507
+
1508
+ Trade Price if limit or stop limit order
1509
+
1510
+ ##### stop: `number`
1511
+
1512
+ Stop Price. If stop loss or stop limit order, the price to trigger the stop
1513
+
1514
+ ##### timeInForce:
1515
+
1516
+ ##### units: `number`
1517
+
1518
+ Trade Units
1519
+
1520
+ ##### universalSymbolId: `string`
1521
+
1522
+ #### 🔄 Return
1523
+ [AccountOrderRecord](./models/account-order-record.ts)
1524
+
1525
+ #### 🌐 Endpoint
1526
+
1527
+ `/trade/place` `POST`
1528
+
1529
+ [🔙 Back to Table of Contents](#table-of-contents)
1530
+
1531
+ ---
1532
+
1533
+
1534
+ ### `snaptrade.trading.placeOCOOrder`
1535
+
1536
+ Place a OCO (One Cancels Other) order
1537
+
1538
+ #### 🛠️ Usage
1539
+
1540
+ ```typescript
1541
+ const placeOCOOrderResponse = await snaptrade.trading.placeOCOOrder({
1542
+ userId: "John.doe@snaptrade.com",
1543
+ userSecret: "USERSECRET123",
1544
+ });
1545
+ ```
1546
+
1547
+ #### ⚙️ Parameters
1548
+
1549
+ ##### userId: `string`
1550
+
1551
+ ##### userSecret: `string`
1552
+
1553
+ ##### firstTradeId:
1554
+
1555
+ The ID of first trade object obtained from trade/impact endpoint
1556
+
1557
+ ##### secondTradeId:
1558
+
1559
+ The ID of second trade object obtained from trade/impact endpoint
1560
+
1561
+ #### 🔄 Return
1562
+ [AccountOrderRecord](./models/account-order-record.ts)
1563
+
1564
+ #### 🌐 Endpoint
1565
+
1566
+ `/trade/oco` `POST`
1567
+
1568
+ [🔙 Back to Table of Contents](#table-of-contents)
1569
+
1570
+ ---
1571
+
1572
+
1573
+ ### `snaptrade.trading.placeOrder`
1574
+
1575
+ Place order
1576
+
1577
+ #### 🛠️ Usage
1578
+
1579
+ ```typescript
1580
+ const placeOrderResponse = await snaptrade.trading.placeOrder({
1581
+ tradeId: "tradeId_example",
1582
+ userId: "John.doe@snaptrade.com",
1583
+ userSecret: "USERSECRET123",
1584
+ });
1585
+ ```
1586
+
1587
+ #### ⚙️ Parameters
1588
+
1589
+ ##### tradeId: `string`
1590
+
1591
+ The ID of trade object obtained from trade/impact endpoint
1592
+
1593
+ ##### userId: `string`
1594
+
1595
+ ##### userSecret: `string`
1596
+
1597
+ #### 🔄 Return
1598
+ [AccountOrderRecord](./models/account-order-record.ts)
1599
+
1600
+ #### 🌐 Endpoint
1601
+
1602
+ `/trade/{tradeId}` `POST`
1603
+
1604
+ [🔙 Back to Table of Contents](#table-of-contents)
1605
+
1606
+ ---
1607
+
1608
+
1609
+ ### `snaptrade.transactionsAndReporting.getActivities`
1610
+
1611
+ Returns activities (transactions) for a user. Specifing start and end date is highly recommended for automatic calls for better performance
1612
+
1613
+ #### 🛠️ Usage
1614
+
1615
+ ```typescript
1616
+ const getActivitiesResponse =
1617
+ await snaptrade.transactionsAndReporting.getActivities({
1618
+ startDate: "2022-01-24",
1619
+ endDate: "2022-01-24",
1620
+ accounts:
1621
+ "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
1622
+ brokerageAuthorizations:
1623
+ "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
1624
+ type: "DIVIDEND",
1625
+ userId: "John.doe@snaptrade.com",
1626
+ userSecret: "USERSECRET123",
1627
+ });
1628
+ ```
1629
+
1630
+ #### ⚙️ Parameters
1631
+
1632
+ ##### userId: `string`
1633
+
1634
+ ##### userSecret: `string`
1635
+
1636
+ ##### startDate: `string | Date`
1637
+
1638
+ ##### endDate: `string | Date`
1639
+
1640
+ ##### accounts: `string`
1641
+
1642
+ Optional comma seperated list of account IDs used to filter the request on specific accounts
1643
+
1644
+ ##### brokerageAuthorizations: `string`
1645
+
1646
+ Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations
1647
+
1648
+ ##### type: `string`
1649
+
1650
+ Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT
1651
+
1652
+ #### 🔄 Return
1653
+ [UniversalActivity](./models/universal-activity.ts)
1654
+
1655
+ #### 🌐 Endpoint
1656
+
1657
+ `/activities` `GET`
1658
+
1659
+ [🔙 Back to Table of Contents](#table-of-contents)
1660
+
1661
+ ---
1662
+
1663
+
1664
+ ### `snaptrade.transactionsAndReporting.getReportingCustomRange`
1665
+
1666
+ Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Total Equity Timeframe and Rate of Returns are experimental and should not be trusted to be 100% accurate
1667
+
1668
+ #### 🛠️ Usage
1669
+
1670
+ ```typescript
1671
+ const getReportingCustomRangeResponse =
1672
+ await snaptrade.transactionsAndReporting.getReportingCustomRange({
1673
+ startDate: "2022-01-24",
1674
+ endDate: "2022-01-24",
1675
+ accounts:
1676
+ "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
1677
+ detailed: true,
1678
+ frequency: "monthly",
1679
+ userId: "John.doe@snaptrade.com",
1680
+ userSecret: "USERSECRET123",
1681
+ });
1682
+ ```
1683
+
1684
+ #### ⚙️ Parameters
1685
+
1686
+ ##### startDate: `string | Date`
1687
+
1688
+ ##### endDate: `string | Date`
1689
+
1690
+ ##### userId: `string`
1691
+
1692
+ ##### userSecret: `string`
1693
+
1694
+ ##### accounts: `string`
1695
+
1696
+ Optional comma seperated list of account IDs used to filter the request on specific accounts
1697
+
1698
+ ##### detailed: `boolean`
1699
+
1700
+ Optional, increases frequency of data points for the total value and contribution charts if set to true
1701
+
1702
+ ##### frequency: `string`
1703
+
1704
+ Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly.
1705
+
1706
+ #### 🔄 Return
1707
+ [PerformanceCustom](./models/performance-custom.ts)
1708
+
1709
+ #### 🌐 Endpoint
1710
+
1711
+ `/performance/custom` `GET`
1712
+
1713
+ [🔙 Back to Table of Contents](#table-of-contents)
1714
+
1715
+ ---
1716
+
1717
+
1718
+ ## Author
1719
+ This TypeScript package is automatically generated by [Konfig](https://konfigthis.com)