@tastytrade/api 3.0.0 → 4.0.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.
- package/.vscode/launch.json +29 -0
- package/CHANGELOG.md +26 -0
- package/CODEOWNERS +1 -0
- package/README.md +4 -2
- package/dist/account-streamer.d.ts +7 -6
- package/dist/account-streamer.d.ts.map +1 -0
- package/dist/account-streamer.js +145 -228
- package/dist/account-streamer.js.map +1 -0
- package/dist/market-data-streamer.d.ts +7 -5
- package/dist/market-data-streamer.d.ts.map +1 -0
- package/dist/market-data-streamer.js +139 -172
- package/dist/market-data-streamer.js.map +1 -0
- package/dist/models/tastytrade-session.d.ts +1 -0
- package/dist/models/tastytrade-session.d.ts.map +1 -0
- package/dist/models/tastytrade-session.js +10 -20
- package/dist/models/tastytrade-session.js.map +1 -0
- package/dist/services/account-status-service.d.ts +2 -1
- package/dist/services/account-status-service.d.ts.map +1 -0
- package/dist/services/account-status-service.js +12 -61
- package/dist/services/account-status-service.js.map +1 -0
- package/dist/services/accounts-and-customers-service.d.ts +2 -1
- package/dist/services/accounts-and-customers-service.d.ts.map +1 -0
- package/dist/services/accounts-and-customers-service.js +29 -112
- package/dist/services/accounts-and-customers-service.js.map +1 -0
- package/dist/services/balances-and-positions-service.d.ts +2 -1
- package/dist/services/balances-and-positions-service.d.ts.map +1 -0
- package/dist/services/balances-and-positions-service.js +22 -88
- package/dist/services/balances-and-positions-service.js.map +1 -0
- package/dist/services/instruments-service.d.ts +2 -1
- package/dist/services/instruments-service.d.ts.map +1 -0
- package/dist/services/instruments-service.js +130 -365
- package/dist/services/instruments-service.js.map +1 -0
- package/dist/services/margin-requirements-service.d.ts +2 -1
- package/dist/services/margin-requirements-service.d.ts.map +1 -0
- package/dist/services/margin-requirements-service.js +16 -73
- package/dist/services/margin-requirements-service.js.map +1 -0
- package/dist/services/market-metrics-service.d.ts +2 -1
- package/dist/services/market-metrics-service.d.ts.map +1 -0
- package/dist/services/market-metrics-service.js +21 -88
- package/dist/services/market-metrics-service.js.map +1 -0
- package/dist/services/net-liquidating-value-history-service.d.ts +2 -1
- package/dist/services/net-liquidating-value-history-service.d.ts.map +1 -0
- package/dist/services/net-liquidating-value-history-service.js +16 -74
- package/dist/services/net-liquidating-value-history-service.js.map +1 -0
- package/dist/services/orders-service.d.ts +4 -1
- package/dist/services/orders-service.d.ts.map +1 -0
- package/dist/services/orders-service.js +76 -205
- package/dist/services/orders-service.js.map +1 -0
- package/dist/services/risk-parameters-service.d.ts +2 -1
- package/dist/services/risk-parameters-service.d.ts.map +1 -0
- package/dist/services/risk-parameters-service.js +16 -73
- package/dist/services/risk-parameters-service.js.map +1 -0
- package/dist/services/session-service.d.ts +2 -1
- package/dist/services/session-service.d.ts.map +1 -0
- package/dist/services/session-service.js +30 -110
- package/dist/services/session-service.js.map +1 -0
- package/dist/services/symbol-search-service.d.ts +2 -1
- package/dist/services/symbol-search-service.d.ts.map +1 -0
- package/dist/services/symbol-search-service.js +11 -60
- package/dist/services/symbol-search-service.js.map +1 -0
- package/dist/services/tastytrade-http-client.d.ts +2 -2
- package/dist/services/tastytrade-http-client.d.ts.map +1 -0
- package/dist/services/tastytrade-http-client.js +51 -133
- package/dist/services/tastytrade-http-client.js.map +1 -0
- package/dist/services/transactions-service.d.ts +2 -1
- package/dist/services/transactions-service.d.ts.map +1 -0
- package/dist/services/transactions-service.js +22 -87
- package/dist/services/transactions-service.js.map +1 -0
- package/dist/services/watchlists-service.d.ts +2 -1
- package/dist/services/watchlists-service.d.ts.map +1 -0
- package/dist/services/watchlists-service.js +51 -165
- package/dist/services/watchlists-service.js.map +1 -0
- package/dist/tastytrade-api.d.ts +20 -19
- package/dist/tastytrade-api.d.ts.map +1 -0
- package/dist/tastytrade-api.js +41 -77
- package/dist/tastytrade-api.js.map +1 -0
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +2 -4
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/json-util.d.ts +4 -3
- package/dist/utils/json-util.d.ts.map +1 -0
- package/dist/utils/json-util.js +14 -25
- package/dist/utils/json-util.js.map +1 -0
- package/dist/utils/response-util.d.ts +1 -0
- package/dist/utils/response-util.d.ts.map +1 -0
- package/dist/utils/response-util.js +7 -12
- package/dist/utils/response-util.js.map +1 -0
- package/lib/account-streamer.ts +4 -4
- package/lib/market-data-streamer.ts +5 -1
- package/lib/services/account-status-service.ts +3 -3
- package/lib/services/accounts-and-customers-service.ts +2 -2
- package/lib/services/balances-and-positions-service.ts +2 -2
- package/lib/services/instruments-service.ts +2 -2
- package/lib/services/margin-requirements-service.ts +2 -2
- package/lib/services/market-metrics-service.ts +2 -2
- package/lib/services/net-liquidating-value-history-service.ts +2 -2
- package/lib/services/orders-service.ts +14 -2
- package/lib/services/risk-parameters-service.ts +2 -2
- package/lib/services/session-service.ts +2 -2
- package/lib/services/symbol-search-service.ts +2 -2
- package/lib/services/tastytrade-http-client.ts +15 -13
- package/lib/services/transactions-service.ts +2 -2
- package/lib/services/watchlists-service.ts +2 -2
- package/lib/tastytrade-api.ts +19 -19
- package/package.json +14 -9
- package/tsconfig.json +12 -11
|
@@ -1,64 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var response_util_1 = __importDefault(require("../utils/response-util"));
|
|
43
|
-
// create the central class that aggregates all services from dmoss
|
|
44
|
-
var AccountStatusService = /** @class */ (function () {
|
|
45
|
-
function AccountStatusService(httpClient) {
|
|
1
|
+
import extractResponseData from "../utils/response-util.js";
|
|
2
|
+
import TastytradeHttpClient from "./tastytrade-http-client.js";
|
|
3
|
+
// create the central class that aggregates all services
|
|
4
|
+
export default class AccountStatusService {
|
|
5
|
+
constructor(httpClient) {
|
|
46
6
|
this.httpClient = httpClient;
|
|
47
7
|
}
|
|
48
8
|
//Trading Status: Allows an API client to request information about the basic trade status of an account. This includes information about the strategies an account can trade.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
accountStatus = (_a.sent());
|
|
57
|
-
return [2 /*return*/, (0, response_util_1.default)(accountStatus)];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
return AccountStatusService;
|
|
63
|
-
}());
|
|
64
|
-
exports.default = AccountStatusService;
|
|
9
|
+
async getAccountStatus(accountNumber) {
|
|
10
|
+
//Returns current trading status for an account.
|
|
11
|
+
const accountStatus = (await this.httpClient.getData(`/accounts/${accountNumber}/trading-status`, {}, {}));
|
|
12
|
+
return extractResponseData(accountStatus);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=account-status-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-status-service.js","sourceRoot":"","sources":["../../lib/services/account-status-service.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,2BAA2B,CAAC;AAC5D,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAE/D,wDAAwD;AACxD,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACrC,YAAoB,UAAgC;QAAhC,eAAU,GAAV,UAAU,CAAsB;IACpD,CAAC;IAED,+KAA+K;IAC/K,KAAK,CAAC,gBAAgB,CAAC,aAAqB;QACxC,gDAAgD;QAChD,MAAM,aAAa,GAAI,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,aAAa,aAAa,iBAAiB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QAC3G,OAAO,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAC7C,CAAC;CACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import TastytradeHttpClient from "./tastytrade-http-client";
|
|
1
|
+
import TastytradeHttpClient from "./tastytrade-http-client.js";
|
|
2
2
|
export default class AccountsAndCustomersService {
|
|
3
3
|
private httpClient;
|
|
4
4
|
constructor(httpClient: TastytradeHttpClient);
|
|
@@ -8,3 +8,4 @@ export default class AccountsAndCustomersService {
|
|
|
8
8
|
getFullCustomerAccountResource(accountNumber: string): Promise<any>;
|
|
9
9
|
getApiQuoteToken(): Promise<any>;
|
|
10
10
|
}
|
|
11
|
+
//# sourceMappingURL=accounts-and-customers-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts-and-customers-service.d.ts","sourceRoot":"","sources":["../../lib/services/accounts-and-customers-service.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAE/D,MAAM,CAAC,OAAO,OAAO,2BAA2B;IAChC,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,oBAAoB;IAE9C,mBAAmB;IAMnB,mBAAmB;IAKnB,2BAA2B;IAK3B,8BAA8B,CAAC,aAAa,EAAE,MAAM;IAOpD,gBAAgB;CAIzB"}
|
|
@@ -1,116 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var response_util_1 = __importDefault(require("../utils/response-util"));
|
|
43
|
-
var AccountsAndCustomersService = /** @class */ (function () {
|
|
44
|
-
function AccountsAndCustomersService(httpClient) {
|
|
1
|
+
import extractResponseData from "../utils/response-util.js";
|
|
2
|
+
import TastytradeHttpClient from "./tastytrade-http-client.js";
|
|
3
|
+
export default class AccountsAndCustomersService {
|
|
4
|
+
constructor(httpClient) {
|
|
45
5
|
this.httpClient = httpClient;
|
|
46
6
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
switch (_a.label) {
|
|
52
|
-
case 0: return [4 /*yield*/, this.httpClient.getData('/customers/me/accounts', {}, {})];
|
|
53
|
-
case 1:
|
|
54
|
-
accountNumber = (_a.sent());
|
|
55
|
-
return [2 /*return*/, (0, response_util_1.default)(accountNumber)];
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
};
|
|
7
|
+
async getCustomerAccounts() {
|
|
8
|
+
const accountNumber = (await this.httpClient.getData('/customers/me/accounts', {}, {}));
|
|
9
|
+
return extractResponseData(accountNumber);
|
|
10
|
+
}
|
|
60
11
|
//Customers: Operations about customers
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var customerAccountResources;
|
|
77
|
-
return __generator(this, function (_a) {
|
|
78
|
-
switch (_a.label) {
|
|
79
|
-
case 0: return [4 /*yield*/, this.httpClient.getData("/customers/me/accounts", {}, {})];
|
|
80
|
-
case 1:
|
|
81
|
-
customerAccountResources = (_a.sent());
|
|
82
|
-
return [2 /*return*/, (0, response_util_1.default)(customerAccountResources)];
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
AccountsAndCustomersService.prototype.getFullCustomerAccountResource = function (accountNumber) {
|
|
88
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
-
var fullCustomerAccountResource;
|
|
90
|
-
return __generator(this, function (_a) {
|
|
91
|
-
switch (_a.label) {
|
|
92
|
-
case 0: return [4 /*yield*/, this.httpClient.getData("/customers/me/accounts/".concat(accountNumber), {}, {})];
|
|
93
|
-
case 1:
|
|
94
|
-
fullCustomerAccountResource = (_a.sent());
|
|
95
|
-
return [2 /*return*/, (0, response_util_1.default)(fullCustomerAccountResource)];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
12
|
+
async getCustomerResource() {
|
|
13
|
+
//Get a full customer resource.
|
|
14
|
+
const customerResource = (await this.httpClient.getData(`/customers/me`, {}, {}));
|
|
15
|
+
return extractResponseData(customerResource);
|
|
16
|
+
}
|
|
17
|
+
async getCustomerAccountResources() {
|
|
18
|
+
//Get a list of all the customer account resources attached to the current customer.
|
|
19
|
+
const customerAccountResources = (await this.httpClient.getData(`/customers/me/accounts`, {}, {}));
|
|
20
|
+
return extractResponseData(customerAccountResources);
|
|
21
|
+
}
|
|
22
|
+
async getFullCustomerAccountResource(accountNumber) {
|
|
23
|
+
//Get a full customer account resource.
|
|
24
|
+
const fullCustomerAccountResource = (await this.httpClient.getData(`/customers/me/accounts/${accountNumber}`, {}, {}));
|
|
25
|
+
return extractResponseData(fullCustomerAccountResource);
|
|
26
|
+
}
|
|
100
27
|
//Returns the appropriate quote streamer endpoint, level and identification token for the current customer to receive market data.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
case 1:
|
|
108
|
-
apiQuoteToken = (_a.sent());
|
|
109
|
-
return [2 /*return*/, (0, response_util_1.default)(apiQuoteToken)];
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
return AccountsAndCustomersService;
|
|
115
|
-
}());
|
|
116
|
-
exports.default = AccountsAndCustomersService;
|
|
28
|
+
async getApiQuoteToken() {
|
|
29
|
+
const apiQuoteToken = (await this.httpClient.getData('/api-quote-tokens', {}, {}));
|
|
30
|
+
return extractResponseData(apiQuoteToken);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=accounts-and-customers-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts-and-customers-service.js","sourceRoot":"","sources":["../../lib/services/accounts-and-customers-service.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,2BAA2B,CAAC;AAC5D,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAE/D,MAAM,CAAC,OAAO,OAAO,2BAA2B;IAC5C,YAAoB,UAAgC;QAAhC,eAAU,GAAV,UAAU,CAAsB;IACpD,CAAC;IACD,KAAK,CAAC,mBAAmB;QACrB,MAAM,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QACvF,OAAO,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAC7C,CAAC;IAED,uCAAuC;IACvC,KAAK,CAAC,mBAAmB;QACrB,+BAA+B;QAC/B,MAAM,gBAAgB,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QACjF,OAAO,mBAAmB,CAAC,gBAAgB,CAAC,CAAA;IAChD,CAAC;IACD,KAAK,CAAC,2BAA2B;QAC7B,oFAAoF;QACpF,MAAM,wBAAwB,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QAClG,OAAO,mBAAmB,CAAC,wBAAwB,CAAC,CAAA;IACxD,CAAC;IACD,KAAK,CAAC,8BAA8B,CAAC,aAAqB;QACtD,uCAAuC;QACvC,MAAM,2BAA2B,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,0BAA0B,aAAa,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QACtH,OAAO,mBAAmB,CAAC,2BAA2B,CAAC,CAAA;IAC3D,CAAC;IAED,kIAAkI;IAClI,KAAK,CAAC,gBAAgB;QAClB,MAAM,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QAClF,OAAO,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAC7C,CAAC;CACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import TastytradeHttpClient from "./tastytrade-http-client";
|
|
1
|
+
import TastytradeHttpClient from "./tastytrade-http-client.js";
|
|
2
2
|
export default class BalancesAndPositionsService {
|
|
3
3
|
private httpClient;
|
|
4
4
|
constructor(httpClient: TastytradeHttpClient);
|
|
@@ -6,3 +6,4 @@ export default class BalancesAndPositionsService {
|
|
|
6
6
|
getAccountBalanceValues(accountNumber: string): Promise<any>;
|
|
7
7
|
getBalanceSnapshots(accountNumber: string, queryParams?: {}): Promise<any>;
|
|
8
8
|
}
|
|
9
|
+
//# sourceMappingURL=balances-and-positions-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balances-and-positions-service.d.ts","sourceRoot":"","sources":["../../lib/services/balances-and-positions-service.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAE/D,MAAM,CAAC,OAAO,OAAO,2BAA2B;IAChC,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,oBAAoB;IAI9C,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,KAAK;IAQxD,uBAAuB,CAAC,aAAa,EAAE,MAAM;IAO7C,mBAAmB,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,KAAK;CAKpE"}
|
|
@@ -1,93 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var response_util_1 = __importDefault(require("../utils/response-util"));
|
|
43
|
-
var BalancesAndPositionsService = /** @class */ (function () {
|
|
44
|
-
function BalancesAndPositionsService(httpClient) {
|
|
1
|
+
import extractResponseData from "../utils/response-util.js";
|
|
2
|
+
import TastytradeHttpClient from "./tastytrade-http-client.js";
|
|
3
|
+
export default class BalancesAndPositionsService {
|
|
4
|
+
constructor(httpClient) {
|
|
45
5
|
this.httpClient = httpClient;
|
|
46
6
|
}
|
|
47
7
|
//Positions: Operations about positions
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
case 0: return [4 /*yield*/, this.httpClient.getData("/accounts/".concat(accountNumber, "/positions"), {}, queryParams)];
|
|
55
|
-
case 1:
|
|
56
|
-
positionsList = (_a.sent());
|
|
57
|
-
return [2 /*return*/, (0, response_util_1.default)(positionsList)];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
};
|
|
8
|
+
async getPositionsList(accountNumber, queryParams = {}) {
|
|
9
|
+
//Returns a list of the account's positions.
|
|
10
|
+
//Can be filtered by symbol, underlying_symbol
|
|
11
|
+
const positionsList = (await this.httpClient.getData(`/accounts/${accountNumber}/positions`, {}, queryParams));
|
|
12
|
+
return extractResponseData(positionsList);
|
|
13
|
+
}
|
|
62
14
|
//Accounts: Operations about accounts
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
case 0: return [4 /*yield*/, this.httpClient.getData("/accounts/".concat(accountNumber, "/balances"), {}, {})];
|
|
69
|
-
case 1:
|
|
70
|
-
accountBalanceValues = (_a.sent());
|
|
71
|
-
return [2 /*return*/, (0, response_util_1.default)(accountBalanceValues)];
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
};
|
|
15
|
+
async getAccountBalanceValues(accountNumber) {
|
|
16
|
+
//Returns the current balance values for an account
|
|
17
|
+
const accountBalanceValues = (await this.httpClient.getData(`/accounts/${accountNumber}/balances`, {}, {}));
|
|
18
|
+
return extractResponseData(accountBalanceValues);
|
|
19
|
+
}
|
|
76
20
|
//Balance-snapshots Operations about balance-snapshots
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
case 1:
|
|
85
|
-
balanceSnapshot = (_a.sent());
|
|
86
|
-
return [2 /*return*/, (0, response_util_1.default)(balanceSnapshot)];
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
return BalancesAndPositionsService;
|
|
92
|
-
}());
|
|
93
|
-
exports.default = BalancesAndPositionsService;
|
|
21
|
+
async getBalanceSnapshots(accountNumber, queryParams = {}) {
|
|
22
|
+
//Returns most recent snapshot and current balance for an account
|
|
23
|
+
const balanceSnapshot = (await this.httpClient.getData(`/accounts/${accountNumber}/balance-snapshots`, {}, queryParams));
|
|
24
|
+
return extractResponseData(balanceSnapshot);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=balances-and-positions-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balances-and-positions-service.js","sourceRoot":"","sources":["../../lib/services/balances-and-positions-service.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,2BAA2B,CAAC;AAC5D,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAE/D,MAAM,CAAC,OAAO,OAAO,2BAA2B;IAC5C,YAAoB,UAAgC;QAAhC,eAAU,GAAV,UAAU,CAAsB;IACpD,CAAC;IAED,uCAAuC;IACvC,KAAK,CAAC,gBAAgB,CAAC,aAAqB,EAAE,WAAW,GAAG,EAAE;QAC1D,4CAA4C;QAC5C,8CAA8C;QAC9C,MAAM,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,aAAa,aAAa,YAAY,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,CAAA;QAC9G,OAAO,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAC7C,CAAC;IAED,qCAAqC;IACrC,KAAK,CAAC,uBAAuB,CAAC,aAAqB;QAC/C,mDAAmD;QACnD,MAAM,oBAAoB,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,aAAa,aAAa,WAAW,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QAC3G,OAAO,mBAAmB,CAAC,oBAAoB,CAAC,CAAA;IACpD,CAAC;IAED,sDAAsD;IACtD,KAAK,CAAC,mBAAmB,CAAC,aAAqB,EAAE,WAAW,GAAG,EAAE;QAC7D,iEAAiE;QACjE,MAAM,eAAe,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,aAAa,aAAa,oBAAoB,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,CAAA;QACxH,OAAO,mBAAmB,CAAC,eAAe,CAAC,CAAA;IAC/C,CAAC;CACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import TastytradeHttpClient from "./tastytrade-http-client";
|
|
1
|
+
import TastytradeHttpClient from "./tastytrade-http-client.js";
|
|
2
2
|
export default class InstrumentsService {
|
|
3
3
|
private httpClient;
|
|
4
4
|
constructor(httpClient: TastytradeHttpClient);
|
|
@@ -26,3 +26,4 @@ export default class InstrumentsService {
|
|
|
26
26
|
getCompactOptionChain(symbol: string): Promise<any>;
|
|
27
27
|
getOptionChain(symbol: string): Promise<any>;
|
|
28
28
|
}
|
|
29
|
+
//# sourceMappingURL=instruments-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instruments-service.d.ts","sourceRoot":"","sources":["../../lib/services/instruments-service.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAG/D,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACvB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,oBAAoB;IAI9C,mBAAmB,CAAC,OAAO,GAAE,MAAM,EAAO;IAM1C,uBAAuB,CAAC,MAAM,EAAE,MAAM;IAMtC,iBAAiB,CAAC,WAAW,KAAK;IAKlC,oBAAoB,CAAC,WAAW,KAAK;IAKrC,eAAe,CAAC,MAAM,EAAE,MAAM;IAK9B,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,UAAO,EAAE,WAAW,UAAQ;IAUtE,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK;IAKtD,UAAU,CAAC,WAAW,KAAK;IAK3B,eAAe,CAAC,MAAM,EAAE,MAAM;IAK9B,wBAAwB;IAKxB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAKjE,gBAAgB,CAAC,WAAW,KAAK;IAMjC,qBAAqB,CAAC,MAAM,EAAE,MAAM;IAKpC,kBAAkB;IAKlB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAKrD,4BAA4B;IAK5B,WAAW,CAAC,WAAW,KAAK;IAK5B,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAO/B,2BAA2B,CAAC,MAAM,EAAE,MAAM;IAK1C,oBAAoB,CAAC,MAAM,EAAE,MAAM;IAOnC,oBAAoB,CAAC,MAAM,EAAE,MAAM;IAMnC,qBAAqB,CAAC,MAAM,EAAE,MAAM;IAKpC,cAAc,CAAC,MAAM,EAAE,MAAM;CAKtC"}
|