@tastytrade/api 2.1.0 → 2.1.2

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.
@@ -40,6 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.AccountStreamer = exports.STREAMER_STATE = void 0;
43
+ var isomorphic_ws_1 = __importDefault(require("isomorphic-ws"));
43
44
  var lodash_1 = __importDefault(require("lodash"));
44
45
  var json_util_1 = require("./utils/json-util");
45
46
  var STREAMER_STATE;
@@ -230,7 +231,7 @@ var AccountStreamer = /** @class */ (function () {
230
231
  if (this.startPromise !== null) {
231
232
  return [2 /*return*/, this.startPromise];
232
233
  }
233
- websocket = (this.websocket = new WebSocket(this.url));
234
+ websocket = (this.websocket = new isomorphic_ws_1.default(this.url));
234
235
  this.lastCloseEvent = null;
235
236
  this.lastErrorEvent = null;
236
237
  websocket.addEventListener('open', this.handleOpen);
@@ -1,3 +1,4 @@
1
+ import WebSocket from 'isomorphic-ws'
1
2
  import _ from 'lodash'
2
3
  import type { JsonMap, JsonValue } from './utils/json-util'
3
4
  import { JsonBuilder } from './utils/json-util'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastytrade/api",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "main": "dist/tastytrade-api.js",
5
5
  "typings": "dist/tastytrade-api.d.ts",
6
6
  "repository": "https://github.com/tastytrade/tastytrade-api-js",
package/tsconfig.json CHANGED
@@ -67,5 +67,5 @@
67
67
  "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
68
68
  },
69
69
  "include": ["lib/**/*"],
70
- "exclude": ["node_modules", "dist", "tests/**/*", "examples"]
70
+ "exclude": ["node_modules", "dist", "tests/**/*", "examples", ".env", ".env.sample"]
71
71
  }
package/.env DELETED
@@ -1,4 +0,0 @@
1
- BASE_URL=https://api.cert.tastyworks.com
2
- API_USERNAME=devin.moss@tastytrade.com
3
- API_PASSWORD=rebuke-padding-vizor
4
- API_ACCOUNT_NUMBER=5WT05179
@@ -1,20 +0,0 @@
1
- {
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "type": "node",
9
- "request": "launch",
10
- "name": "Launch Program",
11
- "skipFiles": [
12
- "<node_internals>/**"
13
- ],
14
- "program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
15
- "args": [
16
- "-c", "jest.config.js", "tests/integration/service/accounts-and-customers-service.test.ts"
17
- ]
18
- }
19
- ]
20
- }
@@ -1,11 +0,0 @@
1
- import { EventType, IEvent } from '@dxfeed/api';
2
- export declare const SupportedEventTypes: EventType[];
3
- export default class QuoteStreamer {
4
- private readonly token;
5
- private readonly url;
6
- private feed;
7
- constructor(token: string, url: string);
8
- connect(): void;
9
- disconnect(): void;
10
- subscribe(dxfeedSymbol: string, eventHandler: (event: IEvent) => void): () => void;
11
- }
@@ -1,63 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.SupportedEventTypes = void 0;
30
- var api_1 = __importStar(require("@dxfeed/api"));
31
- var lodash_1 = __importDefault(require("lodash"));
32
- exports.SupportedEventTypes = [
33
- api_1.EventType.Quote,
34
- api_1.EventType.Trade,
35
- api_1.EventType.Summary,
36
- api_1.EventType.Greeks,
37
- api_1.EventType.Profile
38
- ];
39
- var QuoteStreamer = /** @class */ (function () {
40
- function QuoteStreamer(token, url) {
41
- this.token = token;
42
- this.url = url;
43
- this.feed = null;
44
- }
45
- QuoteStreamer.prototype.connect = function () {
46
- this.feed = new api_1.default();
47
- this.feed.setAuthToken(this.token);
48
- this.feed.connect(this.url);
49
- };
50
- QuoteStreamer.prototype.disconnect = function () {
51
- if (!lodash_1.default.isNil(this.feed)) {
52
- this.feed.disconnect();
53
- }
54
- };
55
- QuoteStreamer.prototype.subscribe = function (dxfeedSymbol, eventHandler) {
56
- if (lodash_1.default.isNil(this.feed)) {
57
- return lodash_1.default.noop;
58
- }
59
- return this.feed.subscribe(exports.SupportedEventTypes, [dxfeedSymbol], eventHandler);
60
- };
61
- return QuoteStreamer;
62
- }());
63
- exports.default = QuoteStreamer;