@woodger/t-invest-node-sdk 0.5.5 → 0.5.7
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/CHANGELOG.md +313 -522
- package/NOTICE +8 -8
- package/dist/application/dto/t-invest-services.d.ts +2 -1
- package/dist/application/dto/t-invest-services.js +2 -1
- package/dist/application/errors/sdk-error.d.ts +9 -0
- package/dist/application/errors/sdk-error.js +12 -2
- package/dist/application/reports/accounts.report.d.ts +7 -2
- package/dist/application/reports/accrued-interests.report.d.ts +8 -2
- package/dist/application/reports/bond-coupons.report.d.ts +3 -1
- package/dist/application/reports/bond.report.d.ts +3 -1
- package/dist/application/reports/brands.report.d.ts +4 -1
- package/dist/application/reports/broker-report.report.d.ts +6 -2
- package/dist/application/reports/candles.report.d.ts +4 -1
- package/dist/application/reports/close-prices.report.d.ts +7 -2
- package/dist/application/reports/currency.report.d.ts +4 -1
- package/dist/application/reports/dividends-foreign-issuer.report.d.ts +4 -1
- package/dist/application/reports/dividends.report.d.ts +4 -1
- package/dist/application/reports/find-instrument.report.d.ts +3 -1
- package/dist/application/reports/future.report.d.ts +3 -1
- package/dist/application/reports/futures-margin.report.d.ts +10 -3
- package/dist/application/reports/instrument.report.d.ts +7 -2
- package/dist/application/reports/last-prices.report.d.ts +7 -2
- package/dist/application/reports/last-trades.report.d.ts +4 -2
- package/dist/application/reports/margin-attributes.report.d.ts +6 -2
- package/dist/application/reports/operations-by-cursor.report.d.ts +7 -2
- package/dist/application/reports/option.report.d.ts +4 -1
- package/dist/application/reports/order-book.report.d.ts +1 -1
- package/dist/application/reports/order-mutation.report.d.ts +6 -2
- package/dist/application/reports/portfolio.report.d.ts +4 -1
- package/dist/application/reports/stop-orders.report.d.ts +3 -1
- package/dist/application/reports/trading-schedules.report.d.ts +12 -4
- package/dist/application/reports/trading-status.report.d.ts +3 -1
- package/dist/application/reports/trading-statuses.report.d.ts +4 -1
- package/dist/application/reports/user-tariff.report.d.ts +2 -0
- package/dist/application/reports/withdraw-limits.report.d.ts +4 -1
- package/dist/application/services/unary-limiter.d.ts +5 -2
- package/dist/application/services/unary-limiter.js +77 -27
- package/dist/bootstrap/args/instrument-id-options.d.ts +4 -2
- package/dist/bootstrap/args/instrument-id-options.js +4 -2
- package/dist/bootstrap/args/instruments-args.js +2 -1
- package/dist/bootstrap/args/sdk-options.d.ts +2 -1
- package/dist/bootstrap/args/sdk-options.js +2 -1
- package/dist/bootstrap/args/side-effect-args.js +3 -1
- package/dist/bootstrap/cli/contract.d.ts +2 -1
- package/dist/bootstrap/cli/contract.js +2 -1
- package/dist/bootstrap/cli/domains.d.ts +2 -1
- package/dist/bootstrap/cli/domains.js +8 -3
- package/dist/bootstrap/cli/error.d.ts +2 -1
- package/dist/bootstrap/cli/error.js +2 -1
- package/dist/bootstrap/cli/help-catalog.d.ts +1 -0
- package/dist/bootstrap/cli/help-catalog.js +5 -0
- package/dist/bootstrap/cli/help.d.ts +2 -1
- package/dist/bootstrap/cli/help.js +4 -3
- package/dist/bootstrap/cli/registry.d.ts +2 -1
- package/dist/bootstrap/cli/registry.js +4 -2
- package/dist/bootstrap/cli/version.d.ts +2 -1
- package/dist/bootstrap/cli/version.js +2 -1
- package/dist/bootstrap/commands/accounts/cli.d.ts +2 -1
- package/dist/bootstrap/commands/accounts/cli.js +2 -1
- package/dist/bootstrap/commands/accounts/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/accounts/reporter.js +2 -1
- package/dist/bootstrap/commands/accrued-interests/cli.d.ts +2 -1
- package/dist/bootstrap/commands/accrued-interests/cli.js +2 -1
- package/dist/bootstrap/commands/accrued-interests/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/accrued-interests/reporter.js +2 -1
- package/dist/bootstrap/commands/asset/cli.d.ts +2 -1
- package/dist/bootstrap/commands/asset/cli.js +2 -1
- package/dist/bootstrap/commands/asset/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/asset/reporter.js +2 -1
- package/dist/bootstrap/commands/assets/cli.d.ts +2 -1
- package/dist/bootstrap/commands/assets/cli.js +2 -1
- package/dist/bootstrap/commands/assets/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/assets/reporter.js +2 -1
- package/dist/bootstrap/commands/bond/cli.d.ts +2 -1
- package/dist/bootstrap/commands/bond/cli.js +2 -1
- package/dist/bootstrap/commands/bond/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/bond/reporter.js +5 -2
- package/dist/bootstrap/commands/bond-coupons/cli.d.ts +2 -1
- package/dist/bootstrap/commands/bond-coupons/cli.js +2 -1
- package/dist/bootstrap/commands/bond-coupons/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/bond-coupons/reporter.js +2 -1
- package/dist/bootstrap/commands/bonds/cli.d.ts +2 -1
- package/dist/bootstrap/commands/bonds/cli.js +2 -1
- package/dist/bootstrap/commands/bonds/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/bonds/reporter.js +2 -1
- package/dist/bootstrap/commands/brand/cli.d.ts +2 -1
- package/dist/bootstrap/commands/brand/cli.js +2 -1
- package/dist/bootstrap/commands/brand/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/brand/reporter.js +2 -1
- package/dist/bootstrap/commands/brands/cli.d.ts +2 -1
- package/dist/bootstrap/commands/brands/cli.js +2 -1
- package/dist/bootstrap/commands/brands/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/brands/reporter.js +2 -1
- package/dist/bootstrap/commands/broker-report/cli.d.ts +2 -1
- package/dist/bootstrap/commands/broker-report/cli.js +2 -1
- package/dist/bootstrap/commands/broker-report/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/broker-report/reporter.js +2 -1
- package/dist/bootstrap/commands/cancel-order/cli.d.ts +2 -1
- package/dist/bootstrap/commands/cancel-order/cli.js +2 -1
- package/dist/bootstrap/commands/cancel-order/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/cancel-order/reporter.js +2 -1
- package/dist/bootstrap/commands/cancel-stop-order/cli.d.ts +2 -1
- package/dist/bootstrap/commands/cancel-stop-order/cli.js +2 -1
- package/dist/bootstrap/commands/cancel-stop-order/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/cancel-stop-order/reporter.js +2 -1
- package/dist/bootstrap/commands/candles/cli.d.ts +2 -1
- package/dist/bootstrap/commands/candles/cli.js +2 -1
- package/dist/bootstrap/commands/candles/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/candles/reporter.js +2 -1
- package/dist/bootstrap/commands/close-prices/cli.d.ts +2 -1
- package/dist/bootstrap/commands/close-prices/cli.js +2 -1
- package/dist/bootstrap/commands/close-prices/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/close-prices/reporter.js +2 -1
- package/dist/bootstrap/commands/compile-proto/cli.d.ts +2 -1
- package/dist/bootstrap/commands/compile-proto/cli.js +2 -1
- package/dist/bootstrap/commands/countries/cli.d.ts +2 -1
- package/dist/bootstrap/commands/countries/cli.js +2 -1
- package/dist/bootstrap/commands/countries/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/countries/reporter.js +2 -1
- package/dist/bootstrap/commands/currencies/cli.d.ts +2 -1
- package/dist/bootstrap/commands/currencies/cli.js +2 -1
- package/dist/bootstrap/commands/currencies/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/currencies/reporter.js +2 -1
- package/dist/bootstrap/commands/currency/cli.d.ts +2 -1
- package/dist/bootstrap/commands/currency/cli.js +2 -1
- package/dist/bootstrap/commands/currency/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/currency/reporter.js +2 -1
- package/dist/bootstrap/commands/dividends/cli.d.ts +2 -1
- package/dist/bootstrap/commands/dividends/cli.js +2 -1
- package/dist/bootstrap/commands/dividends/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/dividends/reporter.js +2 -1
- package/dist/bootstrap/commands/dividends-foreign-issuer/cli.d.ts +2 -1
- package/dist/bootstrap/commands/dividends-foreign-issuer/cli.js +6 -2
- package/dist/bootstrap/commands/dividends-foreign-issuer/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/dividends-foreign-issuer/reporter.js +2 -1
- package/dist/bootstrap/commands/edit-favorites/cli.d.ts +2 -1
- package/dist/bootstrap/commands/edit-favorites/cli.js +2 -1
- package/dist/bootstrap/commands/etf/cli.d.ts +2 -1
- package/dist/bootstrap/commands/etf/cli.js +2 -1
- package/dist/bootstrap/commands/etf/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/etf/reporter.js +5 -2
- package/dist/bootstrap/commands/etfs/cli.d.ts +2 -1
- package/dist/bootstrap/commands/etfs/cli.js +2 -1
- package/dist/bootstrap/commands/etfs/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/etfs/reporter.js +2 -1
- package/dist/bootstrap/commands/favorites/cli.d.ts +2 -1
- package/dist/bootstrap/commands/favorites/cli.js +2 -1
- package/dist/bootstrap/commands/favorites/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/favorites/reporter.js +2 -1
- package/dist/bootstrap/commands/find-instrument/cli.d.ts +2 -1
- package/dist/bootstrap/commands/find-instrument/cli.js +2 -1
- package/dist/bootstrap/commands/find-instrument/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/find-instrument/reporter.js +2 -1
- package/dist/bootstrap/commands/future/cli.d.ts +2 -1
- package/dist/bootstrap/commands/future/cli.js +2 -1
- package/dist/bootstrap/commands/future/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/future/reporter.js +2 -1
- package/dist/bootstrap/commands/futures/cli.d.ts +2 -1
- package/dist/bootstrap/commands/futures/cli.js +2 -1
- package/dist/bootstrap/commands/futures/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/futures/reporter.js +2 -1
- package/dist/bootstrap/commands/futures-margin/cli.d.ts +2 -1
- package/dist/bootstrap/commands/futures-margin/cli.js +2 -1
- package/dist/bootstrap/commands/futures-margin/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/futures-margin/reporter.js +8 -2
- package/dist/bootstrap/commands/instrument/cli.d.ts +2 -1
- package/dist/bootstrap/commands/instrument/cli.js +2 -1
- package/dist/bootstrap/commands/instrument/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/instrument/reporter.js +5 -2
- package/dist/bootstrap/commands/last-prices/cli.d.ts +2 -1
- package/dist/bootstrap/commands/last-prices/cli.js +2 -1
- package/dist/bootstrap/commands/last-prices/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/last-prices/reporter.js +2 -1
- package/dist/bootstrap/commands/last-trades/cli.d.ts +2 -1
- package/dist/bootstrap/commands/last-trades/cli.js +2 -1
- package/dist/bootstrap/commands/last-trades/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/last-trades/reporter.js +2 -1
- package/dist/bootstrap/commands/margin-attributes/cli.d.ts +2 -1
- package/dist/bootstrap/commands/margin-attributes/cli.js +2 -1
- package/dist/bootstrap/commands/margin-attributes/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/margin-attributes/reporter.js +2 -1
- package/dist/bootstrap/commands/operations/cli.d.ts +2 -1
- package/dist/bootstrap/commands/operations/cli.js +8 -2
- package/dist/bootstrap/commands/operations/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/operations/reporter.js +2 -1
- package/dist/bootstrap/commands/operations-by-cursor/cli.d.ts +2 -1
- package/dist/bootstrap/commands/operations-by-cursor/cli.js +8 -2
- package/dist/bootstrap/commands/operations-by-cursor/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/operations-by-cursor/reporter.js +2 -1
- package/dist/bootstrap/commands/operations-by-cursor/request.mapper.d.ts +2 -1
- package/dist/bootstrap/commands/operations-by-cursor/request.mapper.js +2 -1
- package/dist/bootstrap/commands/option/cli.d.ts +2 -1
- package/dist/bootstrap/commands/option/cli.js +2 -1
- package/dist/bootstrap/commands/option/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/option/reporter.js +2 -1
- package/dist/bootstrap/commands/options-by/cli.d.ts +2 -1
- package/dist/bootstrap/commands/options-by/cli.js +2 -1
- package/dist/bootstrap/commands/options-by/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/options-by/reporter.js +2 -1
- package/dist/bootstrap/commands/order-book/cli.d.ts +2 -1
- package/dist/bootstrap/commands/order-book/cli.js +2 -1
- package/dist/bootstrap/commands/order-book/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/order-book/reporter.js +11 -2
- package/dist/bootstrap/commands/order-state/cli.d.ts +2 -1
- package/dist/bootstrap/commands/order-state/cli.js +2 -1
- package/dist/bootstrap/commands/order-state/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/order-state/reporter.js +2 -1
- package/dist/bootstrap/commands/orders/cli.d.ts +2 -1
- package/dist/bootstrap/commands/orders/cli.js +2 -1
- package/dist/bootstrap/commands/orders/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/orders/reporter.js +2 -1
- package/dist/bootstrap/commands/portfolio/cli.d.ts +2 -1
- package/dist/bootstrap/commands/portfolio/cli.js +2 -1
- package/dist/bootstrap/commands/portfolio/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/portfolio/reporter.js +2 -1
- package/dist/bootstrap/commands/portfolio/request.mapper.d.ts +2 -1
- package/dist/bootstrap/commands/portfolio/request.mapper.js +2 -1
- package/dist/bootstrap/commands/positions/cli.d.ts +2 -1
- package/dist/bootstrap/commands/positions/cli.js +2 -1
- package/dist/bootstrap/commands/positions/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/positions/reporter.js +11 -2
- package/dist/bootstrap/commands/post-order/cli.d.ts +2 -1
- package/dist/bootstrap/commands/post-order/cli.js +2 -1
- package/dist/bootstrap/commands/post-order/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/post-order/reporter.js +2 -1
- package/dist/bootstrap/commands/post-stop-order/cli.d.ts +2 -1
- package/dist/bootstrap/commands/post-stop-order/cli.js +4 -2
- package/dist/bootstrap/commands/post-stop-order/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/post-stop-order/reporter.js +2 -1
- package/dist/bootstrap/commands/replace-order/cli.d.ts +2 -1
- package/dist/bootstrap/commands/replace-order/cli.js +2 -1
- package/dist/bootstrap/commands/replace-order/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/replace-order/reporter.js +2 -1
- package/dist/bootstrap/commands/sandbox-accounts/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-accounts/cli.js +2 -1
- package/dist/bootstrap/commands/sandbox-cancel-order/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-cancel-order/cli.js +2 -1
- package/dist/bootstrap/commands/sandbox-close-account/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-close-account/cli.js +2 -1
- package/dist/bootstrap/commands/sandbox-close-account/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-close-account/reporter.js +2 -1
- package/dist/bootstrap/commands/sandbox-open-account/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-open-account/cli.js +2 -1
- package/dist/bootstrap/commands/sandbox-open-account/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-open-account/reporter.js +2 -1
- package/dist/bootstrap/commands/sandbox-operations/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-operations/cli.js +2 -1
- package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.js +7 -2
- package/dist/bootstrap/commands/sandbox-order-state/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-order-state/cli.js +2 -1
- package/dist/bootstrap/commands/sandbox-orders/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-orders/cli.js +2 -1
- package/dist/bootstrap/commands/sandbox-pay-in/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-pay-in/cli.js +2 -1
- package/dist/bootstrap/commands/sandbox-pay-in/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-pay-in/reporter.js +2 -1
- package/dist/bootstrap/commands/sandbox-portfolio/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-portfolio/cli.js +2 -1
- package/dist/bootstrap/commands/sandbox-positions/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-positions/cli.js +2 -1
- package/dist/bootstrap/commands/sandbox-post-order/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-post-order/cli.js +2 -1
- package/dist/bootstrap/commands/sandbox-replace-order/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-replace-order/cli.js +2 -1
- package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.d.ts +2 -1
- package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.js +6 -2
- package/dist/bootstrap/commands/share/cli.d.ts +2 -1
- package/dist/bootstrap/commands/share/cli.js +2 -1
- package/dist/bootstrap/commands/share/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/share/reporter.js +5 -2
- package/dist/bootstrap/commands/shares/cli.d.ts +2 -1
- package/dist/bootstrap/commands/shares/cli.js +2 -1
- package/dist/bootstrap/commands/shares/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/shares/reporter.js +2 -1
- package/dist/bootstrap/commands/stop-orders/cli.d.ts +2 -1
- package/dist/bootstrap/commands/stop-orders/cli.js +2 -1
- package/dist/bootstrap/commands/stop-orders/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/stop-orders/reporter.js +2 -1
- package/dist/bootstrap/commands/stream-run/cli.d.ts +2 -1
- package/dist/bootstrap/commands/stream-run/cli.js +3 -4
- package/dist/bootstrap/commands/stream-run/config.js +2 -1
- package/dist/bootstrap/commands/stream-run/request.mapper.js +15 -5
- package/dist/bootstrap/commands/stream-run/stream-session.js +6 -2
- package/dist/bootstrap/commands/trading-schedules/cli.d.ts +2 -1
- package/dist/bootstrap/commands/trading-schedules/cli.js +2 -1
- package/dist/bootstrap/commands/trading-schedules/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/trading-schedules/reporter.js +11 -2
- package/dist/bootstrap/commands/trading-status/cli.d.ts +2 -1
- package/dist/bootstrap/commands/trading-status/cli.js +2 -1
- package/dist/bootstrap/commands/trading-status/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/trading-status/reporter.js +2 -1
- package/dist/bootstrap/commands/trading-statuses/cli.d.ts +2 -1
- package/dist/bootstrap/commands/trading-statuses/cli.js +2 -1
- package/dist/bootstrap/commands/trading-statuses/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/trading-statuses/reporter.js +2 -1
- package/dist/bootstrap/commands/user-info/cli.d.ts +2 -1
- package/dist/bootstrap/commands/user-info/cli.js +2 -1
- package/dist/bootstrap/commands/user-info/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/user-info/reporter.js +2 -1
- package/dist/bootstrap/commands/user-tariff/cli.d.ts +2 -1
- package/dist/bootstrap/commands/user-tariff/cli.js +2 -1
- package/dist/bootstrap/commands/user-tariff/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/user-tariff/reporter.js +17 -2
- package/dist/bootstrap/commands/withdraw-limits/cli.d.ts +2 -1
- package/dist/bootstrap/commands/withdraw-limits/cli.js +2 -1
- package/dist/bootstrap/commands/withdraw-limits/reporter.d.ts +2 -1
- package/dist/bootstrap/commands/withdraw-limits/reporter.js +2 -1
- package/dist/bootstrap/generated-exports.d.ts +2 -2
- package/dist/bootstrap/generated-exports.js +11 -9
- package/dist/bootstrap/proto/compile-proto.d.ts +4 -2
- package/dist/bootstrap/proto/compile-proto.js +9 -6
- package/dist/bootstrap/t-invest-node-sdk.d.ts +21 -1
- package/dist/bootstrap/t-invest-node-sdk.js +40 -16
- package/dist/config.d.ts +5 -2
- package/dist/config.js +5 -2
- package/dist/generated/common.js +1 -1
- package/dist/generated/google/api/field_behavior.js +1 -1
- package/dist/generated/google/protobuf/descriptor.js +1 -1
- package/dist/generated/google/protobuf/timestamp.js +1 -1
- package/dist/generated/instruments.d.ts +16 -0
- package/dist/generated/instruments.js +160 -3
- package/dist/generated/marketdata.d.ts +22 -1
- package/dist/generated/marketdata.js +228 -11
- package/dist/generated/operations.d.ts +4 -0
- package/dist/generated/operations.js +46 -1
- package/dist/generated/orders.js +1 -1
- package/dist/generated/sandbox.js +1 -1
- package/dist/generated/signals.js +1 -1
- package/dist/generated/stoporders.js +1 -1
- package/dist/generated/users.d.ts +8 -0
- package/dist/generated/users.js +29 -1
- package/dist/infrastructure/interceptor/warning-interceptor.d.ts +2 -1
- package/dist/infrastructure/interceptor/warning-interceptor.js +4 -3
- package/dist/infrastructure/report-values.js +3 -1
- package/dist/infrastructure/transport/grpc/sdk-call-error.js +2 -2
- package/dist/infrastructure/transport/grpc/sdk-middleware.d.ts +2 -1
- package/dist/infrastructure/transport/grpc/sdk-middleware.js +2 -1
- package/dist/infrastructure/transport/grpc/unary-limit-resolver.d.ts +18 -0
- package/dist/infrastructure/transport/grpc/unary-limit-resolver.js +19 -3
- package/docs/architecture.md +78 -92
- package/docs/bundled-ca.md +25 -41
- package/docs/clean-architecture/api-commands.md +98 -91
- package/docs/clean-architecture/application.md +61 -79
- package/docs/clean-architecture/cli-output-boundaries.md +88 -104
- package/docs/clean-architecture/index.md +10 -32
- package/docs/cli-reference.md +30 -22
- package/docs/cli-stream-configuration.md +28 -28
- package/docs/cli-stream-reference.md +38 -70
- package/docs/examples/custom-unary-limiter.md +442 -0
- package/docs/examples/deprecated-fields.md +27 -0
- package/docs/examples/errors-and-lifecycle.md +168 -0
- package/docs/examples/getting-started.md +45 -0
- package/docs/examples/index.md +34 -0
- package/docs/examples/market-data-recovery.md +273 -0
- package/docs/examples/streams-and-cancellation.md +131 -0
- package/docs/examples/testing-with-service-definitions.md +77 -0
- package/docs/examples/unary-calls.md +144 -0
- package/docs/examples/unary-limits.md +90 -0
- package/docs/index.md +24 -45
- package/docs/limits-policy.md +16 -41
- package/docs/roadmap.md +54 -54
- package/docs/tls-policy.md +30 -14
- package/package.json +6 -6
- package/readme.md +51 -113
- package/docs/guides/custom-unary-limiter.md +0 -500
- package/docs/guides/errors-and-lifecycle.md +0 -184
- package/docs/guides/getting-started.md +0 -86
- package/docs/guides/index.md +0 -32
- package/docs/guides/streams-and-cancellation.md +0 -162
- package/docs/guides/testing-with-service-definitions.md +0 -102
- package/docs/guides/unary-calls.md +0 -181
|
@@ -1,40 +1,18 @@
|
|
|
1
1
|
# Заметки по Clean Architecture
|
|
2
2
|
|
|
3
|
-
> Type: Navigation. Здесь собраны
|
|
3
|
+
> Type: Navigation. Здесь собраны пояснения к слоям SDK и границам ответственности CLI.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Ограничения и направление зависимостей задаёт [архитектурная политика](https://github.com/woodger/t-invest-node-sdk/blob/main/docs/policy/architecture.md).
|
|
8
|
-
|
|
9
|
-
## Зачем этот раздел
|
|
10
|
-
|
|
11
|
-
Текущий SDK меньше Inventory: здесь нет отдельного `domain`, `application/use-cases`, HTTP transport и dataset pipeline. Слои `application`, `infrastructure` и `bootstrap` обслуживают SDK facade и CLI-команды. Публичный port `TInvestUnaryLimiter` находится в `application/services`; отдельного каталога `ports` нет.
|
|
12
|
-
|
|
13
|
-
Этот раздел решает две задачи:
|
|
14
|
-
|
|
15
|
-
- объяснить, как применять Clean Architecture Lite к текущей структуре;
|
|
16
|
-
- показать, куда развивать `commands`-слой, если CLI formatting и adapters начнут расти.
|
|
5
|
+
<a id="зачем-этот-раздел"></a>
|
|
6
|
+
<a id="текущая-карта"></a>
|
|
17
7
|
|
|
18
8
|
## Документы
|
|
19
9
|
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
24
|
-
- [
|
|
25
|
-
|
|
26
|
-
## Текущая карта
|
|
27
|
-
|
|
28
|
-
Актуальная карта слоёв и ownership поддерживается в [архитектуре SDK](../architecture.md#карта-слоев). SDK оборачивает generated gRPC contracts и не содержит самостоятельной provider-neutral доменной модели.
|
|
29
|
-
|
|
30
|
-
## Главная идея
|
|
31
|
-
|
|
32
|
-
Выбирайте слой по ответственности, а не по удобству imports:
|
|
10
|
+
- [Архитектура SDK](../architecture.md) — фактическая карта слоёв.
|
|
11
|
+
- [Архитектурная политика](../policy/architecture.md) — ограничения и направление зависимостей.
|
|
12
|
+
- [Application-слой, DTO и отчёты](./application.md) — контракты приложения и преобразование данных между слоями.
|
|
13
|
+
- [API-команды](./api-commands.md) — выполнение команды и ответственность её модулей.
|
|
14
|
+
- [Форматирование и вывод в CLI](./cli-output-boundaries.md) — подготовка результата, функции форматирования `icore` и запись в терминал.
|
|
33
15
|
|
|
34
|
-
|
|
35
|
-
- `infrastructure` содержит внешние технологии и adapters;
|
|
36
|
-
- `bootstrap` собирает runtime entrypoints, связывает зависимости и интегрирует публичный API `icore` с project-owned CLI contracts;
|
|
37
|
-
- `generated` содержит proto-generated contracts в плоском source layout; вручную этот код не редактируется;
|
|
38
|
-
- `bootstrap/generated-exports.ts` остается generated DTO/enums и server-side contracts public export exception.
|
|
16
|
+
<a id="главная-идея"></a>
|
|
39
17
|
|
|
40
|
-
Если новая логика не укладывается в
|
|
18
|
+
Если новая логика не укладывается в карту слоёв, сначала уточните архитектурное намерение и обновите документацию.
|
package/docs/cli-reference.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Справочник CLI
|
|
2
2
|
|
|
3
|
-
> Type: Reference. Здесь собраны поддерживаемые команды,
|
|
3
|
+
> Type: Reference. Здесь собраны поддерживаемые команды, их основные имена, совместимые псевдонимы и ограничения CLI. Актуальные опции показывает встроенный `--help`; поведение задают реестр команд, обработчики и тесты.
|
|
4
4
|
|
|
5
5
|
## Домены и справка
|
|
6
6
|
|
|
7
7
|
SDK публикует команды в форме `<domain> <resource/action>`.
|
|
8
8
|
|
|
9
|
-
Публичные
|
|
9
|
+
Публичные домены:
|
|
10
10
|
|
|
11
11
|
- `account`;
|
|
12
12
|
- `instrument`;
|
|
@@ -18,7 +18,7 @@ SDK публикует команды в форме `<domain> <resource/action>`
|
|
|
18
18
|
- `stream`;
|
|
19
19
|
- `dev`.
|
|
20
20
|
|
|
21
|
-
После установки
|
|
21
|
+
После установки модуля справка доступна через:
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
24
|
npm exec -- t-invest-node-sdk --help
|
|
@@ -26,7 +26,21 @@ npm exec -- t-invest-node-sdk market --help
|
|
|
26
26
|
npm exec -- t-invest-node-sdk market order-book --help
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
Технические и прежние имена команд работают как совместимые псевдонимы. Справка показывает основные имена; совместимые пути перечислены в скобках рядом с каждой командой.
|
|
30
|
+
|
|
31
|
+
## Подключение и аргументы
|
|
32
|
+
|
|
33
|
+
Для команд, которым нужен SDK, передавайте параметры подключения через `--token` / `T_INVEST_TOKEN` и `--endpoint` / `T_INVEST_ENDPOINT`.
|
|
34
|
+
|
|
35
|
+
Передавайте логические опции как флаги (`--raw` и, если опция поддерживает отрицательное переопределение, `--no-raw`), без форм `--raw=true` и `--raw=false`. Положительные целочисленные опции должны помещаться в безопасный диапазон JavaScript. Для дат используйте RFC 3339 с явным `Z` или числовым смещением часового пояса.
|
|
36
|
+
|
|
37
|
+
## Коды завершения
|
|
38
|
+
|
|
39
|
+
- `0` — команда завершилась успешно;
|
|
40
|
+
- `2` — ошибка вызова: неизвестная команда, неверные аргументы, отсутствие обязательного значения из CLI или окружения либо неверная конфигурация команды;
|
|
41
|
+
- `1` — ошибка выполнения, провайдера, файловой системы, вывода или внутреннего определения команды.
|
|
42
|
+
|
|
43
|
+
Завершение потока по сигналам процесса описано в [справочнике потокового CLI](./cli-stream-reference.md#коды-завершения).
|
|
30
44
|
|
|
31
45
|
## Команды и совместимые пути
|
|
32
46
|
|
|
@@ -96,37 +110,31 @@ Technical и legacy paths работают как compatibility aliases. Help п
|
|
|
96
110
|
- `sandbox portfolio` -> `sdk.sandbox.getSandboxPortfolio` (`sandbox get-sandbox-portfolio`);
|
|
97
111
|
- `sandbox withdraw-limits` -> `sdk.sandbox.getSandboxWithdrawLimits` (`sandbox get-sandbox-withdraw-limits`);
|
|
98
112
|
- `sandbox pay-in` -> `sdk.sandbox.sandboxPayIn` (`sandbox sandbox-pay-in`);
|
|
99
|
-
- `stream run` -> поток выбирается в JSON
|
|
100
|
-
- `dev compile-proto` -> TypeScript
|
|
113
|
+
- `stream run` -> поток выбирается в JSON-конфигурации;
|
|
114
|
+
- `dev compile-proto` -> генерация TypeScript-контрактов (`compile-proto`).
|
|
101
115
|
- `help` -> встроенная справка по CLI, домену или команде;
|
|
102
|
-
- `version` -> версия
|
|
116
|
+
- `version` -> версия модуля.
|
|
103
117
|
|
|
104
118
|
## Побочные эффекты и idempotency
|
|
105
119
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
`sandbox pay-in` принимает `--currency=rub|usd`. CLI parser отклоняет неизвестные currency values, а для явно неподдержанного provider-кейса `--currency=usd` команда возвращает ошибку.
|
|
120
|
+
Команды, которые изменяют заявки, избранное или счета в песочнице, по умолчанию требуют `--confirm`. За это отвечает `defaultConfig.requireSideEffectConfirmation`.
|
|
109
121
|
|
|
110
|
-
|
|
122
|
+
CLI не генерирует ключи идемпотентности автоматически: `order place` принимает `--order-id`, а `order replace` — `--idempotency-key`.
|
|
111
123
|
|
|
112
|
-
|
|
124
|
+
`sandbox pay-in` принимает `--currency=rub|usd`. CLI отклоняет неизвестные значения валюты, а для неподдерживаемого провайдером `--currency=usd` команда возвращает ошибку.
|
|
113
125
|
|
|
114
|
-
|
|
126
|
+
## Потоковые команды и ограничения
|
|
115
127
|
|
|
116
|
-
|
|
117
|
-
- `sdk.marketdataStream.marketDataServerSideStream`;
|
|
118
|
-
- `sdk.operationsStream.portfolioStream`;
|
|
119
|
-
- `sdk.operationsStream.positionsStream`;
|
|
120
|
-
- `sdk.ordersStream.tradesStream`.
|
|
128
|
+
Для потокового API есть отдельная команда `stream run --config=PATH`. Долгоживущие подписки, завершение процесса и формат событий описаны в [справочнике потокового CLI](./cli-stream-reference.md) и [справочнике его конфигурации](./cli-stream-configuration.md).
|
|
121
129
|
|
|
122
|
-
|
|
130
|
+
Публичный CLI не добавляет команды для устаревших сгенерированных методов:
|
|
123
131
|
|
|
124
|
-
|
|
132
|
+
- `sdk.instruments.options` - устарел в сгенерированном контракте; вместо него используется `instrument option list` / `sdk.instruments.optionsBy`.
|
|
125
133
|
|
|
126
|
-
|
|
134
|
+
Совместимость `--figi` и полей риска описана в руководстве [Устаревшие поля провайдера](./examples/deprecated-fields.md#совместимость-cli).
|
|
127
135
|
|
|
128
136
|
## Связанные документы
|
|
129
137
|
|
|
130
|
-
- [
|
|
138
|
+
- [Установка и быстрый старт SDK](../readme.md).
|
|
131
139
|
- [Архитектура API-команд](./clean-architecture/api-commands.md).
|
|
132
140
|
- [Навигация по документации](./index.md).
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Справочник конфигурации потокового CLI
|
|
2
2
|
|
|
3
|
-
> Type: Reference. Здесь описан JSON
|
|
3
|
+
> Type: Reference. Здесь описан JSON-файл конфигурации для команды `t-invest-node-sdk stream run --config=PATH`.
|
|
4
4
|
|
|
5
5
|
## Цель
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Конфигурация выбирает поток, подписки и параметры вывода. Для типовых подписок CLI сам собирает запросы по сгенерированным gRPC-контрактам.
|
|
8
8
|
|
|
9
9
|
Минимальная допустимая конфигурация:
|
|
10
10
|
|
|
@@ -28,11 +28,11 @@ Stream config следует generated gRPC contracts и не скрывает
|
|
|
28
28
|
|
|
29
29
|
| Поле | Тип | Обязательность | Назначение |
|
|
30
30
|
| --- | --- | --- | --- |
|
|
31
|
-
| `stream` | string | всегда | Выбирает
|
|
32
|
-
| `subscriptions` | object | для
|
|
33
|
-
| `requests` | object[] | для
|
|
34
|
-
| `accounts` | string[] | для потоков по счетам | Идентификаторы счетов
|
|
35
|
-
| `runtime` | object | нет | Настройки вывода и
|
|
31
|
+
| `stream` | string | всегда | Выбирает метод потокового API |
|
|
32
|
+
| `subscriptions` | object | для серверного потока рыночных данных | Подписки на рыночные данные |
|
|
33
|
+
| `requests` | object[] | для двустороннего потока рыночных данных | Статический набор начальных запросов |
|
|
34
|
+
| `accounts` | string[] | для потоков по счетам | Идентификаторы счетов в потоках операций и заявок |
|
|
35
|
+
| `runtime` | object | нет | Настройки вывода и завершения процесса |
|
|
36
36
|
|
|
37
37
|
Допустимые значения `stream`:
|
|
38
38
|
|
|
@@ -42,9 +42,9 @@ Stream config следует generated gRPC contracts и не скрывает
|
|
|
42
42
|
- `operations.positionsStream`;
|
|
43
43
|
- `orders.tradesStream`.
|
|
44
44
|
|
|
45
|
-
`marketdata.marketDataStream` использует отдельное поле `requests`, потому что это
|
|
45
|
+
`marketdata.marketDataStream` использует отдельное поле `requests`, потому что это двусторонний поток: CLI сначала отправляет заданный в конфигурации набор запросов, а затем читает события провайдера.
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
Поле `rawRequests` не поддерживается: проверка конфигурации отклоняет его для любого потока.
|
|
48
48
|
|
|
49
49
|
## Настройки runtime
|
|
50
50
|
|
|
@@ -66,11 +66,11 @@ Stream config следует generated gRPC contracts и не скрывает
|
|
|
66
66
|
|
|
67
67
|
- `format` — формат вывода; поддерживается только `jsonl`;
|
|
68
68
|
- `maxEvents` — завершиться после N выведенных событий;
|
|
69
|
-
- `durationMs` — завершиться через N миллисекунд после запуска
|
|
69
|
+
- `durationMs` — завершиться через N миллисекунд после запуска потока;
|
|
70
70
|
- `idleTimeoutMs` — завершиться после N миллисекунд без событий;
|
|
71
71
|
- `includePings` — включать события `ping` в `stdout`;
|
|
72
72
|
- `includeSubscriptionEvents` — включать статусы подписок в `stdout`;
|
|
73
|
-
- `raw` — выводить
|
|
73
|
+
- `raw` — выводить сгенерированный ответ без общей структуры нормализованного события.
|
|
74
74
|
|
|
75
75
|
## Подписки на рыночные данные
|
|
76
76
|
|
|
@@ -119,28 +119,28 @@ Stream config следует generated gRPC contracts и не скрывает
|
|
|
119
119
|
|
|
120
120
|
Значения подписок по умолчанию:
|
|
121
121
|
|
|
122
|
-
- CLI всегда подписывается через `SUBSCRIPTION_ACTION_SUBSCRIBE`; поле `action` в
|
|
122
|
+
- CLI всегда подписывается через `SUBSCRIPTION_ACTION_SUBSCRIBE`; поле `action` в конфигурации не принимается;
|
|
123
123
|
- устаревшие поля `figi` сгенерированных контрактов сохраняют значения по умолчанию protobuf и не сериализуются;
|
|
124
124
|
- `instrumentId` обязателен для каждого инструмента;
|
|
125
125
|
- `waitingClose` имеет значение `false`;
|
|
126
126
|
- `orderBooks[].depth` обязателен и должен быть целым числом от `1` до `2147483647` (диапазон protobuf `int32`).
|
|
127
127
|
|
|
128
|
-
Значения `waitingClose` должны совпадать у всех свечных подписок одного запроса. Для
|
|
128
|
+
Значения `waitingClose` должны совпадать у всех свечных подписок одного запроса. Для серверного потока это весь массив `subscriptions.candles`; для двустороннего — `instruments` внутри одного запроса `subscribeCandles`. Отсутствующее поле считается `false`.
|
|
129
129
|
|
|
130
130
|
Поддерживаемые алиасы интервала свечей:
|
|
131
131
|
|
|
132
132
|
- `1min`;
|
|
133
133
|
- `5min`.
|
|
134
134
|
|
|
135
|
-
Другие
|
|
135
|
+
Другие псевдонимы из CLI-команды получения исторических свечей здесь не принимаются: сгенерированный `SubscriptionInterval` для потока содержит только интервалы в одну и пять минут.
|
|
136
136
|
|
|
137
137
|
## Сравнение MarketDataStream и MarketDataServerSideStream
|
|
138
138
|
|
|
139
139
|
`marketdata.marketDataServerSideStream` отправляет один начальный запрос, собранный из поля `subscriptions`, а затем читает события.
|
|
140
140
|
|
|
141
|
-
`marketdata.marketDataStream` —
|
|
141
|
+
`marketdata.marketDataStream` — двусторонний поток. `stream run` поддерживает только статический набор типизированных начальных запросов из конфигурации и не читает дополнительные запросы из `stdin`, файлов, таймеров или интерактивного ввода.
|
|
142
142
|
|
|
143
|
-
Типизированная
|
|
143
|
+
Типизированная форма двустороннего потока:
|
|
144
144
|
|
|
145
145
|
```json
|
|
146
146
|
{
|
|
@@ -174,14 +174,14 @@ Stream config следует generated gRPC contracts и не скрывает
|
|
|
174
174
|
- `subscribeLastPrice`;
|
|
175
175
|
- `getMySubscriptions`.
|
|
176
176
|
|
|
177
|
-
Элементы запроса используют те же поля инструмента, что и
|
|
177
|
+
Элементы запроса используют те же поля инструмента, что и подписки серверного потока рыночных данных:
|
|
178
178
|
|
|
179
179
|
- `subscribeCandles` требует `instrumentId` и `interval`; `waitingClose` необязателен;
|
|
180
180
|
- `subscribeOrderBook` требует `instrumentId` и `depth`;
|
|
181
181
|
- `subscribeTrades`, `subscribeInfo` и `subscribeLastPrice` требуют `instrumentId`;
|
|
182
182
|
- `getMySubscriptions` не принимает `instruments`.
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
Отправка произвольных запросов двустороннего потока не поддерживается. Используйте поле `requests` и перечисленные выше типизированные варианты.
|
|
185
185
|
|
|
186
186
|
## Потоки по счетам
|
|
187
187
|
|
|
@@ -227,30 +227,30 @@ Stream config следует generated gRPC contracts и не скрывает
|
|
|
227
227
|
Правила:
|
|
228
228
|
|
|
229
229
|
- `accounts` должен содержать хотя бы один идентификатор счёта;
|
|
230
|
-
- идентификаторы передаются в поле `accounts`
|
|
230
|
+
- идентификаторы передаются в поле `accounts` сгенерированного запроса;
|
|
231
231
|
- потоки по счетам не используют `subscriptions`;
|
|
232
232
|
- неизвестные поля отклоняются до создания SDK.
|
|
233
233
|
|
|
234
234
|
## Правила проверки
|
|
235
235
|
|
|
236
|
-
|
|
236
|
+
Проверка конфигурации отклоняет:
|
|
237
237
|
|
|
238
238
|
- неизвестные значения `stream`;
|
|
239
239
|
- отсутствие `accounts` для потоков по счетам;
|
|
240
|
-
- пустой `subscriptions` для
|
|
240
|
+
- пустой `subscriptions` для серверного потока рыночных данных;
|
|
241
241
|
- отсутствующий или пустой `requests` для `marketdata.marketDataStream`;
|
|
242
242
|
- неизвестные поля верхнего уровня;
|
|
243
243
|
- неподдерживаемое поле `rawRequests`;
|
|
244
244
|
- неподдерживаемый `runtime.format`;
|
|
245
|
-
- неположительные числовые runtime
|
|
245
|
+
- неположительные числовые ограничения в `runtime`;
|
|
246
246
|
- элементы Market Data без `instrumentId`;
|
|
247
|
-
-
|
|
247
|
+
- имена сгенерированных перечислений и псевдонимы, которые не поддерживает преобразователь конфигурации.
|
|
248
248
|
|
|
249
|
-
CLI проверяет
|
|
249
|
+
CLI проверяет конфигурацию до создания `TInvestNodeSDK`.
|
|
250
250
|
|
|
251
251
|
## Переопределения через CLI
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
Настройки из `runtime` можно переопределить CLI-флагами:
|
|
254
254
|
|
|
255
255
|
```bash
|
|
256
256
|
t-invest-node-sdk stream run \
|
|
@@ -259,9 +259,9 @@ t-invest-node-sdk stream run \
|
|
|
259
259
|
--include-pings
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
-
|
|
262
|
+
Доступные флаги и правила переопределения логических значений описаны в [настройках runtime потокового CLI](./cli-stream-reference.md#настройки-runtime).
|
|
263
263
|
|
|
264
|
-
Подписки и выбор счетов задаются только в
|
|
264
|
+
Подписки и выбор счетов задаются только в конфигурации. Это позволяет использовать одну команду для разных потоков без отдельного набора флагов для каждого метода.
|
|
265
265
|
|
|
266
266
|
## Режимы вывода
|
|
267
267
|
|
|
@@ -277,7 +277,7 @@ Raw-событие при `runtime.raw: true`:
|
|
|
277
277
|
{"orderTrades":{"orderId":"..."}}
|
|
278
278
|
```
|
|
279
279
|
|
|
280
|
-
По умолчанию CLI выводит нормализованные события в
|
|
280
|
+
По умолчанию CLI выводит нормализованные события в единой структуре для всех потоковых методов.
|
|
281
281
|
|
|
282
282
|
## Связанная документация
|
|
283
283
|
|
|
@@ -1,84 +1,54 @@
|
|
|
1
1
|
# Справочник потокового CLI
|
|
2
2
|
|
|
3
|
-
> Type: Reference. Здесь
|
|
3
|
+
> Type: Reference. Здесь описана команда `stream run`: поддерживаемые потоки, формат событий и условия завершения работы. Она поддерживает серверные потоки и статический набор начальных запросов двустороннего потока рыночных данных.
|
|
4
4
|
|
|
5
5
|
## Статус
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```text
|
|
10
|
-
t-invest-node-sdk <domain> <command> [options]
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Для Stream API нужен отдельный контракт: команда не возвращает один response и не завершается сразу. Она открывает долгоживущий stream, печатает события и завершает работу по лимиту, таймауту, сигналу или ошибке provider-а.
|
|
14
|
-
|
|
15
|
-
Текущая точка входа:
|
|
7
|
+
Команда `stream run` открывает долгоживущий поток, печатает события и завершает работу по лимиту, таймауту, сигналу или ошибке провайдера:
|
|
16
8
|
|
|
17
9
|
```bash
|
|
18
10
|
t-invest-node-sdk stream run --config=PATH [runtime options]
|
|
19
11
|
```
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Текущая реализация поддерживает:
|
|
24
|
-
|
|
25
|
-
- `marketdata.marketDataStream` со статическими initial requests из config;
|
|
26
|
-
- `marketdata.marketDataServerSideStream`;
|
|
27
|
-
- `operations.portfolioStream`;
|
|
28
|
-
- `operations.positionsStream`;
|
|
29
|
-
- `orders.tradesStream`.
|
|
30
|
-
|
|
31
|
-
Команда не поддерживает динамические источники bidirectional requests и не читает дополнительные request-ы из stdin, файлов, таймеров или interactive input.
|
|
13
|
+
Метод и начальные запросы выбираются в [файле конфигурации](./cli-stream-configuration.md). Поддерживаемые методы перечислены в таблице ниже.
|
|
32
14
|
|
|
33
15
|
## Доступные stream methods
|
|
34
16
|
|
|
35
|
-
| Значение `stream` в
|
|
17
|
+
| Значение `stream` в конфигурации | Метод SDK | Метод gRPC | Тип потока |
|
|
36
18
|
| --- | --- | --- | --- |
|
|
37
|
-
| `marketdata.marketDataStream` | `sdk.marketdataStream.marketDataStream` | `MarketDataStreamService/MarketDataStream` |
|
|
38
|
-
| `marketdata.marketDataServerSideStream` | `sdk.marketdataStream.marketDataServerSideStream` | `MarketDataStreamService/MarketDataServerSideStream` |
|
|
39
|
-
| `operations.portfolioStream` | `sdk.operationsStream.portfolioStream` | `OperationsStreamService/PortfolioStream` |
|
|
40
|
-
| `operations.positionsStream` | `sdk.operationsStream.positionsStream` | `OperationsStreamService/PositionsStream` |
|
|
41
|
-
| `orders.tradesStream` | `sdk.ordersStream.tradesStream` | `OrdersStreamService/TradesStream` |
|
|
19
|
+
| `marketdata.marketDataStream` | `sdk.marketdataStream.marketDataStream` | `MarketDataStreamService/MarketDataStream` | двусторонний, статические начальные запросы |
|
|
20
|
+
| `marketdata.marketDataServerSideStream` | `sdk.marketdataStream.marketDataServerSideStream` | `MarketDataStreamService/MarketDataServerSideStream` | серверный |
|
|
21
|
+
| `operations.portfolioStream` | `sdk.operationsStream.portfolioStream` | `OperationsStreamService/PortfolioStream` | серверный |
|
|
22
|
+
| `operations.positionsStream` | `sdk.operationsStream.positionsStream` | `OperationsStreamService/PositionsStream` | серверный |
|
|
23
|
+
| `orders.tradesStream` | `sdk.ordersStream.tradesStream` | `OrdersStreamService/TradesStream` | серверный |
|
|
42
24
|
|
|
43
25
|
## Runtime-модель
|
|
44
26
|
|
|
45
|
-
`stream run`
|
|
46
|
-
|
|
47
|
-
1. прочитать и провалидировать config;
|
|
48
|
-
2. применить CLI runtime overrides;
|
|
49
|
-
3. создать `TInvestNodeSDK`;
|
|
50
|
-
4. создать initial request для server-side stream или конечный initial request iterator для `marketdata.marketDataStream`;
|
|
51
|
-
5. открыть stream;
|
|
52
|
-
6. писать события в `stdout`;
|
|
53
|
-
7. писать diagnostics/errors/status в `stderr`;
|
|
54
|
-
8. завершиться по `maxEvents`, `durationMs`, `idleTimeoutMs`, закрытию stream или provider error;
|
|
55
|
-
9. закрыть SDK channel в `finally`.
|
|
27
|
+
За один запуск `stream run` открывает одну сессию с настройками из конфигурации и переопределениями CLI. Лимиты `maxEvents`, `durationMs` и `idleTimeoutMs` приводят к штатному завершению; ошибка провайдера, возникшая до таймаута, не маскируется.
|
|
56
28
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
При достижении `maxEvents` pending read отсутствует: команда сначала завершает iterator, затем отменяет session signal и закрывает SDK. Это сохраняет штатное завершение без ошибки локальной отмены.
|
|
29
|
+
Порядок отмены чтения, завершения итератора и закрытия SDK описан в [архитектуре потоковой сессии](./clean-architecture/api-commands.md#потоковая-сессия).
|
|
60
30
|
|
|
61
31
|
## Контракт вывода
|
|
62
32
|
|
|
63
|
-
Базовый формат
|
|
33
|
+
Базовый формат вывода потока — `jsonl`. Каждое событие печатается отдельной строкой JSON:
|
|
64
34
|
|
|
65
35
|
```json
|
|
66
36
|
{"stream":"marketdata.marketDataServerSideStream","sequence":1,"receivedAt":"2026-06-29T12:00:00.000Z","type":"candle","payload":{"instrumentUid":"..."}}
|
|
67
37
|
```
|
|
68
38
|
|
|
69
|
-
Обязательные поля
|
|
39
|
+
Обязательные поля структуры события:
|
|
70
40
|
|
|
71
|
-
- `stream` - имя
|
|
72
|
-
- `sequence` - порядковый номер события в
|
|
41
|
+
- `stream` - имя потока из конфигурации;
|
|
42
|
+
- `sequence` - порядковый номер события в текущем процессе;
|
|
73
43
|
- `receivedAt` - время получения события CLI-процессом в ISO-формате;
|
|
74
44
|
- `type` - нормализованный тип события;
|
|
75
|
-
- `payload` -
|
|
45
|
+
- `payload` - данные события.
|
|
76
46
|
|
|
77
|
-
CLI пишет в `stdout` только события. Ошибки чтения
|
|
47
|
+
CLI пишет в `stdout` только события. Ошибки чтения конфигурации, транспорта, провайдера и вывода направляются в `stderr`. Статусы подписок, включая отклонённые подписки, выводятся как события в `stdout`; при `runtime.includeSubscriptionEvents: false` эти события не выводятся.
|
|
78
48
|
|
|
79
49
|
## Типы событий
|
|
80
50
|
|
|
81
|
-
`marketdata
|
|
51
|
+
События `marketdata.*`:
|
|
82
52
|
|
|
83
53
|
- `subscribeCandlesResponse`;
|
|
84
54
|
- `subscribeOrderBookResponse`;
|
|
@@ -92,19 +62,19 @@ CLI пишет в `stdout` только события. Ошибки чтени
|
|
|
92
62
|
- `lastPrice`;
|
|
93
63
|
- `ping`.
|
|
94
64
|
|
|
95
|
-
`operations.portfolioStream
|
|
65
|
+
События `operations.portfolioStream`:
|
|
96
66
|
|
|
97
67
|
- `subscriptions`;
|
|
98
68
|
- `portfolio`;
|
|
99
69
|
- `ping`.
|
|
100
70
|
|
|
101
|
-
`operations.positionsStream
|
|
71
|
+
События `operations.positionsStream`:
|
|
102
72
|
|
|
103
73
|
- `subscriptions`;
|
|
104
74
|
- `position`;
|
|
105
75
|
- `ping`.
|
|
106
76
|
|
|
107
|
-
`orders.tradesStream
|
|
77
|
+
События `orders.tradesStream`:
|
|
108
78
|
|
|
109
79
|
- `subscription`;
|
|
110
80
|
- `orderTrades`;
|
|
@@ -114,7 +84,7 @@ CLI пишет в `stdout` только события. Ошибки чтени
|
|
|
114
84
|
|
|
115
85
|
## Настройки runtime
|
|
116
86
|
|
|
117
|
-
|
|
87
|
+
Файл конфигурации задаёт настройки вывода и завершения работы по умолчанию в поле `runtime`. CLI-флаги могут переопределить эти настройки; подписки задаются только в файле:
|
|
118
88
|
|
|
119
89
|
```bash
|
|
120
90
|
t-invest-node-sdk stream run \
|
|
@@ -124,45 +94,43 @@ t-invest-node-sdk stream run \
|
|
|
124
94
|
--include-pings
|
|
125
95
|
```
|
|
126
96
|
|
|
127
|
-
Настройки
|
|
97
|
+
Настройки запуска:
|
|
128
98
|
|
|
129
|
-
- `--config=PATH` — обязательный путь к JSON
|
|
99
|
+
- `--config=PATH` — обязательный путь к JSON-файлу конфигурации;
|
|
130
100
|
- `--max-events=N` — завершиться после N выведенных событий;
|
|
131
101
|
- `--duration-ms=N` — завершиться через N миллисекунд;
|
|
132
102
|
- `--idle-timeout-ms=N` — завершиться, если события отсутствуют N миллисекунд;
|
|
133
103
|
- `--include-pings` — печатать события `ping` в `stdout`;
|
|
134
|
-
- `--raw` — печатать
|
|
104
|
+
- `--raw` — печатать сгенерированный ответ без общей структуры нормализованного события;
|
|
135
105
|
- `--format=jsonl` — формат вывода; поддерживается только `jsonl`.
|
|
136
106
|
|
|
137
|
-
Логические runtime
|
|
107
|
+
Логические флаги настроек `runtime` поддерживают синтаксис `--flag` / `--no-flag`. Используйте `--no-include-pings` или `--no-raw`, чтобы переопределить значение `true` из конфигурации; формы `--flag=true` и `--flag=false` не поддерживаются.
|
|
138
108
|
|
|
139
|
-
Числовые runtime
|
|
109
|
+
Числовые значения в `runtime` должны быть положительными безопасными целыми числами JavaScript.
|
|
140
110
|
|
|
141
111
|
## Коды завершения
|
|
142
112
|
|
|
143
|
-
- `0` -
|
|
144
|
-
- `2` - содержимое
|
|
145
|
-
- `1` - ошибка чтения
|
|
113
|
+
- `0` - поток завершился по лимиту, таймауту или нормальному закрытию;
|
|
114
|
+
- `2` - содержимое конфигурации не прошло синтаксическую или семантическую проверку;
|
|
115
|
+
- `1` - ошибка чтения файла конфигурации, провайдера или выполнения;
|
|
146
116
|
- `130` - процесс остановлен через `SIGINT`;
|
|
147
117
|
- `143` - процесс остановлен через `SIGTERM`.
|
|
148
118
|
|
|
149
|
-
При штатном завершении,
|
|
119
|
+
При штатном завершении, таймауте или обработанной ошибке команда закрывает SDK в `finally`. При `SIGINT` и `SIGTERM` встроенный CLI завершается по стандартным правилам Node.js, поэтому корректная отмена и выполнение `finally` не гарантируются.
|
|
150
120
|
|
|
151
121
|
## Обратное давление
|
|
152
122
|
|
|
153
|
-
`stream run` отдаёт
|
|
123
|
+
`stream run` отдаёт результат последовательностью фрагментов и не собирает бесконечный поток в одну строку. При записи в `stdout` и `stderr` CLI учитывает обратное давление: если буфер потока заполнен, он ждёт событие `drain` или ошибку записи.
|
|
154
124
|
|
|
155
125
|
## Что не входит в текущую реализацию
|
|
156
126
|
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
127
|
+
- вывод событий потока в таблицы или CSV;
|
|
128
|
+
- автоматическое переподключение;
|
|
129
|
+
- сохранение позиции чтения в постоянном хранилище;
|
|
160
130
|
- интерактивная смена подписок после старта;
|
|
161
|
-
-
|
|
162
|
-
- агрегация событий в
|
|
163
|
-
-
|
|
164
|
-
|
|
165
|
-
Эти возможности можно добавить позднее отдельными изменениями контракта.
|
|
131
|
+
- источники запросов двустороннего потока из stdin, файлов или таймеров;
|
|
132
|
+
- агрегация событий в отчёт приложения;
|
|
133
|
+
- запись в файл вместо stdout.
|
|
166
134
|
|
|
167
135
|
## Связанная документация
|
|
168
136
|
|