From 4565876be92e57bb92d2d404256db7bcf142021b Mon Sep 17 00:00:00 2001 From: viet-nv Date: Wed, 3 Aug 2022 18:28:27 +0700 Subject: [PATCH] chore: upgrade dependencies --- .eslintrc.json | 23 +- config-overrides.js | 24 +- cypress/integration/add-liquidity.test.ts | 50 - cypress/integration/landing.test.ts | 22 - cypress/integration/lists.test.ts | 20 - cypress/integration/migrate-v1.test.ts | 8 - cypress/integration/pool.test.ts | 12 - cypress/integration/remove-liquidity.test.ts | 39 - cypress/integration/send.test.ts | 11 - cypress/integration/swap.test.ts | 75 - cypress/integration/token-warning.ts | 17 - cypress/support/commands.d.ts | 10 - cypress/support/commands.js | 82 - cypress/support/index.js | 9 - cypress/tsconfig.json | 10 - lingui.config.ts | 10 +- package.json | 63 +- public/charting_library/charting_library.d.ts | 3601 +-- public/charting_library/datafeed-api.d.ts | 541 +- public/index.html | 10 +- src/apollo/queries/index.ts | 5 +- src/components/AccountDetails/index.tsx | 10 +- src/components/AddressInputPanel/index.tsx | 4 +- src/components/Badge/RangeBadge.tsx | 18 +- src/components/Banner/index.tsx | 2 +- src/components/Button/index.tsx | 15 +- src/components/CurrencyInputPanel/index.tsx | 7 +- src/components/CurrentPrice/index.tsx | 6 +- src/components/FeeSelector/index.tsx | 3 +- src/components/HoverInlineText/index.tsx | 3 +- src/components/Icons/PoolClassicIcon.tsx | 15 +- .../InputStepCounter/InputStepCounter.tsx | 3 +- src/components/LanguageSelector/index.tsx | 4 +- .../LiquidityChartRangeInput/Line.tsx | 9 +- .../LiquidityChartRangeInput/hooks.ts | 6 +- .../LiquidityChartRangeInput/index.tsx | 2 +- .../LiquidityChartRangeInput/svg.tsx | 6 +- src/components/LiveChart/AnimatingNumber.tsx | 12 +- src/components/LiveChart/LineChart.tsx | 131 +- src/components/LiveChart/index.tsx | 7 +- src/components/Menu/ClaimRewardModal.tsx | 6 +- src/components/Menu/FaucetModal.tsx | 6 +- src/components/Modal/index.tsx | 6 +- src/components/ModalViews/index.tsx | 7 +- .../PoolList/ItemCard/TabYourStakedItems.tsx | 8 +- src/components/PoolPriceBar/index.tsx | 12 +- src/components/Popups/ListUpdatePopup.tsx | 6 +- src/components/Popups/PopupItem.tsx | 7 +- src/components/Popups/SimplePopup.tsx | 7 +- src/components/Popups/TransactionPopup.tsx | 7 +- src/components/PositionCard/V1.tsx | 6 +- src/components/PositionPreview/index.tsx | 6 +- .../RangeSelector/PresetsButtons.tsx | 6 +- src/components/RangeSelector/index.tsx | 2 +- src/components/RateToggle/index.tsx | 2 +- src/components/RewardTokenPrices/index.tsx | 8 +- src/components/SearchModal/CurrencyList.tsx | 14 +- src/components/SearchModal/CurrencySearch.tsx | 4 +- src/components/SearchModal/ManageLists.tsx | 4 +- src/components/SearchModal/ManageTokens.tsx | 4 +- src/components/ShareModal/index.tsx | 11 +- src/components/Slider/index.tsx | 4 +- .../index.tsx | 6 +- .../charting_library/charting_library.d.ts | 3601 +-- .../charting_library/datafeed-api.d.ts | 541 +- src/components/TradingViewChart/datafeed.tsx | 15 +- src/components/TradingViewChart/index.tsx | 1 - .../TransactionConfirmationModal/index.tsx | 17 +- src/components/TransactionSettings/index.tsx | 6 +- src/components/Vesting/ProMMVesting.tsx | 6 +- src/components/Vesting/index.tsx | 4 +- src/components/WalletModal/WarningBox.tsx | 7 +- src/components/YieldPools/HarvestAll.tsx | 9 +- src/components/YieldPools/ProMMFarmGroup.tsx | 35 +- .../ProMMFarmModals/DepositModal.tsx | 1 + .../ProMMFarmModals/HarvestModal.tsx | 4 +- .../YieldPools/ProMMFarmModals/StakeModal.tsx | 2 +- .../ProMMFarmModals/WithdrawModal.tsx | 1 + src/components/swap/AdvancedSwapDetails.tsx | 11 +- src/components/swap/SwapModalFooter.tsx | 19 +- src/components/swap/SwapModalHeader.tsx | 14 +- src/components/swap/SwapRoute.tsx | 6 +- src/components/swap/TradePrice.tsx | 5 +- src/components/swapv2/AdvancedSwapDetails.tsx | 7 +- src/components/swapv2/MobileLiveChart.tsx | 6 +- src/components/swapv2/MobileTokenInfo.tsx | 9 +- src/components/swapv2/MobileTradeRoutes.tsx | 6 +- src/components/swapv2/SwapModalFooter.tsx | 14 +- src/components/swapv2/SwapModalHeader.tsx | 14 +- src/components/swapv2/SwapRoute.tsx | 6 +- .../swapv2/TokenInfoV2/BlockWrapper.tsx | 3 +- src/components/swapv2/TradePrice.tsx | 5 +- src/components/swapv2/styleds.tsx | 7 +- src/constants/dexes.ts | 3 +- src/constants/networks.ts | 2 +- src/data/Allowances.ts | 8 +- src/data/Reserves.ts | 14 +- src/hooks/Trades.ts | 4 +- src/hooks/useAllCurrencyCombinations.ts | 8 +- src/hooks/useClaimReward.ts | 8 +- src/hooks/useContract.ts | 40 +- src/hooks/useCopyClipboard.ts | 2 +- src/hooks/useENS.ts | 8 +- src/hooks/useIsTickAtLimit.ts | 6 +- src/hooks/useLiveChartData.ts | 432 +- src/hooks/usePools.ts | 4 +- src/hooks/useProAmmBestTrade.ts | 4 +- src/hooks/useProAmmDerivedPositionInfo.ts | 8 +- src/hooks/useProAmmPositionTokenURI.ts | 19 +- src/hooks/useProAmmPreviousTicks.ts | 2 +- src/hooks/useTheme.ts | 6 +- src/hooks/useWrapCallback.ts | 72 +- src/i18n.tsx | 3 +- src/index.tsx | 11 +- src/locales/en-US.po | 76 +- src/locales/ko-KR.po | 74 +- src/locales/tl-PH.po | 74 +- src/locales/tr-TR.po | 74 +- src/locales/vi-VN.po | 74 +- src/locales/zh-CN.po | 74 +- src/pages/About/AboutKNC.tsx | 2 +- src/pages/About/styleds.tsx | 1 - src/pages/AddLiquidity/TokenPair.tsx | 11 +- src/pages/AddLiquidity/ZapIn.tsx | 11 +- src/pages/AddLiquidityV2/index.tsx | 48 +- src/pages/AddLiquidityV2/redirects.tsx | 6 +- src/pages/App.tsx | 22 +- src/pages/BuyCrypto/index.tsx | 6 +- src/pages/Campaign/CampaignListAndSearch.tsx | 2 +- src/pages/Campaign/index.tsx | 170 +- src/pages/CreatePool/StaticFeeSelector.tsx | 5 +- src/pages/CreatePool/index.tsx | 6 +- src/pages/IncreaseLiquidity/index.tsx | 7 +- src/pages/Pool/index.tsx | 14 +- src/pages/ProAmmPool/PositionListItem.tsx | 7 +- src/pages/ProAmmPools/ListItem.tsx | 3 +- src/pages/ProAmmPools/index.tsx | 2 +- src/pages/RemoveLiquidity/TokenPair.tsx | 47 +- src/pages/RemoveLiquidity/ZapOut.tsx | 29 +- src/pages/RemoveLiquidityProAmm/index.tsx | 17 +- src/pages/Swap/index.tsx | 26 +- src/pages/SwapProAmm/index.tsx | 25 +- src/pages/SwapV2/index.tsx | 38 +- .../hooks/useGetCoinGeckoChartData.ts | 7 +- .../TrueSight/hooks/useGetTrendingData.ts | 7 +- .../TrueSight/hooks/useGetTrendingSoonData.ts | 7 +- .../getFormattedNumLongDiscoveredDetails.ts | 5 +- src/pages/Yield/index.tsx | 2 +- src/react-app-env.d.ts | 16 +- src/state/application/hooks.ts | 10 +- src/state/application/reducer.test.ts | 89 - src/state/burn/proamm/actions.ts | 2 +- src/state/burn/proamm/hooks.tsx | 6 +- src/state/burn/proamm/reducer.ts | 6 +- src/state/campaigns/updater.tsx | 8 +- src/state/farms/hooks.ts | 36 +- src/state/lists/hooks.ts | 6 +- src/state/lists/reducer.test.ts | 525 - src/state/mint/hooks.ts | 4 +- src/state/mint/proamm/actions.ts | 6 +- src/state/mint/proamm/hooks.tsx | 78 +- src/state/mint/proamm/reducer.ts | 20 +- src/state/mint/proamm/utils.test.ts | 61 - src/state/mint/proamm/utils.ts | 6 +- src/state/mint/reducer.test.ts | 28 - src/state/multicall/actions.test.ts | 57 - src/state/multicall/actions.ts | 2 +- src/state/multicall/reducer.test.ts | 311 - src/state/multicall/updater.test.ts | 168 - src/state/multicall/updater.tsx | 9 +- src/state/pair/hooks.ts | 4 +- src/state/prommPools/hooks.ts | 56 +- src/state/swap/hooks.test.ts | 97 - src/state/swap/reducer.test.ts | 36 - src/state/swap/useAggregator.ts | 13 +- src/state/transactions/hooks.tsx | 7 +- src/state/transactions/reducer.test.ts | 192 - src/state/transactions/updater.test.ts | 35 - src/state/transactions/updater.tsx | 4 +- src/state/user/hooks.tsx | 18 +- src/state/user/reducer.test.ts | 33 - src/state/wallet/hooks.ts | 13 +- src/theme/index.tsx | 6 +- src/utils/aggregationRouting.ts | 2 +- src/utils/aggregator.ts | 9 +- src/utils/checkChrome.ts | 5 +- src/utils/currencyId.ts | 3 +- src/utils/formatBalance.ts | 2 +- src/utils/formatCurrencyAmount.ts | 4 +- src/utils/index.ts | 22 +- src/utils/oembed2iframe.ts | 6 +- src/utils/prices.ts | 21 +- tsconfig.json | 6 +- yarn.lock | 19047 ++++++++-------- 194 files changed, 15638 insertions(+), 16536 deletions(-) delete mode 100644 cypress/integration/add-liquidity.test.ts delete mode 100644 cypress/integration/landing.test.ts delete mode 100644 cypress/integration/lists.test.ts delete mode 100644 cypress/integration/migrate-v1.test.ts delete mode 100644 cypress/integration/pool.test.ts delete mode 100644 cypress/integration/remove-liquidity.test.ts delete mode 100644 cypress/integration/send.test.ts delete mode 100644 cypress/integration/swap.test.ts delete mode 100644 cypress/integration/token-warning.ts delete mode 100644 cypress/support/commands.d.ts delete mode 100644 cypress/support/commands.js delete mode 100644 cypress/support/index.js delete mode 100644 cypress/tsconfig.json delete mode 100644 src/state/application/reducer.test.ts delete mode 100644 src/state/lists/reducer.test.ts delete mode 100644 src/state/mint/proamm/utils.test.ts delete mode 100644 src/state/mint/reducer.test.ts delete mode 100644 src/state/multicall/actions.test.ts delete mode 100644 src/state/multicall/reducer.test.ts delete mode 100644 src/state/multicall/updater.test.ts delete mode 100644 src/state/swap/hooks.test.ts delete mode 100644 src/state/swap/reducer.test.ts delete mode 100644 src/state/transactions/reducer.test.ts delete mode 100644 src/state/transactions/updater.test.ts delete mode 100644 src/state/user/reducer.test.ts diff --git a/.eslintrc.json b/.eslintrc.json index b10ac7380d..a20ca7a72e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -8,17 +8,33 @@ "jsx": true } }, - "ignorePatterns": ["node_modules/**/*"], + "ignorePatterns": [ + "src/locales/**/*.js", + "src/locales/**/en-US.po", + "node_modules", + "build", + "dist", + ".DS_Store", + ".env.local", + ".env.development.local", + ".env.test.local", + ".env.production.local", + ".idea/", + ".vscode/", + "public", + "package-lock.json", + "yarn.lock" + ], "settings": { "react": { "version": "detect" } }, "extends": [ + "react-app", "plugin:react/recommended", "plugin:@typescript-eslint/recommended", "plugin:react-hooks/recommended", - "prettier/@typescript-eslint", "plugin:prettier/recommended" ], "rules": { @@ -28,6 +44,7 @@ "@typescript-eslint/camelcase": "off", "react/prop-types": "off", "@typescript-eslint/interface-name-prefix": "off", - "no-duplicate-imports": "error" + "no-duplicate-imports": "error", + "react/react-in-jsx-scope": "off" } } diff --git a/config-overrides.js b/config-overrides.js index d63a6edee8..2694e6510c 100644 --- a/config-overrides.js +++ b/config-overrides.js @@ -5,6 +5,20 @@ const CompressionPlugin = require('compression-webpack-plugin') module.exports = function override(config, env) { config = rewireStyledComponents(config, env) + let loaders = config.resolve + loaders.fallback = { + // "fs": false, + // "tls": false, + // "net": false, + // "http": require.resolve("stream-http"), + // "https": false, + // "zlib": require.resolve("browserify-zlib") , + // "path": require.resolve("path-browserify"), + // "stream": require.resolve("stream-browserify"), + // "util": require.resolve("util/"), + crypto: require.resolve('crypto-browserify'), + } + config.optimization = { ...config.optimization, moduleIds: 'named', @@ -13,8 +27,8 @@ module.exports = function override(config, env) { vendor: { test: /[\\/]node_modules[\\/](ethers|@ethersproject)[\\/]/, name: 'ethers', - chunks: 'all' - } + chunks: 'all', + }, // commons: { // test: /[\\/]node_modules[\\/]/, // // cacheGroupKey here is `commons` as the key of the cacheGroup @@ -28,12 +42,12 @@ module.exports = function override(config, env) { // }, // chunks: 'all' // } - } - } + }, + }, } return { ...config, - plugins: [...config.plugins, new CompressionPlugin()] + plugins: [...config.plugins, new CompressionPlugin()], } } diff --git a/cypress/integration/add-liquidity.test.ts b/cypress/integration/add-liquidity.test.ts deleted file mode 100644 index 9703c6c79f..0000000000 --- a/cypress/integration/add-liquidity.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -describe('Add Liquidity', () => { - it('loads the two correct tokens', () => { - cy.visit('/add/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85-0xc778417E063141139Fce010982780140Aa0cD5Ab') - cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'MKR') - cy.get('#add-liquidity-input-tokenb .token-symbol-container').should('contain.text', 'ETH') - }) - - it('does not crash if ETH is duplicated', () => { - cy.visit('/add/0xc778417E063141139Fce010982780140Aa0cD5Ab-0xc778417E063141139Fce010982780140Aa0cD5Ab') - cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'ETH') - cy.get('#add-liquidity-input-tokenb .token-symbol-container').should('not.contain.text', 'ETH') - }) - - it('token not in storage is loaded', () => { - cy.visit('/add/0xb290b2f9f8f108d03ff2af3ac5c8de6de31cdf6d-0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85') - cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'SKL') - cy.get('#add-liquidity-input-tokenb .token-symbol-container').should('contain.text', 'MKR') - }) - - it('single token can be selected', () => { - cy.visit('/add/0xb290b2f9f8f108d03ff2af3ac5c8de6de31cdf6d') - cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'SKL') - cy.visit('/add/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85') - cy.get('#add-liquidity-input-tokena .token-symbol-container').should('contain.text', 'MKR') - }) - - it('redirects /add/token-token to add/token/token', () => { - cy.visit('/add/0xb290b2f9f8f108d03ff2af3ac5c8de6de31cdf6d-0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85') - cy.url().should( - 'contain', - '/add/0xb290b2f9f8f108d03ff2af3ac5c8de6de31cdf6d/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85' - ) - }) - - it('redirects /add/WETH-token to /add/WETH-address/token', () => { - cy.visit('/add/0xc778417E063141139Fce010982780140Aa0cD5Ab-0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85') - cy.url().should( - 'contain', - '/add/0xc778417E063141139Fce010982780140Aa0cD5Ab/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85' - ) - }) - - it('redirects /add/token-WETH to /add/token/WETH-address', () => { - cy.visit('/add/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85-0xc778417E063141139Fce010982780140Aa0cD5Ab') - cy.url().should( - 'contain', - '/add/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85/0xc778417E063141139Fce010982780140Aa0cD5Ab' - ) - }) -}) diff --git a/cypress/integration/landing.test.ts b/cypress/integration/landing.test.ts deleted file mode 100644 index a8e5db2260..0000000000 --- a/cypress/integration/landing.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { TEST_ADDRESS_NEVER_USE_SHORTENED } from '../support/commands' - -describe('Landing Page', () => { - beforeEach(() => cy.visit('/')) - it('loads swap page', () => { - cy.get('#swap-page') - }) - - it('redirects to url /swap', () => { - cy.url().should('include', '/swap') - }) - - it('allows navigation to pool', () => { - cy.get('#pool-nav-link').click() - cy.url().should('include', '/pool') - }) - - it('is connected', () => { - cy.get('#web3-status-connected').click() - cy.get('#web3-account-identifier-row').contains(TEST_ADDRESS_NEVER_USE_SHORTENED) - }) -}) diff --git a/cypress/integration/lists.test.ts b/cypress/integration/lists.test.ts deleted file mode 100644 index e8879691af..0000000000 --- a/cypress/integration/lists.test.ts +++ /dev/null @@ -1,20 +0,0 @@ -describe('Lists', () => { - beforeEach(() => { - cy.visit('/swap') - }) - - it('defaults to uniswap list', () => { - cy.get('#swap-currency-output .open-currency-select-button').click() - cy.get('#currency-search-selected-list-name').should('contain', 'Uniswap') - }) - - it('change list', () => { - cy.get('#swap-currency-output .open-currency-select-button').click() - cy.get('#currency-search-change-list-button').click() - cy.get('#list-row-tokens-1inch-eth .select-button').click() - cy.get('#currency-search-selected-list-name').should('contain', '1inch') - cy.get('#currency-search-change-list-button').click() - cy.get('#list-row-tokens-uniswap-eth .select-button').click() - cy.get('#currency-search-selected-list-name').should('contain', 'Uniswap') - }) -}) diff --git a/cypress/integration/migrate-v1.test.ts b/cypress/integration/migrate-v1.test.ts deleted file mode 100644 index 362504828a..0000000000 --- a/cypress/integration/migrate-v1.test.ts +++ /dev/null @@ -1,8 +0,0 @@ -describe('Migrate V1 Liquidity', () => { - describe('Remove V1 liquidity', () => { - it('renders the correct page', () => { - cy.visit('/remove/v1/0x93bB63aFe1E0180d0eF100D774B473034fd60C36') - cy.get('#remove-v1-exchange').should('contain', 'MKR/ETH') - }) - }) -}) diff --git a/cypress/integration/pool.test.ts b/cypress/integration/pool.test.ts deleted file mode 100644 index 5969abce71..0000000000 --- a/cypress/integration/pool.test.ts +++ /dev/null @@ -1,12 +0,0 @@ -describe('Pool', () => { - beforeEach(() => cy.visit('/pool')) - it('add liquidity links to /add/ETH', () => { - cy.get('#join-pool-button').click() - cy.url().should('contain', '/add/ETH') - }) - - it('import pool links to /import', () => { - cy.get('#import-pool-link').click() - cy.url().should('contain', '/find') - }) -}) diff --git a/cypress/integration/remove-liquidity.test.ts b/cypress/integration/remove-liquidity.test.ts deleted file mode 100644 index 63c8e1a360..0000000000 --- a/cypress/integration/remove-liquidity.test.ts +++ /dev/null @@ -1,39 +0,0 @@ -describe('Remove Liquidity', () => { - it('redirects', () => { - cy.visit('/remove/0xc778417E063141139Fce010982780140Aa0cD5Ab-0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85') - cy.url().should( - 'contain', - '/remove/0xc778417E063141139Fce010982780140Aa0cD5Ab/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85' - ) - }) - - it('eth remove', () => { - cy.visit('/remove/ETH/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85') - cy.get('#remove-liquidity-tokena-symbol').should('contain.text', 'ETH') - cy.get('#remove-liquidity-tokenb-symbol').should('contain.text', 'MKR') - }) - - it('eth remove swap order', () => { - cy.visit('/remove/0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85/ETH') - cy.get('#remove-liquidity-tokena-symbol').should('contain.text', 'MKR') - cy.get('#remove-liquidity-tokenb-symbol').should('contain.text', 'ETH') - }) - - it('loads the two correct tokens', () => { - cy.visit('/remove/0xc778417E063141139Fce010982780140Aa0cD5Ab-0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85') - cy.get('#remove-liquidity-tokena-symbol').should('contain.text', 'WETH') - cy.get('#remove-liquidity-tokenb-symbol').should('contain.text', 'MKR') - }) - - it('does not crash if ETH is duplicated', () => { - cy.visit('/remove/0xc778417E063141139Fce010982780140Aa0cD5Ab-0xc778417E063141139Fce010982780140Aa0cD5Ab') - cy.get('#remove-liquidity-tokena-symbol').should('contain.text', 'WETH') - cy.get('#remove-liquidity-tokenb-symbol').should('contain.text', 'WETH') - }) - - it('token not in storage is loaded', () => { - cy.visit('/remove/0xb290b2f9f8f108d03ff2af3ac5c8de6de31cdf6d-0xF9bA5210F91D0474bd1e1DcDAeC4C58E359AaD85') - cy.get('#remove-liquidity-tokena-symbol').should('contain.text', 'SKL') - cy.get('#remove-liquidity-tokenb-symbol').should('contain.text', 'MKR') - }) -}) diff --git a/cypress/integration/send.test.ts b/cypress/integration/send.test.ts deleted file mode 100644 index 35b8dee108..0000000000 --- a/cypress/integration/send.test.ts +++ /dev/null @@ -1,11 +0,0 @@ -describe('Send', () => { - it('should redirect', () => { - cy.visit('/send') - cy.url().should('include', '/swap') - }) - - it('should redirect with url params', () => { - cy.visit('/send?outputCurrency=ETH&recipient=bob.argent.xyz') - cy.url().should('contain', '/swap?outputCurrency=ETH&recipient=bob.argent.xyz') - }) -}) diff --git a/cypress/integration/swap.test.ts b/cypress/integration/swap.test.ts deleted file mode 100644 index 06cedb3f55..0000000000 --- a/cypress/integration/swap.test.ts +++ /dev/null @@ -1,75 +0,0 @@ -describe('Swap', () => { - beforeEach(() => { - cy.visit('/swap') - }) - it('can enter an amount into input', () => { - cy.get('#swap-currency-input .token-amount-input') - .type('0.001', { delay: 200 }) - .should('have.value', '0.001') - }) - - it('zero swap amount', () => { - cy.get('#swap-currency-input .token-amount-input') - .type('0.0', { delay: 200 }) - .should('have.value', '0.0') - }) - - it('invalid swap amount', () => { - cy.get('#swap-currency-input .token-amount-input') - .type('\\', { delay: 200 }) - .should('have.value', '') - }) - - it('can enter an amount into output', () => { - cy.get('#swap-currency-output .token-amount-input') - .type('0.001', { delay: 200 }) - .should('have.value', '0.001') - }) - - it('zero output amount', () => { - cy.get('#swap-currency-output .token-amount-input') - .type('0.0', { delay: 200 }) - .should('have.value', '0.0') - }) - - it('can swap ETH for DAI', () => { - cy.get('#swap-currency-output .open-currency-select-button').click() - cy.get('.token-item-0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735').should('be.visible') - cy.get('.token-item-0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735').click({ force: true }) - cy.get('#swap-currency-input .token-amount-input').should('be.visible') - cy.get('#swap-currency-input .token-amount-input').type('0.001', { force: true, delay: 200 }) - cy.get('#swap-currency-output .token-amount-input').should('not.equal', '') - cy.get('#swap-button').click() - cy.get('#confirm-swap-or-send').should('contain', 'Confirm Swap') - }) - - it('add a recipient does not exist unless in expert mode', () => { - cy.get('#add-recipient-button').should('not.exist') - }) - - describe('expert mode', () => { - beforeEach(() => { - cy.window().then(win => { - cy.stub(win, 'prompt').returns('confirm') - }) - cy.get('#open-settings-dialog-button').click() - cy.get('#toggle-expert-mode-button').click() - cy.get('#confirm-expert-mode').click() - }) - - it('add a recipient is visible', () => { - cy.get('#add-recipient-button').should('be.visible') - }) - - it('add a recipient', () => { - cy.get('#add-recipient-button').click() - cy.get('#recipient').should('exist') - }) - - it('remove recipient', () => { - cy.get('#add-recipient-button').click() - cy.get('#remove-recipient-button').click() - cy.get('#recipient').should('not.exist') - }) - }) -}) diff --git a/cypress/integration/token-warning.ts b/cypress/integration/token-warning.ts deleted file mode 100644 index 0e0254c0a9..0000000000 --- a/cypress/integration/token-warning.ts +++ /dev/null @@ -1,17 +0,0 @@ -describe('Warning', () => { - beforeEach(() => { - cy.visit('/swap?outputCurrency=0x0a40f26d74274b7f22b28556a27b35d97ce08e0a') - }) - - it('Check that warning is displayed', () => { - cy.get('.token-warning-container').should('be.visible') - }) - - it('Check that warning hides after button dismissal', () => { - cy.get('.token-dismiss-button').should('be.disabled') - cy.get('.understand-checkbox').click() - cy.get('.token-dismiss-button').should('not.be.disabled') - cy.get('.token-dismiss-button').click() - cy.get('.token-warning-container').should('not.be.visible') - }) -}) diff --git a/cypress/support/commands.d.ts b/cypress/support/commands.d.ts deleted file mode 100644 index e7eba62fd3..0000000000 --- a/cypress/support/commands.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const TEST_ADDRESS_NEVER_USE: string - -export const TEST_ADDRESS_NEVER_USE_SHORTENED: string - -// declare namespace Cypress { -// // eslint-disable-next-line @typescript-eslint/class-name-casing -// interface cy { -// additionalCommands(): void -// } -// } diff --git a/cypress/support/commands.js b/cypress/support/commands.js deleted file mode 100644 index a2c0deb52f..0000000000 --- a/cypress/support/commands.js +++ /dev/null @@ -1,82 +0,0 @@ -// *********************************************** -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** - -import { JsonRpcProvider } from '@ethersproject/providers' -import { Wallet } from '@ethersproject/wallet' -import { _Eip1193Bridge } from '@ethersproject/experimental/lib/eip1193-bridge' - -// never send real ether to this, obviously -const PRIVATE_KEY_TEST_NEVER_USE = '0xad20c82497421e9784f18460ad2fe84f73569068e98e270b3e63743268af5763' - -// address of the above key -export const TEST_ADDRESS_NEVER_USE = '0x0fF2D1eFd7A57B7562b2bf27F3f37899dB27F4a5' - -export const TEST_ADDRESS_NEVER_USE_SHORTENED = '0x0fF2...F4a5' - -class CustomizedBridge extends _Eip1193Bridge { - async sendAsync(...args) { - console.debug('sendAsync called', ...args) - return this.send(...args) - } - async send(...args) { - console.debug('send called', ...args) - const isCallbackForm = typeof args[0] === 'object' && typeof args[1] === 'function' - let callback - let method - let params - if (isCallbackForm) { - callback = args[1] - method = args[0].method - params = args[0].params - } else { - method = args[0] - params = args[1] - } - if (method === 'eth_requestAccounts' || method === 'eth_accounts') { - if (isCallbackForm) { - callback({ result: [TEST_ADDRESS_NEVER_USE] }) - } else { - return Promise.resolve([TEST_ADDRESS_NEVER_USE]) - } - } - if (method === 'eth_chainId') { - if (isCallbackForm) { - callback(null, { result: '0x4' }) - } else { - return Promise.resolve('0x4') - } - } - try { - const result = await super.send(method, params) - console.debug('result received', method, params, result) - if (isCallbackForm) { - callback(null, { result }) - } else { - return result - } - } catch (error) { - if (isCallbackForm) { - callback(error, null) - } else { - throw error - } - } - } -} - -// sets up the injected provider to be a mock ethereum provider with the given mnemonic/index -Cypress.Commands.overwrite('visit', (original, url, options) => { - return original(url.startsWith('/') && url.length > 2 && !url.startsWith('/#') ? `/#${url}` : url, { - ...options, - onBeforeLoad(win) { - options && options.onBeforeLoad && options.onBeforeLoad(win) - win.localStorage.clear() - const provider = new JsonRpcProvider('https://rinkeby.infura.io/v3/4bf032f2d38a4ed6bb975b80d6340847', 4) - const signer = new Wallet(PRIVATE_KEY_TEST_NEVER_USE, provider) - win.ethereum = new CustomizedBridge(signer, provider) - } - }) -}) diff --git a/cypress/support/index.js b/cypress/support/index.js deleted file mode 100644 index 3d834ebd4a..0000000000 --- a/cypress/support/index.js +++ /dev/null @@ -1,9 +0,0 @@ -// *********************************************************** -// This file is processed and loaded automatically before your test files. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.ts using ES2015 syntax: -import './commands' diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json deleted file mode 100644 index 0cbfffb01a..0000000000 --- a/cypress/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "baseUrl": "../node_modules", - "target": "es5", - "lib": ["es5", "dom"], - "types": ["cypress"] - }, - "include": ["**/*.ts"] -} diff --git a/lingui.config.ts b/lingui.config.ts index 1775f3f3b0..682f82c7c8 100644 --- a/lingui.config.ts +++ b/lingui.config.ts @@ -2,20 +2,20 @@ export default { catalogs: [ { path: '/src/locales/{locale}', - include: ['/src'] - } + include: ['/src'], + }, ], compileNamespace: 'cjs', fallbackLocales: { - default: 'en-US' + default: 'en-US', }, format: 'po', formatOptions: { - lineNumbers: false + lineNumbers: false, }, locales: ['en-US', 'ko-KR', 'tr-TR', 'vi-VN', 'zh-CN', 'tl-PH'], orderBy: 'messageId', rootDir: '.', runtimeConfigModule: ['@lingui/core', 'i18n'], - sourceLocale: 'en-US' + sourceLocale: 'en-US', } diff --git a/package.json b/package.json index 4f8f889227..7927a15fdb 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "private": true, "devDependencies": { "@ethersproject/experimental": "^5.4.0", - "@lingui/cli": "^3.10.2", - "@lingui/loader": "^3.10.2", - "@lingui/macro": "^3.10.2", + "@lingui/cli": "^3.14.0", + "@lingui/loader": "^3.14.0", + "@lingui/macro": "^3.14.0", "@pangolindex/web3-react-injected-connector": "1.0.1", "@popperjs/core": "^2.4.4", "@reach/dialog": "^0.10.3", @@ -23,8 +23,8 @@ "@types/node": "^13.13.5", "@types/numeral": "^2.0.0", "@types/qs": "^6.9.2", - "@types/react": "^16.9.34", - "@types/react-dom": "^16.9.7", + "@types/react": "^18.0.15", + "@types/react-dom": "^18.0.6", "@types/react-helmet": "^6.1.2", "@types/react-redux": "^7.1.16", "@types/react-router-dom": "^5.0.0", @@ -32,10 +32,10 @@ "@types/react-window": "^1.8.2", "@types/rebass": "^4.0.5", "@types/rebass__forms": "^4.0.4", - "@types/styled-components": "^5.1.0", + "@types/styled-components": "^5.1.25", "@types/wcag-contrast": "^3.0.0", - "@typescript-eslint/eslint-plugin": "^2.31.0", - "@typescript-eslint/parser": "^2.31.0", + "@typescript-eslint/eslint-plugin": "^5.32.0", + "@typescript-eslint/parser": "^5.32.0", "@uniswap/token-lists": "^1.0.0-beta.21", "@walletconnect/web3-provider": "^1.5.0", "@web3-react/core": "^6.0.9", @@ -50,11 +50,11 @@ "cids": "^1.0.0", "compression-webpack-plugin": "^6.1.1", "copy-to-clipboard": "^3.2.0", - "eslint": "^6.8.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-prettier": "^3.1.3", - "eslint-plugin-react": "^7.19.0", - "eslint-plugin-react-hooks": "^4.0.0", + "eslint": "^8.21.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-react": "^7.30.1", + "eslint-plugin-react-hooks": "^4.6.0", "ethers": "^5.4.6", "inter-ui": "^3.13.1", "jazzicon": "^1.5.0", @@ -63,24 +63,24 @@ "multihashes": "^3.0.1", "node-vibrant": "^3.1.5", "polished": "^3.3.2", - "prettier": "^1.17.0", + "prettier": "^2.7.1", "qs": "^6.9.4", - "react": "^17.0.2", + "react": "^18.2.0", "react-device-detect": "^1.6.2", - "react-dom": "^17.0.2", + "react-dom": "^18.2.0", "react-feather": "^2.0.8", "react-popper": "^2.2.3", "react-redux": "^7.2.6", "react-router-dom": "^5.0.0", - "react-scripts": "^3.4.1", + "react-scripts": "^5.0.1", "react-spring": "^8.0.27", "react-use-gesture": "^6.0.14", "react-virtualized-auto-sizer": "^1.0.2", "react-window": "^1.8.5", "rebass": "^4.0.7", "redux-localstorage-simple": "^2.4.0", - "styled-components": "^4.2.0", - "typescript": "^3.8.3", + "styled-components": "^5.3.5", + "typescript": "^4.4.3", "wcag-contrast": "^3.0.0", "workbox-core": "^6.3.0", "workbox-precaching": "^6.3.0", @@ -98,20 +98,16 @@ "start-local": "env-cmd -f .env.local react-app-rewired start", "start-dev": "env-cmd -f .env.dev react-app-rewired start", "start-stg": "env-cmd -f .env.stg react-app-rewired start", - "start-production": "env-cmd -f .env.production react-app-rewired start", + "start-production": "env-cmd -f .env.production react-scripts start", "build": "yarn i18n && react-app-rewired build", "build-dev": "yarn i18n && env-cmd -f .env.dev react-app-rewired build", "build-stg": "yarn i18n && env-cmd -f .env.stg react-app-rewired build", - "build-prod": "yarn i18n && env-cmd -f .env.production react-app-rewired build", + "build-prod": "yarn i18n && env-cmd -f .env.production react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", - "analyze": "source-map-explorer 'build/static/js/*.js'" - }, - "eslintConfig": { - "extends": "react-app", - "ignorePatterns": [ - "node_modules" - ] + "analyze": "source-map-explorer 'build/static/js/*.js'", + "lint": "yarn eslint .", + "format": "prettier --write \"{,!(node_modules)/**/}*.{ts,tsx}\"" }, "browserslist": { "production": [ @@ -132,7 +128,7 @@ "@kyberswap/ks-sdk-core": "^0.0.13", "@kyberswap/ks-sdk-elastic": "^0.0.43", "@lingui/detect-locale": "^3.10.4", - "@lingui/react": "^3.10.2", + "@lingui/react": "^3.14.0", "@rebass/forms": "^4.0.6", "@sentry/react": "^6.16.1", "@typeform/embed-react": "^1.2.4", @@ -145,6 +141,8 @@ "@types/recharts": "^1.8.23", "@uniswap/default-token-list": "^2.0.0", "aos": "^2.3.4", + "assert": "npm:assert", + "crypto": "npm:crypto-browserify", "d3": "^7.3.0", "dayjs": "^1.10.7", "env-cmd": "^10.1.0", @@ -157,16 +155,17 @@ "numbro": "^2.3.6", "numeral": "^2.0.6", "react-app-rewire-styled-components": "^3.0.2", - "react-app-rewired": "^2.1.8", + "react-app-rewired": "^2.2.1", "react-copy-to-clipboard": "^5.0.4", "react-gtm-module": "^2.0.11", "react-helmet": "^6.1.0", "react-indiana-drag-scroll": "^2.0.1", "react-player": "^2.9.0", "react-use": "^15.3.4", - "recharts": "^2.1.6", + "recharts": "^2.1.13", + "stream": "npm:stream-browserify", "swiper": "^8.0.7", "swr": "^1.0.1", "uuidv4": "^6.2.12" } -} \ No newline at end of file +} diff --git a/public/charting_library/charting_library.d.ts b/public/charting_library/charting_library.d.ts index 08efbf27c0..50d395b0d5 100644 --- a/public/charting_library/charting_library.d.ts +++ b/public/charting_library/charting_library.d.ts @@ -1,180 +1,262 @@ // Generated by dts-bundle-generator v5.3.0 declare const dateFormatFunctions: { - "dd MMM 'yy": (date: Date, local: boolean) => string; - "MMM dd, yyyy": (date: Date, local: boolean) => string; - "MMM dd": (date: Date, local: boolean) => string; - "yyyy-MM-dd": (date: Date, local: boolean) => string; - "yy-MM-dd": (date: Date, local: boolean) => string; - "yy/MM/dd": (date: Date, local: boolean) => string; - "yyyy/MM/dd": (date: Date, local: boolean) => string; - "dd-MM-yyyy": (date: Date, local: boolean) => string; - "dd-MM-yy": (date: Date, local: boolean) => string; - "dd/MM/yy": (date: Date, local: boolean) => string; - "dd/MM/yyyy": (date: Date, local: boolean) => string; - "MM/dd/yy": (date: Date, local: boolean) => string; - "MM/dd/yyyy": (date: Date, local: boolean) => string; -}; + "dd MMM 'yy": (date: Date, local: boolean) => string + 'MMM dd, yyyy': (date: Date, local: boolean) => string + 'MMM dd': (date: Date, local: boolean) => string + 'yyyy-MM-dd': (date: Date, local: boolean) => string + 'yy-MM-dd': (date: Date, local: boolean) => string + 'yy/MM/dd': (date: Date, local: boolean) => string + 'yyyy/MM/dd': (date: Date, local: boolean) => string + 'dd-MM-yyyy': (date: Date, local: boolean) => string + 'dd-MM-yy': (date: Date, local: boolean) => string + 'dd/MM/yy': (date: Date, local: boolean) => string + 'dd/MM/yyyy': (date: Date, local: boolean) => string + 'MM/dd/yy': (date: Date, local: boolean) => string + 'MM/dd/yyyy': (date: Date, local: boolean) => string +} declare enum OrderOrPositionMessageType { - Information = "information", - Warning = "warning", - Error = "error" + Information = 'information', + Warning = 'warning', + Error = 'error', } declare enum StopType { - StopLoss = 0, - TrailingStop = 1 + StopLoss = 0, + TrailingStop = 1, } export declare const enum ChartStyle { - Bar = 0, - Candle = 1, - Line = 2, - Area = 3, - Renko = 4, - Kagi = 5, - PnF = 6, - LineBreak = 7, - HeikinAshi = 8, - HollowCandle = 9, - Baseline = 10, - HiLo = 12 + Bar = 0, + Candle = 1, + Line = 2, + Area = 3, + Renko = 4, + Kagi = 5, + PnF = 6, + LineBreak = 7, + HeikinAshi = 8, + HollowCandle = 9, + Baseline = 10, + HiLo = 12, } export declare const enum ConnectionStatus { - Connected = 1, - Connecting = 2, - Disconnected = 3, - Error = 4 + Connected = 1, + Connecting = 2, + Disconnected = 3, + Error = 4, } export declare const enum NotificationType { - Error = 0, - Success = 1 + Error = 0, + Success = 1, } export declare const enum OrderStatus { - Canceled = 1, - Filled = 2, - Inactive = 3, - Placing = 4, - Rejected = 5, - Working = 6 + Canceled = 1, + Filled = 2, + Inactive = 3, + Placing = 4, + Rejected = 5, + Working = 6, } export declare const enum OrderStatusFilter { - All = 0, - Canceled = 1, - Filled = 2, - Inactive = 3, - Rejected = 5, - Working = 6 + All = 0, + Canceled = 1, + Filled = 2, + Inactive = 3, + Rejected = 5, + Working = 6, } export declare const enum OrderTicketFocusControl { - LimitPrice = 1, - StopPrice = 2, - TakeProfit = 3, - StopLoss = 4, - Quantity = 5 + LimitPrice = 1, + StopPrice = 2, + TakeProfit = 3, + StopLoss = 4, + Quantity = 5, } export declare const enum OrderType { - Limit = 1, - Market = 2, - Stop = 3, - StopLimit = 4 + Limit = 1, + Market = 2, + Stop = 3, + StopLimit = 4, } export declare const enum ParentType { - Order = 1, - Position = 2, - Trade = 3 + Order = 1, + Position = 2, + Trade = 3, } export declare const enum PriceScaleMode { - Normal = 0, - Log = 1, - Percentage = 2, - IndexedTo100 = 3 + Normal = 0, + Log = 1, + Percentage = 2, + IndexedTo100 = 3, } export declare const enum SeriesStyle { - Bars = 0, - Candles = 1, - Line = 2, - Area = 3, - HeikenAshi = 8, - HollowCandles = 9, - Baseline = 10, - HiLo = 12, - Renko = 4, - Kagi = 5, - PointAndFigure = 6, - LineBreak = 7 + Bars = 0, + Candles = 1, + Line = 2, + Area = 3, + HeikenAshi = 8, + HollowCandles = 9, + Baseline = 10, + HiLo = 12, + Renko = 4, + Kagi = 5, + PointAndFigure = 6, + LineBreak = 7, } export declare const enum Side { - Buy = 1, - Sell = -1 + Buy = 1, + Sell = -1, } export declare const enum StandardFormatterName { - Date = "date", - DateOrDateTime = "dateOrDateTime", - Default = "default", - Fixed = "fixed", - VariablePrecision = "variablePrecision", - FormatQuantity = "formatQuantity", - FormatPrice = "formatPrice", - FormatPriceForexSup = "formatPriceForexSup", - IntegerSeparated = "integerSeparated", - LocalDate = "localDate", - LocalDateOrDateTime = "localDateOrDateTime", - OrderSettings = "orderSettings", - Percentage = "percentage", - Pips = "pips", - Profit = "profit", - ProfitInInstrumentCurrency = "profitInInstrumentCurrency", - PosSettings = "posSettings", - Side = "side", - PositionSide = "positionSide", - Status = "status", - Symbol = "symbol", - Text = "text", - TextNoWrap = "textNoWrap", - TradeSettings = "tradeSettings", - Type = "type", - MarginPercent = "marginPercent" + Date = 'date', + DateOrDateTime = 'dateOrDateTime', + Default = 'default', + Fixed = 'fixed', + VariablePrecision = 'variablePrecision', + FormatQuantity = 'formatQuantity', + FormatPrice = 'formatPrice', + FormatPriceForexSup = 'formatPriceForexSup', + IntegerSeparated = 'integerSeparated', + LocalDate = 'localDate', + LocalDateOrDateTime = 'localDateOrDateTime', + OrderSettings = 'orderSettings', + Percentage = 'percentage', + Pips = 'pips', + Profit = 'profit', + ProfitInInstrumentCurrency = 'profitInInstrumentCurrency', + PosSettings = 'posSettings', + Side = 'side', + PositionSide = 'positionSide', + Status = 'status', + Symbol = 'symbol', + Text = 'text', + TextNoWrap = 'textNoWrap', + TradeSettings = 'tradeSettings', + Type = 'type', + MarginPercent = 'marginPercent', } export declare const enum TimeFrameType { - PeriodBack = "period-back", - TimeRange = "time-range" + PeriodBack = 'period-back', + TimeRange = 'time-range', } export declare const enum VisibilityType { - AlwaysOn = "alwaysOn", - VisibleOnMouseOver = "visibleOnMouseOver", - AlwaysOff = "alwaysOff" -} -export declare const widget: ChartingLibraryWidgetConstructor; -export declare function version(): string; -export declare type AccountId = Nominal; -export declare type ActionMetaInfo = ActionDescriptionWithCallback | MenuSeparator; -export declare type AvailableSaveloadVersions = "1.0" | "1.1"; -export declare type CellAlignment = "left" | "right"; -export declare type ChartActionId = "chartProperties" | "compareOrAdd" | "scalesProperties" | "paneObjectTree" | "insertIndicator" | "symbolSearch" | "changeInterval" | "timeScaleReset" | "chartReset" | "seriesHide" | "studyHide" | "lineToggleLock" | "lineHide" | "scaleSeriesOnly" | "drawingToolbarAction" | "stayInDrawingModeAction" | "hideAllMarks" | "showCountdown" | "showSeriesLastValue" | "showSymbolLabelsAction" | "showStudyLastValue" | "showStudyPlotNamesAction" | "undo" | "redo" | "paneRemoveAllStudiesDrawingTools" | "showSymbolInfoDialog"; -export declare type DateFormat = keyof typeof dateFormatFunctions; -export declare type Direction = "buy" | "sell"; -export declare type DomeCallback = (data: DOMData) => void; -export declare type DrawingEventType = "click" | "move" | "remove" | "hide" | "show"; -export declare type DropdownUpdateParams = Partial>; -export declare type EditObjectDialogObjectType = "mainSeries" | "drawing" | "study" | "other"; -export declare type EmptyCallback = () => void; -export declare type EntityId = Nominal; -export declare type ErrorCallback = (reason: string) => void; -export declare type FieldDescriptor = TimeFieldDescriptor | UserTimeFieldDescriptor | SeriesFieldDescriptor | StudyFieldDescriptor; -export declare type GetMarksCallback = (marks: T[]) => void; -export declare type GetNewsFunction = (symbol: string, callback: (response: GetNewsResponse) => void) => void; -export declare type GroupLockState = "Locked" | "Unlocked" | "Partial"; -export declare type GroupVisibilityState = "Visible" | "Invisible" | "Partial"; -export declare type HeaderWidgetButtonsMode = "fullsize" | "compact" | "adaptive"; -export declare type HistoryCallback = (bars: Bar[], meta?: HistoryMetadata) => void; -export declare type IBasicDataFeed = IDatafeedChartApi & IExternalDatafeed; -export declare type INumberFormatter = IFormatter; -export declare type InputFieldValidator = (value: any) => InputFieldValidatorResult; -export declare type InputFieldValidatorResult = PositiveBaseInputFieldValidatorResult | NegativeBaseInputFieldValidatorResult; -export declare type LanguageCode = "ar" | "zh" | "cs" | "da_DK" | "nl_NL" | "en" | "et_EE" | "fr" | "de" | "el" | "he_IL" | "hu_HU" | "id_ID" | "it" | "ja" | "ko" | "fa" | "pl" | "pt" | "ro" | "ru" | "sk_SK" | "es" | "sv" | "th" | "tr" | "vi" | "no" | "ms_MY" | "zh_TW"; -export declare type LayoutType = SingleChartLayoutType | MultipleChartsLayoutType; -export declare type LegendMode = "horizontal" | "vertical"; -export declare type MarkConstColors = "red" | "green" | "blue" | "yellow"; -export declare type MultipleChartsLayoutType = "2h" | "2v" | "2-1" | "3s" | "3h" | "3v" | "4" | "6" | "8" | "1-2" | "3r" | "4h" | "4v" | "4s" | "1-3" | "2-2" | "1-4" | "5s" | "6c" | "8c"; + AlwaysOn = 'alwaysOn', + VisibleOnMouseOver = 'visibleOnMouseOver', + AlwaysOff = 'alwaysOff', +} +export declare const widget: ChartingLibraryWidgetConstructor +export declare function version(): string +export declare type AccountId = Nominal +export declare type ActionMetaInfo = ActionDescriptionWithCallback | MenuSeparator +export declare type AvailableSaveloadVersions = '1.0' | '1.1' +export declare type CellAlignment = 'left' | 'right' +export declare type ChartActionId = + | 'chartProperties' + | 'compareOrAdd' + | 'scalesProperties' + | 'paneObjectTree' + | 'insertIndicator' + | 'symbolSearch' + | 'changeInterval' + | 'timeScaleReset' + | 'chartReset' + | 'seriesHide' + | 'studyHide' + | 'lineToggleLock' + | 'lineHide' + | 'scaleSeriesOnly' + | 'drawingToolbarAction' + | 'stayInDrawingModeAction' + | 'hideAllMarks' + | 'showCountdown' + | 'showSeriesLastValue' + | 'showSymbolLabelsAction' + | 'showStudyLastValue' + | 'showStudyPlotNamesAction' + | 'undo' + | 'redo' + | 'paneRemoveAllStudiesDrawingTools' + | 'showSymbolInfoDialog' +export declare type DateFormat = keyof typeof dateFormatFunctions +export declare type Direction = 'buy' | 'sell' +export declare type DomeCallback = (data: DOMData) => void +export declare type DrawingEventType = 'click' | 'move' | 'remove' | 'hide' | 'show' +export declare type DropdownUpdateParams = Partial> +export declare type EditObjectDialogObjectType = 'mainSeries' | 'drawing' | 'study' | 'other' +export declare type EmptyCallback = () => void +export declare type EntityId = Nominal +export declare type ErrorCallback = (reason: string) => void +export declare type FieldDescriptor = + | TimeFieldDescriptor + | UserTimeFieldDescriptor + | SeriesFieldDescriptor + | StudyFieldDescriptor +export declare type GetMarksCallback = (marks: T[]) => void +export declare type GetNewsFunction = (symbol: string, callback: (response: GetNewsResponse) => void) => void +export declare type GroupLockState = 'Locked' | 'Unlocked' | 'Partial' +export declare type GroupVisibilityState = 'Visible' | 'Invisible' | 'Partial' +export declare type HeaderWidgetButtonsMode = 'fullsize' | 'compact' | 'adaptive' +export declare type HistoryCallback = (bars: Bar[], meta?: HistoryMetadata) => void +export declare type IBasicDataFeed = IDatafeedChartApi & IExternalDatafeed +export declare type INumberFormatter = IFormatter +export declare type InputFieldValidator = (value: any) => InputFieldValidatorResult +export declare type InputFieldValidatorResult = + | PositiveBaseInputFieldValidatorResult + | NegativeBaseInputFieldValidatorResult +export declare type LanguageCode = + | 'ar' + | 'zh' + | 'cs' + | 'da_DK' + | 'nl_NL' + | 'en' + | 'et_EE' + | 'fr' + | 'de' + | 'el' + | 'he_IL' + | 'hu_HU' + | 'id_ID' + | 'it' + | 'ja' + | 'ko' + | 'fa' + | 'pl' + | 'pt' + | 'ro' + | 'ru' + | 'sk_SK' + | 'es' + | 'sv' + | 'th' + | 'tr' + | 'vi' + | 'no' + | 'ms_MY' + | 'zh_TW' +export declare type LayoutType = SingleChartLayoutType | MultipleChartsLayoutType +export declare type LegendMode = 'horizontal' | 'vertical' +export declare type MarkConstColors = 'red' | 'green' | 'blue' | 'yellow' +export declare type MultipleChartsLayoutType = + | '2h' + | '2v' + | '2-1' + | '3s' + | '3h' + | '3v' + | '4' + | '6' + | '8' + | '1-2' + | '3r' + | '4h' + | '4v' + | '4s' + | '1-3' + | '2-2' + | '1-4' + | '5s' + | '6c' + | '8c' /** * This is the generic type useful for declaring a nominal type, * which does not structurally matches with the base type and @@ -189,1899 +271,2162 @@ export declare type MultipleChartsLayoutType = "2h" | "2v" | "2-1" | "3s" | "3h" * type TagName = Nominal; */ export declare type Nominal = T & { - [Symbol.species]: Name; -}; -export declare type OnReadyCallback = (configuration: DatafeedConfiguration) => void; -export declare type Order = PlacedOrder | BracketOrder; -export declare type PineJS = any; -export declare type QuoteData = QuoteOkData | QuoteErrorData; -export declare type QuotesCallback = (data: QuoteData[]) => void; -export declare type ResolutionString = Nominal; -export declare type ResolveCallback = (symbolInfo: LibrarySymbolInfo) => void; -export declare type RssNewsFeedItem = RssNewsFeedInfo | RssNewsFeedInfo[]; -export declare type SearchSymbolsCallback = (items: SearchSymbolResultItem[]) => void; -export declare type SeriesEventType = "price_scale_changed"; -export declare type SeriesFormat = "price" | "volume"; -export declare type SeriesPriceScale = "new-left" | "new-right" | "no-scale" | EntityId; -export declare type ServerTimeCallback = (serverTime: number) => void; -export declare type SetVisibleTimeRange = Omit & Partial>; -export declare type ShapePoint = StickedPoint | PricedPoint | TimePoint; -export declare type ShapesGroupId = Nominal; -export declare type SingleChartLayoutType = "s"; -export declare type StudyEventType = "remove" | "price_scale_changed"; -export declare type StudyInputId = Nominal; -export declare type StudyInputValue = string | number | boolean; -export declare type StudyOverrideValueType = string | number | boolean; -export declare type StudyPriceScale = "new-left" | "new-right" | "no-scale" | "as-series"; -export declare type SubscribeBarsCallback = (bar: Bar) => void; -export declare type SupportedLineTools = "text" | "anchored_text" | "note" | "anchored_note" | "signpost" | "double_curve" | "arc" | "icon" | "arrow_up" | "arrow_down" | "arrow_left" | "arrow_right" | "price_label" | "price_note" | "arrow_marker" | "flag" | "vertical_line" | "horizontal_line" | "cross_line" | "horizontal_ray" | "trend_line" | "info_line" | "trend_angle" | "arrow" | "ray" | "extended" | "parallel_channel" | "disjoint_angle" | "flat_bottom" | "pitchfork" | "schiff_pitchfork_modified" | "schiff_pitchfork" | "balloon" | "inside_pitchfork" | "pitchfan" | "gannbox" | "gannbox_square" | "gannbox_fixed" | "gannbox_fan" | "fib_retracement" | "fib_trend_ext" | "fib_speed_resist_fan" | "fib_timezone" | "fib_trend_time" | "fib_circles" | "fib_spiral" | "fib_speed_resist_arcs" | "fib_channel" | "xabcd_pattern" | "cypher_pattern" | "abcd_pattern" | "callout" | "triangle_pattern" | "3divers_pattern" | "head_and_shoulders" | "fib_wedge" | "elliott_impulse_wave" | "elliott_triangle_wave" | "elliott_triple_combo" | "elliott_correction" | "elliott_double_combo" | "cyclic_lines" | "time_cycles" | "sine_line" | "long_position" | "short_position" | "forecast" | "date_range" | "price_range" | "date_and_price_range" | "bars_pattern" | "ghost_feed" | "projection" | "rectangle" | "rotated_rectangle" | "ellipse" | "triangle" | "polyline" | "path" | "curve" | "cursor" | "dot" | "arrow_cursor" | "eraser" | "measure" | "zoom" | "brush" | "highlighter" | "regression_trend" | "fixed_range_volume_profile"; -export declare type SymbolSearchCompleteOverrideFunction = (symbol: string) => Promise; -export declare type SymbolType = "stock" | "index" | "forex" | "futures" | "bitcoin" | "crypto" | "undefined" | "expression" | "spread" | "cfd" | "economic" | "equity" | "dr" | "bond" | "right" | "warrant" | "fund" | "structured"; -export declare type TextInputFieldValidator = (value: string) => InputFieldValidatorResult; -export declare type ThemeName = "Light" | "Dark"; -export declare type TickMarkType = -/** - * The start of the year (e.g. it's the first tick mark in a year). - */ -"Year" -/** - * The start of the month (e.g. it's the first tick mark in a month). - */ - | "Month" -/** - * A day of the month. - */ - | "DayOfMonth" -/** - * A time without seconds. - */ - | "Time" -/** - * A time with seconds. - */ - | "TimeWithSeconds"; -export declare type TimeFrameValue = TimeFramePeriodBack | TimeFrameTimeRange; -export declare type Timezone = "Etc/UTC" | CustomTimezones; -export declare type TradableSolutions = ChangeAccountSolution | ChangeSymbolSolution; -export declare type TradingDialogCustomField = TextWithCheckboxFieldMetaInfo | CustomComboBoxMetaInfo; -export declare type WatchListSymbolListAddedCallback = (listId: string, symbols: string[]) => void; -export declare type WatchListSymbolListChangedCallback = (listId: string) => void; -export declare type WatchListSymbolListRemovedCallback = (listId: string) => void; -export declare type WatchListSymbolListRenamedCallback = (listId: string, oldName: string, newName: string) => void; -export declare type WatchedValueCallback = (value: T) => void; + [Symbol.species]: Name +} +export declare type OnReadyCallback = (configuration: DatafeedConfiguration) => void +export declare type Order = PlacedOrder | BracketOrder +export declare type PineJS = any +export declare type QuoteData = QuoteOkData | QuoteErrorData +export declare type QuotesCallback = (data: QuoteData[]) => void +export declare type ResolutionString = Nominal +export declare type ResolveCallback = (symbolInfo: LibrarySymbolInfo) => void +export declare type RssNewsFeedItem = RssNewsFeedInfo | RssNewsFeedInfo[] +export declare type SearchSymbolsCallback = (items: SearchSymbolResultItem[]) => void +export declare type SeriesEventType = 'price_scale_changed' +export declare type SeriesFormat = 'price' | 'volume' +export declare type SeriesPriceScale = 'new-left' | 'new-right' | 'no-scale' | EntityId +export declare type ServerTimeCallback = (serverTime: number) => void +export declare type SetVisibleTimeRange = Omit & Partial> +export declare type ShapePoint = StickedPoint | PricedPoint | TimePoint +export declare type ShapesGroupId = Nominal +export declare type SingleChartLayoutType = 's' +export declare type StudyEventType = 'remove' | 'price_scale_changed' +export declare type StudyInputId = Nominal +export declare type StudyInputValue = string | number | boolean +export declare type StudyOverrideValueType = string | number | boolean +export declare type StudyPriceScale = 'new-left' | 'new-right' | 'no-scale' | 'as-series' +export declare type SubscribeBarsCallback = (bar: Bar) => void +export declare type SupportedLineTools = + | 'text' + | 'anchored_text' + | 'note' + | 'anchored_note' + | 'signpost' + | 'double_curve' + | 'arc' + | 'icon' + | 'arrow_up' + | 'arrow_down' + | 'arrow_left' + | 'arrow_right' + | 'price_label' + | 'price_note' + | 'arrow_marker' + | 'flag' + | 'vertical_line' + | 'horizontal_line' + | 'cross_line' + | 'horizontal_ray' + | 'trend_line' + | 'info_line' + | 'trend_angle' + | 'arrow' + | 'ray' + | 'extended' + | 'parallel_channel' + | 'disjoint_angle' + | 'flat_bottom' + | 'pitchfork' + | 'schiff_pitchfork_modified' + | 'schiff_pitchfork' + | 'balloon' + | 'inside_pitchfork' + | 'pitchfan' + | 'gannbox' + | 'gannbox_square' + | 'gannbox_fixed' + | 'gannbox_fan' + | 'fib_retracement' + | 'fib_trend_ext' + | 'fib_speed_resist_fan' + | 'fib_timezone' + | 'fib_trend_time' + | 'fib_circles' + | 'fib_spiral' + | 'fib_speed_resist_arcs' + | 'fib_channel' + | 'xabcd_pattern' + | 'cypher_pattern' + | 'abcd_pattern' + | 'callout' + | 'triangle_pattern' + | '3divers_pattern' + | 'head_and_shoulders' + | 'fib_wedge' + | 'elliott_impulse_wave' + | 'elliott_triangle_wave' + | 'elliott_triple_combo' + | 'elliott_correction' + | 'elliott_double_combo' + | 'cyclic_lines' + | 'time_cycles' + | 'sine_line' + | 'long_position' + | 'short_position' + | 'forecast' + | 'date_range' + | 'price_range' + | 'date_and_price_range' + | 'bars_pattern' + | 'ghost_feed' + | 'projection' + | 'rectangle' + | 'rotated_rectangle' + | 'ellipse' + | 'triangle' + | 'polyline' + | 'path' + | 'curve' + | 'cursor' + | 'dot' + | 'arrow_cursor' + | 'eraser' + | 'measure' + | 'zoom' + | 'brush' + | 'highlighter' + | 'regression_trend' + | 'fixed_range_volume_profile' +export declare type SymbolSearchCompleteOverrideFunction = (symbol: string) => Promise +export declare type SymbolType = + | 'stock' + | 'index' + | 'forex' + | 'futures' + | 'bitcoin' + | 'crypto' + | 'undefined' + | 'expression' + | 'spread' + | 'cfd' + | 'economic' + | 'equity' + | 'dr' + | 'bond' + | 'right' + | 'warrant' + | 'fund' + | 'structured' +export declare type TextInputFieldValidator = (value: string) => InputFieldValidatorResult +export declare type ThemeName = 'Light' | 'Dark' +export declare type TickMarkType = + /** + * The start of the year (e.g. it's the first tick mark in a year). + */ + | 'Year' + /** + * The start of the month (e.g. it's the first tick mark in a month). + */ + | 'Month' + /** + * A day of the month. + */ + | 'DayOfMonth' + /** + * A time without seconds. + */ + | 'Time' + /** + * A time with seconds. + */ + | 'TimeWithSeconds' +export declare type TimeFrameValue = TimeFramePeriodBack | TimeFrameTimeRange +export declare type Timezone = 'Etc/UTC' | CustomTimezones +export declare type TradableSolutions = ChangeAccountSolution | ChangeSymbolSolution +export declare type TradingDialogCustomField = TextWithCheckboxFieldMetaInfo | CustomComboBoxMetaInfo +export declare type WatchListSymbolListAddedCallback = (listId: string, symbols: string[]) => void +export declare type WatchListSymbolListChangedCallback = (listId: string) => void +export declare type WatchListSymbolListRemovedCallback = (listId: string) => void +export declare type WatchListSymbolListRenamedCallback = (listId: string, oldName: string, newName: string) => void +export declare type WatchedValueCallback = (value: T) => void export interface AccessList { - type: "black" | "white"; - tools: AccessListItem[]; + type: 'black' | 'white' + tools: AccessListItem[] } export interface AccessListItem { - name: string; - grayed?: boolean; + name: string + grayed?: boolean } export interface AccountManagerColumn { - label: string; - alignment?: CellAlignment; - formatter?: StandardFormatterName | "orderSettings" | "posSettings" | string; - property: string; - sortProp?: string; - notSortable?: boolean; - help?: string; - highlightDiff?: boolean; - notHideable?: boolean; - hideByDefault?: boolean; - tooltipProperty?: string; - isCapitalize?: boolean; - showZeroValues?: boolean; + label: string + alignment?: CellAlignment + formatter?: StandardFormatterName | 'orderSettings' | 'posSettings' | string + property: string + sortProp?: string + notSortable?: boolean + help?: string + highlightDiff?: boolean + notHideable?: boolean + hideByDefault?: boolean + tooltipProperty?: string + isCapitalize?: boolean + showZeroValues?: boolean } export interface AccountManagerInfo { - accountTitle: string; - summary: AccountManagerSummaryField[]; - orderColumns: OrderTableColumn[]; - orderColumnsSorting?: SortingParameters; - historyColumns?: AccountManagerColumn[]; - historyColumnsSorting?: SortingParameters; - positionColumns?: AccountManagerColumn[]; - tradeColumns?: AccountManagerColumn[]; - pages: AccountManagerPage[]; - possibleOrderStatuses?: OrderStatus[]; - marginUsed?: IWatchedValue; - contextMenuActions?(contextMenuEvent: MouseEvent | TouchEvent, activePageActions: ActionMetaInfo[]): Promise; + accountTitle: string + summary: AccountManagerSummaryField[] + orderColumns: OrderTableColumn[] + orderColumnsSorting?: SortingParameters + historyColumns?: AccountManagerColumn[] + historyColumnsSorting?: SortingParameters + positionColumns?: AccountManagerColumn[] + tradeColumns?: AccountManagerColumn[] + pages: AccountManagerPage[] + possibleOrderStatuses?: OrderStatus[] + marginUsed?: IWatchedValue + contextMenuActions?( + contextMenuEvent: MouseEvent | TouchEvent, + activePageActions: ActionMetaInfo[], + ): Promise } export interface AccountManagerPage { - id: string; - title: string; - tables: AccountManagerTable[]; + id: string + title: string + tables: AccountManagerTable[] } export interface AccountManagerSummaryField { - text: string; - wValue: IWatchedValueReadonly; - formatter?: string; + text: string + wValue: IWatchedValueReadonly + formatter?: string } export interface AccountManagerTable { - id: string; - title?: string; - columns: AccountManagerColumn[]; - initialSorting?: SortingParameters; - changeDelegate: ISubscription<(data: {}) => void>; - flags?: AccountManagerTableFlags; - getData(paginationLastId?: string | number): Promise<{}[]>; + id: string + title?: string + columns: AccountManagerColumn[] + initialSorting?: SortingParameters + changeDelegate: ISubscription<(data: {}) => void> + flags?: AccountManagerTableFlags + getData(paginationLastId?: string | number): Promise<{}[]> } export interface AccountManagerTableFlags { - supportPagination?: boolean; + supportPagination?: boolean } export interface ActionDescription { - text?: "-" | string; - separator?: boolean; - shortcut?: string; - tooltip?: string; - checked?: boolean; - checkedStateSource?: () => boolean; - checkable?: boolean; - enabled?: boolean; - externalLink?: boolean; - icon?: string; + text?: '-' | string + separator?: boolean + shortcut?: string + tooltip?: string + checked?: boolean + checkedStateSource?: () => boolean + checkable?: boolean + enabled?: boolean + externalLink?: boolean + icon?: string } export interface ActionDescriptionWithCallback extends ActionDescription { - action: (a?: ActionDescription) => void; + action: (a?: ActionDescription) => void } export interface AdditionalSymbolInfoField { - title: string; - propertyName: string; + title: string + propertyName: string } export interface AreaStylePreferences { - color1: string; - color2: string; - linecolor: string; - linestyle: number; - linewidth: number; - transparency: number; + color1: string + color2: string + linecolor: string + linestyle: number + linewidth: number + transparency: number } export interface AvailableZOrderOperations { - bringForwardEnabled: boolean; - bringToFrontEnabled: boolean; - sendBackwardEnabled: boolean; - sendToBackEnabled: boolean; + bringForwardEnabled: boolean + bringToFrontEnabled: boolean + sendBackwardEnabled: boolean + sendToBackEnabled: boolean } export interface Bar { - time: number; - open: number; - high: number; - low: number; - close: number; - volume?: number; + time: number + open: number + high: number + low: number + close: number + volume?: number } export interface BarStylePreferences { - upColor: string; - downColor: string; - barColorsOnPrevClose: boolean; - dontDrawOpen: boolean; - thinBars: boolean; + upColor: string + downColor: string + barColorsOnPrevClose: boolean + dontDrawOpen: boolean + thinBars: boolean } export interface BaseInputFieldValidatorResult { - valid: boolean; + valid: boolean } export interface BaselineStylePreferences { - topFillColor1: string; - topFillColor2: string; - bottomFillColor1: string; - bottomFillColor2: string; - topLineColor: string; - bottomLineColor: string; - topLineWidth: number; - bottomLineWidth: number; - transparency: number; - baseLevelPercentage: number; + topFillColor1: string + topFillColor2: string + bottomFillColor1: string + bottomFillColor2: string + topLineColor: string + bottomLineColor: string + topLineWidth: number + bottomLineWidth: number + transparency: number + baseLevelPercentage: number } export interface BracketOrder extends PlacedOrder { - parentId: string; - parentType: ParentType; + parentId: string + parentType: ParentType } export interface Brackets { - stopLoss?: number; - takeProfit?: number; - trailingStopPips?: number; + stopLoss?: number + takeProfit?: number + trailingStopPips?: number } export interface BrokerConfigFlags { - supportDisplayBrokerNameInSymbolSearch?: boolean; - showQuantityInsteadOfAmount?: boolean; - supportOrderBrackets?: boolean; - supportTrailingStop?: boolean; - supportPositions?: boolean; - supportPositionBrackets?: boolean; - supportTradeBrackets?: boolean; - supportTrades?: boolean; - supportClosePosition?: boolean; - supportCloseTrade?: boolean; - supportEditAmount?: boolean; - supportLevel2Data?: boolean; - supportDOM?: boolean; - supportMultiposition?: boolean; - supportPLUpdate?: boolean; - supportReversePosition?: boolean; - supportNativeReversePosition?: boolean; - supportMarketOrders?: boolean; - supportLimitOrders?: boolean; - supportStopOrders?: boolean; - supportStopLimitOrders?: boolean; - supportDemoLiveSwitcher?: boolean; - supportMarketBrackets?: boolean; - supportSymbolSearch?: boolean; - supportModifyDuration?: boolean; - supportModifyOrder?: boolean; - supportModifyTrailingStop?: boolean; - supportMargin?: boolean; - calculatePLUsingLast?: boolean; - supportPlaceOrderPreview?: boolean; - supportModifyOrderPreview?: boolean; - supportOrdersHistory?: boolean; - supportAddBracketsToExistingOrder?: boolean; - supportBalances?: boolean; - closePositionCancelsOrders?: boolean; - supportOnlyPairPositionBrackets?: boolean; - supportCryptoExchangeOrderTicket?: boolean; - supportConfirmations?: boolean; - /** Does broker need to display position's PL in instrument's currency */ - positionPLInInstrumentCurrency?: boolean; - /** Does broker support partial position closing */ - supportPartialClosePosition?: boolean; - /** Does broker support partial trade closing */ - supportPartialCloseTrade?: boolean; - /** Cancelling a bracket cancels it's oco pair */ - supportCancellingBothBracketsOnly?: boolean; - /** Does broker support crypto brackets */ - supportCryptoBrackets?: boolean; - /** Does broker need to show notifications log */ - showNotificationsLog?: boolean; - /** - * Whether stop orders should behave like Market-if-touched in both directions. - * Enabling this flag removes the direction check from the order dialog. - */ - supportStopOrdersInBothDirections?: boolean; - /** Does broker support executions */ - supportExecutions?: boolean; - requiresFIFOCloseTrades?: boolean; - /** - * @deprecated - */ - supportBrackets?: boolean; + supportDisplayBrokerNameInSymbolSearch?: boolean + showQuantityInsteadOfAmount?: boolean + supportOrderBrackets?: boolean + supportTrailingStop?: boolean + supportPositions?: boolean + supportPositionBrackets?: boolean + supportTradeBrackets?: boolean + supportTrades?: boolean + supportClosePosition?: boolean + supportCloseTrade?: boolean + supportEditAmount?: boolean + supportLevel2Data?: boolean + supportDOM?: boolean + supportMultiposition?: boolean + supportPLUpdate?: boolean + supportReversePosition?: boolean + supportNativeReversePosition?: boolean + supportMarketOrders?: boolean + supportLimitOrders?: boolean + supportStopOrders?: boolean + supportStopLimitOrders?: boolean + supportDemoLiveSwitcher?: boolean + supportMarketBrackets?: boolean + supportSymbolSearch?: boolean + supportModifyDuration?: boolean + supportModifyOrder?: boolean + supportModifyTrailingStop?: boolean + supportMargin?: boolean + calculatePLUsingLast?: boolean + supportPlaceOrderPreview?: boolean + supportModifyOrderPreview?: boolean + supportOrdersHistory?: boolean + supportAddBracketsToExistingOrder?: boolean + supportBalances?: boolean + closePositionCancelsOrders?: boolean + supportOnlyPairPositionBrackets?: boolean + supportCryptoExchangeOrderTicket?: boolean + supportConfirmations?: boolean + /** Does broker need to display position's PL in instrument's currency */ + positionPLInInstrumentCurrency?: boolean + /** Does broker support partial position closing */ + supportPartialClosePosition?: boolean + /** Does broker support partial trade closing */ + supportPartialCloseTrade?: boolean + /** Cancelling a bracket cancels it's oco pair */ + supportCancellingBothBracketsOnly?: boolean + /** Does broker support crypto brackets */ + supportCryptoBrackets?: boolean + /** Does broker need to show notifications log */ + showNotificationsLog?: boolean + /** + * Whether stop orders should behave like Market-if-touched in both directions. + * Enabling this flag removes the direction check from the order dialog. + */ + supportStopOrdersInBothDirections?: boolean + /** Does broker support executions */ + supportExecutions?: boolean + requiresFIFOCloseTrades?: boolean + /** + * @deprecated + */ + supportBrackets?: boolean } export interface BrokerCustomUI { - showOrderDialog?: (order: OrderTemplate | Order, focus?: OrderTicketFocusControl) => Promise; - showPositionDialog?: (position: Position | Trade, brackets: Brackets, focus?: OrderTicketFocusControl) => Promise; - showCancelOrderDialog?: (order: Order) => Promise; - showClosePositionDialog?: (position: Position) => Promise; + showOrderDialog?: (order: OrderTemplate | Order, focus?: OrderTicketFocusControl) => Promise + showPositionDialog?: ( + position: Position | Trade, + brackets: Brackets, + focus?: OrderTicketFocusControl, + ) => Promise + showCancelOrderDialog?: (order: Order) => Promise + showClosePositionDialog?: (position: Position) => Promise } export interface CandleStylePreferences { - upColor: string; - downColor: string; - drawWick: boolean; - drawBorder: boolean; - drawBody: boolean; - borderColor: string; - borderUpColor: string; - borderDownColor: string; - wickColor: string; - wickUpColor: string; - wickDownColor: string; - barColorsOnPrevClose: boolean; + upColor: string + downColor: string + drawWick: boolean + drawBorder: boolean + drawBody: boolean + borderColor: string + borderUpColor: string + borderDownColor: string + wickColor: string + wickUpColor: string + wickDownColor: string + barColorsOnPrevClose: boolean } export interface ChangeAccountSolution { - changeAccount: AccountId; + changeAccount: AccountId } export interface ChangeSymbolSolution { - changeSymbol: string; + changeSymbol: string } export interface ChangeThemeOptions { - disableUndo: boolean; + disableUndo: boolean } export interface ChartData { - id: string; - name: string; - symbol: string; - resolution: ResolutionString; - content: string; + id: string + name: string + symbol: string + resolution: ResolutionString + content: string } export interface ChartMetaInfo { - id: number; - name: string; - symbol: string; - resolution: ResolutionString; - timestamp: number; + id: number + name: string + symbol: string + resolution: ResolutionString + timestamp: number } export interface ChartingLibraryWidgetConstructor { - new (options: ChartingLibraryWidgetOptions | TradingTerminalWidgetOptions): IChartingLibraryWidget; + new (options: ChartingLibraryWidgetOptions | TradingTerminalWidgetOptions): IChartingLibraryWidget } export interface ChartingLibraryWidgetOptions { - /** @deprecated */ - container_id?: string; - container: HTMLElement | string; - datafeed: IBasicDataFeed | (IBasicDataFeed & IDatafeedQuotesApi); - interval: ResolutionString; - symbol?: string; - auto_save_delay?: number; - autosize?: boolean; - debug?: boolean; - disabled_features?: string[]; - drawings_access?: AccessList; - enabled_features?: string[]; - fullscreen?: boolean; - height?: number; - library_path?: string; - locale: LanguageCode; - numeric_formatting?: NumericFormattingParams; - saved_data?: object; - saved_data_meta_info?: SavedStateMetaInfo; - studies_access?: AccessList; - study_count_limit?: number; - symbol_search_request_delay?: number; - timeframe?: string; - timezone?: "exchange" | Timezone; - toolbar_bg?: string; - width?: number; - charts_storage_url?: string; - charts_storage_api_version?: AvailableSaveloadVersions; - client_id?: string; - user_id?: string; - load_last_chart?: boolean; - studies_overrides?: StudyOverrides; - customFormatters?: CustomFormatters; - custom_formatters?: CustomFormatters; - overrides?: Overrides; - snapshot_url?: string; - preset?: "mobile"; - time_frames?: TimeFrameItem[]; - custom_css_url?: string; - favorites?: Favorites; - save_load_adapter?: IExternalSaveLoadAdapter; - loading_screen?: LoadingScreenOptions; - settings_adapter?: ISettingsAdapter; - theme?: ThemeName; - compare_symbols?: CompareSymbol[]; - custom_indicators_getter?: (PineJS: PineJS) => Promise; - additional_symbol_info_fields?: AdditionalSymbolInfoField[]; - header_widget_buttons_mode?: HeaderWidgetButtonsMode; - time_scale?: TimeScaleOptions; - symbol_search_complete?: SymbolSearchCompleteOverrideFunction; + /** @deprecated */ + container_id?: string + container: HTMLElement | string + datafeed: IBasicDataFeed | (IBasicDataFeed & IDatafeedQuotesApi) + interval: ResolutionString + symbol?: string + auto_save_delay?: number + autosize?: boolean + debug?: boolean + disabled_features?: string[] + drawings_access?: AccessList + enabled_features?: string[] + fullscreen?: boolean + height?: number + library_path?: string + locale: LanguageCode + numeric_formatting?: NumericFormattingParams + saved_data?: object + saved_data_meta_info?: SavedStateMetaInfo + studies_access?: AccessList + study_count_limit?: number + symbol_search_request_delay?: number + timeframe?: string + timezone?: 'exchange' | Timezone + toolbar_bg?: string + width?: number + charts_storage_url?: string + charts_storage_api_version?: AvailableSaveloadVersions + client_id?: string + user_id?: string + load_last_chart?: boolean + studies_overrides?: StudyOverrides + customFormatters?: CustomFormatters + custom_formatters?: CustomFormatters + overrides?: Overrides + snapshot_url?: string + preset?: 'mobile' + time_frames?: TimeFrameItem[] + custom_css_url?: string + favorites?: Favorites + save_load_adapter?: IExternalSaveLoadAdapter + loading_screen?: LoadingScreenOptions + settings_adapter?: ISettingsAdapter + theme?: ThemeName + compare_symbols?: CompareSymbol[] + custom_indicators_getter?: (PineJS: PineJS) => Promise + additional_symbol_info_fields?: AdditionalSymbolInfoField[] + header_widget_buttons_mode?: HeaderWidgetButtonsMode + time_scale?: TimeScaleOptions + symbol_search_complete?: SymbolSearchCompleteOverrideFunction } export interface ClientSnapshotOptions { - backgroundColor: string; - borderColor: string; - font: string; - fontSize: number; - legendMode: LegendMode; - hideResolution: boolean; + backgroundColor: string + borderColor: string + font: string + fontSize: number + legendMode: LegendMode + hideResolution: boolean } export interface CompareSymbol { - symbol: string; - title: string; + symbol: string + title: string } export interface ContextMenuItem { - position: "top" | "bottom"; - text: string; - click: EmptyCallback; + position: 'top' | 'bottom' + text: string + click: EmptyCallback } export interface CreateButtonOptions { - align: "right" | "left"; + align: 'right' | 'left' } export interface CreateMultipointShapeOptions extends CreateShapeOptionsBase { - shape?: Exclude; + shape?: Exclude } export interface CreateShapeOptions extends CreateShapeOptionsBase { - shape?: "arrow_up" | "arrow_down" | "flag" | "vertical_line" | "horizontal_line" | "long_position" | "short_position"; - ownerStudyId?: EntityId; + shape?: 'arrow_up' | 'arrow_down' | 'flag' | 'vertical_line' | 'horizontal_line' | 'long_position' | 'short_position' + ownerStudyId?: EntityId } export interface CreateShapeOptionsBase { - text?: string; - lock?: boolean; - disableSelection?: boolean; - disableSave?: boolean; - disableUndo?: boolean; - overrides?: TOverrides; - zOrder?: "top" | "bottom"; - showInObjectsTree?: boolean; - ownerStudyId?: EntityId; + text?: string + lock?: boolean + disableSelection?: boolean + disableSave?: boolean + disableUndo?: boolean + overrides?: TOverrides + zOrder?: 'top' | 'bottom' + showInObjectsTree?: boolean + ownerStudyId?: EntityId } export interface CreateStudyOptions { - checkLimit?: boolean; - priceScale?: StudyPriceScale; - allowChangeCurrency?: boolean; - allowChangeUnit?: boolean; - disableUndo?: boolean; + checkLimit?: boolean + priceScale?: StudyPriceScale + allowChangeCurrency?: boolean + allowChangeUnit?: boolean + disableUndo?: boolean } export interface CreateStudyTemplateOptions { - saveSymbol?: boolean; - saveInterval?: boolean; + saveSymbol?: boolean + saveInterval?: boolean } export interface CrossHairMovedEventParams { - time: number; - price: number; + time: number + price: number } export interface CryptoBalance { - symbol: string; - total: number; - available: number; - reserved?: number; - value?: number; - valueCurrency?: string; - longName?: string; - btcValue?: number; + symbol: string + total: number + available: number + reserved?: number + value?: number + valueCurrency?: string + longName?: string + btcValue?: number } export interface CustomComboBoxItem { - text: string; - value: string; + text: string + value: string } export interface CustomComboBoxMetaInfo extends CustomInputFieldMetaInfo { - inputType: "ComboBox"; - items: CustomComboBoxItem[]; + inputType: 'ComboBox' + items: CustomComboBoxItem[] } export interface CustomFields { - [key: string]: any; + [key: string]: any } export interface CustomFormatter { - format(date: Date): string; - formatLocal(date: Date): string; + format(date: Date): string + formatLocal(date: Date): string } export interface CustomFormatters { - timeFormatter: CustomFormatter; - dateFormatter: CustomFormatter; - tickMarkFormatter?: (date: Date, tickMarkType: TickMarkType) => string; + timeFormatter: CustomFormatter + dateFormatter: CustomFormatter + tickMarkFormatter?: (date: Date, tickMarkType: TickMarkType) => string } export interface CustomIndicator { - readonly name: string; - readonly metainfo: any; - readonly constructor: any; + readonly name: string + readonly metainfo: any + readonly constructor: any } export interface CustomInputFieldMetaInfo { - inputType: string; - id: string; - title: string; - preventModify?: boolean; - placeHolder?: string; - value?: any; - validator?: InputFieldValidator; - customInfo?: any; - saveToSettings?: boolean; + inputType: string + id: string + title: string + preventModify?: boolean + placeHolder?: string + value?: any + validator?: InputFieldValidator + customInfo?: any + saveToSettings?: boolean } export interface CustomInputFieldsValues { - [fieldId: string]: TextWithCheckboxValue | string | any; + [fieldId: string]: TextWithCheckboxValue | string | any } export interface DOMData { - snapshot: boolean; - asks: DOMLevel[]; - bids: DOMLevel[]; + snapshot: boolean + asks: DOMLevel[] + bids: DOMLevel[] } export interface DOMLevel { - price: number; - volume: number; + price: number + volume: number } export interface DatafeedConfiguration { - exchanges?: Exchange[]; - supported_resolutions?: ResolutionString[]; - units?: Record; - currency_codes?: string[]; - supports_marks?: boolean; - supports_time?: boolean; - supports_timescale_marks?: boolean; - symbols_types?: DatafeedSymbolType[]; + exchanges?: Exchange[] + supported_resolutions?: ResolutionString[] + units?: Record + currency_codes?: string[] + supports_marks?: boolean + supports_time?: boolean + supports_timescale_marks?: boolean + symbols_types?: DatafeedSymbolType[] } export interface DatafeedQuoteValues { - ch?: number; - chp?: number; - short_name?: string; - exchange?: string; - description?: string; - lp?: number; - ask?: number; - bid?: number; - spread?: number; - open_price?: number; - high_price?: number; - low_price?: number; - prev_close_price?: number; - volume?: number; - original_name?: string; - [valueName: string]: string | number | undefined; + ch?: number + chp?: number + short_name?: string + exchange?: string + description?: string + lp?: number + ask?: number + bid?: number + spread?: number + open_price?: number + high_price?: number + low_price?: number + prev_close_price?: number + volume?: number + original_name?: string + [valueName: string]: string | number | undefined } export interface DatafeedSymbolType { - name: string; - value: string; -} -export interface DefaultContextMenuActionsParams { + name: string + value: string } +export interface DefaultContextMenuActionsParams {} export interface DefaultDropdownActionsParams { - tradingProperties?: boolean; - showHowToUse?: boolean; - restoreConfirmations?: boolean; + tradingProperties?: boolean + showHowToUse?: boolean + restoreConfirmations?: boolean } export interface DialogParams { - title: string; - body: string; - callback: CallbackType; + title: string + body: string + callback: CallbackType } export interface DropdownItem { - title: string; - onSelect: () => void; + title: string + onSelect: () => void } export interface DropdownParams { - title: string; - items: DropdownItem[]; - tooltip?: string; - icon?: string; - align?: "right" | "left"; + title: string + items: DropdownItem[] + tooltip?: string + icon?: string + align?: 'right' | 'left' } export interface EditObjectDialogEventParams { - objectType: EditObjectDialogObjectType; - scriptTitle: string; + objectType: EditObjectDialogObjectType + scriptTitle: string } export interface EntityInfo { - id: EntityId; - name: string; + id: EntityId + name: string } export interface ErrorFormatterParseResult extends FormatterParseResult { - error?: string; - res: false; + error?: string + res: false } export interface Exchange { - value: string; - name: string; - desc: string; + value: string + name: string + desc: string } export interface Execution extends CustomFields { - symbol: string; - price: number; - qty: number; - side: Side; - time: number; + symbol: string + price: number + qty: number + side: Side + time: number } export interface ExportDataOptions { - from?: number; - to?: number; - includeTime?: boolean; - includeUserTime?: boolean; - includeSeries?: boolean; - includeDisplayedValues?: boolean; - includedStudies: readonly string[] | "all"; + from?: number + to?: number + includeTime?: boolean + includeUserTime?: boolean + includeSeries?: boolean + includeDisplayedValues?: boolean + includedStudies: readonly string[] | 'all' } export interface ExportedData { - schema: FieldDescriptor[]; - data: Float64Array[]; - displayedData: string[][]; + schema: FieldDescriptor[] + data: Float64Array[] + displayedData: string[][] } export interface Favorites { - intervals: ResolutionString[]; - chartTypes: string[]; + intervals: ResolutionString[] + chartTypes: string[] } export interface FormatterParseResult { - res: boolean; + res: boolean } export interface GetNewsResponse { - title?: string; - newsItems: NewsItem[]; + title?: string + newsItems: NewsItem[] } export interface GrayedObject { - type: "drawing" | "study"; - name: string; + type: 'drawing' | 'study' + name: string } export interface HeikinAshiStylePreferences { - upColor: string; - downColor: string; - drawWick: boolean; - drawBorder: boolean; - drawBody: boolean; - borderColor: string; - borderUpColor: string; - borderDownColor: string; - wickColor: string; - wickUpColor: string; - wickDownColor: string; - showRealLastPrice: boolean; - barColorsOnPrevClose: boolean; + upColor: string + downColor: string + drawWick: boolean + drawBorder: boolean + drawBody: boolean + borderColor: string + borderUpColor: string + borderDownColor: string + wickColor: string + wickUpColor: string + wickDownColor: string + showRealLastPrice: boolean + barColorsOnPrevClose: boolean } export interface HiLoStylePreferences { - color: string; - showBorders: boolean; - borderColor: string; - showLabels: boolean; - labelColor: string; - fontSize: number; - drawBody: boolean; + color: string + showBorders: boolean + borderColor: string + showLabels: boolean + labelColor: string + fontSize: number + drawBody: boolean } export interface HistoryMetadata { - noData?: boolean; - nextTime?: number | null; + noData?: boolean + nextTime?: number | null } export interface HollowCandleStylePreferences { - upColor: string; - downColor: string; - drawWick: boolean; - drawBorder: boolean; - drawBody: boolean; - borderColor: string; - borderUpColor: string; - borderDownColor: string; - wickColor: string; - wickUpColor: string; - wickDownColor: string; + upColor: string + downColor: string + drawWick: boolean + drawBorder: boolean + drawBody: boolean + borderColor: string + borderUpColor: string + borderDownColor: string + wickColor: string + wickUpColor: string + wickDownColor: string } export interface IBoxedValue extends IBoxedValueReadOnly { - setValue(value: T): void; + setValue(value: T): void } export interface IBoxedValueReadOnly { - value(): T; + value(): T } export interface IBrokerCommon { - chartContextMenuActions(context: TradeContext, options?: DefaultContextMenuActionsParams): Promise; - isTradable(symbol: string): Promise; - connectionStatus(): ConnectionStatus; - orders(): Promise; - ordersHistory?(): Promise; - positions?(): Promise; - trades?(): Promise; - executions(symbol: string): Promise; - symbolInfo(symbol: string): Promise; - accountManagerInfo(): AccountManagerInfo; - formatter?(symbol: string, alignToMinMove: boolean): Promise; - spreadFormatter?(symbol: string): Promise; - quantityFormatter?(symbol: string): Promise; - getOrderDialogOptions?(symbol: string): Promise; - getPositionDialogOptions?(): PositionDialogOptions | undefined; + chartContextMenuActions(context: TradeContext, options?: DefaultContextMenuActionsParams): Promise + isTradable(symbol: string): Promise + connectionStatus(): ConnectionStatus + orders(): Promise + ordersHistory?(): Promise + positions?(): Promise + trades?(): Promise + executions(symbol: string): Promise + symbolInfo(symbol: string): Promise + accountManagerInfo(): AccountManagerInfo + formatter?(symbol: string, alignToMinMove: boolean): Promise + spreadFormatter?(symbol: string): Promise + quantityFormatter?(symbol: string): Promise + getOrderDialogOptions?(symbol: string): Promise + getPositionDialogOptions?(): PositionDialogOptions | undefined } export interface IBrokerConnectionAdapterFactory { - createDelegate(): IDelegate; - createWatchedValue(value?: T): IWatchedValue; - createPriceFormatter(priceScale?: number, minMove?: number, fractional?: boolean, minMove2?: number): IPriceFormatter; + createDelegate(): IDelegate + createWatchedValue(value?: T): IWatchedValue + createPriceFormatter(priceScale?: number, minMove?: number, fractional?: boolean, minMove2?: number): IPriceFormatter } export interface IBrokerConnectionAdapterHost { - factory: IBrokerConnectionAdapterFactory; - defaultFormatter(symbol: string, alignToMinMove: boolean): Promise; - numericFormatter(decimalPlaces: number): Promise; - quantityFormatter(decimalPlaces?: number): Promise; - defaultContextMenuActions(context: TradeContext, params?: DefaultContextMenuActionsParams): Promise; - defaultDropdownMenuActions(options?: Partial): ActionMetaInfo[]; - sellBuyButtonsVisibility(): IWatchedValue | null; - domPanelVisibility(): IWatchedValue | null; - orderPanelVisibility(): IWatchedValue | null; - silentOrdersPlacement(): IWatchedValue; - patchConfig(config: Partial): void; - setDurations(durations: OrderDurationMetaInfo[]): void; - orderUpdate(order: Order): void; - orderPartialUpdate(id: string, orderChanges: Partial): void; - positionUpdate(position: Position, isHistoryUpdate?: boolean): void; - positionPartialUpdate(id: string, positionChanges: Partial): void; - tradeUpdate(trade: Trade, isHistoryUpdate?: boolean): void; - tradePartialUpdate(id: string, tradeChanges: Partial): void; - executionUpdate(execution: Execution): void; - currentAccountUpdate(): void; - realtimeUpdate(symbol: string, data: TradingQuotes): void; - plUpdate(positionId: string, pl: number): void; - pipValueUpdate(symbol: string, pipValues: PipValues): void; - tradePLUpdate(tradeId: string, pl: number): void; - equityUpdate(equity: number): void; - marginAvailableUpdate(marginAvailable: number): void; - cryptoBalanceUpdate(symbol: string, balance: CryptoBalance): void; - domeUpdate(symbol: string, equity: DOMData): void; - showOrderDialog?(order: T, focus?: OrderTicketFocusControl): Promise; - showNotification(title: string, text: string, notificationType?: NotificationType): void; - showCancelOrderDialog(orderId: string, handler: () => Promise): Promise; - showCancelMultipleOrdersDialog(symbol: string, side: Side, qty: number, handler: () => Promise): Promise; - showCancelBracketsDialog(orderId: string, handler: () => Promise): Promise; - showCancelMultipleBracketsDialog(orderId: string, handler: () => Promise): Promise; - showReversePositionDialog(position: string, handler: () => Promise): Promise; - showPositionBracketsDialog(position: Position | Trade, brackets: Brackets, focus: OrderTicketFocusControl): Promise; - setButtonDropdownActions(descriptions: ActionMetaInfo[]): void; - activateBottomWidget(): Promise; - showTradingProperties(): void; - suggestedQty(): SuggestedQuantity; - getSymbolMinTick(symbol: string): Promise; - showMessageDialog(title: string, text: string, textHasHTML: boolean): void; - showConfirmDialog(title: string, content: string | string[], mainButtonText?: string, cancelButtonText?: string, showDisableConfirmationsCheckbox?: boolean): Promise; - showSimpleConfirmDialog(title: string, content: string | string[], mainButtonText?: string, cancelButtonText?: string, showDisableConfirmationsCheckbox?: boolean): Promise; + factory: IBrokerConnectionAdapterFactory + defaultFormatter(symbol: string, alignToMinMove: boolean): Promise + numericFormatter(decimalPlaces: number): Promise + quantityFormatter(decimalPlaces?: number): Promise + defaultContextMenuActions(context: TradeContext, params?: DefaultContextMenuActionsParams): Promise + defaultDropdownMenuActions(options?: Partial): ActionMetaInfo[] + sellBuyButtonsVisibility(): IWatchedValue | null + domPanelVisibility(): IWatchedValue | null + orderPanelVisibility(): IWatchedValue | null + silentOrdersPlacement(): IWatchedValue + patchConfig(config: Partial): void + setDurations(durations: OrderDurationMetaInfo[]): void + orderUpdate(order: Order): void + orderPartialUpdate(id: string, orderChanges: Partial): void + positionUpdate(position: Position, isHistoryUpdate?: boolean): void + positionPartialUpdate(id: string, positionChanges: Partial): void + tradeUpdate(trade: Trade, isHistoryUpdate?: boolean): void + tradePartialUpdate(id: string, tradeChanges: Partial): void + executionUpdate(execution: Execution): void + currentAccountUpdate(): void + realtimeUpdate(symbol: string, data: TradingQuotes): void + plUpdate(positionId: string, pl: number): void + pipValueUpdate(symbol: string, pipValues: PipValues): void + tradePLUpdate(tradeId: string, pl: number): void + equityUpdate(equity: number): void + marginAvailableUpdate(marginAvailable: number): void + cryptoBalanceUpdate(symbol: string, balance: CryptoBalance): void + domeUpdate(symbol: string, equity: DOMData): void + showOrderDialog?(order: T, focus?: OrderTicketFocusControl): Promise + showNotification(title: string, text: string, notificationType?: NotificationType): void + showCancelOrderDialog(orderId: string, handler: () => Promise): Promise + showCancelMultipleOrdersDialog(symbol: string, side: Side, qty: number, handler: () => Promise): Promise + showCancelBracketsDialog(orderId: string, handler: () => Promise): Promise + showCancelMultipleBracketsDialog(orderId: string, handler: () => Promise): Promise + showReversePositionDialog(position: string, handler: () => Promise): Promise + showPositionBracketsDialog( + position: Position | Trade, + brackets: Brackets, + focus: OrderTicketFocusControl, + ): Promise + setButtonDropdownActions(descriptions: ActionMetaInfo[]): void + activateBottomWidget(): Promise + showTradingProperties(): void + suggestedQty(): SuggestedQuantity + getSymbolMinTick(symbol: string): Promise + showMessageDialog(title: string, text: string, textHasHTML: boolean): void + showConfirmDialog( + title: string, + content: string | string[], + mainButtonText?: string, + cancelButtonText?: string, + showDisableConfirmationsCheckbox?: boolean, + ): Promise + showSimpleConfirmDialog( + title: string, + content: string | string[], + mainButtonText?: string, + cancelButtonText?: string, + showDisableConfirmationsCheckbox?: boolean, + ): Promise } export interface IBrokerTerminal extends IBrokerWithoutRealtime { - subscribeRealtime(symbol: string): void; - unsubscribeRealtime(symbol: string): void; + subscribeRealtime(symbol: string): void + unsubscribeRealtime(symbol: string): void } export interface IBrokerWithoutRealtime extends IBrokerCommon { - subscribeDOME?(symbol: string): void; - unsubscribeDOME?(symbol: string): void; - placeOrder(order: PreOrder, confirmId?: string): Promise; - previewOrder?(order: PreOrder): Promise; - modifyOrder(order: Order, confirmId?: string): Promise; - cancelOrder(orderId: string): Promise; - cancelOrders(symbol: string, side: Side | undefined, ordersIds: string[]): Promise; - reversePosition?(positionId: string): Promise; - closePosition?(positionId: string, amount?: number): Promise; - closeTrade?(tradeId: string, amount?: number): Promise; - editPositionBrackets?(positionId: string, brackets: Brackets, customFields?: CustomInputFieldsValues): Promise; - editTradeBrackets?(tradeId: string, brackets: Brackets): Promise; - /** - * @deprecated Brokers should always send PL and equity updates - */ - subscribePL?(positionId: string): void; - subscribeEquity?(): void; - subscribeMarginAvailable?(symbol: string): void; - subscribePipValue?(symbol: string): void; - unsubscribePipValue?(symbol: string): void; - unsubscribeMarginAvailable?(symbol: string): void; - /** - * @deprecated - */ - unsubscribePL?(positionId: string): void; - unsubscribeEquity?(): void; + subscribeDOME?(symbol: string): void + unsubscribeDOME?(symbol: string): void + placeOrder(order: PreOrder, confirmId?: string): Promise + previewOrder?(order: PreOrder): Promise + modifyOrder(order: Order, confirmId?: string): Promise + cancelOrder(orderId: string): Promise + cancelOrders(symbol: string, side: Side | undefined, ordersIds: string[]): Promise + reversePosition?(positionId: string): Promise + closePosition?(positionId: string, amount?: number): Promise + closeTrade?(tradeId: string, amount?: number): Promise + editPositionBrackets?(positionId: string, brackets: Brackets, customFields?: CustomInputFieldsValues): Promise + editTradeBrackets?(tradeId: string, brackets: Brackets): Promise + /** + * @deprecated Brokers should always send PL and equity updates + */ + subscribePL?(positionId: string): void + subscribeEquity?(): void + subscribeMarginAvailable?(symbol: string): void + subscribePipValue?(symbol: string): void + unsubscribePipValue?(symbol: string): void + unsubscribeMarginAvailable?(symbol: string): void + /** + * @deprecated + */ + unsubscribePL?(positionId: string): void + unsubscribeEquity?(): void } export interface IChartWidgetApi { - onDataLoaded(): ISubscription<() => void>; - onSymbolChanged(): ISubscription<() => void>; - onIntervalChanged(): ISubscription<(interval: ResolutionString, timeFrameParameters: { - timeframe?: TimeFrameValue; - }) => void>; - onVisibleRangeChanged(): ISubscription<(range: VisibleTimeRange) => void>; - onChartTypeChanged(): ISubscription<(chartType: SeriesStyle) => void>; - dataReady(callback: () => void): boolean; - crossHairMoved(): ISubscription<(params: CrossHairMovedEventParams) => void>; - setVisibleRange(range: SetVisibleTimeRange, options?: SetVisibleRangeOptions): Promise; - setSymbol(symbol: string, callback?: () => void): void; - setResolution(resolution: ResolutionString, callback?: () => void): void; - setChartType(type: SeriesStyle, callback?: () => void): void; - resetData(): void; - executeActionById(actionId: ChartActionId): void; - getCheckableActionState(actionId: ChartActionId): boolean; - refreshMarks(): void; - clearMarks(): void; - getAllShapes(): EntityInfo[]; - getAllStudies(): EntityInfo[]; - getPriceToBarRatio(): number | null; - setPriceToBarRatio(ratio: number, options?: UndoOptions): void; - isPriceToBarRatioLocked(): boolean; - setPriceToBarRatioLocked(value: boolean, options?: UndoOptions): void; - getAllPanesHeight(): number[]; - setAllPanesHeight(heights: readonly number[]): void; - availableZOrderOperations(sources: readonly EntityId[]): AvailableZOrderOperations; - sendToBack(entities: readonly EntityId[]): void; - bringToFront(sources: readonly EntityId[]): void; - bringForward(sources: readonly EntityId[]): void; - sendBackward(sources: readonly EntityId[]): void; - /** - * @deprecated Use shape/study API instead ([getStudyById] / [getShapeById]) - */ - setEntityVisibility(entityId: EntityId, isVisible: boolean): void; - createStudy(name: string, forceOverlay?: boolean, lock?: boolean, inputs?: TStudyInputValue[], overrides?: TOverrides, options?: CreateStudyOptions): Promise; - getStudyById(entityId: EntityId): IStudyApi; - getSeries(): ISeriesApi; - createShape(point: ShapePoint, options: CreateShapeOptions): EntityId | null; - createMultipointShape(points: ShapePoint[], options: CreateMultipointShapeOptions): EntityId | null; - getShapeById(entityId: EntityId): ILineDataSourceApi; - removeEntity(entityId: EntityId, options?: UndoOptions): void; - removeAllShapes(): void; - removeAllStudies(): void; - selection(): ISelectionApi; - showPropertiesDialog(studyId: EntityId): void; - createStudyTemplate(options: CreateStudyTemplateOptions): object; - applyStudyTemplate(template: object): void; - createOrderLine(options?: UndoOptions): IOrderLineAdapter; - createPositionLine(options?: UndoOptions): IPositionLineAdapter; - createExecutionShape(options?: UndoOptions): IExecutionLineAdapter; - symbol(): string; - symbolExt(): SymbolExt; - resolution(): ResolutionString; - getVisibleRange(): VisibleTimeRange; - /** - * @deprecated Use Price Scale API instead - */ - getVisiblePriceRange(): VisiblePriceRange; - scrollPosition(): number; - defaultScrollPosition(): number; - priceFormatter(): INumberFormatter; - chartType(): SeriesStyle; - setTimezone(timezone: "exchange" | Timezone): void; - getTimezone(): "exchange" | Timezone; - getPanes(): IPaneApi[]; - exportData(options?: Partial): Promise; - canZoomOut(): boolean; - zoomOut(): void; - setZoomEnabled(enabled: boolean): void; - setScrollEnabled(enabled: boolean): void; - shapesGroupController(): IShapesGroupControllerApi; - barTimeToEndOfPeriod(unixTime: number): number; - endOfPeriodToBarTime(unixTime: number): number; - getTimeScale(): ITimeScaleApi; - isSelectBarRequested(): boolean; - requestSelectBar(): Promise; - cancelSelectBar(): void; + onDataLoaded(): ISubscription<() => void> + onSymbolChanged(): ISubscription<() => void> + onIntervalChanged(): ISubscription< + ( + interval: ResolutionString, + timeFrameParameters: { + timeframe?: TimeFrameValue + }, + ) => void + > + onVisibleRangeChanged(): ISubscription<(range: VisibleTimeRange) => void> + onChartTypeChanged(): ISubscription<(chartType: SeriesStyle) => void> + dataReady(callback: () => void): boolean + crossHairMoved(): ISubscription<(params: CrossHairMovedEventParams) => void> + setVisibleRange(range: SetVisibleTimeRange, options?: SetVisibleRangeOptions): Promise + setSymbol(symbol: string, callback?: () => void): void + setResolution(resolution: ResolutionString, callback?: () => void): void + setChartType(type: SeriesStyle, callback?: () => void): void + resetData(): void + executeActionById(actionId: ChartActionId): void + getCheckableActionState(actionId: ChartActionId): boolean + refreshMarks(): void + clearMarks(): void + getAllShapes(): EntityInfo[] + getAllStudies(): EntityInfo[] + getPriceToBarRatio(): number | null + setPriceToBarRatio(ratio: number, options?: UndoOptions): void + isPriceToBarRatioLocked(): boolean + setPriceToBarRatioLocked(value: boolean, options?: UndoOptions): void + getAllPanesHeight(): number[] + setAllPanesHeight(heights: readonly number[]): void + availableZOrderOperations(sources: readonly EntityId[]): AvailableZOrderOperations + sendToBack(entities: readonly EntityId[]): void + bringToFront(sources: readonly EntityId[]): void + bringForward(sources: readonly EntityId[]): void + sendBackward(sources: readonly EntityId[]): void + /** + * @deprecated Use shape/study API instead ([getStudyById] / [getShapeById]) + */ + setEntityVisibility(entityId: EntityId, isVisible: boolean): void + createStudy( + name: string, + forceOverlay?: boolean, + lock?: boolean, + inputs?: TStudyInputValue[], + overrides?: TOverrides, + options?: CreateStudyOptions, + ): Promise + getStudyById(entityId: EntityId): IStudyApi + getSeries(): ISeriesApi + createShape(point: ShapePoint, options: CreateShapeOptions): EntityId | null + createMultipointShape( + points: ShapePoint[], + options: CreateMultipointShapeOptions, + ): EntityId | null + getShapeById(entityId: EntityId): ILineDataSourceApi + removeEntity(entityId: EntityId, options?: UndoOptions): void + removeAllShapes(): void + removeAllStudies(): void + selection(): ISelectionApi + showPropertiesDialog(studyId: EntityId): void + createStudyTemplate(options: CreateStudyTemplateOptions): object + applyStudyTemplate(template: object): void + createOrderLine(options?: UndoOptions): IOrderLineAdapter + createPositionLine(options?: UndoOptions): IPositionLineAdapter + createExecutionShape(options?: UndoOptions): IExecutionLineAdapter + symbol(): string + symbolExt(): SymbolExt + resolution(): ResolutionString + getVisibleRange(): VisibleTimeRange + /** + * @deprecated Use Price Scale API instead + */ + getVisiblePriceRange(): VisiblePriceRange + scrollPosition(): number + defaultScrollPosition(): number + priceFormatter(): INumberFormatter + chartType(): SeriesStyle + setTimezone(timezone: 'exchange' | Timezone): void + getTimezone(): 'exchange' | Timezone + getPanes(): IPaneApi[] + exportData(options?: Partial): Promise + canZoomOut(): boolean + zoomOut(): void + setZoomEnabled(enabled: boolean): void + setScrollEnabled(enabled: boolean): void + shapesGroupController(): IShapesGroupControllerApi + barTimeToEndOfPeriod(unixTime: number): number + endOfPeriodToBarTime(unixTime: number): number + getTimeScale(): ITimeScaleApi + isSelectBarRequested(): boolean + requestSelectBar(): Promise + cancelSelectBar(): void } export interface IChartingLibraryWidget { - headerReady(): Promise; - onChartReady(callback: EmptyCallback): void; - onGrayedObjectClicked(callback: (obj: GrayedObject) => void): void; - onShortcut(shortCut: string | number | (string | number)[], callback: EmptyCallback): void; - subscribe(event: EventName, callback: SubscribeEventsMap[EventName]): void; - unsubscribe(event: EventName, callback: SubscribeEventsMap[EventName]): void; - chart(index?: number): IChartWidgetApi; - getLanguage(): LanguageCode; - setSymbol(symbol: string, interval: ResolutionString, callback: EmptyCallback): void; - remove(): void; - closePopupsAndDialogs(): void; - selectLineTool(linetool: SupportedLineTools): void; - selectedLineTool(): SupportedLineTools; - save(callback: (state: object) => void): void; - load(state: object, extendedData?: SavedStateMetaInfo): void; - getSavedCharts(callback: (chartRecords: SaveLoadChartRecord[]) => void): void; - loadChartFromServer(chartRecord: SaveLoadChartRecord): void; - saveChartToServer(onComplete?: EmptyCallback, onFail?: EmptyCallback, options?: SaveChartToServerOptions): void; - removeChartFromServer(chartId: string, onCompleteCallback: EmptyCallback): void; - onContextMenu(callback: (unixTime: number, price: number) => ContextMenuItem[]): void; - createButton(options?: CreateButtonOptions): HTMLElement; - createDropdown(params: DropdownParams): Promise; - showNoticeDialog(params: DialogParams<() => void>): void; - showConfirmDialog(params: DialogParams<(confirmed: boolean) => void>): void; - showLoadChartDialog(): void; - showSaveAsChartDialog(): void; - symbolInterval(): SymbolIntervalResult; - mainSeriesPriceFormatter(): INumberFormatter; - getIntervals(): string[]; - getStudiesList(): string[]; - getStudyInputs(studyName: string): StudyInputInfo[]; - addCustomCSSFile(url: string): void; - applyOverrides(overrides: TOverrides): void; - applyStudiesOverrides(overrides: object): void; - watchList(): Promise; - news(): Promise; - activeChart(): IChartWidgetApi; - chartsCount(): number; - layout(): LayoutType; - setLayout(layout: LayoutType): void; - layoutName(): string; - changeTheme(themeName: ThemeName, options?: ChangeThemeOptions): Promise; - getTheme(): ThemeName; - takeScreenshot(): void; - takeClientScreenshot(options?: Partial): Promise; - lockAllDrawingTools(): IWatchedValue; - hideAllDrawingTools(): IWatchedValue; - magnetEnabled(): IWatchedValue; - magnetMode(): IWatchedValue; - symbolSync(): IWatchedValue; - intervalSync(): IWatchedValue; - crosshairSync(): IWatchedValue; - timeSync(): IWatchedValue; - startFullscreen(): void; - exitFullscreen(): void; - undoRedoState(): UndoRedoState; - navigationButtonsVisibility(): IWatchedValue; - paneButtonsVisibility(): IWatchedValue; - dateFormat(): IWatchedValue; + headerReady(): Promise + onChartReady(callback: EmptyCallback): void + onGrayedObjectClicked(callback: (obj: GrayedObject) => void): void + onShortcut(shortCut: string | number | (string | number)[], callback: EmptyCallback): void + subscribe(event: EventName, callback: SubscribeEventsMap[EventName]): void + unsubscribe( + event: EventName, + callback: SubscribeEventsMap[EventName], + ): void + chart(index?: number): IChartWidgetApi + getLanguage(): LanguageCode + setSymbol(symbol: string, interval: ResolutionString, callback: EmptyCallback): void + remove(): void + closePopupsAndDialogs(): void + selectLineTool(linetool: SupportedLineTools): void + selectedLineTool(): SupportedLineTools + save(callback: (state: object) => void): void + load(state: object, extendedData?: SavedStateMetaInfo): void + getSavedCharts(callback: (chartRecords: SaveLoadChartRecord[]) => void): void + loadChartFromServer(chartRecord: SaveLoadChartRecord): void + saveChartToServer(onComplete?: EmptyCallback, onFail?: EmptyCallback, options?: SaveChartToServerOptions): void + removeChartFromServer(chartId: string, onCompleteCallback: EmptyCallback): void + onContextMenu(callback: (unixTime: number, price: number) => ContextMenuItem[]): void + createButton(options?: CreateButtonOptions): HTMLElement + createDropdown(params: DropdownParams): Promise + showNoticeDialog(params: DialogParams<() => void>): void + showConfirmDialog(params: DialogParams<(confirmed: boolean) => void>): void + showLoadChartDialog(): void + showSaveAsChartDialog(): void + symbolInterval(): SymbolIntervalResult + mainSeriesPriceFormatter(): INumberFormatter + getIntervals(): string[] + getStudiesList(): string[] + getStudyInputs(studyName: string): StudyInputInfo[] + addCustomCSSFile(url: string): void + applyOverrides(overrides: TOverrides): void + applyStudiesOverrides(overrides: object): void + watchList(): Promise + news(): Promise + activeChart(): IChartWidgetApi + chartsCount(): number + layout(): LayoutType + setLayout(layout: LayoutType): void + layoutName(): string + changeTheme(themeName: ThemeName, options?: ChangeThemeOptions): Promise + getTheme(): ThemeName + takeScreenshot(): void + takeClientScreenshot(options?: Partial): Promise + lockAllDrawingTools(): IWatchedValue + hideAllDrawingTools(): IWatchedValue + magnetEnabled(): IWatchedValue + magnetMode(): IWatchedValue + symbolSync(): IWatchedValue + intervalSync(): IWatchedValue + crosshairSync(): IWatchedValue + timeSync(): IWatchedValue + startFullscreen(): void + exitFullscreen(): void + undoRedoState(): UndoRedoState + navigationButtonsVisibility(): IWatchedValue + paneButtonsVisibility(): IWatchedValue + dateFormat(): IWatchedValue } export interface IDatafeedChartApi { - getMarks?(symbolInfo: LibrarySymbolInfo, from: number, to: number, onDataCallback: GetMarksCallback, resolution: ResolutionString): void; - getTimescaleMarks?(symbolInfo: LibrarySymbolInfo, from: number, to: number, onDataCallback: GetMarksCallback, resolution: ResolutionString): void; - /** - * This function is called if configuration flag supports_time is set to true when chart needs to know the server time. - * The charting library expects callback to be called once. - * The time is provided without milliseconds. Example: 1445324591. It is used to display Countdown on the price scale. - */ - getServerTime?(callback: ServerTimeCallback): void; - searchSymbols(userInput: string, exchange: string, symbolType: string, onResult: SearchSymbolsCallback): void; - resolveSymbol(symbolName: string, onResolve: ResolveCallback, onError: ErrorCallback, extension?: SymbolResolveExtension): void; - getBars(symbolInfo: LibrarySymbolInfo, resolution: ResolutionString, periodParams: PeriodParams, onResult: HistoryCallback, onError: ErrorCallback): void; - subscribeBars(symbolInfo: LibrarySymbolInfo, resolution: ResolutionString, onTick: SubscribeBarsCallback, listenerGuid: string, onResetCacheNeededCallback: () => void): void; - unsubscribeBars(listenerGuid: string): void; - subscribeDepth?(symbol: string, callback: DomeCallback): string; - unsubscribeDepth?(subscriberUID: string): void; - getVolumeProfileResolutionForPeriod?(currentResolution: ResolutionString, from: number, to: number, symbolInfo: LibrarySymbolInfo): ResolutionString; + getMarks?( + symbolInfo: LibrarySymbolInfo, + from: number, + to: number, + onDataCallback: GetMarksCallback, + resolution: ResolutionString, + ): void + getTimescaleMarks?( + symbolInfo: LibrarySymbolInfo, + from: number, + to: number, + onDataCallback: GetMarksCallback, + resolution: ResolutionString, + ): void + /** + * This function is called if configuration flag supports_time is set to true when chart needs to know the server time. + * The charting library expects callback to be called once. + * The time is provided without milliseconds. Example: 1445324591. It is used to display Countdown on the price scale. + */ + getServerTime?(callback: ServerTimeCallback): void + searchSymbols(userInput: string, exchange: string, symbolType: string, onResult: SearchSymbolsCallback): void + resolveSymbol( + symbolName: string, + onResolve: ResolveCallback, + onError: ErrorCallback, + extension?: SymbolResolveExtension, + ): void + getBars( + symbolInfo: LibrarySymbolInfo, + resolution: ResolutionString, + periodParams: PeriodParams, + onResult: HistoryCallback, + onError: ErrorCallback, + ): void + subscribeBars( + symbolInfo: LibrarySymbolInfo, + resolution: ResolutionString, + onTick: SubscribeBarsCallback, + listenerGuid: string, + onResetCacheNeededCallback: () => void, + ): void + unsubscribeBars(listenerGuid: string): void + subscribeDepth?(symbol: string, callback: DomeCallback): string + unsubscribeDepth?(subscriberUID: string): void + getVolumeProfileResolutionForPeriod?( + currentResolution: ResolutionString, + from: number, + to: number, + symbolInfo: LibrarySymbolInfo, + ): ResolutionString } export interface IDatafeedQuotesApi { - getQuotes(symbols: string[], onDataCallback: QuotesCallback, onErrorCallback: (msg: string) => void): void; - subscribeQuotes(symbols: string[], fastSymbols: string[], onRealtimeCallback: QuotesCallback, listenerGUID: string): void; - unsubscribeQuotes(listenerGUID: string): void; + getQuotes(symbols: string[], onDataCallback: QuotesCallback, onErrorCallback: (msg: string) => void): void + subscribeQuotes( + symbols: string[], + fastSymbols: string[], + onRealtimeCallback: QuotesCallback, + listenerGUID: string, + ): void + unsubscribeQuotes(listenerGUID: string): void } export interface IDelegate extends ISubscription { - fire: TFunc; + fire: TFunc } export interface IDropdownApi { - applyOptions(options: DropdownUpdateParams): void; - remove(): void; + applyOptions(options: DropdownUpdateParams): void + remove(): void } export interface IExecutionLineAdapter { - remove(): void; - getPrice(): number; - setPrice(value: number): this; - getTime(): number; - setTime(value: number): this; - getDirection(): Direction; - setDirection(value: Direction): this; - getText(): string; - setText(value: string): this; - getTooltip(): string; - setTooltip(value: string): this; - getArrowHeight(): number; - setArrowHeight(value: number): this; - getArrowSpacing(): number; - setArrowSpacing(value: number): this; - getFont(): string; - setFont(value: string): this; - getTextColor(): string; - setTextColor(value: string): this; - getArrowColor(): string; - setArrowColor(value: string): this; + remove(): void + getPrice(): number + setPrice(value: number): this + getTime(): number + setTime(value: number): this + getDirection(): Direction + setDirection(value: Direction): this + getText(): string + setText(value: string): this + getTooltip(): string + setTooltip(value: string): this + getArrowHeight(): number + setArrowHeight(value: number): this + getArrowSpacing(): number + setArrowSpacing(value: number): this + getFont(): string + setFont(value: string): this + getTextColor(): string + setTextColor(value: string): this + getArrowColor(): string + setArrowColor(value: string): this } export interface IExternalDatafeed { - onReady(callback: OnReadyCallback): void; + onReady(callback: OnReadyCallback): void } export interface IExternalSaveLoadAdapter { - getAllCharts(): Promise; - removeChart(id: T): Promise; - saveChart(chartData: ChartData): Promise; - getChartContent(chartId: number): Promise; - getAllStudyTemplates(): Promise; - removeStudyTemplate(studyTemplateInfo: StudyTemplateMetaInfo): Promise; - saveStudyTemplate(studyTemplateData: StudyTemplateData): Promise; - getStudyTemplateContent(studyTemplateInfo: StudyTemplateMetaInfo): Promise; - getDrawingTemplates(toolName: string): Promise; - loadDrawingTemplate(toolName: string, templateName: string): Promise; - removeDrawingTemplate(toolName: string, templateName: string): Promise; - saveDrawingTemplate(toolName: string, templateName: string, content: string): Promise; + getAllCharts(): Promise + removeChart(id: T): Promise + saveChart(chartData: ChartData): Promise + getChartContent(chartId: number): Promise + getAllStudyTemplates(): Promise + removeStudyTemplate(studyTemplateInfo: StudyTemplateMetaInfo): Promise + saveStudyTemplate(studyTemplateData: StudyTemplateData): Promise + getStudyTemplateContent(studyTemplateInfo: StudyTemplateMetaInfo): Promise + getDrawingTemplates(toolName: string): Promise + loadDrawingTemplate(toolName: string, templateName: string): Promise + removeDrawingTemplate(toolName: string, templateName: string): Promise + saveDrawingTemplate(toolName: string, templateName: string, content: string): Promise } export interface IFormatter { - format(value?: T): string; - parse?(value: string): ErrorFormatterParseResult | SuccessFormatterParseResult; + format(value?: T): string + parse?(value: string): ErrorFormatterParseResult | SuccessFormatterParseResult } export interface ILineDataSourceApi { - isSelectionEnabled(): boolean; - setSelectionEnabled(enable: boolean): void; - isSavingEnabled(): boolean; - setSavingEnabled(enable: boolean): void; - isShowInObjectsTreeEnabled(): boolean; - setShowInObjectsTreeEnabled(enabled: boolean): void; - isUserEditEnabled(): boolean; - setUserEditEnabled(enabled: boolean): void; - bringToFront(): void; - sendToBack(): void; - getProperties(): Record; - setProperties(newProperties: object): void; - getPoints(): PricedPoint[]; - setPoints(points: ShapePoint[]): void; + isSelectionEnabled(): boolean + setSelectionEnabled(enable: boolean): void + isSavingEnabled(): boolean + setSavingEnabled(enable: boolean): void + isShowInObjectsTreeEnabled(): boolean + setShowInObjectsTreeEnabled(enabled: boolean): void + isUserEditEnabled(): boolean + setUserEditEnabled(enabled: boolean): void + bringToFront(): void + sendToBack(): void + getProperties(): Record + setProperties(newProperties: object): void + getPoints(): PricedPoint[] + setPoints(points: ShapePoint[]): void } export interface INewsApi { - refresh(): void; + refresh(): void } export interface IObservable { - subscribe(callback: (value: T) => void): void; - unsubscribe(callback: (value: T) => void): void; -} -export interface IObservableValue extends IBoxedValue, IObservable { -} -export interface IObservableValueReadOnly extends IBoxedValueReadOnly, IObservable { + subscribe(callback: (value: T) => void): void + unsubscribe(callback: (value: T) => void): void } +export interface IObservableValue extends IBoxedValue, IObservable {} +export interface IObservableValueReadOnly extends IBoxedValueReadOnly, IObservable {} export interface IOrderLineAdapter { - remove(): void; - onModify(callback: () => void): this; - onModify(data: T, callback: (data: T) => void): this; - onMove(callback: () => void): this; - onMove(data: T, callback: (data: T) => void): this; - onCancel(callback: () => void): this; - onCancel(data: T, callback: (data: T) => void): this; - getPrice(): number; - setPrice(value: number): this; - getText(): string; - setText(value: string): this; - getTooltip(): string; - setTooltip(value: string): this; - getModifyTooltip(): string; - setModifyTooltip(value: string): this; - getCancelTooltip(): string; - setCancelTooltip(value: string): this; - getQuantity(): string; - setQuantity(value: string): this; - getEditable(): boolean; - setEditable(value: boolean): this; - getCancellable(): boolean; - setCancellable(value: boolean): this; - getExtendLeft(): boolean; - setExtendLeft(value: boolean): this; - getLineLength(): number; - setLineLength(value: number): this; - getLineStyle(): number; - setLineStyle(value: number): this; - getLineWidth(): number; - setLineWidth(value: number): this; - getBodyFont(): string; - setBodyFont(value: string): this; - getQuantityFont(): string; - setQuantityFont(value: string): this; - getLineColor(): string; - setLineColor(value: string): this; - getBodyBorderColor(): string; - setBodyBorderColor(value: string): this; - getBodyBackgroundColor(): string; - setBodyBackgroundColor(value: string): this; - getBodyTextColor(): string; - setBodyTextColor(value: string): this; - getQuantityBorderColor(): string; - setQuantityBorderColor(value: string): this; - getQuantityBackgroundColor(): string; - setQuantityBackgroundColor(value: string): this; - getQuantityTextColor(): string; - setQuantityTextColor(value: string): this; - getCancelButtonBorderColor(): string; - setCancelButtonBorderColor(value: string): this; - getCancelButtonBackgroundColor(): string; - setCancelButtonBackgroundColor(value: string): this; - getCancelButtonIconColor(): string; - setCancelButtonIconColor(value: string): this; + remove(): void + onModify(callback: () => void): this + onModify(data: T, callback: (data: T) => void): this + onMove(callback: () => void): this + onMove(data: T, callback: (data: T) => void): this + onCancel(callback: () => void): this + onCancel(data: T, callback: (data: T) => void): this + getPrice(): number + setPrice(value: number): this + getText(): string + setText(value: string): this + getTooltip(): string + setTooltip(value: string): this + getModifyTooltip(): string + setModifyTooltip(value: string): this + getCancelTooltip(): string + setCancelTooltip(value: string): this + getQuantity(): string + setQuantity(value: string): this + getEditable(): boolean + setEditable(value: boolean): this + getCancellable(): boolean + setCancellable(value: boolean): this + getExtendLeft(): boolean + setExtendLeft(value: boolean): this + getLineLength(): number + setLineLength(value: number): this + getLineStyle(): number + setLineStyle(value: number): this + getLineWidth(): number + setLineWidth(value: number): this + getBodyFont(): string + setBodyFont(value: string): this + getQuantityFont(): string + setQuantityFont(value: string): this + getLineColor(): string + setLineColor(value: string): this + getBodyBorderColor(): string + setBodyBorderColor(value: string): this + getBodyBackgroundColor(): string + setBodyBackgroundColor(value: string): this + getBodyTextColor(): string + setBodyTextColor(value: string): this + getQuantityBorderColor(): string + setQuantityBorderColor(value: string): this + getQuantityBackgroundColor(): string + setQuantityBackgroundColor(value: string): this + getQuantityTextColor(): string + setQuantityTextColor(value: string): this + getCancelButtonBorderColor(): string + setCancelButtonBorderColor(value: string): this + getCancelButtonBackgroundColor(): string + setCancelButtonBackgroundColor(value: string): this + getCancelButtonIconColor(): string + setCancelButtonIconColor(value: string): this } export interface IPaneApi { - hasMainSeries(): boolean; - getLeftPriceScales(): readonly IPriceScaleApi[]; - getRightPriceScales(): readonly IPriceScaleApi[]; - getMainSourcePriceScale(): IPriceScaleApi | null; - getHeight(): number; - setHeight(height: number): void; - moveTo(paneIndex: number): void; - paneIndex(): number; + hasMainSeries(): boolean + getLeftPriceScales(): readonly IPriceScaleApi[] + getRightPriceScales(): readonly IPriceScaleApi[] + getMainSourcePriceScale(): IPriceScaleApi | null + getHeight(): number + setHeight(height: number): void + moveTo(paneIndex: number): void + paneIndex(): number } export interface IPositionLineAdapter { - remove(): void; - onClose(callback: () => void): this; - onClose(data: T, callback: (data: T) => void): this; - onModify(callback: () => void): this; - onModify(data: T, callback: (data: T) => void): this; - onReverse(callback: () => void): this; - onReverse(data: T, callback: (data: T) => void): this; - getPrice(): number; - setPrice(value: number): this; - getText(): string; - setText(value: string): this; - getTooltip(): string; - setTooltip(value: string): this; - getProtectTooltip(): string; - setProtectTooltip(value: string): this; - getCloseTooltip(): string; - setCloseTooltip(value: string): this; - getReverseTooltip(): string; - setReverseTooltip(value: string): this; - getQuantity(): string; - setQuantity(value: string): this; - getExtendLeft(): boolean; - setExtendLeft(value: boolean): this; - getLineLength(): number; - setLineLength(value: number): this; - getLineStyle(): number; - setLineStyle(value: number): this; - getLineWidth(): number; - setLineWidth(value: number): this; - getBodyFont(): string; - setBodyFont(value: string): this; - getQuantityFont(): string; - setQuantityFont(value: string): this; - getLineColor(): string; - setLineColor(value: string): this; - getBodyBorderColor(): string; - setBodyBorderColor(value: string): this; - getBodyBackgroundColor(): string; - setBodyBackgroundColor(value: string): this; - getBodyTextColor(): string; - setBodyTextColor(value: string): this; - getQuantityBorderColor(): string; - setQuantityBorderColor(value: string): this; - getQuantityBackgroundColor(): string; - setQuantityBackgroundColor(value: string): this; - getQuantityTextColor(): string; - setQuantityTextColor(value: string): this; - getReverseButtonBorderColor(): string; - setReverseButtonBorderColor(value: string): this; - getReverseButtonBackgroundColor(): string; - setReverseButtonBackgroundColor(value: string): this; - getReverseButtonIconColor(): string; - setReverseButtonIconColor(value: string): this; - getCloseButtonBorderColor(): string; - setCloseButtonBorderColor(value: string): this; - getCloseButtonBackgroundColor(): string; - setCloseButtonBackgroundColor(value: string): this; - getCloseButtonIconColor(): string; - setCloseButtonIconColor(value: string): this; + remove(): void + onClose(callback: () => void): this + onClose(data: T, callback: (data: T) => void): this + onModify(callback: () => void): this + onModify(data: T, callback: (data: T) => void): this + onReverse(callback: () => void): this + onReverse(data: T, callback: (data: T) => void): this + getPrice(): number + setPrice(value: number): this + getText(): string + setText(value: string): this + getTooltip(): string + setTooltip(value: string): this + getProtectTooltip(): string + setProtectTooltip(value: string): this + getCloseTooltip(): string + setCloseTooltip(value: string): this + getReverseTooltip(): string + setReverseTooltip(value: string): this + getQuantity(): string + setQuantity(value: string): this + getExtendLeft(): boolean + setExtendLeft(value: boolean): this + getLineLength(): number + setLineLength(value: number): this + getLineStyle(): number + setLineStyle(value: number): this + getLineWidth(): number + setLineWidth(value: number): this + getBodyFont(): string + setBodyFont(value: string): this + getQuantityFont(): string + setQuantityFont(value: string): this + getLineColor(): string + setLineColor(value: string): this + getBodyBorderColor(): string + setBodyBorderColor(value: string): this + getBodyBackgroundColor(): string + setBodyBackgroundColor(value: string): this + getBodyTextColor(): string + setBodyTextColor(value: string): this + getQuantityBorderColor(): string + setQuantityBorderColor(value: string): this + getQuantityBackgroundColor(): string + setQuantityBackgroundColor(value: string): this + getQuantityTextColor(): string + setQuantityTextColor(value: string): this + getReverseButtonBorderColor(): string + setReverseButtonBorderColor(value: string): this + getReverseButtonBackgroundColor(): string + setReverseButtonBackgroundColor(value: string): this + getReverseButtonIconColor(): string + setReverseButtonIconColor(value: string): this + getCloseButtonBorderColor(): string + setCloseButtonBorderColor(value: string): this + getCloseButtonBackgroundColor(): string + setCloseButtonBackgroundColor(value: string): this + getCloseButtonIconColor(): string + setCloseButtonIconColor(value: string): this } export interface IPriceFormatter extends ISymbolValueFormatter { - format(price: number, signPositive?: boolean, tailSize?: number, signNegative?: boolean, useRtlFormat?: boolean): string; + format( + price: number, + signPositive?: boolean, + tailSize?: number, + signNegative?: boolean, + useRtlFormat?: boolean, + ): string } export interface IPriceScaleApi { - getMode(): PriceScaleMode; - setMode(newMode: PriceScaleMode): void; - isInverted(): boolean; - setInverted(isInverted: boolean): void; - getVisiblePriceRange(): VisiblePriceRange | null; - setVisiblePriceRange(range: VisiblePriceRange): void; - hasMainSeries(): boolean; - getStudies(): EntityId[]; + getMode(): PriceScaleMode + setMode(newMode: PriceScaleMode): void + isInverted(): boolean + setInverted(isInverted: boolean): void + getVisiblePriceRange(): VisiblePriceRange | null + setVisiblePriceRange(range: VisiblePriceRange): void + hasMainSeries(): boolean + getStudies(): EntityId[] } export interface ISelectionApi { - add(entities: EntityId[] | EntityId): void; - set(entities: EntityId[] | EntityId): void; - remove(entities: EntityId[]): void; - contains(entity: EntityId): boolean; - allSources(): EntityId[]; - isEmpty(): boolean; - clear(): void; - onChanged(): ISubscription<() => void>; - canBeAddedToSelection(entity: EntityId): boolean; + add(entities: EntityId[] | EntityId): void + set(entities: EntityId[] | EntityId): void + remove(entities: EntityId[]): void + contains(entity: EntityId): boolean + allSources(): EntityId[] + isEmpty(): boolean + clear(): void + onChanged(): ISubscription<() => void> + canBeAddedToSelection(entity: EntityId): boolean } export interface ISeriesApi { - isUserEditEnabled(): boolean; - setUserEditEnabled(enabled: boolean): void; - mergeUp(): void; - mergeDown(): void; - unmergeUp(): void; - unmergeDown(): void; - detachToRight(): void; - detachToLeft(): void; - detachNoScale(): void; - changePriceScale(newPriceScale: SeriesPriceScale): void; - isVisible(): boolean; - setVisible(visible: boolean): void; - bringToFront(): void; - sendToBack(): void; - entityId(): EntityId; - chartStyleProperties(chartStyle: T): SeriesPreferencesMap[T]; - setChartStyleProperties(chartStyle: T, newPrefs: Partial): void; + isUserEditEnabled(): boolean + setUserEditEnabled(enabled: boolean): void + mergeUp(): void + mergeDown(): void + unmergeUp(): void + unmergeDown(): void + detachToRight(): void + detachToLeft(): void + detachNoScale(): void + changePriceScale(newPriceScale: SeriesPriceScale): void + isVisible(): boolean + setVisible(visible: boolean): void + bringToFront(): void + sendToBack(): void + entityId(): EntityId + chartStyleProperties(chartStyle: T): SeriesPreferencesMap[T] + setChartStyleProperties(chartStyle: T, newPrefs: Partial): void } export interface ISettingsAdapter { - initialSettings?: InitialSettingsMap; - setValue(key: string, value: string): void; - removeValue(key: string): void; + initialSettings?: InitialSettingsMap + setValue(key: string, value: string): void + removeValue(key: string): void } export interface IShapesGroupControllerApi { - createGroupFromSelection(): ShapesGroupId; - removeGroup(groupId: ShapesGroupId): void; - groups(): readonly ShapesGroupId[]; - shapesInGroup(groupId: ShapesGroupId): readonly EntityId[]; - excludeShapeFromGroup(groupId: ShapesGroupId, shapeId: EntityId): void; - availableZOrderOperations(groupId: ShapesGroupId): AvailableZOrderOperations; - bringToFront(groupId: ShapesGroupId): void; - sendToBack(groupId: ShapesGroupId): void; - bringForward(groupId: ShapesGroupId): void; - sendBackward(groupId: ShapesGroupId): void; - insertAfter(groupId: ShapesGroupId, target: ShapesGroupId | EntityId): void; - insertBefore(groupId: ShapesGroupId, target: ShapesGroupId | EntityId): void; - setGroupVisibility(groupId: ShapesGroupId, value: boolean): void; - groupVisibility(groupId: ShapesGroupId): GroupVisibilityState; - setGroupLock(groupId: ShapesGroupId, value: boolean): void; - groupLock(groupId: ShapesGroupId): GroupLockState; - getGroupName(groupId: ShapesGroupId): string; - setGroupName(groupId: ShapesGroupId, name: string): void; - canBeGroupped(shapes: readonly EntityId[]): boolean; + createGroupFromSelection(): ShapesGroupId + removeGroup(groupId: ShapesGroupId): void + groups(): readonly ShapesGroupId[] + shapesInGroup(groupId: ShapesGroupId): readonly EntityId[] + excludeShapeFromGroup(groupId: ShapesGroupId, shapeId: EntityId): void + availableZOrderOperations(groupId: ShapesGroupId): AvailableZOrderOperations + bringToFront(groupId: ShapesGroupId): void + sendToBack(groupId: ShapesGroupId): void + bringForward(groupId: ShapesGroupId): void + sendBackward(groupId: ShapesGroupId): void + insertAfter(groupId: ShapesGroupId, target: ShapesGroupId | EntityId): void + insertBefore(groupId: ShapesGroupId, target: ShapesGroupId | EntityId): void + setGroupVisibility(groupId: ShapesGroupId, value: boolean): void + groupVisibility(groupId: ShapesGroupId): GroupVisibilityState + setGroupLock(groupId: ShapesGroupId, value: boolean): void + groupLock(groupId: ShapesGroupId): GroupLockState + getGroupName(groupId: ShapesGroupId): string + setGroupName(groupId: ShapesGroupId, name: string): void + canBeGroupped(shapes: readonly EntityId[]): boolean } export interface IStudyApi { - isUserEditEnabled(): boolean; - setUserEditEnabled(enabled: boolean): void; - getInputsInfo(): StudyInputInfo[]; - getInputValues(): StudyInputValueItem[]; - setInputValues(values: StudyInputValueItem[]): void; - mergeUp(): void; - mergeDown(): void; - unmergeUp(): void; - unmergeDown(): void; - changePriceScale(newPriceScale: StudyPriceScale | EntityId): void; - isVisible(): boolean; - setVisible(visible: boolean): void; - bringToFront(): void; - sendToBack(): void; - applyOverrides(overrides: TOverrides): void; - applyToEntireLayout(): void; - onDataLoaded(): ISubscription<() => void>; - onStudyError(): ISubscription<() => void>; + isUserEditEnabled(): boolean + setUserEditEnabled(enabled: boolean): void + getInputsInfo(): StudyInputInfo[] + getInputValues(): StudyInputValueItem[] + setInputValues(values: StudyInputValueItem[]): void + mergeUp(): void + mergeDown(): void + unmergeUp(): void + unmergeDown(): void + changePriceScale(newPriceScale: StudyPriceScale | EntityId): void + isVisible(): boolean + setVisible(visible: boolean): void + bringToFront(): void + sendToBack(): void + applyOverrides(overrides: TOverrides): void + applyToEntireLayout(): void + onDataLoaded(): ISubscription<() => void> + onStudyError(): ISubscription<() => void> } export interface ISubscription { - subscribe(obj: object | null, member: TFunc, singleshot?: boolean): void; - unsubscribe(obj: object | null, member: TFunc): void; - unsubscribeAll(obj: object | null): void; + subscribe(obj: object | null, member: TFunc, singleshot?: boolean): void + unsubscribe(obj: object | null, member: TFunc): void + unsubscribeAll(obj: object | null): void } export interface ISymbolValueFormatter { - format(price: number, signPositive?: boolean): string; + format(price: number, signPositive?: boolean): string } export interface ITimeScaleApi { - coordinateToTime(x: number): number | null; - /** - * This is to detect when the chart has been zoomed in/out - */ - barSpacingChanged(): ISubscription<(newBarSpacing: number) => void>; - /** - * This is to detect when the chart has been scrolled left/right - */ - rightOffsetChanged(): ISubscription<(rightOffset: number) => void>; + coordinateToTime(x: number): number | null + /** + * This is to detect when the chart has been zoomed in/out + */ + barSpacingChanged(): ISubscription<(newBarSpacing: number) => void> + /** + * This is to detect when the chart has been scrolled left/right + */ + rightOffsetChanged(): ISubscription<(rightOffset: number) => void> } export interface IWatchListApi { - defaultList(): string[]; - getList(id?: string): string[] | null; - getAllLists(): WatchListSymbolListMap | null; - setActiveList(id: string): void; - getActiveListId(): string | null; - setList(symbols: string[]): void; - updateList(listId: string, symbols: string[]): void; - renameList(listId: string, newName: string): void; - createList(listName?: string, symbols?: string[]): WatchListSymbolList | null; - saveList(list: WatchListSymbolList): boolean; - deleteList(listId: string): void; - onListChanged(): ISubscription; - onActiveListChanged(): ISubscription; - onListAdded(): ISubscription; - onListRemoved(): ISubscription; - onListRenamed(): ISubscription; + defaultList(): string[] + getList(id?: string): string[] | null + getAllLists(): WatchListSymbolListMap | null + setActiveList(id: string): void + getActiveListId(): string | null + setList(symbols: string[]): void + updateList(listId: string, symbols: string[]): void + renameList(listId: string, newName: string): void + createList(listName?: string, symbols?: string[]): WatchListSymbolList | null + saveList(list: WatchListSymbolList): boolean + deleteList(listId: string): void + onListChanged(): ISubscription + onActiveListChanged(): ISubscription + onListAdded(): ISubscription + onListRemoved(): ISubscription + onListRenamed(): ISubscription } export interface IWatchedValue extends IWatchedValueReadonly, IObservableValue { - setValue(value: T, forceUpdate?: boolean): void; - subscribe(callback: WatchedValueCallback, options?: WatchedValueSubscribeOptions): void; - unsubscribe(callback?: WatchedValueCallback | null): void; + setValue(value: T, forceUpdate?: boolean): void + subscribe(callback: WatchedValueCallback, options?: WatchedValueSubscribeOptions): void + unsubscribe(callback?: WatchedValueCallback | null): void } export interface IWatchedValueReadonly extends IObservableValueReadOnly { - subscribe(callback: (value: T) => void, options?: WatchedValueSubscribeOptions): void; - unsubscribe(callback?: ((value: T) => void) | null): void; + subscribe(callback: (value: T) => void, options?: WatchedValueSubscribeOptions): void + unsubscribe(callback?: ((value: T) => void) | null): void } export interface InitialSettingsMap { - [key: string]: string; + [key: string]: string } export interface InstrumentInfo { - qty: QuantityMetainfo; - pipValue: number; - pipSize: number; - minTick: number; - lotSize?: number; - type?: SymbolType; - units?: string; - brokerSymbol?: string; - description: string; - domVolumePrecision?: number; - leverage?: string; - marginRate?: number; - limitPriceStep?: number; - stopPriceStep?: number; - allowedDurations?: string[]; - currency?: string; - baseCurrency?: string; - quoteCurrency?: string; - bigPointValue?: number; + qty: QuantityMetainfo + pipValue: number + pipSize: number + minTick: number + lotSize?: number + type?: SymbolType + units?: string + brokerSymbol?: string + description: string + domVolumePrecision?: number + leverage?: string + marginRate?: number + limitPriceStep?: number + stopPriceStep?: number + allowedDurations?: string[] + currency?: string + baseCurrency?: string + quoteCurrency?: string + bigPointValue?: number } export interface IsTradableResult { - tradable: boolean; - reason?: string; - solutions?: TradableSolutions; - shortReason?: string; + tradable: boolean + reason?: string + solutions?: TradableSolutions + shortReason?: string } export interface KagiStylePreferences { - upColor: string; - downColor: string; - upColorProjection: string; - downColorProjection: string; + upColor: string + downColor: string + upColorProjection: string + downColorProjection: string } export interface LibrarySymbolInfo { - /** - * Symbol Name - */ - name: string; - full_name: string; - base_name?: [ - string - ]; - /** - * Unique symbol id - */ - ticker?: string; - description: string; - type: string; - /** - * @example "1700-0200" - */ - session: string; - session_display?: string; - /** @deprecated Use session_holidays instead */ - holidays?: string; - /** - * @example "20181105,20181107,20181112" - */ - session_holidays?: string; - /** - * @example "1900F4-2350F4,1000-1845:20181113;1000-1400:20181114" - */ - corrections?: string; - /** - * Traded exchange - * @example "NYSE" - */ - exchange: string; - listed_exchange: string; - timezone: Timezone; - /** - * Prices format: "price" or "volume" - */ - format: SeriesFormat; - /** - * Code (Tick) - * @example 8/16/.../256 (1/8/100 1/16/100 ... 1/256/100) or 1/10/.../10000000 (1 0.1 ... 0.0000001) - */ - pricescale: number; - /** - * The number of units that make up one tick. - * @example For example, U.S. equities are quotes in decimals, and tick in decimals, and can go up +/- .01. So the tick increment is 1. But the e-mini S&P futures contract, though quoted in decimals, goes up in .25 increments, so the tick increment is 25. (see also Tick Size) - */ - minmov: number; - fractional?: boolean; - /** - * @example Quarters of 1/32: pricescale=128, minmovement=1, minmovement2=4 - */ - minmove2?: number; - /** - * false if DWM only - */ - has_intraday?: boolean; - /** - * An array of resolutions which should be enabled in resolutions picker for this symbol. - */ - supported_resolutions: ResolutionString[]; - /** - * @example (for ex.: "1,5,60") - only these resolutions will be requested, all others will be built using them if possible - */ - intraday_multipliers?: string[]; - has_seconds?: boolean; - has_ticks?: boolean; - /** - * It is an array containing seconds resolutions (in seconds without a postfix) the datafeed builds by itself. - */ - seconds_multipliers?: string[]; - has_daily?: boolean; - has_weekly_and_monthly?: boolean; - has_empty_bars?: boolean; - has_no_volume?: boolean; - /** - * Integer showing typical volume value decimal places for this symbol - */ - volume_precision?: number; - data_status?: "streaming" | "endofday" | "pulsed" | "delayed_streaming"; - /** - * Boolean showing whether this symbol is expired futures contract or not. - */ - expired?: boolean; - /** - * Unix timestamp of expiration date. - */ - expiration_date?: number; - sector?: string; - industry?: string; - currency_code?: string; - original_currency_code?: string; - unit_id?: string; - original_unit_id?: string; - unit_conversion_types?: string[]; + /** + * Symbol Name + */ + name: string + full_name: string + base_name?: [string] + /** + * Unique symbol id + */ + ticker?: string + description: string + type: string + /** + * @example "1700-0200" + */ + session: string + session_display?: string + /** @deprecated Use session_holidays instead */ + holidays?: string + /** + * @example "20181105,20181107,20181112" + */ + session_holidays?: string + /** + * @example "1900F4-2350F4,1000-1845:20181113;1000-1400:20181114" + */ + corrections?: string + /** + * Traded exchange + * @example "NYSE" + */ + exchange: string + listed_exchange: string + timezone: Timezone + /** + * Prices format: "price" or "volume" + */ + format: SeriesFormat + /** + * Code (Tick) + * @example 8/16/.../256 (1/8/100 1/16/100 ... 1/256/100) or 1/10/.../10000000 (1 0.1 ... 0.0000001) + */ + pricescale: number + /** + * The number of units that make up one tick. + * @example For example, U.S. equities are quotes in decimals, and tick in decimals, and can go up +/- .01. So the tick increment is 1. But the e-mini S&P futures contract, though quoted in decimals, goes up in .25 increments, so the tick increment is 25. (see also Tick Size) + */ + minmov: number + fractional?: boolean + /** + * @example Quarters of 1/32: pricescale=128, minmovement=1, minmovement2=4 + */ + minmove2?: number + /** + * false if DWM only + */ + has_intraday?: boolean + /** + * An array of resolutions which should be enabled in resolutions picker for this symbol. + */ + supported_resolutions: ResolutionString[] + /** + * @example (for ex.: "1,5,60") - only these resolutions will be requested, all others will be built using them if possible + */ + intraday_multipliers?: string[] + has_seconds?: boolean + has_ticks?: boolean + /** + * It is an array containing seconds resolutions (in seconds without a postfix) the datafeed builds by itself. + */ + seconds_multipliers?: string[] + has_daily?: boolean + has_weekly_and_monthly?: boolean + has_empty_bars?: boolean + has_no_volume?: boolean + /** + * Integer showing typical volume value decimal places for this symbol + */ + volume_precision?: number + data_status?: 'streaming' | 'endofday' | 'pulsed' | 'delayed_streaming' + /** + * Boolean showing whether this symbol is expired futures contract or not. + */ + expired?: boolean + /** + * Unix timestamp of expiration date. + */ + expiration_date?: number + sector?: string + industry?: string + currency_code?: string + original_currency_code?: string + unit_id?: string + original_unit_id?: string + unit_conversion_types?: string[] } export interface LineBreakStylePreferences { - upColor: string; - downColor: string; - borderUpColor: string; - borderDownColor: string; - upColorProjection: string; - downColorProjection: string; - borderUpColorProjection: string; - borderDownColorProjection: string; + upColor: string + downColor: string + borderUpColor: string + borderDownColor: string + upColorProjection: string + downColorProjection: string + borderUpColorProjection: string + borderDownColorProjection: string } export interface LineStylePreferences { - color: string; - linestyle: number; - linewidth: number; - styleType: number; + color: string + linestyle: number + linewidth: number + styleType: number } export interface LoadingScreenOptions { - foregroundColor?: string; - backgroundColor?: string; + foregroundColor?: string + backgroundColor?: string } export interface Mark { - id: string | number; - time: number; - color: MarkConstColors | MarkCustomColor; - text: string; - label: string; - labelFontColor: string; - minSize: number; + id: string | number + time: number + color: MarkConstColors | MarkCustomColor + text: string + label: string + labelFontColor: string + minSize: number } export interface MarkCustomColor { - color: string; - background: string; + color: string + background: string } export interface MenuSeparator extends ActionDescription { - separator: boolean; + separator: boolean } export interface MouseEventParams { - clientX: number; - clientY: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; + clientX: number + clientY: number + pageX: number + pageY: number + screenX: number + screenY: number } export interface NegativeBaseInputFieldValidatorResult extends BaseInputFieldValidatorResult { - valid: false; - errorMessage: string; + valid: false + errorMessage: string } export interface NewsItem { - title: string; - source: string; - published: number; - link?: string; - shortDescription?: string; - fullDescription?: string; + title: string + source: string + published: number + link?: string + shortDescription?: string + fullDescription?: string } export interface NumericFormattingParams { - decimal_sign: string; -} -export interface OrderDialogOptions extends TradingDialogOptions { + decimal_sign: string } +export interface OrderDialogOptions extends TradingDialogOptions {} export interface OrderDuration { - /** - * type is OrderDurationMetaInfo.value - */ - type: string; - datetime?: number; + /** + * type is OrderDurationMetaInfo.value + */ + type: string + datetime?: number } export interface OrderDurationMetaInfo { - hasDatePicker?: boolean; - hasTimePicker?: boolean; - default?: boolean; - name: string; - value: string; - supportedOrderTypes?: OrderType[]; + hasDatePicker?: boolean + hasTimePicker?: boolean + default?: boolean + name: string + value: string + supportedOrderTypes?: OrderType[] } export interface OrderOrPositionMessage { - type: OrderOrPositionMessageType; - text: string; + type: OrderOrPositionMessageType + text: string } export interface OrderPreviewResult { - sections: OrderPreviewSection[]; - confirmId?: string; - warnings?: string[]; - errors?: string[]; + sections: OrderPreviewSection[] + confirmId?: string + warnings?: string[] + errors?: string[] } export interface OrderPreviewSection { - rows: OrderPreviewSectionRow[]; - header?: string; + rows: OrderPreviewSectionRow[] + header?: string } export interface OrderPreviewSectionRow { - title: string; - value: string; + title: string + value: string } export interface OrderRule { - id: string; - severity: "warning" | "error"; + id: string + severity: 'warning' | 'error' } export interface OrderTableColumn extends AccountManagerColumn { - supportedStatusFilters?: OrderStatusFilter[]; + supportedStatusFilters?: OrderStatusFilter[] } /** * Input value of the order ticket * This info is not sufficient to place an order */ export interface OrderTemplate { - symbol: string; - type?: OrderType; - side?: Side; - qty?: number; - stopPrice?: number; - limitPrice?: number; - takeProfit?: number; - stopLoss?: number; - trailingStopPips?: number; - duration?: OrderDuration; - customFields?: CustomInputFieldsValues; + symbol: string + type?: OrderType + side?: Side + qty?: number + stopPrice?: number + limitPrice?: number + takeProfit?: number + stopLoss?: number + trailingStopPips?: number + duration?: OrderDuration + customFields?: CustomInputFieldsValues } export interface Overrides { - [key: string]: string | number | boolean; + [key: string]: string | number | boolean } export interface PeriodParams { - from: number; - to: number; - countBack: number; - firstDataRequest: boolean; + from: number + to: number + countBack: number + firstDataRequest: boolean } export interface PipValues { - buyPipValue: number; - sellPipValue: number; + buyPipValue: number + sellPipValue: number } export interface PlaceOrderResult { - orderId?: string; + orderId?: string } /** * Info about a placed order */ export interface PlacedOrder extends CustomFields { - id: string; - symbol: string; - type: OrderType; - side: Side; - qty: number; - status: OrderStatus; - stopLoss?: number; - trailingStopPips?: number; - stopType?: StopType; - takeProfit?: number; - duration?: OrderDuration; - customFields?: CustomInputFieldsValues; - filledQty?: number; - avgPrice?: number; - updateTime?: number; /** unix timestamp in milliseconds */ - limitPrice?: number; - stopPrice?: number; - message?: OrderOrPositionMessage; + id: string + symbol: string + type: OrderType + side: Side + qty: number + status: OrderStatus + stopLoss?: number + trailingStopPips?: number + stopType?: StopType + takeProfit?: number + duration?: OrderDuration + customFields?: CustomInputFieldsValues + filledQty?: number + avgPrice?: number + updateTime?: number /** unix timestamp in milliseconds */ + limitPrice?: number + stopPrice?: number + message?: OrderOrPositionMessage } export interface PlusClickParams extends MouseEventParams { - symbol: string | null; - price: number; + symbol: string | null + price: number } export interface PnFStylePreferences { - upColor: string; - downColor: string; - upColorProjection: string; - downColorProjection: string; + upColor: string + downColor: string + upColorProjection: string + downColorProjection: string } export interface Position { - id: string; - symbol: string; - qty: number; - shortQty?: number; - longQty?: number; - side: Side; - avgPrice: number; - message?: OrderOrPositionMessage; - [key: string]: any; -} -export interface PositionDialogOptions extends TradingDialogOptions { -} + id: string + symbol: string + qty: number + shortQty?: number + longQty?: number + side: Side + avgPrice: number + message?: OrderOrPositionMessage + [key: string]: any +} +export interface PositionDialogOptions extends TradingDialogOptions {} export interface PositiveBaseInputFieldValidatorResult extends BaseInputFieldValidatorResult { - valid: true; + valid: true } /** * Output value of the order ticket and input value of the broker's place order command * This info is sufficient to place an order */ export interface PreOrder extends OrderTemplate { - symbol: string; - type: OrderType; - side: Side; - qty: number; - seenPrice: number | null; - isClose?: boolean; + symbol: string + type: OrderType + side: Side + qty: number + seenPrice: number | null + isClose?: boolean } export interface PricedPoint extends TimePoint { - price: number; + price: number } export interface QuantityMetainfo { - min: number; - max: number; - step: number; - uiStep?: number; - default?: number; + min: number + max: number + step: number + uiStep?: number + default?: number } export interface QuoteErrorData { - s: "error"; - n: string; - v: object; + s: 'error' + n: string + v: object } export interface QuoteOkData { - s: "ok"; - n: string; - v: DatafeedQuoteValues; + s: 'ok' + n: string + v: DatafeedQuoteValues } export interface RenkoStylePreferences { - upColor: string; - downColor: string; - borderUpColor: string; - borderDownColor: string; - upColorProjection: string; - downColorProjection: string; - borderUpColorProjection: string; - borderDownColorProjection: string; - wickUpColor: string; - wickDownColor: string; + upColor: string + downColor: string + borderUpColor: string + borderDownColor: string + upColorProjection: string + downColorProjection: string + borderUpColorProjection: string + borderDownColorProjection: string + wickUpColor: string + wickDownColor: string } export interface RestBrokerConnectionInfo { - url: string; - access_token: string; + url: string + access_token: string } export interface RssNewsFeedInfo { - url: string; - name: string; + url: string + name: string } export interface RssNewsFeedParams { - default: RssNewsFeedItem; - [symbolType: string]: RssNewsFeedItem; + default: RssNewsFeedItem + [symbolType: string]: RssNewsFeedItem } export interface SaveChartToServerOptions { - chartName?: string; - defaultChartName?: string; + chartName?: string + defaultChartName?: string } export interface SaveLoadChartRecord { - id: string; - name: string; - image_url: string; - modified_iso: number; - short_symbol: string; - interval: ResolutionString; + id: string + name: string + image_url: string + modified_iso: number + short_symbol: string + interval: ResolutionString } export interface SavedStateMetaInfo { - uid: number; - name: string; - description: string; + uid: number + name: string + description: string } export interface SearchSymbolResultItem { - symbol: string; - full_name: string; - description: string; - exchange: string; - ticker: string; - type: string; + symbol: string + full_name: string + description: string + exchange: string + ticker: string + type: string } export interface SeriesFieldDescriptor { - type: "value"; - sourceType: "series"; - plotTitle: string; - sourceTitle: string; + type: 'value' + sourceType: 'series' + plotTitle: string + sourceTitle: string } export interface SeriesPreferencesMap { - [ChartStyle.Bar]: BarStylePreferences; - [ChartStyle.Candle]: CandleStylePreferences; - [ChartStyle.Line]: LineStylePreferences; - [ChartStyle.Area]: AreaStylePreferences; - [ChartStyle.Renko]: RenkoStylePreferences; - [ChartStyle.Kagi]: KagiStylePreferences; - [ChartStyle.PnF]: PnFStylePreferences; - [ChartStyle.LineBreak]: LineBreakStylePreferences; - [ChartStyle.HeikinAshi]: HeikinAshiStylePreferences; - [ChartStyle.HollowCandle]: HollowCandleStylePreferences; - [ChartStyle.Baseline]: BaselineStylePreferences; - [ChartStyle.HiLo]: HiLoStylePreferences; + [ChartStyle.Bar]: BarStylePreferences + [ChartStyle.Candle]: CandleStylePreferences + [ChartStyle.Line]: LineStylePreferences + [ChartStyle.Area]: AreaStylePreferences + [ChartStyle.Renko]: RenkoStylePreferences + [ChartStyle.Kagi]: KagiStylePreferences + [ChartStyle.PnF]: PnFStylePreferences + [ChartStyle.LineBreak]: LineBreakStylePreferences + [ChartStyle.HeikinAshi]: HeikinAshiStylePreferences + [ChartStyle.HollowCandle]: HollowCandleStylePreferences + [ChartStyle.Baseline]: BaselineStylePreferences + [ChartStyle.HiLo]: HiLoStylePreferences } export interface SetVisibleRangeOptions { - applyDefaultRightMargin?: boolean; - percentRightMargin?: number; + applyDefaultRightMargin?: boolean + percentRightMargin?: number } export interface SingleBrokerMetaInfo { - configFlags: BrokerConfigFlags; - customNotificationFields?: string[]; - durations?: OrderDurationMetaInfo[]; - positionDialogOptions?: PositionDialogOptions; - orderRules?: OrderRule[]; - customUI?: BrokerCustomUI; + configFlags: BrokerConfigFlags + customNotificationFields?: string[] + durations?: OrderDurationMetaInfo[] + positionDialogOptions?: PositionDialogOptions + orderRules?: OrderRule[] + customUI?: BrokerCustomUI } export interface SortingParameters { - columnId: string; - asc?: boolean; + columnId: string + asc?: boolean } export interface StickedPoint extends TimePoint { - channel: "open" | "high" | "low" | "close"; + channel: 'open' | 'high' | 'low' | 'close' } export interface StudyFieldDescriptor { - type: "value"; - sourceType: "study"; - sourceId: string; - sourceTitle: string; - plotTitle: string; + type: 'value' + sourceType: 'study' + sourceId: string + sourceTitle: string + plotTitle: string } export interface StudyInputInfo { - id: StudyInputId; - name: string; - type: string; - localizedName: string; + id: StudyInputId + name: string + type: string + localizedName: string } export interface StudyInputValueItem { - id: StudyInputId; - value: StudyInputValue; + id: StudyInputId + value: StudyInputValue } export interface StudyOrDrawingAddedToChartEventParams { - value: string; + value: string } export interface StudyOverrides { - [key: string]: StudyOverrideValueType; + [key: string]: StudyOverrideValueType } export interface StudyTemplateData { - name: string; - content: string; + name: string + content: string } export interface StudyTemplateMetaInfo { - name: string; + name: string } export interface SubscribeEventsMap { - toggle_sidebar: (isHidden: boolean) => void; - indicators_dialog: EmptyCallback; - toggle_header: (isHidden: boolean) => void; - edit_object_dialog: (params: EditObjectDialogEventParams) => void; - chart_load_requested: (savedData: object) => void; - chart_loaded: EmptyCallback; - mouse_down: (params: MouseEventParams) => void; - mouse_up: (params: MouseEventParams) => void; - drawing: (params: StudyOrDrawingAddedToChartEventParams) => void; - study: (params: StudyOrDrawingAddedToChartEventParams) => void; - undo: EmptyCallback; - redo: EmptyCallback; - undo_redo_state_changed: (state: UndoRedoState) => void; - reset_scales: EmptyCallback; - compare_add: EmptyCallback; - add_compare: EmptyCallback; - "load_study template": EmptyCallback; - onTick: (tick: Bar) => void; - onAutoSaveNeeded: EmptyCallback; - onScreenshotReady: (url: string) => void; - onMarkClick: (markId: Mark["id"]) => void; - onPlusClick: (params: PlusClickParams) => void; - onTimescaleMarkClick: (markId: TimescaleMark["id"]) => void; - onSelectedLineToolChanged: EmptyCallback; - layout_about_to_be_changed: (newLayoutType: LayoutType) => void; - layout_changed: EmptyCallback; - activeChartChanged: (chartIndex: number) => void; - series_event: (seriesEventType: SeriesEventType) => void; - study_event: (entityId: EntityId, studyEventType: StudyEventType) => void; - drawing_event: (sourceId: EntityId, drawingEventType: DrawingEventType) => void; - study_properties_changed: (id: EntityId) => void; - series_properties_changed: (id: EntityId) => void; - panes_height_changed: () => void; - panes_order_changed: () => void; + toggle_sidebar: (isHidden: boolean) => void + indicators_dialog: EmptyCallback + toggle_header: (isHidden: boolean) => void + edit_object_dialog: (params: EditObjectDialogEventParams) => void + chart_load_requested: (savedData: object) => void + chart_loaded: EmptyCallback + mouse_down: (params: MouseEventParams) => void + mouse_up: (params: MouseEventParams) => void + drawing: (params: StudyOrDrawingAddedToChartEventParams) => void + study: (params: StudyOrDrawingAddedToChartEventParams) => void + undo: EmptyCallback + redo: EmptyCallback + undo_redo_state_changed: (state: UndoRedoState) => void + reset_scales: EmptyCallback + compare_add: EmptyCallback + add_compare: EmptyCallback + 'load_study template': EmptyCallback + onTick: (tick: Bar) => void + onAutoSaveNeeded: EmptyCallback + onScreenshotReady: (url: string) => void + onMarkClick: (markId: Mark['id']) => void + onPlusClick: (params: PlusClickParams) => void + onTimescaleMarkClick: (markId: TimescaleMark['id']) => void + onSelectedLineToolChanged: EmptyCallback + layout_about_to_be_changed: (newLayoutType: LayoutType) => void + layout_changed: EmptyCallback + activeChartChanged: (chartIndex: number) => void + series_event: (seriesEventType: SeriesEventType) => void + study_event: (entityId: EntityId, studyEventType: StudyEventType) => void + drawing_event: (sourceId: EntityId, drawingEventType: DrawingEventType) => void + study_properties_changed: (id: EntityId) => void + series_properties_changed: (id: EntityId) => void + panes_height_changed: () => void + panes_order_changed: () => void } export interface SuccessFormatterParseResult extends FormatterParseResult { - res: true; - value: T; - suggest?: string; + res: true + value: T + suggest?: string } export interface SuggestedQuantity { - changed: IDelegate<(symbol: string) => void>; - value(symbol: string): Promise; - setValue(symbol: string, value: number): void; + changed: IDelegate<(symbol: string) => void> + value(symbol: string): Promise + setValue(symbol: string, value: number): void } export interface SymbolExt { - symbol: string; - full_name: string; - exchange: string; - description: string; - type: string; - pro_name: string; + symbol: string + full_name: string + exchange: string + description: string + type: string + pro_name: string } export interface SymbolIntervalResult { - symbol: string; - interval: ResolutionString; + symbol: string + interval: ResolutionString } export interface SymbolResolveExtension { - currencyCode?: string; - unitId?: string; + currencyCode?: string + unitId?: string } export interface TextWithCheckboxFieldCustomInfo { - checkboxTitle: string; - asterix?: boolean; + checkboxTitle: string + asterix?: boolean } export interface TextWithCheckboxFieldMetaInfo extends CustomInputFieldMetaInfo { - inputType: "TextWithCheckBox"; - value: TextWithCheckboxValue; - customInfo: TextWithCheckboxFieldCustomInfo; - validator?: TextInputFieldValidator; + inputType: 'TextWithCheckBox' + value: TextWithCheckboxValue + customInfo: TextWithCheckboxFieldCustomInfo + validator?: TextInputFieldValidator } export interface TextWithCheckboxValue { - text: string; - checked: boolean; + text: string + checked: boolean } export interface TimeFieldDescriptor { - type: "time"; + type: 'time' } export interface TimeFrameItem { - text: string; - resolution: ResolutionString; - description?: string; - title?: string; + text: string + resolution: ResolutionString + description?: string + title?: string } export interface TimeFramePeriodBack { - type: TimeFrameType.PeriodBack; - value: string; + type: TimeFrameType.PeriodBack + value: string } export interface TimeFrameTimeRange { - type: TimeFrameType.TimeRange; - from: number; - to: number; + type: TimeFrameType.TimeRange + from: number + to: number } export interface TimePoint { - time: number; + time: number } export interface TimeScaleOptions { - min_bar_spacing?: number; + min_bar_spacing?: number } export interface TimescaleMark { - id: string | number; - time: number; - color: MarkConstColors | string; - label: string; - tooltip: string[]; + id: string | number + time: number + color: MarkConstColors | string + label: string + tooltip: string[] } export interface Trade extends CustomFields { - id: string; - date: number; - symbol: string; - qty: number; - side: Side; - price: number; + id: string + date: number + symbol: string + qty: number + side: Side + price: number } export interface TradeContext { - symbol: string; - displaySymbol: string; - value: number | null; - formattedValue: string; - last: number; + symbol: string + displaySymbol: string + value: number | null + formattedValue: string + last: number } export interface TradingCustomization { - position: Overrides; - order: Overrides; + position: Overrides + order: Overrides } export interface TradingDialogOptions { - customFields?: TradingDialogCustomField[]; + customFields?: TradingDialogCustomField[] } export interface TradingQuotes { - trade?: number; - size?: number; - bid?: number; - bid_size?: number; - ask?: number; - ask_size?: number; - spread?: number; - isDelayed?: boolean; + trade?: number + size?: number + bid?: number + bid_size?: number + ask?: number + ask_size?: number + spread?: number + isDelayed?: boolean } export interface TradingTerminalWidgetOptions extends ChartingLibraryWidgetOptions { - brokerConfig?: SingleBrokerMetaInfo; - broker_config?: SingleBrokerMetaInfo; - restConfig?: RestBrokerConnectionInfo; - widgetbar?: WidgetBarParams; - rss_news_feed?: RssNewsFeedParams; - news_provider?: GetNewsFunction; - trading_customization?: TradingCustomization; - brokerFactory?(host: IBrokerConnectionAdapterHost): IBrokerWithoutRealtime | IBrokerTerminal; - broker_factory?(host: IBrokerConnectionAdapterHost): IBrokerWithoutRealtime | IBrokerTerminal; + brokerConfig?: SingleBrokerMetaInfo + broker_config?: SingleBrokerMetaInfo + restConfig?: RestBrokerConnectionInfo + widgetbar?: WidgetBarParams + rss_news_feed?: RssNewsFeedParams + news_provider?: GetNewsFunction + trading_customization?: TradingCustomization + brokerFactory?(host: IBrokerConnectionAdapterHost): IBrokerWithoutRealtime | IBrokerTerminal + broker_factory?(host: IBrokerConnectionAdapterHost): IBrokerWithoutRealtime | IBrokerTerminal } export interface UndoOptions { - disableUndo?: boolean; + disableUndo?: boolean } export interface UndoRedoState { - readonly enableUndo: boolean; - readonly undoText: string | undefined; - readonly enableRedo: boolean; - readonly redoText: string | undefined; + readonly enableUndo: boolean + readonly undoText: string | undefined + readonly enableRedo: boolean + readonly redoText: string | undefined } export interface Unit { - id: string; - name: string; - description: string; + id: string + name: string + description: string } export interface UserTimeFieldDescriptor { - type: "userTime"; + type: 'userTime' } export interface VisiblePriceRange { - from: number; - to: number; + from: number + to: number } export interface VisibleTimeRange { - from: number; - to: number; + from: number + to: number } export interface WatchListSymbolList extends WatchListSymbolListData { - id: string; + id: string } export interface WatchListSymbolListData { - symbols: string[]; - title: string; + symbols: string[] + title: string } export interface WatchListSymbolListMap { - [listId: string]: WatchListSymbolList; + [listId: string]: WatchListSymbolList } export interface WatchedValueSubscribeOptions { - once?: boolean; - callWithLast?: boolean; + once?: boolean + callWithLast?: boolean } export interface WidgetBarParams { - details?: boolean; - watchlist?: boolean; - news?: boolean; - datawindow?: boolean; - watchlist_settings?: { - default_symbols: string[]; - readonly?: boolean; - }; -} -export type CustomTimezones = "Africa/Cairo" | "Africa/Johannesburg" | "Africa/Lagos" | "America/Argentina/Buenos_Aires" | "America/Bogota" | "America/Caracas" | "America/Chicago" | "America/El_Salvador" | "America/Juneau" | "America/Lima" | "America/Los_Angeles" | "America/Mexico_City" | "America/New_York" | "America/Phoenix" | "America/Santiago" | "America/Sao_Paulo" | "America/Toronto" | "America/Vancouver" | "Asia/Almaty" | "Asia/Ashkhabad" | "Asia/Bahrain" | "Asia/Bangkok" | "Asia/Chongqing" | "Asia/Dubai" | "Asia/Ho_Chi_Minh" | "Asia/Hong_Kong" | "Asia/Jakarta" | "Asia/Jerusalem" | "Asia/Kathmandu" | "Asia/Kolkata" | "Asia/Kuwait" | "Asia/Muscat" | "Asia/Qatar" | "Asia/Riyadh" | "Asia/Seoul" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Taipei" | "Asia/Tehran" | "Asia/Tokyo" | "Atlantic/Reykjavik" | "Australia/ACT" | "Australia/Adelaide" | "Australia/Brisbane" | "Australia/Perth" | "Australia/Sydney" | "Europe/Amsterdam" | "Europe/Athens" | "Europe/Belgrade" | "Europe/Berlin" | "Europe/Brussels" | "Europe/Copenhagen" | "Europe/Dublin" | "Europe/Helsinki" | "Europe/Istanbul" | "Europe/Lisbon" | "Europe/London" | "Europe/Luxembourg" | "Europe/Madrid" | "Europe/Malta" | "Europe/Moscow" | "Europe/Oslo" | "Europe/Paris" | "Europe/Riga" | "Europe/Rome" | "Europe/Stockholm" | "Europe/Tallinn" | "Europe/Vilnius" | "Europe/Warsaw" | "Europe/Zurich" | "Pacific/Auckland" | "Pacific/Chatham" | "Pacific/Fakaofo" | "Pacific/Honolulu" | "Pacific/Norfolk" | "US/Mountain"; + details?: boolean + watchlist?: boolean + news?: boolean + datawindow?: boolean + watchlist_settings?: { + default_symbols: string[] + readonly?: boolean + } +} +export type CustomTimezones = + | 'Africa/Cairo' + | 'Africa/Johannesburg' + | 'Africa/Lagos' + | 'America/Argentina/Buenos_Aires' + | 'America/Bogota' + | 'America/Caracas' + | 'America/Chicago' + | 'America/El_Salvador' + | 'America/Juneau' + | 'America/Lima' + | 'America/Los_Angeles' + | 'America/Mexico_City' + | 'America/New_York' + | 'America/Phoenix' + | 'America/Santiago' + | 'America/Sao_Paulo' + | 'America/Toronto' + | 'America/Vancouver' + | 'Asia/Almaty' + | 'Asia/Ashkhabad' + | 'Asia/Bahrain' + | 'Asia/Bangkok' + | 'Asia/Chongqing' + | 'Asia/Dubai' + | 'Asia/Ho_Chi_Minh' + | 'Asia/Hong_Kong' + | 'Asia/Jakarta' + | 'Asia/Jerusalem' + | 'Asia/Kathmandu' + | 'Asia/Kolkata' + | 'Asia/Kuwait' + | 'Asia/Muscat' + | 'Asia/Qatar' + | 'Asia/Riyadh' + | 'Asia/Seoul' + | 'Asia/Shanghai' + | 'Asia/Singapore' + | 'Asia/Taipei' + | 'Asia/Tehran' + | 'Asia/Tokyo' + | 'Atlantic/Reykjavik' + | 'Australia/ACT' + | 'Australia/Adelaide' + | 'Australia/Brisbane' + | 'Australia/Perth' + | 'Australia/Sydney' + | 'Europe/Amsterdam' + | 'Europe/Athens' + | 'Europe/Belgrade' + | 'Europe/Berlin' + | 'Europe/Brussels' + | 'Europe/Copenhagen' + | 'Europe/Dublin' + | 'Europe/Helsinki' + | 'Europe/Istanbul' + | 'Europe/Lisbon' + | 'Europe/London' + | 'Europe/Luxembourg' + | 'Europe/Madrid' + | 'Europe/Malta' + | 'Europe/Moscow' + | 'Europe/Oslo' + | 'Europe/Paris' + | 'Europe/Riga' + | 'Europe/Rome' + | 'Europe/Stockholm' + | 'Europe/Tallinn' + | 'Europe/Vilnius' + | 'Europe/Warsaw' + | 'Europe/Zurich' + | 'Pacific/Auckland' + | 'Pacific/Chatham' + | 'Pacific/Fakaofo' + | 'Pacific/Honolulu' + | 'Pacific/Norfolk' + | 'US/Mountain' -export as namespace TradingView; +export as namespace TradingView -export {}; +export {} diff --git a/public/charting_library/datafeed-api.d.ts b/public/charting_library/datafeed-api.d.ts index fff1d33921..a85d32167d 100644 --- a/public/charting_library/datafeed-api.d.ts +++ b/public/charting_library/datafeed-api.d.ts @@ -1,10 +1,10 @@ // Generated by dts-bundle-generator v5.3.0 -export declare type DomeCallback = (data: DOMData) => void; -export declare type ErrorCallback = (reason: string) => void; -export declare type GetMarksCallback = (marks: T[]) => void; -export declare type HistoryCallback = (bars: Bar[], meta?: HistoryMetadata) => void; -export declare type MarkConstColors = "red" | "green" | "blue" | "yellow"; +export declare type DomeCallback = (data: DOMData) => void +export declare type ErrorCallback = (reason: string) => void +export declare type GetMarksCallback = (marks: T[]) => void +export declare type HistoryCallback = (bars: Bar[], meta?: HistoryMetadata) => void +export declare type MarkConstColors = 'red' | 'green' | 'blue' | 'yellow' /** * This is the generic type useful for declaring a nominal type, * which does not structurally matches with the base type and @@ -19,256 +19,369 @@ export declare type MarkConstColors = "red" | "green" | "blue" | "yellow"; * type TagName = Nominal; */ export declare type Nominal = T & { - [Symbol.species]: Name; -}; -export declare type OnReadyCallback = (configuration: DatafeedConfiguration) => void; -export declare type QuoteData = QuoteOkData | QuoteErrorData; -export declare type QuotesCallback = (data: QuoteData[]) => void; -export declare type ResolutionString = Nominal; -export declare type ResolveCallback = (symbolInfo: LibrarySymbolInfo) => void; -export declare type SearchSymbolsCallback = (items: SearchSymbolResultItem[]) => void; -export declare type SeriesFormat = "price" | "volume"; -export declare type ServerTimeCallback = (serverTime: number) => void; -export declare type SubscribeBarsCallback = (bar: Bar) => void; -export declare type Timezone = "Etc/UTC" | CustomTimezones; + [Symbol.species]: Name +} +export declare type OnReadyCallback = (configuration: DatafeedConfiguration) => void +export declare type QuoteData = QuoteOkData | QuoteErrorData +export declare type QuotesCallback = (data: QuoteData[]) => void +export declare type ResolutionString = Nominal +export declare type ResolveCallback = (symbolInfo: LibrarySymbolInfo) => void +export declare type SearchSymbolsCallback = (items: SearchSymbolResultItem[]) => void +export declare type SeriesFormat = 'price' | 'volume' +export declare type ServerTimeCallback = (serverTime: number) => void +export declare type SubscribeBarsCallback = (bar: Bar) => void +export declare type Timezone = 'Etc/UTC' | CustomTimezones export interface Bar { - time: number; - open: number; - high: number; - low: number; - close: number; - volume?: number; + time: number + open: number + high: number + low: number + close: number + volume?: number } export interface DOMData { - snapshot: boolean; - asks: DOMLevel[]; - bids: DOMLevel[]; + snapshot: boolean + asks: DOMLevel[] + bids: DOMLevel[] } export interface DOMLevel { - price: number; - volume: number; + price: number + volume: number } export interface DatafeedConfiguration { - exchanges?: Exchange[]; - supported_resolutions?: ResolutionString[]; - units?: Record; - currency_codes?: string[]; - supports_marks?: boolean; - supports_time?: boolean; - supports_timescale_marks?: boolean; - symbols_types?: DatafeedSymbolType[]; + exchanges?: Exchange[] + supported_resolutions?: ResolutionString[] + units?: Record + currency_codes?: string[] + supports_marks?: boolean + supports_time?: boolean + supports_timescale_marks?: boolean + symbols_types?: DatafeedSymbolType[] } export interface DatafeedQuoteValues { - ch?: number; - chp?: number; - short_name?: string; - exchange?: string; - description?: string; - lp?: number; - ask?: number; - bid?: number; - spread?: number; - open_price?: number; - high_price?: number; - low_price?: number; - prev_close_price?: number; - volume?: number; - original_name?: string; - [valueName: string]: string | number | undefined; + ch?: number + chp?: number + short_name?: string + exchange?: string + description?: string + lp?: number + ask?: number + bid?: number + spread?: number + open_price?: number + high_price?: number + low_price?: number + prev_close_price?: number + volume?: number + original_name?: string + [valueName: string]: string | number | undefined } export interface DatafeedSymbolType { - name: string; - value: string; + name: string + value: string } export interface Exchange { - value: string; - name: string; - desc: string; + value: string + name: string + desc: string } export interface HistoryMetadata { - noData?: boolean; - nextTime?: number | null; + noData?: boolean + nextTime?: number | null } export interface IDatafeedChartApi { - getMarks?(symbolInfo: LibrarySymbolInfo, from: number, to: number, onDataCallback: GetMarksCallback, resolution: ResolutionString): void; - getTimescaleMarks?(symbolInfo: LibrarySymbolInfo, from: number, to: number, onDataCallback: GetMarksCallback, resolution: ResolutionString): void; - /** - * This function is called if configuration flag supports_time is set to true when chart needs to know the server time. - * The charting library expects callback to be called once. - * The time is provided without milliseconds. Example: 1445324591. It is used to display Countdown on the price scale. - */ - getServerTime?(callback: ServerTimeCallback): void; - searchSymbols(userInput: string, exchange: string, symbolType: string, onResult: SearchSymbolsCallback): void; - resolveSymbol(symbolName: string, onResolve: ResolveCallback, onError: ErrorCallback, extension?: SymbolResolveExtension): void; - getBars(symbolInfo: LibrarySymbolInfo, resolution: ResolutionString, periodParams: PeriodParams, onResult: HistoryCallback, onError: ErrorCallback): void; - subscribeBars(symbolInfo: LibrarySymbolInfo, resolution: ResolutionString, onTick: SubscribeBarsCallback, listenerGuid: string, onResetCacheNeededCallback: () => void): void; - unsubscribeBars(listenerGuid: string): void; - subscribeDepth?(symbol: string, callback: DomeCallback): string; - unsubscribeDepth?(subscriberUID: string): void; - getVolumeProfileResolutionForPeriod?(currentResolution: ResolutionString, from: number, to: number, symbolInfo: LibrarySymbolInfo): ResolutionString; + getMarks?( + symbolInfo: LibrarySymbolInfo, + from: number, + to: number, + onDataCallback: GetMarksCallback, + resolution: ResolutionString, + ): void + getTimescaleMarks?( + symbolInfo: LibrarySymbolInfo, + from: number, + to: number, + onDataCallback: GetMarksCallback, + resolution: ResolutionString, + ): void + /** + * This function is called if configuration flag supports_time is set to true when chart needs to know the server time. + * The charting library expects callback to be called once. + * The time is provided without milliseconds. Example: 1445324591. It is used to display Countdown on the price scale. + */ + getServerTime?(callback: ServerTimeCallback): void + searchSymbols(userInput: string, exchange: string, symbolType: string, onResult: SearchSymbolsCallback): void + resolveSymbol( + symbolName: string, + onResolve: ResolveCallback, + onError: ErrorCallback, + extension?: SymbolResolveExtension, + ): void + getBars( + symbolInfo: LibrarySymbolInfo, + resolution: ResolutionString, + periodParams: PeriodParams, + onResult: HistoryCallback, + onError: ErrorCallback, + ): void + subscribeBars( + symbolInfo: LibrarySymbolInfo, + resolution: ResolutionString, + onTick: SubscribeBarsCallback, + listenerGuid: string, + onResetCacheNeededCallback: () => void, + ): void + unsubscribeBars(listenerGuid: string): void + subscribeDepth?(symbol: string, callback: DomeCallback): string + unsubscribeDepth?(subscriberUID: string): void + getVolumeProfileResolutionForPeriod?( + currentResolution: ResolutionString, + from: number, + to: number, + symbolInfo: LibrarySymbolInfo, + ): ResolutionString } export interface IDatafeedQuotesApi { - getQuotes(symbols: string[], onDataCallback: QuotesCallback, onErrorCallback: (msg: string) => void): void; - subscribeQuotes(symbols: string[], fastSymbols: string[], onRealtimeCallback: QuotesCallback, listenerGUID: string): void; - unsubscribeQuotes(listenerGUID: string): void; + getQuotes(symbols: string[], onDataCallback: QuotesCallback, onErrorCallback: (msg: string) => void): void + subscribeQuotes( + symbols: string[], + fastSymbols: string[], + onRealtimeCallback: QuotesCallback, + listenerGUID: string, + ): void + unsubscribeQuotes(listenerGUID: string): void } export interface IExternalDatafeed { - onReady(callback: OnReadyCallback): void; + onReady(callback: OnReadyCallback): void } export interface LibrarySymbolInfo { - /** - * Symbol Name - */ - name: string; - full_name: string; - base_name?: [ - string - ]; - /** - * Unique symbol id - */ - ticker?: string; - description: string; - type: string; - /** - * @example "1700-0200" - */ - session: string; - session_display?: string; - /** @deprecated Use session_holidays instead */ - holidays?: string; - /** - * @example "20181105,20181107,20181112" - */ - session_holidays?: string; - /** - * @example "1900F4-2350F4,1000-1845:20181113;1000-1400:20181114" - */ - corrections?: string; - /** - * Traded exchange - * @example "NYSE" - */ - exchange: string; - listed_exchange: string; - timezone: Timezone; - /** - * Prices format: "price" or "volume" - */ - format: SeriesFormat; - /** - * Code (Tick) - * @example 8/16/.../256 (1/8/100 1/16/100 ... 1/256/100) or 1/10/.../10000000 (1 0.1 ... 0.0000001) - */ - pricescale: number; - /** - * The number of units that make up one tick. - * @example For example, U.S. equities are quotes in decimals, and tick in decimals, and can go up +/- .01. So the tick increment is 1. But the e-mini S&P futures contract, though quoted in decimals, goes up in .25 increments, so the tick increment is 25. (see also Tick Size) - */ - minmov: number; - fractional?: boolean; - /** - * @example Quarters of 1/32: pricescale=128, minmovement=1, minmovement2=4 - */ - minmove2?: number; - /** - * false if DWM only - */ - has_intraday?: boolean; - /** - * An array of resolutions which should be enabled in resolutions picker for this symbol. - */ - supported_resolutions: ResolutionString[]; - /** - * @example (for ex.: "1,5,60") - only these resolutions will be requested, all others will be built using them if possible - */ - intraday_multipliers?: string[]; - has_seconds?: boolean; - has_ticks?: boolean; - /** - * It is an array containing seconds resolutions (in seconds without a postfix) the datafeed builds by itself. - */ - seconds_multipliers?: string[]; - has_daily?: boolean; - has_weekly_and_monthly?: boolean; - has_empty_bars?: boolean; - has_no_volume?: boolean; - /** - * Integer showing typical volume value decimal places for this symbol - */ - volume_precision?: number; - data_status?: "streaming" | "endofday" | "pulsed" | "delayed_streaming"; - /** - * Boolean showing whether this symbol is expired futures contract or not. - */ - expired?: boolean; - /** - * Unix timestamp of expiration date. - */ - expiration_date?: number; - sector?: string; - industry?: string; - currency_code?: string; - original_currency_code?: string; - unit_id?: string; - original_unit_id?: string; - unit_conversion_types?: string[]; + /** + * Symbol Name + */ + name: string + full_name: string + base_name?: [string] + /** + * Unique symbol id + */ + ticker?: string + description: string + type: string + /** + * @example "1700-0200" + */ + session: string + session_display?: string + /** @deprecated Use session_holidays instead */ + holidays?: string + /** + * @example "20181105,20181107,20181112" + */ + session_holidays?: string + /** + * @example "1900F4-2350F4,1000-1845:20181113;1000-1400:20181114" + */ + corrections?: string + /** + * Traded exchange + * @example "NYSE" + */ + exchange: string + listed_exchange: string + timezone: Timezone + /** + * Prices format: "price" or "volume" + */ + format: SeriesFormat + /** + * Code (Tick) + * @example 8/16/.../256 (1/8/100 1/16/100 ... 1/256/100) or 1/10/.../10000000 (1 0.1 ... 0.0000001) + */ + pricescale: number + /** + * The number of units that make up one tick. + * @example For example, U.S. equities are quotes in decimals, and tick in decimals, and can go up +/- .01. So the tick increment is 1. But the e-mini S&P futures contract, though quoted in decimals, goes up in .25 increments, so the tick increment is 25. (see also Tick Size) + */ + minmov: number + fractional?: boolean + /** + * @example Quarters of 1/32: pricescale=128, minmovement=1, minmovement2=4 + */ + minmove2?: number + /** + * false if DWM only + */ + has_intraday?: boolean + /** + * An array of resolutions which should be enabled in resolutions picker for this symbol. + */ + supported_resolutions: ResolutionString[] + /** + * @example (for ex.: "1,5,60") - only these resolutions will be requested, all others will be built using them if possible + */ + intraday_multipliers?: string[] + has_seconds?: boolean + has_ticks?: boolean + /** + * It is an array containing seconds resolutions (in seconds without a postfix) the datafeed builds by itself. + */ + seconds_multipliers?: string[] + has_daily?: boolean + has_weekly_and_monthly?: boolean + has_empty_bars?: boolean + has_no_volume?: boolean + /** + * Integer showing typical volume value decimal places for this symbol + */ + volume_precision?: number + data_status?: 'streaming' | 'endofday' | 'pulsed' | 'delayed_streaming' + /** + * Boolean showing whether this symbol is expired futures contract or not. + */ + expired?: boolean + /** + * Unix timestamp of expiration date. + */ + expiration_date?: number + sector?: string + industry?: string + currency_code?: string + original_currency_code?: string + unit_id?: string + original_unit_id?: string + unit_conversion_types?: string[] } export interface Mark { - id: string | number; - time: number; - color: MarkConstColors | MarkCustomColor; - text: string; - label: string; - labelFontColor: string; - minSize: number; + id: string | number + time: number + color: MarkConstColors | MarkCustomColor + text: string + label: string + labelFontColor: string + minSize: number } export interface MarkCustomColor { - color: string; - background: string; + color: string + background: string } export interface PeriodParams { - from: number; - to: number; - countBack: number; - firstDataRequest: boolean; + from: number + to: number + countBack: number + firstDataRequest: boolean } export interface QuoteErrorData { - s: "error"; - n: string; - v: object; + s: 'error' + n: string + v: object } export interface QuoteOkData { - s: "ok"; - n: string; - v: DatafeedQuoteValues; + s: 'ok' + n: string + v: DatafeedQuoteValues } export interface SearchSymbolResultItem { - symbol: string; - full_name: string; - description: string; - exchange: string; - ticker: string; - type: string; + symbol: string + full_name: string + description: string + exchange: string + ticker: string + type: string } export interface SymbolResolveExtension { - currencyCode?: string; - unitId?: string; + currencyCode?: string + unitId?: string } export interface TimescaleMark { - id: string | number; - time: number; - color: MarkConstColors | string; - label: string; - tooltip: string[]; + id: string | number + time: number + color: MarkConstColors | string + label: string + tooltip: string[] } export interface Unit { - id: string; - name: string; - description: string; + id: string + name: string + description: string } -export type CustomTimezones = "Africa/Cairo" | "Africa/Johannesburg" | "Africa/Lagos" | "America/Argentina/Buenos_Aires" | "America/Bogota" | "America/Caracas" | "America/Chicago" | "America/El_Salvador" | "America/Juneau" | "America/Lima" | "America/Los_Angeles" | "America/Mexico_City" | "America/New_York" | "America/Phoenix" | "America/Santiago" | "America/Sao_Paulo" | "America/Toronto" | "America/Vancouver" | "Asia/Almaty" | "Asia/Ashkhabad" | "Asia/Bahrain" | "Asia/Bangkok" | "Asia/Chongqing" | "Asia/Dubai" | "Asia/Ho_Chi_Minh" | "Asia/Hong_Kong" | "Asia/Jakarta" | "Asia/Jerusalem" | "Asia/Kathmandu" | "Asia/Kolkata" | "Asia/Kuwait" | "Asia/Muscat" | "Asia/Qatar" | "Asia/Riyadh" | "Asia/Seoul" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Taipei" | "Asia/Tehran" | "Asia/Tokyo" | "Atlantic/Reykjavik" | "Australia/ACT" | "Australia/Adelaide" | "Australia/Brisbane" | "Australia/Perth" | "Australia/Sydney" | "Europe/Amsterdam" | "Europe/Athens" | "Europe/Belgrade" | "Europe/Berlin" | "Europe/Brussels" | "Europe/Copenhagen" | "Europe/Dublin" | "Europe/Helsinki" | "Europe/Istanbul" | "Europe/Lisbon" | "Europe/London" | "Europe/Luxembourg" | "Europe/Madrid" | "Europe/Malta" | "Europe/Moscow" | "Europe/Oslo" | "Europe/Paris" | "Europe/Riga" | "Europe/Rome" | "Europe/Stockholm" | "Europe/Tallinn" | "Europe/Vilnius" | "Europe/Warsaw" | "Europe/Zurich" | "Pacific/Auckland" | "Pacific/Chatham" | "Pacific/Fakaofo" | "Pacific/Honolulu" | "Pacific/Norfolk" | "US/Mountain"; +export type CustomTimezones = + | 'Africa/Cairo' + | 'Africa/Johannesburg' + | 'Africa/Lagos' + | 'America/Argentina/Buenos_Aires' + | 'America/Bogota' + | 'America/Caracas' + | 'America/Chicago' + | 'America/El_Salvador' + | 'America/Juneau' + | 'America/Lima' + | 'America/Los_Angeles' + | 'America/Mexico_City' + | 'America/New_York' + | 'America/Phoenix' + | 'America/Santiago' + | 'America/Sao_Paulo' + | 'America/Toronto' + | 'America/Vancouver' + | 'Asia/Almaty' + | 'Asia/Ashkhabad' + | 'Asia/Bahrain' + | 'Asia/Bangkok' + | 'Asia/Chongqing' + | 'Asia/Dubai' + | 'Asia/Ho_Chi_Minh' + | 'Asia/Hong_Kong' + | 'Asia/Jakarta' + | 'Asia/Jerusalem' + | 'Asia/Kathmandu' + | 'Asia/Kolkata' + | 'Asia/Kuwait' + | 'Asia/Muscat' + | 'Asia/Qatar' + | 'Asia/Riyadh' + | 'Asia/Seoul' + | 'Asia/Shanghai' + | 'Asia/Singapore' + | 'Asia/Taipei' + | 'Asia/Tehran' + | 'Asia/Tokyo' + | 'Atlantic/Reykjavik' + | 'Australia/ACT' + | 'Australia/Adelaide' + | 'Australia/Brisbane' + | 'Australia/Perth' + | 'Australia/Sydney' + | 'Europe/Amsterdam' + | 'Europe/Athens' + | 'Europe/Belgrade' + | 'Europe/Berlin' + | 'Europe/Brussels' + | 'Europe/Copenhagen' + | 'Europe/Dublin' + | 'Europe/Helsinki' + | 'Europe/Istanbul' + | 'Europe/Lisbon' + | 'Europe/London' + | 'Europe/Luxembourg' + | 'Europe/Madrid' + | 'Europe/Malta' + | 'Europe/Moscow' + | 'Europe/Oslo' + | 'Europe/Paris' + | 'Europe/Riga' + | 'Europe/Rome' + | 'Europe/Stockholm' + | 'Europe/Tallinn' + | 'Europe/Vilnius' + | 'Europe/Warsaw' + | 'Europe/Zurich' + | 'Pacific/Auckland' + | 'Pacific/Chatham' + | 'Pacific/Fakaofo' + | 'Pacific/Honolulu' + | 'Pacific/Norfolk' + | 'US/Mountain' -export as namespace TradingView; +export as namespace TradingView -export {}; +export {} diff --git a/public/index.html b/public/index.html index 260f9089ca..23d931e349 100644 --- a/public/index.html +++ b/public/index.html @@ -47,7 +47,7 @@ -
+