Skip to content

Commit

Permalink
Merge branch 'master' into github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoss18 authored Mar 8, 2024
2 parents adb9752 + 51803ba commit 0c27b4a
Show file tree
Hide file tree
Showing 22 changed files with 1,560 additions and 1,386 deletions.
25 changes: 19 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
setupFiles: ["dotenv/config"],
const config = {
preset: 'ts-jest/presets/default-esm',
setupFiles: ['dotenv/config'],
testEnvironment: 'node',
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transform: {
'^.+\\.ts?$': 'ts-jest',
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
},
],
},
transformIgnorePatterns: ['<rootDir>/node_modules/']
};
transformIgnorePatterns: ['<rootDir>/node_modules/'],
};

export default config;
8 changes: 4 additions & 4 deletions lib/account-streamer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import WebSocket from 'isomorphic-ws'
import _ from 'lodash'
import type { JsonMap, JsonValue } from './utils/json-util'
import { JsonBuilder } from './utils/json-util'
import TastytradeSession from './models/tastytrade-session'
import { MinTlsVersion } from './utils/constants'
import type { JsonMap, JsonValue } from './utils/json-util.js'
import { JsonBuilder } from './utils/json-util.js'
import TastytradeSession from './models/tastytrade-session.js'
import { MinTlsVersion } from './utils/constants.js'

export enum STREAMER_STATE {
Open = 0,
Expand Down
2 changes: 1 addition & 1 deletion lib/market-data-streamer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import WebSocket from 'isomorphic-ws'
import _ from 'lodash'
import { v4 as uuidv4 } from 'uuid'
import { MinTlsVersion } from './utils/constants'
import { MinTlsVersion } from './utils/constants.js'

export enum MarketDataSubscriptionType {
Candle = 'Candle',
Expand Down
4 changes: 2 additions & 2 deletions lib/services/account-status-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";

// create the central class that aggregates all services
export default class AccountStatusService {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/accounts-and-customers-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";

export default class AccountsAndCustomersService {
constructor(private httpClient: TastytradeHttpClient) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/balances-and-positions-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";

export default class BalancesAndPositionsService {
constructor(private httpClient: TastytradeHttpClient) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/instruments-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";
import _ from 'lodash'

export default class InstrumentsService {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/margin-requirements-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";

export default class MarginRequirementsService {
constructor(private httpClient: TastytradeHttpClient) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/market-metrics-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";

export default class MarketMetricsService {
constructor(private httpClient: TastytradeHttpClient) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/net-liquidating-value-history-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";

export default class NetLiquidatingValueHistoryService {
constructor(private httpClient: TastytradeHttpClient) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/orders-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";

export default class OrderService {
constructor(private httpClient: TastytradeHttpClient) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/risk-parameters-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";

export default class RiskParametersService {
constructor(private httpClient: TastytradeHttpClient) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/session-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";

export default class SessionService {
constructor(public httpClient: TastytradeHttpClient) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/symbol-search-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";

export default class SymbolSearchService {
constructor(private httpClient: TastytradeHttpClient) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/tastytrade-http-client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import TastytradeSession from "../models/tastytrade-session"
import TastytradeSession from "../models/tastytrade-session.js"
import axios from "axios"
import qs from 'qs'
import { recursiveDasherizeKeys } from "../utils/json-util"
import { recursiveDasherizeKeys } from "../utils/json-util.js"
import _ from 'lodash'

const ParamsSerializer = {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/transactions-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";

export default class TransactionsService {
constructor(private httpClient: TastytradeHttpClient) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/watchlists-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import extractResponseData from "../utils/response-util";
import TastytradeHttpClient from "./tastytrade-http-client";
import extractResponseData from "../utils/response-util.js";
import TastytradeHttpClient from "./tastytrade-http-client.js";

export default class WatchlistsService {
constructor(private httpClient: TastytradeHttpClient) {
Expand Down
38 changes: 19 additions & 19 deletions lib/tastytrade-api.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import TastytradeHttpClient from "./services/tastytrade-http-client"
import { AccountStreamer, STREAMER_STATE, Disposer, StreamerStateObserver } from './account-streamer'
import MarketDataStreamer, { CandleSubscriptionOptions, CandleType, MarketDataSubscriptionType, MarketDataListener } from "./market-data-streamer"
import TastytradeHttpClient from "./services/tastytrade-http-client.js"
import { AccountStreamer, STREAMER_STATE, type Disposer, type StreamerStateObserver } from './account-streamer.js'
import MarketDataStreamer, { type CandleSubscriptionOptions, CandleType, MarketDataSubscriptionType, type MarketDataListener } from "./market-data-streamer.js"

//Services:
import SessionService from "./services/session-service"
import AccountStatusService from "./services/account-status-service"
import AccountsAndCustomersService from "./services/accounts-and-customers-service"
import BalancesAndPositionsService from "./services/balances-and-positions-service"
import InstrumentsService from "./services/instruments-service"
import MarginRequirementsService from "./services/margin-requirements-service"
import MarketMetricsService from "./services/market-metrics-service"
import NetLiquidatingValueHistoryService from "./services/net-liquidating-value-history-service"
import OrderService from "./services/orders-service"
import RiskParametersService from "./services/risk-parameters-service"
import SymbolSearchService from "./services/symbol-search-service"
import TransactionsService from "./services/transactions-service"
import WatchlistsService from "./services/watchlists-service"
import TastytradeSession from "./models/tastytrade-session"
import SessionService from "./services/session-service.js"
import AccountStatusService from "./services/account-status-service.js"
import AccountsAndCustomersService from "./services/accounts-and-customers-service.js"
import BalancesAndPositionsService from "./services/balances-and-positions-service.js"
import InstrumentsService from "./services/instruments-service.js"
import MarginRequirementsService from "./services/margin-requirements-service.js"
import MarketMetricsService from "./services/market-metrics-service.js"
import NetLiquidatingValueHistoryService from "./services/net-liquidating-value-history-service.js"
import OrderService from "./services/orders-service.js"
import RiskParametersService from "./services/risk-parameters-service.js"
import SymbolSearchService from "./services/symbol-search-service.js"
import TransactionsService from "./services/transactions-service.js"
import WatchlistsService from "./services/watchlists-service.js"
import TastytradeSession from "./models/tastytrade-session.js"

export default class TastytradeClient {
public readonly httpClient: TastytradeHttpClient
Expand Down Expand Up @@ -61,5 +61,5 @@ export default class TastytradeClient {
}
}

export { MarketDataStreamer, MarketDataSubscriptionType, MarketDataListener, CandleSubscriptionOptions, CandleType }
export { AccountStreamer, STREAMER_STATE, Disposer, StreamerStateObserver }
export { MarketDataStreamer, MarketDataSubscriptionType, type MarketDataListener, type CandleSubscriptionOptions, CandleType }
export { AccountStreamer, STREAMER_STATE, type Disposer, type StreamerStateObserver }
Loading

0 comments on commit 0c27b4a

Please sign in to comment.