diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a955a76..e3530dc 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,8 +22,8 @@ jobs: with: node-version: '18' - - name: Install dependencies - run: yarn install + - name: Bootstrap + run: ./scripts/bootstrap - name: Check types run: ./scripts/lint @@ -41,8 +41,8 @@ jobs: with: node-version: '18' - - name: Install dependencies - run: yarn install + - name: Bootstrap + run: ./scripts/bootstrap - name: Check build run: ./scripts/build diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5375ff4..fad80ad 100755 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.6" + ".": "0.1.0-alpha.7" } diff --git a/CHANGELOG.md b/CHANGELOG.md index e15b9ac..3d94856 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 0.1.0-alpha.7 (2024-08-30) + +Full Changelog: [v0.1.0-alpha.6...v0.1.0-alpha.7](https://github.com/clear-street/studio-sdk-node/compare/v0.1.0-alpha.6...v0.1.0-alpha.7) + +### Features + +* **api:** update via SDK Studio ([#30](https://github.com/clear-street/studio-sdk-node/issues/30)) ([ad826be](https://github.com/clear-street/studio-sdk-node/commit/ad826be6ea6678b03691ab72e9eb89f882772be9)) +* **api:** update via SDK Studio ([#31](https://github.com/clear-street/studio-sdk-node/issues/31)) ([6138a55](https://github.com/clear-street/studio-sdk-node/commit/6138a557b80a6cae32b1dcb2ae27d38f223e60bd)) + + +### Chores + +* **ci:** install deps via ./script/bootstrap ([#29](https://github.com/clear-street/studio-sdk-node/issues/29)) ([19b9d30](https://github.com/clear-street/studio-sdk-node/commit/19b9d3003c642234a8180f9ec82573fd1957e082)) +* run tsc as part of lint script ([#27](https://github.com/clear-street/studio-sdk-node/issues/27)) ([c2e864b](https://github.com/clear-street/studio-sdk-node/commit/c2e864b0f771fc58d577eb32b36bdd1f986e7ccc)) + ## 0.1.0-alpha.6 (2024-08-27) Full Changelog: [v0.1.0-alpha.5...v0.1.0-alpha.6](https://github.com/clear-street/studio-sdk-node/compare/v0.1.0-alpha.5...v0.1.0-alpha.6) diff --git a/README.md b/README.md index 12103a9..cc0f96a 100755 --- a/README.md +++ b/README.md @@ -22,7 +22,9 @@ The full API of this library can be found in [api.md](api.md). ```js import StudioSDK from '@clear-street/studio-sdk'; -const client = new StudioSDK(); +const client = new StudioSDK({ + bearerToken: process.env['STUDIO_SDK_BEARER_TOKEN'], // This is the default and can be omitted +}); async function main() { const entity = await client.entities.retrieve(''); @@ -41,7 +43,9 @@ This library includes TypeScript definitions for all request params and response ```ts import StudioSDK from '@clear-street/studio-sdk'; -const client = new StudioSDK(); +const client = new StudioSDK({ + bearerToken: process.env['STUDIO_SDK_BEARER_TOKEN'], // This is the default and can be omitted +}); async function main() { const entity: StudioSDK.Entity = await client.entities.retrieve(''); diff --git a/api.md b/api.md index 2bb89b1..f393c56 100755 --- a/api.md +++ b/api.md @@ -2,11 +2,12 @@ Types: +- BaseStrategy - LocateOrder - Order -- PnlSummaryForAccount - Position - RegtMarginSimulation +- Strategy - Trade # Entities diff --git a/package.json b/package.json index caf5a9e..1ae6445 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@clear-street/studio-sdk", - "version": "0.1.0-alpha.6", + "version": "0.1.0-alpha.7", "description": "The official TypeScript library for the Studio SDK API", "author": "Studio SDK ", "types": "dist/index.d.ts", diff --git a/scripts/lint b/scripts/lint index 4af1de0..6ba75df 100755 --- a/scripts/lint +++ b/scripts/lint @@ -6,3 +6,6 @@ cd "$(dirname "$0")/.." echo "==> Running eslint" ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --ext ts,js . + +echo "==> Running tsc" +./node_modules/.bin/tsc --noEmit diff --git a/src/index.ts b/src/index.ts index b758419..fd890e8 100755 --- a/src/index.ts +++ b/src/index.ts @@ -196,11 +196,12 @@ export namespace StudioSDK { export import Instrument = API.Instrument; export import InstrumentRetrieveParams = API.InstrumentRetrieveParams; + export import BaseStrategy = API.BaseStrategy; export import LocateOrder = API.LocateOrder; export import Order = API.Order; - export import PnlSummaryForAccount = API.PnlSummaryForAccount; export import Position = API.Position; export import RegtMarginSimulation = API.RegtMarginSimulation; + export import Strategy = API.Strategy; export import Trade = API.Trade; } diff --git a/src/resources/accounts/bulk-orders.ts b/src/resources/accounts/bulk-orders.ts index 88d1856..61e45d0 100755 --- a/src/resources/accounts/bulk-orders.ts +++ b/src/resources/accounts/bulk-orders.ts @@ -3,6 +3,7 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as BulkOrdersAPI from './bulk-orders'; +import * as Shared from '../shared'; export class BulkOrders extends APIResource { /** @@ -143,153 +144,13 @@ export namespace BulkOrderCreateParams { * The execution strategy to use for this order. If not provided, our smart * order-router will handle execution for your order. */ - strategy?: - | Order.BaseStrategy - | Order.BaseStrategy - | Order.BaseStrategy - | Order.BaseStrategy - | Order.BaseStrategy - | Order.BaseStrategy; + strategy?: Shared.Strategy; /** * Denotes the format of the provided `symbol` field. */ symbol_format?: 'cms' | 'osi'; } - - export namespace Order { - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - } } export namespace BulkOrders { diff --git a/src/resources/accounts/orders.ts b/src/resources/accounts/orders.ts index e9329fa..69aed52 100755 --- a/src/resources/accounts/orders.ts +++ b/src/resources/accounts/orders.ts @@ -183,13 +183,7 @@ export interface OrderCreateParams { * The execution strategy to use for this order. If not provided, our smart * order-router will handle execution for your order. */ - strategy?: - | OrderCreateParams.BaseStrategy - | OrderCreateParams.BaseStrategy - | OrderCreateParams.BaseStrategy - | OrderCreateParams.BaseStrategy - | OrderCreateParams.BaseStrategy - | OrderCreateParams.BaseStrategy; + strategy?: Shared.Strategy; /** * Denotes the format of the provided `symbol` field. @@ -197,140 +191,6 @@ export interface OrderCreateParams { symbol_format?: 'cms' | 'osi'; } -export namespace OrderCreateParams { - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } -} - export interface OrderListParams { /** * Milliseconds since epoch timestamp. This will constrain the search for orders diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 8c0fc81..93de583 100755 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,9 +1,30 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import * as EntitiesAPI from './entities/entities'; -import { type PnlSummary } from './entities/entities'; import * as RegtMarginSimulationsAPI from './entities/regt-margin-simulations'; +export interface BaseStrategy { + /** + * The type of strategy. This must be set to the respective strategy type. + */ + type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; + + /** + * The timestamp to stop routing, defaults to market close. + */ + end_at?: number; + + /** + * The timestamp to start routing, defaults to now. + */ + start_at?: number; + + /** + * The urgency associated with the execution strategy. + */ + urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; +} + export interface LocateOrder { /** * Account ID for the account. @@ -217,13 +238,7 @@ export interface Order { /** * The execution strategy used for this order. */ - strategy?: - | Order.BaseStrategy - | Order.BaseStrategy - | Order.BaseStrategy - | Order.BaseStrategy - | Order.BaseStrategy - | Order.BaseStrategy; + strategy?: Strategy; /** * Free form text typically contains reasons for a reject. @@ -231,232 +246,6 @@ export interface Order { text?: string; } -export namespace Order { - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } - - export interface BaseStrategy { - /** - * The type of strategy. This must be set to the respective strategy type. - */ - type: 'sor' | 'dark' | 'ap' | 'pov' | 'twap' | 'vwap'; - - /** - * The timestamp to stop routing, defaults to market close. - */ - end_at?: number; - - /** - * The timestamp to start routing, defaults to now. - */ - start_at?: number; - - /** - * The urgency associated with the execution strategy. - */ - urgency?: 'super-passive' | 'passive' | 'moderate' | 'aggressive' | 'super-aggressive'; - } -} - -export interface PnlSummary { - /** - * Profit and loss from intraday trading activities. - */ - day_pnl: number; - - /** - * Entity ID for the legal entity. - */ - entity_id: string; - - /** - * Net value of instruments held in the portfolio. - */ - equity: number; - - /** - * Absolute market value of long and short market values. - */ - gross_market_value: number; - - /** - * Market value of securities positioned long. - */ - long_market_value: number; - - /** - * Market value net of long and short market values. - */ - net_market_value: number; - - /** - * `total_pnl + total_fees` - */ - net_pnl: number; - - /** - * Profit and loss from previous trading date. - */ - overnight_pnl: number; - - /** - * Profit and loss realized from position closing trading activity - */ - realized_pnl: number; - - /** - * Market value of securities positioned short. - */ - short_market_value: number; - - /** - * Net value of instruments held in the portfolio at the start of a trading day. - */ - sod_equity: number; - - /** - * Absolute market value at the start of a trading day. - */ - sod_gross_market_value: number; - - /** - * Market value of securities positioned long at the start of a trading day. - */ - sod_long_market_value: number; - - /** - * Market value of securities positioned short at the start of a trading day. - */ - sod_short_market_value: number; - - /** - * Milliseconds since epoch. - */ - timestamp: number; - - /** - * Total fees incurred from trading activities. - */ - total_fees: number; - - /** - * `realized_pnl + unrealized_pnl` - */ - total_pnl: number; - - /** - * Profit and loss from market changes. - */ - unrealized_pnl: number; -} - export interface Position { /** * Account ID for the account. @@ -498,6 +287,14 @@ export interface RegtMarginSimulation { simulation_id: RegtMarginSimulationsAPI.SimulationID; } +export type Strategy = + | BaseStrategy + | BaseStrategy + | BaseStrategy + | BaseStrategy + | BaseStrategy + | BaseStrategy; + export interface Trade { /** * When this trade happened in milliseconds since epoch. diff --git a/src/version.ts b/src/version.ts index 9b7cfeb..135324a 100755 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.1.0-alpha.6'; // x-release-please-version +export const VERSION = '0.1.0-alpha.7'; // x-release-please-version