@woodger/t-invest-node-sdk 0.5.1
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 +611 -0
- package/LICENSE +21 -0
- package/THIRD_PARTY_NOTICES.md +307 -0
- package/certificates/russian-trusted-root-ca.pem +33 -0
- package/dist/application/dto/t-invest-options.d.ts +30 -0
- package/dist/application/dto/t-invest-options.js +11 -0
- package/dist/application/dto/t-invest-services.d.ts +168 -0
- package/dist/application/dto/t-invest-services.js +12 -0
- package/dist/application/errors/sdk-error.d.ts +47 -0
- package/dist/application/errors/sdk-error.js +84 -0
- package/dist/application/reports/accounts.report.d.ts +26 -0
- package/dist/application/reports/accounts.report.js +11 -0
- package/dist/application/reports/accrued-interests.report.d.ts +22 -0
- package/dist/application/reports/accrued-interests.report.js +11 -0
- package/dist/application/reports/asset.report.d.ts +72 -0
- package/dist/application/reports/asset.report.js +11 -0
- package/dist/application/reports/bond-coupons.report.d.ts +31 -0
- package/dist/application/reports/bond-coupons.report.js +11 -0
- package/dist/application/reports/bond.report.d.ts +82 -0
- package/dist/application/reports/bond.report.js +11 -0
- package/dist/application/reports/brands.report.d.ts +24 -0
- package/dist/application/reports/brands.report.js +11 -0
- package/dist/application/reports/broker-report.report.d.ts +74 -0
- package/dist/application/reports/broker-report.report.js +11 -0
- package/dist/application/reports/cancel-order.report.d.ts +14 -0
- package/dist/application/reports/cancel-order.report.js +11 -0
- package/dist/application/reports/cancel-stop-order.report.d.ts +14 -0
- package/dist/application/reports/cancel-stop-order.report.js +11 -0
- package/dist/application/reports/candles.report.d.ts +26 -0
- package/dist/application/reports/candles.report.js +11 -0
- package/dist/application/reports/close-prices.report.d.ts +20 -0
- package/dist/application/reports/close-prices.report.js +11 -0
- package/dist/application/reports/countries.report.d.ts +20 -0
- package/dist/application/reports/countries.report.js +11 -0
- package/dist/application/reports/currency.report.d.ts +58 -0
- package/dist/application/reports/currency.report.js +11 -0
- package/dist/application/reports/dividends-foreign-issuer.report.d.ts +51 -0
- package/dist/application/reports/dividends-foreign-issuer.report.js +11 -0
- package/dist/application/reports/dividends.report.d.ts +33 -0
- package/dist/application/reports/dividends.report.js +11 -0
- package/dist/application/reports/etf.report.d.ts +62 -0
- package/dist/application/reports/etf.report.js +11 -0
- package/dist/application/reports/favorites.report.d.ts +24 -0
- package/dist/application/reports/favorites.report.js +11 -0
- package/dist/application/reports/find-instrument.report.d.ts +34 -0
- package/dist/application/reports/find-instrument.report.js +11 -0
- package/dist/application/reports/future.report.d.ts +66 -0
- package/dist/application/reports/future.report.js +11 -0
- package/dist/application/reports/futures-margin.report.d.ts +21 -0
- package/dist/application/reports/futures-margin.report.js +11 -0
- package/dist/application/reports/index.d.ts +50 -0
- package/dist/application/reports/index.js +66 -0
- package/dist/application/reports/instrument.report.d.ts +47 -0
- package/dist/application/reports/instrument.report.js +11 -0
- package/dist/application/reports/last-prices.report.d.ts +20 -0
- package/dist/application/reports/last-prices.report.js +11 -0
- package/dist/application/reports/last-trades.report.d.ts +24 -0
- package/dist/application/reports/last-trades.report.js +11 -0
- package/dist/application/reports/margin-attributes.report.d.ts +25 -0
- package/dist/application/reports/margin-attributes.report.js +11 -0
- package/dist/application/reports/money.report.d.ts +15 -0
- package/dist/application/reports/money.report.js +11 -0
- package/dist/application/reports/operations-by-cursor.report.d.ts +65 -0
- package/dist/application/reports/operations-by-cursor.report.js +11 -0
- package/dist/application/reports/operations.report.d.ts +40 -0
- package/dist/application/reports/operations.report.js +11 -0
- package/dist/application/reports/option.report.d.ts +76 -0
- package/dist/application/reports/option.report.js +11 -0
- package/dist/application/reports/order-book.report.d.ts +38 -0
- package/dist/application/reports/order-book.report.js +11 -0
- package/dist/application/reports/order-mutation.report.d.ts +45 -0
- package/dist/application/reports/order-mutation.report.js +11 -0
- package/dist/application/reports/order-state.report.d.ts +12 -0
- package/dist/application/reports/order-state.report.js +11 -0
- package/dist/application/reports/orders.report.d.ts +53 -0
- package/dist/application/reports/orders.report.js +11 -0
- package/dist/application/reports/portfolio.report.d.ts +54 -0
- package/dist/application/reports/portfolio.report.js +11 -0
- package/dist/application/reports/positions.report.d.ts +45 -0
- package/dist/application/reports/positions.report.js +11 -0
- package/dist/application/reports/post-stop-order.report.d.ts +14 -0
- package/dist/application/reports/post-stop-order.report.js +11 -0
- package/dist/application/reports/sandbox-account.report.d.ts +20 -0
- package/dist/application/reports/sandbox-account.report.js +11 -0
- package/dist/application/reports/share.report.d.ts +66 -0
- package/dist/application/reports/share.report.js +11 -0
- package/dist/application/reports/stop-orders.report.d.ts +34 -0
- package/dist/application/reports/stop-orders.report.js +11 -0
- package/dist/application/reports/trading-schedules.report.d.ts +44 -0
- package/dist/application/reports/trading-schedules.report.js +11 -0
- package/dist/application/reports/trading-status.report.d.ts +19 -0
- package/dist/application/reports/trading-status.report.js +11 -0
- package/dist/application/reports/trading-statuses.report.d.ts +12 -0
- package/dist/application/reports/trading-statuses.report.js +11 -0
- package/dist/application/reports/user-info.report.d.ts +16 -0
- package/dist/application/reports/user-info.report.js +11 -0
- package/dist/application/reports/user-tariff.report.d.ts +28 -0
- package/dist/application/reports/user-tariff.report.js +11 -0
- package/dist/application/reports/withdraw-limits.report.d.ts +16 -0
- package/dist/application/reports/withdraw-limits.report.js +11 -0
- package/dist/application/services/unary-limiter.d.ts +44 -0
- package/dist/application/services/unary-limiter.js +138 -0
- package/dist/bootstrap/args/command-options.d.ts +43 -0
- package/dist/bootstrap/args/command-options.js +125 -0
- package/dist/bootstrap/args/index.d.ts +1 -0
- package/dist/bootstrap/args/index.js +5 -0
- package/dist/bootstrap/args/instrument-id-options.d.ts +24 -0
- package/dist/bootstrap/args/instrument-id-options.js +47 -0
- package/dist/bootstrap/args/instruments-args.d.ts +49 -0
- package/dist/bootstrap/args/instruments-args.js +89 -0
- package/dist/bootstrap/args/sdk-options.d.ts +19 -0
- package/dist/bootstrap/args/sdk-options.js +40 -0
- package/dist/bootstrap/args/side-effect-args.d.ts +20 -0
- package/dist/bootstrap/args/side-effect-args.js +50 -0
- package/dist/bootstrap/cli/contract.d.ts +16 -0
- package/dist/bootstrap/cli/contract.js +15 -0
- package/dist/bootstrap/cli/domains.d.ts +260 -0
- package/dist/bootstrap/cli/domains.js +631 -0
- package/dist/bootstrap/cli/error.d.ts +15 -0
- package/dist/bootstrap/cli/error.js +40 -0
- package/dist/bootstrap/cli/help.d.ts +751 -0
- package/dist/bootstrap/cli/help.js +1789 -0
- package/dist/bootstrap/cli/registry.d.ts +2102 -0
- package/dist/bootstrap/cli/registry.js +186 -0
- package/dist/bootstrap/cli/runner.d.ts +10 -0
- package/dist/bootstrap/cli/runner.js +151 -0
- package/dist/bootstrap/cli/version.d.ts +17 -0
- package/dist/bootstrap/cli/version.js +26 -0
- package/dist/bootstrap/commands/accounts/cli.d.ts +63 -0
- package/dist/bootstrap/commands/accounts/cli.js +50 -0
- package/dist/bootstrap/commands/accounts/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/accounts/reporter.js +50 -0
- package/dist/bootstrap/commands/accrued-interests/cli.d.ts +129 -0
- package/dist/bootstrap/commands/accrued-interests/cli.js +80 -0
- package/dist/bootstrap/commands/accrued-interests/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/accrued-interests/reporter.js +43 -0
- package/dist/bootstrap/commands/asset/cli.d.ts +99 -0
- package/dist/bootstrap/commands/asset/cli.js +64 -0
- package/dist/bootstrap/commands/asset/reporter.d.ts +16 -0
- package/dist/bootstrap/commands/asset/reporter.js +122 -0
- package/dist/bootstrap/commands/assets/cli.d.ts +102 -0
- package/dist/bootstrap/commands/assets/cli.js +78 -0
- package/dist/bootstrap/commands/assets/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/assets/reporter.js +27 -0
- package/dist/bootstrap/commands/bond/cli.d.ts +83 -0
- package/dist/bootstrap/commands/bond/cli.js +53 -0
- package/dist/bootstrap/commands/bond/reporter.d.ts +15 -0
- package/dist/bootstrap/commands/bond/reporter.js +123 -0
- package/dist/bootstrap/commands/bond-coupons/cli.d.ts +129 -0
- package/dist/bootstrap/commands/bond-coupons/cli.js +80 -0
- package/dist/bootstrap/commands/bond-coupons/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/bond-coupons/reporter.js +64 -0
- package/dist/bootstrap/commands/bonds/cli.d.ts +73 -0
- package/dist/bootstrap/commands/bonds/cli.js +53 -0
- package/dist/bootstrap/commands/bonds/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/bonds/reporter.js +27 -0
- package/dist/bootstrap/commands/brand/cli.d.ts +99 -0
- package/dist/bootstrap/commands/brand/cli.js +64 -0
- package/dist/bootstrap/commands/brand/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/brand/reporter.js +37 -0
- package/dist/bootstrap/commands/brands/cli.d.ts +63 -0
- package/dist/bootstrap/commands/brands/cli.js +50 -0
- package/dist/bootstrap/commands/brands/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/brands/reporter.js +49 -0
- package/dist/bootstrap/commands/broker-report/cli.d.ts +132 -0
- package/dist/bootstrap/commands/broker-report/cli.js +105 -0
- package/dist/bootstrap/commands/broker-report/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/broker-report/reporter.js +123 -0
- package/dist/bootstrap/commands/cancel-order/cli.d.ts +120 -0
- package/dist/bootstrap/commands/cancel-order/cli.js +71 -0
- package/dist/bootstrap/commands/cancel-order/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/cancel-order/reporter.js +32 -0
- package/dist/bootstrap/commands/cancel-stop-order/cli.d.ts +120 -0
- package/dist/bootstrap/commands/cancel-stop-order/cli.js +71 -0
- package/dist/bootstrap/commands/cancel-stop-order/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/cancel-stop-order/reporter.js +32 -0
- package/dist/bootstrap/commands/candles/cli.d.ts +138 -0
- package/dist/bootstrap/commands/candles/cli.js +104 -0
- package/dist/bootstrap/commands/candles/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/candles/reporter.js +49 -0
- package/dist/bootstrap/commands/close-prices/cli.d.ts +99 -0
- package/dist/bootstrap/commands/close-prices/cli.js +66 -0
- package/dist/bootstrap/commands/close-prices/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/close-prices/reporter.js +43 -0
- package/dist/bootstrap/commands/compile-proto/cli.d.ts +12 -0
- package/dist/bootstrap/commands/compile-proto/cli.js +22 -0
- package/dist/bootstrap/commands/countries/cli.d.ts +63 -0
- package/dist/bootstrap/commands/countries/cli.js +50 -0
- package/dist/bootstrap/commands/countries/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/countries/reporter.js +42 -0
- package/dist/bootstrap/commands/currencies/cli.d.ts +73 -0
- package/dist/bootstrap/commands/currencies/cli.js +53 -0
- package/dist/bootstrap/commands/currencies/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/currencies/reporter.js +27 -0
- package/dist/bootstrap/commands/currency/cli.d.ts +83 -0
- package/dist/bootstrap/commands/currency/cli.js +53 -0
- package/dist/bootstrap/commands/currency/reporter.d.ts +15 -0
- package/dist/bootstrap/commands/currency/reporter.js +104 -0
- package/dist/bootstrap/commands/dividends/cli.d.ts +129 -0
- package/dist/bootstrap/commands/dividends/cli.js +80 -0
- package/dist/bootstrap/commands/dividends/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/dividends/reporter.js +62 -0
- package/dist/bootstrap/commands/dividends-foreign-issuer/cli.d.ts +132 -0
- package/dist/bootstrap/commands/dividends-foreign-issuer/cli.js +105 -0
- package/dist/bootstrap/commands/dividends-foreign-issuer/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/dividends-foreign-issuer/reporter.js +108 -0
- package/dist/bootstrap/commands/edit-favorites/cli.d.ts +129 -0
- package/dist/bootstrap/commands/edit-favorites/cli.js +78 -0
- package/dist/bootstrap/commands/edit-favorites/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/edit-favorites/reporter.js +23 -0
- package/dist/bootstrap/commands/etf/cli.d.ts +83 -0
- package/dist/bootstrap/commands/etf/cli.js +53 -0
- package/dist/bootstrap/commands/etf/reporter.d.ts +15 -0
- package/dist/bootstrap/commands/etf/reporter.js +109 -0
- package/dist/bootstrap/commands/etfs/cli.d.ts +73 -0
- package/dist/bootstrap/commands/etfs/cli.js +53 -0
- package/dist/bootstrap/commands/etfs/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/etfs/reporter.js +27 -0
- package/dist/bootstrap/commands/favorites/cli.d.ts +63 -0
- package/dist/bootstrap/commands/favorites/cli.js +50 -0
- package/dist/bootstrap/commands/favorites/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/favorites/reporter.js +60 -0
- package/dist/bootstrap/commands/find-instrument/cli.d.ts +126 -0
- package/dist/bootstrap/commands/find-instrument/cli.js +88 -0
- package/dist/bootstrap/commands/find-instrument/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/find-instrument/reporter.js +71 -0
- package/dist/bootstrap/commands/future/cli.d.ts +83 -0
- package/dist/bootstrap/commands/future/cli.js +53 -0
- package/dist/bootstrap/commands/future/reporter.d.ts +15 -0
- package/dist/bootstrap/commands/future/reporter.js +116 -0
- package/dist/bootstrap/commands/futures/cli.d.ts +73 -0
- package/dist/bootstrap/commands/futures/cli.js +53 -0
- package/dist/bootstrap/commands/futures/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/futures/reporter.js +27 -0
- package/dist/bootstrap/commands/futures-margin/cli.d.ts +105 -0
- package/dist/bootstrap/commands/futures-margin/cli.js +64 -0
- package/dist/bootstrap/commands/futures-margin/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/futures-margin/reporter.js +40 -0
- package/dist/bootstrap/commands/help/cli.d.ts +13 -0
- package/dist/bootstrap/commands/help/cli.js +26 -0
- package/dist/bootstrap/commands/instrument/cli.d.ts +83 -0
- package/dist/bootstrap/commands/instrument/cli.js +53 -0
- package/dist/bootstrap/commands/instrument/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/instrument/reporter.js +91 -0
- package/dist/bootstrap/commands/last-prices/cli.d.ts +99 -0
- package/dist/bootstrap/commands/last-prices/cli.js +66 -0
- package/dist/bootstrap/commands/last-prices/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/last-prices/reporter.js +43 -0
- package/dist/bootstrap/commands/last-trades/cli.d.ts +123 -0
- package/dist/bootstrap/commands/last-trades/cli.js +82 -0
- package/dist/bootstrap/commands/last-trades/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/last-trades/reporter.js +48 -0
- package/dist/bootstrap/commands/margin-attributes/cli.d.ts +99 -0
- package/dist/bootstrap/commands/margin-attributes/cli.js +64 -0
- package/dist/bootstrap/commands/margin-attributes/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/margin-attributes/reporter.js +51 -0
- package/dist/bootstrap/commands/operations/cli.d.ts +156 -0
- package/dist/bootstrap/commands/operations/cli.js +99 -0
- package/dist/bootstrap/commands/operations/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/operations/reporter.js +78 -0
- package/dist/bootstrap/commands/operations-by-cursor/cli.d.ts +204 -0
- package/dist/bootstrap/commands/operations-by-cursor/cli.js +164 -0
- package/dist/bootstrap/commands/operations-by-cursor/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/operations-by-cursor/reporter.js +107 -0
- package/dist/bootstrap/commands/option/cli.d.ts +83 -0
- package/dist/bootstrap/commands/option/cli.js +53 -0
- package/dist/bootstrap/commands/option/reporter.d.ts +15 -0
- package/dist/bootstrap/commands/option/reporter.js +125 -0
- package/dist/bootstrap/commands/options-by/cli.d.ts +108 -0
- package/dist/bootstrap/commands/options-by/cli.js +68 -0
- package/dist/bootstrap/commands/options-by/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/options-by/reporter.js +27 -0
- package/dist/bootstrap/commands/order-book/cli.d.ts +120 -0
- package/dist/bootstrap/commands/order-book/cli.js +73 -0
- package/dist/bootstrap/commands/order-book/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/order-book/reporter.js +60 -0
- package/dist/bootstrap/commands/order-state/cli.d.ts +111 -0
- package/dist/bootstrap/commands/order-state/cli.js +71 -0
- package/dist/bootstrap/commands/order-state/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/order-state/reporter.js +57 -0
- package/dist/bootstrap/commands/orders/cli.d.ts +99 -0
- package/dist/bootstrap/commands/orders/cli.js +64 -0
- package/dist/bootstrap/commands/orders/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/orders/reporter.js +88 -0
- package/dist/bootstrap/commands/portfolio/cli.d.ts +114 -0
- package/dist/bootstrap/commands/portfolio/cli.js +77 -0
- package/dist/bootstrap/commands/portfolio/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/portfolio/reporter.js +95 -0
- package/dist/bootstrap/commands/positions/cli.d.ts +99 -0
- package/dist/bootstrap/commands/positions/cli.js +64 -0
- package/dist/bootstrap/commands/positions/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/positions/reporter.js +116 -0
- package/dist/bootstrap/commands/post-order/cli.d.ts +192 -0
- package/dist/bootstrap/commands/post-order/cli.js +113 -0
- package/dist/bootstrap/commands/post-order/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/post-order/reporter.js +77 -0
- package/dist/bootstrap/commands/post-stop-order/cli.d.ts +216 -0
- package/dist/bootstrap/commands/post-stop-order/cli.js +145 -0
- package/dist/bootstrap/commands/post-stop-order/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/post-stop-order/reporter.js +31 -0
- package/dist/bootstrap/commands/replace-order/cli.d.ts +180 -0
- package/dist/bootstrap/commands/replace-order/cli.js +99 -0
- package/dist/bootstrap/commands/replace-order/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/replace-order/reporter.js +17 -0
- package/dist/bootstrap/commands/sandbox-accounts/cli.d.ts +64 -0
- package/dist/bootstrap/commands/sandbox-accounts/cli.js +54 -0
- package/dist/bootstrap/commands/sandbox-cancel-order/cli.d.ts +120 -0
- package/dist/bootstrap/commands/sandbox-cancel-order/cli.js +69 -0
- package/dist/bootstrap/commands/sandbox-close-account/cli.d.ts +108 -0
- package/dist/bootstrap/commands/sandbox-close-account/cli.js +66 -0
- package/dist/bootstrap/commands/sandbox-close-account/reporter.d.ts +12 -0
- package/dist/bootstrap/commands/sandbox-close-account/reporter.js +32 -0
- package/dist/bootstrap/commands/sandbox-open-account/cli.d.ts +70 -0
- package/dist/bootstrap/commands/sandbox-open-account/cli.js +57 -0
- package/dist/bootstrap/commands/sandbox-open-account/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/sandbox-open-account/reporter.js +31 -0
- package/dist/bootstrap/commands/sandbox-operations/cli.d.ts +156 -0
- package/dist/bootstrap/commands/sandbox-operations/cli.js +78 -0
- package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.d.ts +204 -0
- package/dist/bootstrap/commands/sandbox-operations-by-cursor/cli.js +98 -0
- package/dist/bootstrap/commands/sandbox-order-state/cli.d.ts +111 -0
- package/dist/bootstrap/commands/sandbox-order-state/cli.js +67 -0
- package/dist/bootstrap/commands/sandbox-orders/cli.d.ts +99 -0
- package/dist/bootstrap/commands/sandbox-orders/cli.js +63 -0
- package/dist/bootstrap/commands/sandbox-pay-in/cli.d.ts +135 -0
- package/dist/bootstrap/commands/sandbox-pay-in/cli.js +86 -0
- package/dist/bootstrap/commands/sandbox-pay-in/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/sandbox-pay-in/reporter.js +32 -0
- package/dist/bootstrap/commands/sandbox-portfolio/cli.d.ts +114 -0
- package/dist/bootstrap/commands/sandbox-portfolio/cli.js +68 -0
- package/dist/bootstrap/commands/sandbox-positions/cli.d.ts +99 -0
- package/dist/bootstrap/commands/sandbox-positions/cli.js +63 -0
- package/dist/bootstrap/commands/sandbox-post-order/cli.d.ts +192 -0
- package/dist/bootstrap/commands/sandbox-post-order/cli.js +90 -0
- package/dist/bootstrap/commands/sandbox-replace-order/cli.d.ts +180 -0
- package/dist/bootstrap/commands/sandbox-replace-order/cli.js +86 -0
- package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.d.ts +99 -0
- package/dist/bootstrap/commands/sandbox-withdraw-limits/cli.js +63 -0
- package/dist/bootstrap/commands/share/cli.d.ts +83 -0
- package/dist/bootstrap/commands/share/cli.js +53 -0
- package/dist/bootstrap/commands/share/reporter.d.ts +15 -0
- package/dist/bootstrap/commands/share/reporter.js +111 -0
- package/dist/bootstrap/commands/shares/cli.d.ts +73 -0
- package/dist/bootstrap/commands/shares/cli.js +53 -0
- package/dist/bootstrap/commands/shares/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/shares/reporter.js +27 -0
- package/dist/bootstrap/commands/stop-orders/cli.d.ts +99 -0
- package/dist/bootstrap/commands/stop-orders/cli.js +68 -0
- package/dist/bootstrap/commands/stop-orders/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/stop-orders/reporter.js +69 -0
- package/dist/bootstrap/commands/stream-run/cli.d.ts +138 -0
- package/dist/bootstrap/commands/stream-run/cli.js +229 -0
- package/dist/bootstrap/commands/stream-run/config.d.ts +56 -0
- package/dist/bootstrap/commands/stream-run/config.js +468 -0
- package/dist/bootstrap/commands/stream-run/reporter.d.ts +30 -0
- package/dist/bootstrap/commands/stream-run/reporter.js +76 -0
- package/dist/bootstrap/commands/trading-schedules/cli.d.ts +120 -0
- package/dist/bootstrap/commands/trading-schedules/cli.js +79 -0
- package/dist/bootstrap/commands/trading-schedules/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/trading-schedules/reporter.js +58 -0
- package/dist/bootstrap/commands/trading-status/cli.d.ts +99 -0
- package/dist/bootstrap/commands/trading-status/cli.js +65 -0
- package/dist/bootstrap/commands/trading-status/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/trading-status/reporter.js +51 -0
- package/dist/bootstrap/commands/trading-statuses/cli.d.ts +99 -0
- package/dist/bootstrap/commands/trading-statuses/cli.js +64 -0
- package/dist/bootstrap/commands/trading-statuses/reporter.d.ts +14 -0
- package/dist/bootstrap/commands/trading-statuses/reporter.js +44 -0
- package/dist/bootstrap/commands/user-info/cli.d.ts +63 -0
- package/dist/bootstrap/commands/user-info/cli.js +50 -0
- package/dist/bootstrap/commands/user-info/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/user-info/reporter.js +39 -0
- package/dist/bootstrap/commands/user-tariff/cli.d.ts +63 -0
- package/dist/bootstrap/commands/user-tariff/cli.js +50 -0
- package/dist/bootstrap/commands/user-tariff/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/user-tariff/reporter.js +50 -0
- package/dist/bootstrap/commands/version/cli.d.ts +13 -0
- package/dist/bootstrap/commands/version/cli.js +22 -0
- package/dist/bootstrap/commands/withdraw-limits/cli.d.ts +99 -0
- package/dist/bootstrap/commands/withdraw-limits/cli.js +64 -0
- package/dist/bootstrap/commands/withdraw-limits/reporter.d.ts +13 -0
- package/dist/bootstrap/commands/withdraw-limits/reporter.js +59 -0
- package/dist/bootstrap/generated-exports.d.ts +29 -0
- package/dist/bootstrap/generated-exports.js +590 -0
- package/dist/bootstrap/index.d.ts +6 -0
- package/dist/bootstrap/index.js +22 -0
- package/dist/bootstrap/proto/compile-proto.d.ts +18 -0
- package/dist/bootstrap/proto/compile-proto.js +122 -0
- package/dist/bootstrap/sdk-config.d.ts +21 -0
- package/dist/bootstrap/sdk-config.js +152 -0
- package/dist/bootstrap/t-invest-node-sdk.d.ts +42 -0
- package/dist/bootstrap/t-invest-node-sdk.js +115 -0
- package/dist/bootstrap/unary-limit-config.d.ts +38 -0
- package/dist/bootstrap/unary-limit-config.js +130 -0
- package/dist/config.d.ts +160 -0
- package/dist/config.js +173 -0
- package/dist/config.types.d.ts +89 -0
- package/dist/config.types.js +13 -0
- package/dist/generated/common.d.ts +214 -0
- package/dist/generated/common.js +1336 -0
- package/dist/generated/google/api/field_behavior.d.ts +61 -0
- package/dist/generated/google/api/field_behavior.js +126 -0
- package/dist/generated/google/protobuf/descriptor.d.ts +1330 -0
- package/dist/generated/google/protobuf/descriptor.js +5984 -0
- package/dist/generated/google/protobuf/timestamp.d.ts +122 -0
- package/dist/generated/google/protobuf/timestamp.js +102 -0
- package/dist/generated/instruments.d.ts +3230 -0
- package/dist/generated/instruments.js +24246 -0
- package/dist/generated/marketdata.d.ts +1268 -0
- package/dist/generated/marketdata.js +8922 -0
- package/dist/generated/operations.d.ts +1165 -0
- package/dist/generated/operations.js +8625 -0
- package/dist/generated/orders.d.ts +806 -0
- package/dist/generated/orders.js +5639 -0
- package/dist/generated/sandbox.d.ts +356 -0
- package/dist/generated/sandbox.js +603 -0
- package/dist/generated/signals.d.ts +196 -0
- package/dist/generated/signals.js +1261 -0
- package/dist/generated/stoporders.d.ts +328 -0
- package/dist/generated/stoporders.js +1990 -0
- package/dist/generated/users.d.ts +453 -0
- package/dist/generated/users.js +2334 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +30 -0
- package/dist/infrastructure/interceptor/index.d.ts +1 -0
- package/dist/infrastructure/interceptor/index.js +17 -0
- package/dist/infrastructure/interceptor/warning-interceptor.d.ts +23 -0
- package/dist/infrastructure/interceptor/warning-interceptor.js +38 -0
- package/dist/infrastructure/report-values.d.ts +19 -0
- package/dist/infrastructure/report-values.js +50 -0
- package/dist/infrastructure/transport/grpc/index.d.ts +5 -0
- package/dist/infrastructure/transport/grpc/index.js +13 -0
- package/dist/infrastructure/transport/grpc/sdk-channel.d.ts +12 -0
- package/dist/infrastructure/transport/grpc/sdk-channel.js +23 -0
- package/dist/infrastructure/transport/grpc/sdk-client.d.ts +16 -0
- package/dist/infrastructure/transport/grpc/sdk-client.js +33 -0
- package/dist/infrastructure/transport/grpc/sdk-metadata.d.ts +12 -0
- package/dist/infrastructure/transport/grpc/sdk-metadata.js +22 -0
- package/dist/infrastructure/transport/grpc/sdk-middleware.d.ts +22 -0
- package/dist/infrastructure/transport/grpc/sdk-middleware.js +312 -0
- package/dist/infrastructure/transport/grpc/tls-root-certificates.d.ts +10 -0
- package/dist/infrastructure/transport/grpc/tls-root-certificates.js +20 -0
- package/dist/infrastructure/transport/grpc/unary-limit-resolver.d.ts +22 -0
- package/dist/infrastructure/transport/grpc/unary-limit-resolver.js +60 -0
- package/dist/infrastructure/transport/grpc/unary-limits.d.ts +1 -0
- package/dist/infrastructure/transport/grpc/unary-limits.js +7 -0
- package/docs/architecture.md +378 -0
- package/docs/bundled-ca.md +157 -0
- package/docs/clean-architecture/adapters.md +173 -0
- package/docs/clean-architecture/api-commands.md +487 -0
- package/docs/clean-architecture/application.md +137 -0
- package/docs/clean-architecture/cli-output-boundaries.md +256 -0
- package/docs/clean-architecture/dto.md +153 -0
- package/docs/clean-architecture/index.md +89 -0
- package/docs/cli-stream-configuration.md +305 -0
- package/docs/cli-stream-reference.md +195 -0
- package/docs/guides/custom-unary-limiter.md +552 -0
- package/docs/guides/errors-and-lifecycle.md +196 -0
- package/docs/guides/getting-started.md +100 -0
- package/docs/guides/index.md +43 -0
- package/docs/guides/streams-and-cancellation.md +177 -0
- package/docs/guides/testing-with-service-definitions.md +110 -0
- package/docs/guides/unary-calls.md +216 -0
- package/docs/index.md +86 -0
- package/docs/limits-policy.md +201 -0
- package/docs/roadmap.md +204 -0
- package/docs/tls-policy.md +62 -0
- package/package.json +62 -0
- package/readme.md +472 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Unary-вызовы
|
|
2
|
+
|
|
3
|
+
> Type: Guide. Руководство показывает несколько связанных unary-запросов через
|
|
4
|
+
> публичный SDK facade, per-call deadline и чтение response metadata.
|
|
5
|
+
|
|
6
|
+
## Полный сценарий
|
|
7
|
+
|
|
8
|
+
Пример получает доступный счет, портфель, последние минутные свечи и активные
|
|
9
|
+
сигналы первой доступной стратегии. Каждый RPC получает собственный deadline.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import {
|
|
13
|
+
CandleInterval,
|
|
14
|
+
PortfolioRequest_CurrencyRequest,
|
|
15
|
+
SignalState,
|
|
16
|
+
TInvestNodeSDK,
|
|
17
|
+
type TInvestCallOptions,
|
|
18
|
+
type TInvestMetadata
|
|
19
|
+
} from '@woodger/t-invest-node-sdk';
|
|
20
|
+
|
|
21
|
+
type RequiredEnvironmentVariable =
|
|
22
|
+
| 'T_INVEST_TOKEN'
|
|
23
|
+
| 'T_INVEST_ENDPOINT';
|
|
24
|
+
|
|
25
|
+
function requireEnvironment(name: RequiredEnvironmentVariable): string {
|
|
26
|
+
const value = process.env[name]?.trim();
|
|
27
|
+
|
|
28
|
+
if (!value) {
|
|
29
|
+
throw new Error(`Environment variable ${name} is required`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function logRateLimit(
|
|
36
|
+
operation: string,
|
|
37
|
+
phase: 'header' | 'trailer',
|
|
38
|
+
metadata: TInvestMetadata
|
|
39
|
+
): void {
|
|
40
|
+
const limit = metadata.get('x-ratelimit-limit');
|
|
41
|
+
const remaining = metadata.get('x-ratelimit-remaining');
|
|
42
|
+
const reset = metadata.get('x-ratelimit-reset');
|
|
43
|
+
|
|
44
|
+
if (limit !== undefined || remaining !== undefined || reset !== undefined) {
|
|
45
|
+
console.log({
|
|
46
|
+
operation,
|
|
47
|
+
phase,
|
|
48
|
+
limit,
|
|
49
|
+
remaining,
|
|
50
|
+
reset
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function callOptions(operation: string): TInvestCallOptions {
|
|
56
|
+
return {
|
|
57
|
+
signal: AbortSignal.timeout(5_000),
|
|
58
|
+
onHeader(metadata) {
|
|
59
|
+
logRateLimit(operation, 'header', metadata);
|
|
60
|
+
},
|
|
61
|
+
onTrailer(metadata) {
|
|
62
|
+
logRateLimit(operation, 'trailer', metadata);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function main(): Promise<void> {
|
|
68
|
+
const sdk = new TInvestNodeSDK({
|
|
69
|
+
token: requireEnvironment('T_INVEST_TOKEN'),
|
|
70
|
+
endpoint: requireEnvironment('T_INVEST_ENDPOINT')
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
const { accounts } = await sdk.users.getAccounts(
|
|
75
|
+
{},
|
|
76
|
+
callOptions('users.getAccounts')
|
|
77
|
+
);
|
|
78
|
+
const account = accounts[0];
|
|
79
|
+
|
|
80
|
+
if (!account) {
|
|
81
|
+
console.log('No accounts are available for this token');
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const portfolio = await sdk.operations.getPortfolio(
|
|
86
|
+
{
|
|
87
|
+
accountId: account.id,
|
|
88
|
+
currency:
|
|
89
|
+
PortfolioRequest_CurrencyRequest
|
|
90
|
+
.RUB
|
|
91
|
+
},
|
|
92
|
+
callOptions('operations.getPortfolio')
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const now = new Date();
|
|
96
|
+
const fiveMinutesAgo = new Date(now.getTime() - 5 * 60 * 1000);
|
|
97
|
+
const candles = await sdk.marketdata.getCandles(
|
|
98
|
+
{
|
|
99
|
+
instrumentId: 'BBG00QPYJ5H0',
|
|
100
|
+
interval: CandleInterval.CANDLE_INTERVAL_1_MIN,
|
|
101
|
+
from: fiveMinutesAgo,
|
|
102
|
+
to: now
|
|
103
|
+
},
|
|
104
|
+
callOptions('marketdata.getCandles')
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const { strategies } = await sdk.signals.getStrategies(
|
|
108
|
+
{},
|
|
109
|
+
callOptions('signals.getStrategies')
|
|
110
|
+
);
|
|
111
|
+
const strategy = strategies[0];
|
|
112
|
+
|
|
113
|
+
const signals = strategy
|
|
114
|
+
? await sdk.signals.getSignals(
|
|
115
|
+
{
|
|
116
|
+
strategyId: strategy.strategyId,
|
|
117
|
+
active: SignalState.SIGNAL_STATE_ACTIVE,
|
|
118
|
+
from: new Date(now.getTime() - 24 * 60 * 60 * 1000),
|
|
119
|
+
to: now,
|
|
120
|
+
paging: {
|
|
121
|
+
limit: 20,
|
|
122
|
+
pageNumber: 0
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
callOptions('signals.getSignals')
|
|
126
|
+
)
|
|
127
|
+
: undefined;
|
|
128
|
+
|
|
129
|
+
console.log({
|
|
130
|
+
accountId: account.id,
|
|
131
|
+
portfolioPositions: portfolio.positions.length,
|
|
132
|
+
candles: candles.candles.length,
|
|
133
|
+
strategies: strategies.length,
|
|
134
|
+
activeSignals: signals?.signals.length ?? 0
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
sdk.close();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
void main().catch((error: unknown) => {
|
|
143
|
+
console.error(error);
|
|
144
|
+
process.exitCode = 1;
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Опции отдельного вызова
|
|
149
|
+
|
|
150
|
+
`TInvestCallOptions` действует на один RPC:
|
|
151
|
+
|
|
152
|
+
- `signal` отменяет ожидание локальной unary-квоты и последующий transport call;
|
|
153
|
+
- `onHeader` получает initial response metadata;
|
|
154
|
+
- `onTrailer` получает trailing response metadata.
|
|
155
|
+
|
|
156
|
+
Metadata callbacks выполняются синхронно. Если `onHeader` или `onTrailer`
|
|
157
|
+
бросает исключение, SDK отклоняет этой же ошибкой владеющий RPC и отменяет
|
|
158
|
+
transport call, если тот еще не завершился. Не передавайте сюда `async`
|
|
159
|
+
functions: асинхронную обработку metadata нужно выполнять после завершения
|
|
160
|
+
вызова.
|
|
161
|
+
|
|
162
|
+
`AbortSignal.timeout()` создает независимый deadline для каждого вызова в
|
|
163
|
+
примере. Если один signal нужно разделить между несколькими RPC, его отмена
|
|
164
|
+
остановит все вызовы, которым он был передан.
|
|
165
|
+
|
|
166
|
+
Authorization и instance `x-app-name` принадлежат SDK. Consumer metadata
|
|
167
|
+
объединяется с instance metadata, но не должна использоваться для подмены этих
|
|
168
|
+
заголовков.
|
|
169
|
+
|
|
170
|
+
## Устаревшие поля провайдера
|
|
171
|
+
|
|
172
|
+
Публичные сгенерированные декларации повторяют исходный контракт T-Invest вместе
|
|
173
|
+
с его пометками `@deprecated`. Такая пометка означает, что поле нельзя
|
|
174
|
+
автоматически переносить в стабильную доменную или HTTP-модель: сначала нужно
|
|
175
|
+
определить его бизнес-смысл и контракт замены.
|
|
176
|
+
|
|
177
|
+
В частности, `klong` и `kshort` описывают коэффициенты ставки риска по клиенту,
|
|
178
|
+
а `dlong` и `dshort` — ставки риска начальной маржи. SDK не подставляет
|
|
179
|
+
`dlong`/`dshort` вместо `klong`/`kshort` и не объявляет их прямой заменой.
|
|
180
|
+
|
|
181
|
+
Отчёты CLI ветки `0.4.x` сохраняли `klong` и `kshort` для совместимости.
|
|
182
|
+
Начиная с `0.5.0` нормализованный JSON-вывод CLI не содержит эти поля.
|
|
183
|
+
`dlong` и `dshort` остаются отдельными полями со своей семантикой и не
|
|
184
|
+
подставляются вместо удалённых значений. Публичные generated DTO по-прежнему
|
|
185
|
+
дословно отражают upstream-контракт, поэтому прямые service-вызовы продолжают
|
|
186
|
+
возвращать `klong` и `kshort`, пока они присутствуют в T-Invest API.
|
|
187
|
+
|
|
188
|
+
Алиас CLI `--figi` сохранён для совместимости, но его значение преобразуется в
|
|
189
|
+
актуальное protobuf-поле `instrumentId`. Во встроенном CLI устаревшие FIGI-поля
|
|
190
|
+
контрактов запросов и подписок сохраняют значения по умолчанию protobuf и не
|
|
191
|
+
сериализуются. При прямом вызове фасада сервисов содержимое сгенерированного
|
|
192
|
+
запроса по-прежнему задаёт сам Consumer.
|
|
193
|
+
|
|
194
|
+
Consumer-у рекомендуется:
|
|
195
|
+
|
|
196
|
+
- не переносить устаревшие поля провайдера за пределы транспортного адаптера,
|
|
197
|
+
если у приложения нет подтвержденного бизнес-сценария;
|
|
198
|
+
- пометить уже опубликованные `klong`/`kshort` как устаревшие и сохранить их на
|
|
199
|
+
переходный период, если от них зависят внешние клиенты;
|
|
200
|
+
- вводить `dlong`/`dshort` как отдельные поля с собственной семантикой, а не как
|
|
201
|
+
переименование или резервную подстановку для `klong`/`kshort`;
|
|
202
|
+
- изолировать временное чтение устаревших полей и объяснять точечное подавление
|
|
203
|
+
`typescript/no-deprecated` на границе адаптера T-Invest.
|
|
204
|
+
|
|
205
|
+
## Ограничение частоты запросов
|
|
206
|
+
|
|
207
|
+
Unary limiter не включается по умолчанию. Consumer может передать собственную
|
|
208
|
+
реализацию через `TInvestOptions.unaryLimiter`; SDK разрешит для неё package
|
|
209
|
+
quota и объединённый `AbortSignal`. Подробный контракт описан в
|
|
210
|
+
[руководстве по собственной реализации](./custom-unary-limiter.md), а значения
|
|
211
|
+
provider-а — в [лимитной политике](../limits-policy.md).
|
|
212
|
+
|
|
213
|
+
Ошибку `RESOURCE_EXHAUSTED` нельзя автоматически повторять только на основании
|
|
214
|
+
кода. Перед retry нужно учитывать idempotency RPC, metadata provider-а и
|
|
215
|
+
backoff. Пример narrowing приведен в руководстве
|
|
216
|
+
[Ошибки и lifecycle](./errors-and-lifecycle.md).
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Документация проекта
|
|
2
|
+
|
|
3
|
+
> Type: Navigation. Эта страница помогает выбрать актуальный документ и не
|
|
4
|
+
> дублирует пользовательские контракты из README, кода, CLI help или tests.
|
|
5
|
+
|
|
6
|
+
## Начать отсюда
|
|
7
|
+
|
|
8
|
+
- Пользовательская установка, быстрый старт, SDK options и release workflow:
|
|
9
|
+
[README](../readme.md).
|
|
10
|
+
- Законченные сценарии работы с SDK, потоками, ошибками и Consumer-тестами:
|
|
11
|
+
[Руководства для Consumer-ов](./guides/index.md).
|
|
12
|
+
- История версий и инструкции по миграции:
|
|
13
|
+
[CHANGELOG](../CHANGELOG.md).
|
|
14
|
+
- Текущая карта слоев и ownership:
|
|
15
|
+
[Архитектура SDK](./architecture.md).
|
|
16
|
+
- Правила внесения изменений:
|
|
17
|
+
[Политики проекта](https://github.com/woodger/t-invest-node-sdk/blob/main/docs/policy/index.md).
|
|
18
|
+
|
|
19
|
+
## CLI
|
|
20
|
+
|
|
21
|
+
- Поддерживаемые команды, preferred paths и compatibility aliases:
|
|
22
|
+
[API-команды](./clean-architecture/api-commands.md).
|
|
23
|
+
- Контракт `stream run`:
|
|
24
|
+
[Справочник потокового CLI](./cli-stream-reference.md).
|
|
25
|
+
- JSON-конфигурация streaming-команд:
|
|
26
|
+
[Справочник конфигурации потокового CLI](./cli-stream-configuration.md).
|
|
27
|
+
- Границы command-specific formatting, render primitives и terminal output:
|
|
28
|
+
[Разделение форматирования и вывода в CLI](./clean-architecture/cli-output-boundaries.md).
|
|
29
|
+
|
|
30
|
+
Актуальные команды и опции также доступны через встроенный `--help`. Runtime
|
|
31
|
+
контракт CLI принадлежит `src/bootstrap/cli/**`,
|
|
32
|
+
`src/bootstrap/commands/**` и соответствующим tests.
|
|
33
|
+
|
|
34
|
+
## Руководства
|
|
35
|
+
|
|
36
|
+
- [Первый SDK-вызов](./guides/getting-started.md).
|
|
37
|
+
- [Unary-вызовы](./guides/unary-calls.md).
|
|
38
|
+
- [Потоки и отмена](./guides/streams-and-cancellation.md).
|
|
39
|
+
- [Ошибки и lifecycle](./guides/errors-and-lifecycle.md).
|
|
40
|
+
- [Собственная реализация unary limiter-а](./guides/custom-unary-limiter.md).
|
|
41
|
+
- [Mock-сервисы через public exports](./guides/testing-with-service-definitions.md).
|
|
42
|
+
|
|
43
|
+
Guides содержат законченные Consumer workflows. Полные method, DTO и enum
|
|
44
|
+
reference остаются в public types и proto/generated contracts.
|
|
45
|
+
|
|
46
|
+
## SDK и runtime policies
|
|
47
|
+
|
|
48
|
+
- Публичный package entrypoint:
|
|
49
|
+
[`src/index.ts`](https://github.com/woodger/t-invest-node-sdk/blob/main/src/index.ts).
|
|
50
|
+
- Лимиты provider-а, unary limiter port и quota buckets:
|
|
51
|
+
[Лимитная политика](./limits-policy.md).
|
|
52
|
+
- Bundled CA, per-instance trust override и границы TLS policy:
|
|
53
|
+
[TLS-доверие](./tls-policy.md).
|
|
54
|
+
- Происхождение, границы распространения и техническое подключение bundled CA:
|
|
55
|
+
[Встроенный Russian Trusted Root CA](./bundled-ca.md).
|
|
56
|
+
- Архитектурные заметки по application, DTO, отчётам и адаптерам:
|
|
57
|
+
[Заметки по Clean Architecture](./clean-architecture/index.md).
|
|
58
|
+
- Граница project adapters и внешнего API `icore`:
|
|
59
|
+
[Адаптеры](./clean-architecture/adapters.md).
|
|
60
|
+
- Неутверждённые варианты будущих изменений:
|
|
61
|
+
[Roadmap и рабочие идеи](./roadmap.md).
|
|
62
|
+
|
|
63
|
+
## Proto и generated contracts
|
|
64
|
+
|
|
65
|
+
Workflow генерации описан в разделе
|
|
66
|
+
[«Генерация proto»](../readme.md#генерация-proto). Официальный upstream,
|
|
67
|
+
зафиксированные tag и commit хранятся в
|
|
68
|
+
[`contracts/upstream.json`](https://github.com/woodger/t-invest-node-sdk/blob/main/contracts/upstream.json).
|
|
69
|
+
Wire contracts в
|
|
70
|
+
`contracts/*.proto` и generated sources в `src/generated/**` не заменяются
|
|
71
|
+
ручным Markdown reference.
|
|
72
|
+
|
|
73
|
+
## Источники истины
|
|
74
|
+
|
|
75
|
+
Подробные правила выбора источника истины и обновления документации:
|
|
76
|
+
[Политика документации](https://github.com/woodger/t-invest-node-sdk/blob/main/docs/policy/documentation-policy.md).
|
|
77
|
+
|
|
78
|
+
Кратко:
|
|
79
|
+
|
|
80
|
+
- public exports определяет
|
|
81
|
+
[`src/index.ts`](https://github.com/woodger/t-invest-node-sdk/blob/main/src/index.ts);
|
|
82
|
+
- scripts и dependency versions определяет
|
|
83
|
+
[`package.json`](../package.json);
|
|
84
|
+
- CLI behavior определяют runtime source и tests;
|
|
85
|
+
- wire API определяют vendored proto contracts и upstream metadata;
|
|
86
|
+
- Markdown объясняет workflow, границы и маршрут к актуальному контракту.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Лимитная политика T-Invest API
|
|
2
|
+
|
|
3
|
+
Документ фиксирует лимиты из активной официальной документации T-Bank Dev
|
|
4
|
+
Portal: <https://developer.tbank.ru/invest/intro/intro/limits>.
|
|
5
|
+
|
|
6
|
+
Актуальность значений зависит от политики брокера. При изменении официальной
|
|
7
|
+
документации нужно обновить этот файл, декларацию `packageConfig.unaryLimits`
|
|
8
|
+
в `src/config.ts` и связанные тесты одним изменением.
|
|
9
|
+
|
|
10
|
+
## Что важно учитывать
|
|
11
|
+
|
|
12
|
+
- Сервисный лимит provider-а суммирует запросы ко всем методам сервиса.
|
|
13
|
+
- Лимитная политика распространяется на все счета пользователя.
|
|
14
|
+
- Для запросов с одного IP-адреса действует отдельная суммарная политика.
|
|
15
|
+
Официальная рекомендация — не превышать `50` запросов в секунду по всем
|
|
16
|
+
счетам и токенам.
|
|
17
|
+
- Фактические лимиты пользователя доступны через `users.getUserTariff()` и
|
|
18
|
+
response metadata `x-ratelimit-limit`, `x-ratelimit-remaining` и
|
|
19
|
+
`x-ratelimit-reset`.
|
|
20
|
+
|
|
21
|
+
## Лимиты unary-методов
|
|
22
|
+
|
|
23
|
+
SDK работает через `gRPC`, поэтому ниже приведены значения его статической
|
|
24
|
+
unary quota policy.
|
|
25
|
+
|
|
26
|
+
| Сервис или метод | gRPC-лимит |
|
|
27
|
+
| --- | ---: |
|
|
28
|
+
| Сервис инструментов | 200 в минуту |
|
|
29
|
+
| `Bonds`, `Shares`, `Options`, `Futures`, `Etfs`, `GetAssets` | 15 в минуту |
|
|
30
|
+
| Сервис счетов | 100 в минуту |
|
|
31
|
+
| Сервис операций | 200 в минуту |
|
|
32
|
+
| Формирование отчетов в сервисе операций | 5 в минуту |
|
|
33
|
+
| Сервис котировок | 600 в минуту |
|
|
34
|
+
| Сервис сигналов | 100 в минуту |
|
|
35
|
+
| Сервис стоп-ордеров | 50 в минуту |
|
|
36
|
+
| `GetStopOrders` | 60 в минуту |
|
|
37
|
+
| Песочница | 200 в минуту |
|
|
38
|
+
| Сервис ордеров | 100 в минуту |
|
|
39
|
+
| `GetOrders` | 200 в минуту |
|
|
40
|
+
| `PostOrder` | 15 в секунду |
|
|
41
|
+
| `CancelOrder` | 300 в минуту |
|
|
42
|
+
| `ReplaceOrder` | 300 в минуту |
|
|
43
|
+
| `PostOrderAsync` | 600 в минуту |
|
|
44
|
+
|
|
45
|
+
Строки с несколькими методами описывают общую квоту: вызовы `Bonds`, `Shares`,
|
|
46
|
+
`Options`, `Futures`, `Etfs` и `GetAssets` суммарно используют bucket
|
|
47
|
+
`15` запросов в минуту, а два RPC формирования отчетов — общий bucket
|
|
48
|
+
`5` запросов в минуту. Методы ордеров, перечисленные отдельными строками,
|
|
49
|
+
используют индивидуальные buckets.
|
|
50
|
+
|
|
51
|
+
`UnaryLimits` хранит каждое правило как пару `maxRequests` и `windowMs`.
|
|
52
|
+
Поэтому секундное окно `PostOrder` остаётся `{ maxRequests: 15, windowMs:
|
|
53
|
+
1_000 }` и не нормализуется в допускающую другую burst-семантику минутную
|
|
54
|
+
запись.
|
|
55
|
+
|
|
56
|
+
`GetBrokerReport` и `GetDividendsForeignIssuer` объединяют запуск формирования
|
|
57
|
+
и получение готового отчета в одном RPC. Transport resolver не анализирует
|
|
58
|
+
request payload и для всех режимов обоих RPC выбирает одно общее правило с
|
|
59
|
+
квотой `5` запросов за `60_000` мс.
|
|
60
|
+
|
|
61
|
+
## Лимиты stream-соединений
|
|
62
|
+
|
|
63
|
+
Официальная политика задает следующие пределы активных соединений:
|
|
64
|
+
|
|
65
|
+
| Stream service | Лимит соединений |
|
|
66
|
+
| --- | ---: |
|
|
67
|
+
| MarketData | 32 |
|
|
68
|
+
| Orders | 16 на каждый тип stream-соединения |
|
|
69
|
+
| Operations | 11 на каждый тип stream-соединения |
|
|
70
|
+
|
|
71
|
+
Дополнительные ограничения:
|
|
72
|
+
|
|
73
|
+
- В одном MarketData stream можно держать не более `300` одновременных
|
|
74
|
+
подписок суммарно на свечи, стаканы и обезличенные сделки.
|
|
75
|
+
- Подписки `Info` на торговые статусы не входят в лимит `300`.
|
|
76
|
+
- Максимальное количество запросов подписки — `100` в минуту.
|
|
77
|
+
- `users.getUserTariff()` может вернуть лимит соединений на `1` больше для
|
|
78
|
+
безопасного переподключения; использовать этот дополнительный слот как
|
|
79
|
+
рабочий не рекомендуется.
|
|
80
|
+
- Счетчик stream-соединений обновляется каждые `2` минуты.
|
|
81
|
+
- Для `OrderBook` и `Candles` сервер отправляет не более одного сообщения по
|
|
82
|
+
подписке за `100` мс. Для `Trades`, `LastPrice` и `Info` такого интервала нет.
|
|
83
|
+
|
|
84
|
+
## Как это связано с SDK
|
|
85
|
+
|
|
86
|
+
SDK предоставляет необязательный `TInvestUnaryLimiter` port. Если Consumer
|
|
87
|
+
передал `TInvestOptions.unaryLimiter`, SDK перед каждым unary transport call:
|
|
88
|
+
|
|
89
|
+
- использует service fallback или более специфичное правило по полному gRPC
|
|
90
|
+
method path;
|
|
91
|
+
- разрешает общий quota bucket;
|
|
92
|
+
- передаёт limiter-у `path`, `bucket`, `maxRequests`, `windowMs` и объединённый
|
|
93
|
+
`AbortSignal`;
|
|
94
|
+
- продолжает вызов только после успешного завершения `acquire()`.
|
|
95
|
+
|
|
96
|
+
Без `unaryLimiter` скрытого ожидания и локальных counters нет. Streams через
|
|
97
|
+
этот port не проходят. Встроенный CLI также не добавляет limiter. SDK создаёт
|
|
98
|
+
отдельный snapshot таблицы квот для каждого instance, объединяет per-instance
|
|
99
|
+
`unaryLimits` с `defaultConfig.unaryLimits`, но не обновляет его автоматически из
|
|
100
|
+
`users.getUserTariff()` или response metadata.
|
|
101
|
+
|
|
102
|
+
После выдачи permit и передачи unary-вызова transport-у слот не возвращается
|
|
103
|
+
даже при последующей отмене: provider уже мог учесть запрос в своей квоте.
|
|
104
|
+
|
|
105
|
+
Для одного вызова gRPC resolver выбирает только самое специфичное
|
|
106
|
+
совпавшее правило. Method override заменяет service fallback и не передаётся
|
|
107
|
+
как второе одновременное ограничение, поэтому один resolved context не
|
|
108
|
+
воспроизводит все service aggregate и IP policies provider-а. Package policy
|
|
109
|
+
дополнительно связывает некоторые method rules с общей quota group.
|
|
110
|
+
Per-instance override, который меняет квоту отдельного метода, отсоединяет его
|
|
111
|
+
от package default group; согласованный override всех методов группы сохраняет
|
|
112
|
+
общий bucket.
|
|
113
|
+
|
|
114
|
+
Полный контракт создания собственной реализации, cancellation и ownership
|
|
115
|
+
описан в [отдельном руководстве](./guides/custom-unary-limiter.md). Пакет также
|
|
116
|
+
предоставляет необязательную process-local фабрику
|
|
117
|
+
`createInMemoryUnaryLimiter()`: она равномерно распределяет permits, использует
|
|
118
|
+
монотонное время и отменяемую очередь, но не координирует разные процессы и не
|
|
119
|
+
является полной моделью всех ограничений provider-а.
|
|
120
|
+
|
|
121
|
+
## Декларативный package config
|
|
122
|
+
|
|
123
|
+
Package defaults хранятся в `src/config.ts` как одна типизированная декларация.
|
|
124
|
+
Термины source/runtime config и ownership этого pipeline зафиксированы в
|
|
125
|
+
[архитектуре SDK](./architecture.md#конфигурация-терминология-и-ownership).
|
|
126
|
+
Сервисный fallback задается через `default`, индивидуальные RPC — через
|
|
127
|
+
`methods`, а общая квота — одним элементом `groups`:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
OperationsService: {
|
|
131
|
+
default: {
|
|
132
|
+
maxRequests: 200,
|
|
133
|
+
windowMs: 60_000
|
|
134
|
+
},
|
|
135
|
+
groups: {
|
|
136
|
+
reports: {
|
|
137
|
+
limit: {
|
|
138
|
+
maxRequests: 5,
|
|
139
|
+
windowMs: 60_000
|
|
140
|
+
},
|
|
141
|
+
methods: [
|
|
142
|
+
'GetBrokerReport',
|
|
143
|
+
'GetDividendsForeignIssuer'
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`PackageConfigDefinition` из `src/config.types.ts` проверяет при компиляции
|
|
151
|
+
значения квот, имена сервисов и RPC. Bootstrap compiler один раз
|
|
152
|
+
преобразует декларацию в плоские runtime limits и quota buckets и отклоняет
|
|
153
|
+
неположительные или неконечные `maxRequests` и `windowMs`. Публичный
|
|
154
|
+
`defaultConfig.unaryLimits` остаётся плоским. После merge с
|
|
155
|
+
public defaults и per-instance overrides bootstrap повторно проверяет весь
|
|
156
|
+
итоговый snapshot до создания transport resolver, включая
|
|
157
|
+
соответствие service names и полных method paths поддерживаемым generated unary
|
|
158
|
+
definitions.
|
|
159
|
+
|
|
160
|
+
Пример точечного ограничения для отдельного экземпляра:
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
import {
|
|
164
|
+
defineUnaryLimits,
|
|
165
|
+
TInvestNodeSDK,
|
|
166
|
+
type TInvestUnaryLimiter
|
|
167
|
+
} from '@woodger/t-invest-node-sdk';
|
|
168
|
+
|
|
169
|
+
declare const unaryLimiter: TInvestUnaryLimiter;
|
|
170
|
+
|
|
171
|
+
const sdk = new TInvestNodeSDK({
|
|
172
|
+
token,
|
|
173
|
+
endpoint,
|
|
174
|
+
unaryLimiter,
|
|
175
|
+
unaryLimits: defineUnaryLimits({
|
|
176
|
+
UsersService: {
|
|
177
|
+
default: {
|
|
178
|
+
maxRequests: 50,
|
|
179
|
+
windowMs: 60_000
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
OrdersService: {
|
|
183
|
+
methods: {
|
|
184
|
+
PostOrder: {
|
|
185
|
+
maxRequests: 10,
|
|
186
|
+
windowMs: 1_000
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
})
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
`defineUnaryLimits()` преобразует вложенную декларацию в плоский runtime
|
|
195
|
+
`UnaryLimits`. Остальные service и method limits в этом примере наследуются из
|
|
196
|
+
`defaultConfig.unaryLimits`.
|
|
197
|
+
|
|
198
|
+
Consumer-owned limiter должен учитывать выбранную границу координации,
|
|
199
|
+
фактический тариф пользователя и rate-limit metadata provider-а. Наличие
|
|
200
|
+
статической package policy само по себе не определяет retry или deployment
|
|
201
|
+
policy приложения.
|