Skip to content

FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.

general updates and bug fixes

tilakpatel221ac3f5e42148
diff --git a/fincept-terminal-desktop/Temppm_market.json b/fincept-terminal-desktop/Temppm_market.json
deleted file mode 100644
index 78c4e25d8..000000000
--- a/fincept-terminal-desktop/Temppm_market.json
+++ /dev/null
@@ -1 +0,0 @@
-[{"id":"1237864","question":"Counter-Strike: Acend vs Bebop (BO3) - CCT Europe Series #14 Play-In Group B","conditionId":"0xa6d544024ed0b1de9e0cd6c0327a7c18a872e5875f40ceafb61937bccd43f248","slug":"cs2-ace1-bbp-2026-01-23","resolutionSource":"https://www.sofascore.com/esports","endDate":"2026-01-23T18:30:00Z","startDate":"2026-01-22T00:01:27.770446Z","image":"https://polymarket-upload.s3.us-east-2.amazonaws.com/counter-strike-image-16c415c538.png","icon":"https://polymarket-upload.s3.us-east-2.amazonaws.com/counter-strike-image-16c415c538.png","description":"This market refers to the Counter-Strike match between Acend and Bebop in the CCT Europe Series #14 Play-In Group B, scheduled for January 23 at 7:30AM ET.\n\nThis market will resolve to \"Acend\" if Acend win the match against Bebop.\n\nThis market will resolve to \"Bebop\" if Bebop win the match against Acend.\n\nIf the match is canceled (not played at all), ends in a tie, or is delayed beyond 7 days from the scheduled date without a winner determined, this market will resolve to 50-50. \n\nIf the match begins but is not completed, and one team wins due to the opponent's forfeiture, disqualification, or walkover, this market will resolve to the team who wins. \n\nIf the match ends in a forfeit, disqualification, or walkover (team withdraws before the start and the other wins automatically), this market will resolve to 50-50. \n\nThe resolution source for this market will be official information from https://www.sofascore.com/esports.","outcomes":"[\"Acend\", \"Bebop\"]","outcomePrices":"[\"1\", \"0\"]","volume":"9999.995006","active":true,"closed":true,"marketMakerAddress":"","createdAt":"2026-01-22T00:00:11.064526Z","updatedAt":"2026-01-25T00:21:37.311045Z","closedTime":"2026-01-23 20:56:36+00","new":false,"featured":false,"submitted_by":"0x91430CaD2d3975766499717fA0D66A78D814E5c5","archived":false,"resolvedBy":"0x65070BE91477460D8A7AeEb94ef92fe056C2f2A7","restricted":true,"groupItemTitle":"Match Winner","questionID":"0x432ea6aab86e58e5413a12dc5b66a40cd5dfc82d85aec8ea006016008c565ded","umaEndDate":"2026-01-23T20:56:36Z","enableOrderBook":true,"orderPriceMinTickSize":0.001,"orderMinSize":5,"umaResolutionStatus":"resolved","volumeNum":9999.995006,"endDateIso":"2026-01-23","startDateIso":"2026-01-22","hasReviewedDates":true,"volume1wk":9999.995006,"volume1mo":9999.995006,"volume1yr":9999.995006,"gameStartTime":"2026-01-23 12:30:00+00","secondsDelay":3,"clobTokenIds":"[\"13915383147598038388500755196666377480504116216295452377454618635607632089106\", \"5279164082546013152208887890713787838941989595411752055506257404817056208535\"]","umaBond":"500","umaReward":"2","volume1wkClob":9999.995006,"volume1moClob":9999.995006,"volume1yrClob":9999.995006,"volumeClob":9999.995006,"customLiveness":0,"acceptingOrders":false,"negRisk":false,"negRiskRequestID":"","events":[{"id":"179909","ticker":"cs2-ace1-bbp-2026-01-23","slug":"cs2-ace1-bbp-2026-01-23","title":"Counter-Strike: Acend vs Bebop (BO3) - CCT Europe Series #14 Play-In Group B","description":"This market refers to the Counter-Strike match between Acend and Bebop in the CCT Europe Series #14 Play-In Group B, scheduled for January 23 at 7:30AM ET.\n\nThis market will resolve to \"Acend\" if Acend win the match against Bebop.\n\nThis market will resolve to \"Bebop\" if Bebop win the match against Acend.\n\nIf the match is canceled (not played at all), ends in a tie, or is delayed beyond 7 days from the scheduled date without a winner determined, this market will resolve to 50-50. \n\nIf the match begins but is not completed, and one team wins due to the opponent's forfeiture, disqualification, or walkover, this market will resolve to the team who wins. \n\nIf the match ends in a forfeit, disqualification, or walkover (team withdraws before the start and the other wins automatically), this market will resolve to 50-50. \n\nThe resolution source for this market will be official information from https://www.sofascore.com/esports.","resolutionSource":"https://kick.com/cct_cs2","startDate":"2026-01-22T00:03:11.698284Z","creationDate":"2026-01-22T00:03:11.698276Z","endDate":"2026-01-23T18:30:00Z","image":"https://polymarket-upload.s3.us-east-2.amazonaws.com/counter-strike-image-16c415c538.png","icon":"https://polymarket-upload.s3.us-east-2.amazonaws.com/counter-strike-image-16c415c538.png","active":true,"closed":true,"archived":false,"new":false,"featured":false,"restricted":true,"volume":15470.09001,"openInterest":0,"createdAt":"2026-01-22T00:00:10.690544Z","updatedAt":"2026-01-25T00:21:48.154672Z","volume1wk":15234.950009999999,"volume1mo":15234.950009999999,"volume1yr":15234.950009999999,"enableOrderBook":true,"negRisk":false,"commentCount":0,"series":[{"id":"10310","ticker":"counter-strike","slug":"counter-strike","title":"Counter Strike","seriesType":"single","recurrence":"daily","image":"","icon":"","active":true,"closed":false,"archived":false,"featured":false,"restricted":true,"createdAt":"2025-09-18T23:42:36.322544Z","updatedAt":"2026-02-21T08:36:06.139696Z","volume24hr":9491712.330936,"volume":900566.129542,"liquidity":3395878.92072,"commentCount":3263,"requiresTranslation":false}],"cyom":false,"closedTime":"2026-01-23T20:57:36Z","showAllOutcomes":true,"showMarketImages":false,"automaticallyResolved":true,"enableNegRisk":false,"automaticallyActive":true,"eventDate":"2026-01-23","startTime":"2026-01-23T12:30:00Z","eventWeek":1,"seriesSlug":"counter-strike","score":"000-000|2-1|Bo3","period":"3/3","live":false,"ended":true,"negRiskAugmented":false,"pendingDeployment":false,"deploying":false,"gameId":1324191,"requiresTranslation":false}],"ready":false,"funded":false,"acceptingOrdersTimestamp":"2026-01-22T00:01:04Z","cyom":false,"pagerDutyNotificationEnabled":false,"approved":true,"rewardsMinSize":0,"rewardsMaxSpread":0,"spread":0.001,"automaticallyResolved":true,"oneDayPriceChange":0.5145,"lastTradePrice":0.999,"bestBid":0.999,"bestAsk":1,"automaticallyActive":true,"clearBookOnStart":true,"manualActivation":false,"negRiskOther":false,"gameId":"1324191","sportsMarketType":"moneyline","umaResolutionStatuses":"[\"proposed\"]","pendingDeployment":false,"deploying":false,"deployingTimestamp":"2026-01-22T00:00:29.086484Z","rfqEnabled":false,"eventStartTime":"2026-01-23T12:30:00Z","holdingRewardsEnabled":false,"feesEnabled":false,"requiresTranslation":false,"feeType":null}]
diff --git a/fincept-terminal-desktop/bun.lock b/fincept-terminal-desktop/bun.lock
index 2820c2b1e..6c929bd4b 100644
--- a/fincept-terminal-desktop/bun.lock
+++ b/fincept-terminal-desktop/bun.lock
@@ -55,6 +55,25 @@
"@tauri-apps/plugin-process": "^2.3.1",
"@tauri-apps/plugin-shell": "^2.3.3",
"@tauri-apps/plugin-updater": "~2.9.0",
+ "@tiptap/extension-color": "^3.20.0",
+ "@tiptap/extension-font-family": "^3.20.0",
+ "@tiptap/extension-highlight": "^3.20.0",
+ "@tiptap/extension-image": "^3.20.0",
+ "@tiptap/extension-link": "^3.20.0",
+ "@tiptap/extension-placeholder": "^3.20.0",
+ "@tiptap/extension-subscript": "^3.20.0",
+ "@tiptap/extension-superscript": "^3.20.0",
+ "@tiptap/extension-table": "^3.20.0",
+ "@tiptap/extension-table-cell": "^3.20.0",
+ "@tiptap/extension-table-header": "^3.20.0",
+ "@tiptap/extension-table-row": "^3.20.0",
+ "@tiptap/extension-text-align": "^3.20.0",
+ "@tiptap/extension-text-style": "^3.20.0",
+ "@tiptap/extension-typography": "^3.20.0",
+ "@tiptap/extension-underline": "^3.20.0",
+ "@tiptap/pm": "^3.20.0",
+ "@tiptap/react": "^3.20.0",
+ "@tiptap/starter-kit": "^3.20.0",
"@types/dompurify": "^3.2.0",
"@types/plotly.js": "^3.0.9",
"@types/react-grid-layout": "^1.3.5",
@@ -68,6 +87,7 @@
"d3": "^7.9.0",
"date-fns": "^4.1.0",
"deck.gl": "^9.2.5",
+ "docx-preview": "^0.3.7",
"dompurify": "^3.3.1",
"driver.js": "^1.4.0",
"embla-carousel-react": "^8.6.0",
@@ -75,6 +95,7 @@
"fyers-web-sdk-v3": "^1.3.1",
"groq-sdk": "^0.37.0",
"handsontable": "^16.2.0",
+ "html-to-docx": "^1.8.0",
"hyperformula": "^3.1.1",
"i18next": "^25.7.1",
"i18next-browser-languagedetector": "^8.2.0",
@@ -83,11 +104,13 @@
"jsonata": "^2.1.0",
"jsonpath": "^1.1.1",
"jsonpath-plus": "^10.3.0",
+ "jszip": "^3.10.1",
"katex": "^0.16.28",
"langchain": "^0.3.34",
"libphonenumber-js": "^1.12.33",
"lightweight-charts": "^5.0.9",
"lucide-react": "^0.544.0",
+ "mammoth": "^1.11.0",
"maplibre-gl": "^5.16.0",
"marked": "^17.0.1",
"next-themes": "^0.4.6",
@@ -118,9 +141,12 @@
"tailwindcss": "^4.1.13",
"vaul": "^1.1.2",
"ws": "^8.18.3",
+ "xgplayer": "^3.0.23",
+ "xgplayer-hls": "^3.0.23",
"xlsx": "^0.18.5",
},
"devDependencies": {
+ "@eslint/js": "^10.0.1",
"@tauri-apps/cli": "^2",
"@types/d3": "^7.4.3",
"@types/jmespath": "^0.15.2",
@@ -130,11 +156,14 @@
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@types/ws": "^8.18.1",
- "@vitejs/plugin-react": "^4.6.0",
+ "@vitejs/plugin-react-swc": "^4.2.3",
"baseline-browser-mapping": "^2.8.32",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"cross-env": "^10.1.0",
+ "eslint": "^10.0.2",
+ "eslint-plugin-react-hooks": "^7.0.1",
+ "eslint-plugin-react-refresh": "^0.5.2",
"glob": "^13.0.0",
"http-proxy-agent": "^7.0.2",
"https-browserify": "^1.0.0",
@@ -147,6 +176,7 @@
"ts-node": "^10.9.2",
"tw-animate-css": "^1.4.0",
"typescript": "~5.8.3",
+ "typescript-eslint": "^8.56.1",
"url": "^0.11.4",
"util": "^0.12.5",
"vite": "^7.0.4",
@@ -170,23 +200,21 @@
"@arcgis/toolkit": ["@arcgis/[email protected]", "", { "dependencies": { "tslib": "^2.8.1" } }, "sha512-wFST+eVnCwmg9NyICVyn9bsBnR+TlWklsGqG3L7xqSTgfXo6TuCThE7wtTb8xWxsTBkGvImqMUgpgLuwQuTQ1g=="],
- "@babel/code-frame": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg=="],
+ "@babel/code-frame": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.28.5", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw=="],
- "@babel/compat-data": ["@babel/[email protected]", "", {}, "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA=="],
+ "@babel/compat-data": ["@babel/[email protected]", "", {}, "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg=="],
- "@babel/core": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", "@babel/helper-compilation-targets": "^7.27.2", "@babel/helper-module-transforms": "^7.28.3", "@babel/helpers": "^7.28.4", "@babel/parser": "^7.28.5", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.5", "@babel/types": "^7.28.5", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw=="],
+ "@babel/core": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-compilation-targets": "^7.28.6", "@babel/helper-module-transforms": "^7.28.6", "@babel/helpers": "^7.28.6", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/traverse": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA=="],
- "@babel/generator": ["@babel/[email protected]", "", { "dependencies": { "@babel/parser": "^7.28.5", "@babel/types": "^7.28.5", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ=="],
+ "@babel/generator": ["@babel/[email protected]", "", { "dependencies": { "@babel/parser": "^7.29.0", "@babel/types": "^7.29.0", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw=="],
- "@babel/helper-compilation-targets": ["@babel/[email protected]", "", { "dependencies": { "@babel/compat-data": "^7.27.2", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ=="],
+ "@babel/helper-compilation-targets": ["@babel/[email protected]", "", { "dependencies": { "@babel/compat-data": "^7.28.6", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA=="],
"@babel/helper-globals": ["@babel/[email protected]", "", {}, "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw=="],
- "@babel/helper-module-imports": ["@babel/[email protected]", "", { "dependencies": { "@babel/traverse": "^7.27.1", "@babel/types": "^7.27.1" } }, "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w=="],
+ "@babel/helper-module-imports": ["@babel/[email protected]", "", { "dependencies": { "@babel/traverse": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw=="],
- "@babel/helper-module-transforms": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-module-imports": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1", "@babel/traverse": "^7.28.3" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw=="],
-
- "@babel/helper-plugin-utils": ["@babel/[email protected]", "", {}, "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw=="],
+ "@babel/helper-module-transforms": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-module-imports": "^7.28.6", "@babel/helper-validator-identifier": "^7.28.5", "@babel/traverse": "^7.28.6" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA=="],
"@babel/helper-string-parser": ["@babel/[email protected]", "", {}, "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA=="],
@@ -194,21 +222,17 @@
"@babel/helper-validator-option": ["@babel/[email protected]", "", {}, "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg=="],
- "@babel/helpers": ["@babel/[email protected]", "", { "dependencies": { "@babel/template": "^7.27.2", "@babel/types": "^7.28.4" } }, "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w=="],
-
- "@babel/parser": ["@babel/[email protected]", "", { "dependencies": { "@babel/types": "^7.28.5" }, "bin": "./bin/babel-parser.js" }, "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ=="],
+ "@babel/helpers": ["@babel/[email protected]", "", { "dependencies": { "@babel/template": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw=="],
- "@babel/plugin-transform-react-jsx-self": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw=="],
-
- "@babel/plugin-transform-react-jsx-source": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw=="],
+ "@babel/parser": ["@babel/[email protected]", "", { "dependencies": { "@babel/types": "^7.29.0" }, "bin": "./bin/babel-parser.js" }, "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww=="],
"@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
- "@babel/template": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/parser": "^7.27.2", "@babel/types": "^7.27.1" } }, "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw=="],
+ "@babel/template": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.28.6", "@babel/parser": "^7.28.6", "@babel/types": "^7.28.6" } }, "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ=="],
- "@babel/traverse": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.28.5", "@babel/template": "^7.27.2", "@babel/types": "^7.28.5", "debug": "^4.3.1" } }, "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ=="],
+ "@babel/traverse": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.29.0", "@babel/template": "^7.28.6", "@babel/types": "^7.29.0", "debug": "^4.3.1" } }, "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA=="],
- "@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="],
+ "@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="],
"@browserbasehq/sdk": ["@browserbasehq/[email protected]", "", { "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", "node-fetch": "^2.6.7" } }, "sha512-83iXP5D7xMm8Wyn66TUaUrgoByCmAJuoMoZQI3sGg3JAiMlTfnCIMqyVBoNSaItaPIkaCnrsj6LiusmXV2X9YA=="],
@@ -312,6 +336,22 @@
"@esbuild/win32-x64": ["@esbuild/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA=="],
+ "@eslint-community/eslint-utils": ["@eslint-community/[email protected]", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ=="],
+
+ "@eslint-community/regexpp": ["@eslint-community/[email protected]", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="],
+
+ "@eslint/config-array": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/object-schema": "^3.0.2", "debug": "^4.3.1", "minimatch": "^10.2.1" } }, "sha512-YF+fE6LV4v5MGWRGj7G404/OZzGNepVF8fxk7jqmqo3lrza7a0uUcDnROGRBG1WFC1omYUS/Wp1f42i0M+3Q3A=="],
+
+ "@eslint/config-helpers": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/core": "^1.1.0" } }, "sha512-a5MxrdDXEvqnIq+LisyCX6tQMPF/dSJpCfBgBauY+pNZ28yCtSsTvyTYrMhaI+LK26bVyCJfJkT0u8KIj2i1dQ=="],
+
+ "@eslint/core": ["@eslint/[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-/nr9K9wkr3P1EzFTdFdMoLuo1PmIxjmwvPozwoSodjNBdefGujXQUF93u1DDZpEaTuDvMsIQddsd35BwtrW9Xw=="],
+
+ "@eslint/js": ["@eslint/[email protected]", "", { "peerDependencies": { "eslint": "^10.0.0" }, "optionalPeers": ["eslint"] }, "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA=="],
+
+ "@eslint/object-schema": ["@eslint/[email protected]", "", {}, "sha512-HOy56KJt48Bx8KmJ+XGQNSUMT/6dZee/M54XyUyuvTvPXJmsERRvBchsUVx1UMe1WwIH49XLAczNC7V2INsuUw=="],
+
+ "@eslint/plugin-kit": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/core": "^1.1.0", "levn": "^0.4.1" } }, "sha512-bIZEUzOI1jkhviX2cp5vNyXQc6olzb2ohewQubuYlMXZ2Q/XjBO0x0XhGPvc9fjSIiUN0vw+0hq53BJ4eQSJKQ=="],
+
"@esri/arcgis-html-sanitizer": ["@esri/[email protected]", "", { "dependencies": { "xss": "1.0.13" } }, "sha512-einEveDJ/k1180NOp78PB/4Hje9eBy3dyOGLLtLn6bSkizpUfCwuYBIXOA7Y3F/k/BsTQXgKqUVwQ0eiscWMdA=="],
"@esri/calcite-components": ["@esri/[email protected]", "", { "dependencies": { "@arcgis/lumina": ">=4.34.0-next.158 <4.35.0", "@arcgis/toolkit": ">=4.34.0-next.158 <4.35.0", "@esri/calcite-ui-icons": "4.3.0", "@floating-ui/dom": "^1.6.12", "@floating-ui/utils": "^0.2.8", "@types/sortablejs": "^1.15.8", "color": "^5.0.0", "composed-offset-position": "^0.0.6", "es-toolkit": "^1.39.8", "focus-trap": "^7.6.5", "interactjs": "^1.10.27", "lit": "^3.3.0", "sortablejs": "^1.15.6", "timezone-groups": "^0.10.4", "type-fest": "^4.30.1" } }, "sha512-tw+EfJ3pb+Odj71W6E9GUkm8rMbNxfW1KeiI8GgsKDzhr39hMKwY+zYYFFYuO0FONxWGvAB+B8yqB0NvH7WeHw=="],
@@ -346,6 +386,14 @@
"@handsontable/pikaday": ["@handsontable/[email protected]", "", {}, "sha512-1VN6N38t5/DcjJ7y7XUYrDx1LuzvvzlrFdBdMG90Qo1xc8+LXHqbWbsTEm5Ec5gXTEbDEO53vUT35R+2COmOyg=="],
+ "@humanfs/core": ["@humanfs/[email protected]", "", {}, "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA=="],
+
+ "@humanfs/node": ["@humanfs/[email protected]", "", { "dependencies": { "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.4.0" } }, "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ=="],
+
+ "@humanwhocodes/module-importer": ["@humanwhocodes/[email protected]", "", {}, "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA=="],
+
+ "@humanwhocodes/retry": ["@humanwhocodes/[email protected]", "", {}, "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ=="],
+
"@ibm-cloud/watsonx-ai": ["@ibm-cloud/[email protected]", "", { "dependencies": { "@types/node": "^18.0.0", "extend": "3.0.2", "form-data": "^4.0.4", "ibm-cloud-sdk-core": "^5.4.3" } }, "sha512-5cVSUToeZBDEG6q3OfjuYO3yTOjI8dMsi3jgp1PGZ83hBbMeNrTA+hjT6gXPlxpTIgQeov3rSie5w7B3qzFOgg=="],
"@interactjs/types": ["@interactjs/[email protected]", "", {}, "sha512-BUdv0cvs4H5ODuwft2Xp4eL8Vmi3LcihK42z0Ft/FbVJZoRioBsxH+LlsBdK4tAie7PqlKGy+1oyOncu1nQ6eA=="],
@@ -486,6 +534,14 @@
"@noble/hashes": ["@noble/[email protected]", "", {}, "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ=="],
+ "@oozcitak/dom": ["@oozcitak/[email protected]", "", { "dependencies": { "@oozcitak/infra": "1.0.5", "@oozcitak/url": "1.0.0", "@oozcitak/util": "8.3.4" } }, "sha512-k4uEIa6DI3FCrFJMGq/05U/59WnS9DjME0kaPqBRCJAqBTkmopbYV1Xs4qFKbDJ/9wOg8W97p+1E0heng/LH7g=="],
+
+ "@oozcitak/infra": ["@oozcitak/[email protected]", "", { "dependencies": { "@oozcitak/util": "8.0.0" } }, "sha512-o+zZH7M6l5e3FaAWy3ojaPIVN5eusaYPrKm6MZQt0DKNdgXa2wDYExjpP0t/zx+GoQgQKzLu7cfD8rHCLt8JrQ=="],
+
+ "@oozcitak/url": ["@oozcitak/[email protected]", "", { "dependencies": { "@oozcitak/infra": "1.0.3", "@oozcitak/util": "1.0.2" } }, "sha512-LGrMeSxeLzsdaitxq3ZmBRVOrlRRQIgNNci6L0VRnOKlJFuRIkNm4B+BObXPCJA6JT5bEJtrrwjn30jueHJYZQ=="],
+
+ "@oozcitak/util": ["@oozcitak/[email protected]", "", {}, "sha512-6gH/bLQJSJEg7OEpkH4wGQdA8KXHRbzL1YkGyUO12YNAgV3jxKy4K9kvfXj4+9T0OLug5k58cnPCKSSIKzp7pg=="],
+
"@open-wc/dedupe-mixin": ["@open-wc/[email protected]", "", {}, "sha512-Sj7gKl1TLcDbF7B6KUhtvr+1UCxdhMbNY5KxdU5IfMFWqL8oy1ZeAcCANjoB1TL0AJTcPmcCFsCbHf8X2jGDUA=="],
"@otplib/core": ["@otplib/[email protected]", "", {}, "sha512-4sGntwbA/AC+SbPhbsziRiD+jNDdIzsZ3JUyfZwjtKyc/wufl1pnSIaG4Uqx8ymPagujub0o92kgBnB89cuAMA=="],
@@ -660,7 +716,9 @@
"@reactflow/node-toolbar": ["@reactflow/[email protected]", "", { "dependencies": { "@reactflow/core": "11.11.4", "classcat": "^5.0.3", "zustand": "^4.4.1" }, "peerDependencies": { "react": ">=17", "react-dom": ">=17" } }, "sha512-rbynXQnH/xFNu4P9H+hVqlEUafDCkEoCy0Dg9mG22Sg+rY/0ck6KkrAQrYrTgXusd+cEJOMK0uOOFCK2/5rSGQ=="],
- "@rolldown/pluginutils": ["@rolldown/[email protected]", "", {}, "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA=="],
+ "@remirror/core-constants": ["@remirror/[email protected]", "", {}, "sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg=="],
+
+ "@rolldown/pluginutils": ["@rolldown/[email protected]", "", {}, "sha512-izyXV/v+cHiRfozX62W9htOAvwMo4/bXKDrQ+vom1L1qRuexPock/7VZDAhnpHCLNejd3NJ6hiab+tO0D44Rgw=="],
"@rollup/plugin-inject": ["@rollup/[email protected]", "", { "dependencies": { "@rollup/pluginutils": "^5.0.1", "estree-walker": "^2.0.2", "magic-string": "^0.30.3" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-2+DEJbNBoPROPkgTDNe8/1YXWcqxbN5DTjASVIOx8HS+pITXushyNiBV56RB08zuptzz8gT3YfkqriTBVycepg=="],
@@ -710,6 +768,32 @@
"@rollup/rollup-win32-x64-msvc": ["@rollup/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ=="],
+ "@swc/core": ["@swc/[email protected]", "", { "dependencies": { "@swc/counter": "^0.1.3", "@swc/types": "^0.1.25" }, "optionalDependencies": { "@swc/core-darwin-arm64": "1.15.13", "@swc/core-darwin-x64": "1.15.13", "@swc/core-linux-arm-gnueabihf": "1.15.13", "@swc/core-linux-arm64-gnu": "1.15.13", "@swc/core-linux-arm64-musl": "1.15.13", "@swc/core-linux-x64-gnu": "1.15.13", "@swc/core-linux-x64-musl": "1.15.13", "@swc/core-win32-arm64-msvc": "1.15.13", "@swc/core-win32-ia32-msvc": "1.15.13", "@swc/core-win32-x64-msvc": "1.15.13" }, "peerDependencies": { "@swc/helpers": ">=0.5.17" }, "optionalPeers": ["@swc/helpers"] }, "sha512-0l1gl/72PErwUZuavcRpRAQN9uSst+Nk++niC5IX6lmMWpXoScYx3oq/narT64/sKv/eRiPTaAjBFGDEQiWJIw=="],
+
+ "@swc/core-darwin-arm64": ["@swc/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ztXusRuC5NV2w+a6pDhX13CGioMLq8CjX5P4XgVJ21ocqz9t19288Do0y8LklplDtwcEhYGTNdMbkmUT7+lDTg=="],
+
+ "@swc/core-darwin-x64": ["@swc/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-cVifxQUKhaE7qcO/y9Mq6PEhoyvN9tSLzCnnFZ4EIabFHBuLtDDO6a+vLveOy98hAs5Qu1+bb5Nv0oa1Pihe3Q=="],
+
+ "@swc/core-linux-arm-gnueabihf": ["@swc/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-t+xxEzZ48enl/wGGy7SRYd7kImWQ/+wvVFD7g5JZo234g6/QnIgZ+YdfIyjHB+ZJI3F7a2IQHS7RNjxF29UkWw=="],
+
+ "@swc/core-linux-arm64-gnu": ["@swc/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-VndeGvKmTXFn6AGwjy0Kg8i7HccOCE7Jt/vmZwRxGtOfNZM1RLYRQ7MfDLo6T0h1Bq6eYzps3L5Ma4zBmjOnOg=="],
+
+ "@swc/core-linux-arm64-musl": ["@swc/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-SmZ9m+XqCB35NddHCctvHFLqPZDAs5j8IgD36GoutufDJmeq2VNfgk5rQoqNqKmAK3Y7iFdEmI76QoHIWiCLyw=="],
+
+ "@swc/core-linux-x64-gnu": ["@swc/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-5rij+vB9a29aNkHq72EXI2ihDZPszJb4zlApJY4aCC/q6utgqFA6CkrfTfIb+O8hxtG3zP5KERETz8mfFK6A0A=="],
+
+ "@swc/core-linux-x64-musl": ["@swc/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-OlSlaOK9JplQ5qn07WiBLibkOw7iml2++ojEXhhR3rbWrNEKCD7sd8+6wSavsInyFdw4PhLA+Hy6YyDBIE23Yw=="],
+
+ "@swc/core-win32-arm64-msvc": ["@swc/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-zwQii5YVdsfG8Ti9gIKgBKZg8qMkRZxl+OlYWUT5D93Jl4NuNBRausP20tfEkQdAPSRrMCSUZBM6FhW7izAZRg=="],
+
+ "@swc/core-win32-ia32-msvc": ["@swc/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-hYXvyVVntqRlYoAIDwNzkS3tL2ijP3rxyWQMNKaxcCxxkCDto/w3meOK/OB6rbQSkNw0qTUcBfU9k+T0ptYdfQ=="],
+
+ "@swc/core-win32-x64-msvc": ["@swc/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-XTzKs7c/vYCcjmcwawnQvlHHNS1naJEAzcBckMI5OJlnrcgW8UtcX9NHFYvNjGtXuKv0/9KvqL4fuahdvlNGKw=="],
+
+ "@swc/counter": ["@swc/[email protected]", "", {}, "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ=="],
+
+ "@swc/types": ["@swc/[email protected]", "", { "dependencies": { "@swc/counter": "^0.1.3" } }, "sha512-iAoY/qRhNH8a/hBvm3zKj9qQ4oc2+3w1unPJa2XvTK3XjeLXtzcCingVPw/9e5mn1+0yPqxcBGp9Jf0pkfMb1g=="],
+
"@tailwindcss/node": ["@tailwindcss/[email protected]", "", { "dependencies": { "@jridgewell/remapping": "^2.3.4", "enhanced-resolve": "^5.18.3", "jiti": "^2.6.1", "lightningcss": "1.30.2", "magic-string": "^0.30.21", "source-map-js": "^1.2.1", "tailwindcss": "4.1.17" } }, "sha512-csIkHIgLb3JisEFQ0vxr2Y57GUNYh447C8xzwj89U/8fdW8LhProdxvnVH6U8M2Y73QKiTIH+LWbK3V2BBZsAg=="],
"@tailwindcss/oxide": ["@tailwindcss/[email protected]", "", { "optionalDependencies": { "@tailwindcss/oxide-android-arm64": "4.1.17", "@tailwindcss/oxide-darwin-arm64": "4.1.17", "@tailwindcss/oxide-darwin-x64": "4.1.17", "@tailwindcss/oxide-freebsd-x64": "4.1.17", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.17", "@tailwindcss/oxide-linux-arm64-gnu": "4.1.17", "@tailwindcss/oxide-linux-arm64-musl": "4.1.17", "@tailwindcss/oxide-linux-x64-gnu": "4.1.17", "@tailwindcss/oxide-linux-x64-musl": "4.1.17", "@tailwindcss/oxide-wasm32-wasi": "4.1.17", "@tailwindcss/oxide-win32-arm64-msvc": "4.1.17", "@tailwindcss/oxide-win32-x64-msvc": "4.1.17" } }, "sha512-F0F7d01fmkQhsTjXezGBLdrl1KresJTcI3DB8EkScCldyKp3Msz4hub4uyYaVnk88BAS1g5DQjjF6F5qczheLA=="],
@@ -780,6 +864,90 @@
"@tauri-apps/plugin-updater": ["@tauri-apps/[email protected]", "", { "dependencies": { "@tauri-apps/api": "^2.6.0" } }, "sha512-j++sgY8XpeDvzImTrzWA08OqqGqgkNyxczLD7FjNJJx/uXxMZFz5nDcfkyoI/rCjYuj2101Tci/r/HFmOmoxCg=="],
+ "@tiptap/core": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/pm": "^3.20.0" } }, "sha512-aC9aROgia/SpJqhsXFiX9TsligL8d+oeoI8W3u00WI45s0VfsqjgeKQLDLF7Tu7hC+7F02teC84SAHuup003VQ=="],
+
+ "@tiptap/extension-blockquote": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-LQzn6aGtL4WXz2+rYshl/7/VnP2qJTpD7fWL96GXAzhqviPEY1bJES7poqJb3MU/gzl8VJUVzVzU1VoVfUKlbA=="],
+
+ "@tiptap/extension-bold": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-sQklEWiyf58yDjiHtm5vmkVjfIc/cBuSusmCsQ0q9vGYnEF1iOHKhGpvnCeEXNeqF3fiJQRlquzt/6ymle3Iwg=="],
+
+ "@tiptap/extension-bubble-menu": ["@tiptap/[email protected]", "", { "dependencies": { "@floating-ui/dom": "^1.0.0" }, "peerDependencies": { "@tiptap/core": "^3.20.0", "@tiptap/pm": "^3.20.0" } }, "sha512-MDosUfs8Tj+nwg8RC+wTMWGkLJORXmbR6YZgbiX4hrc7G90Gopdd6kj6ht5/T8t7dLLaX7N0+DEHdUEPGED7dw=="],
+
+ "@tiptap/extension-bullet-list": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/extension-list": "^3.20.0" } }, "sha512-OcKMeopBbqWzhSi6o8nNz0aayogg1sfOAhto3NxJu3Ya32dwBFqmHXSYM6uW4jOphNvVPyjiq9aNRh3qTdd1dw=="],
+
+ "@tiptap/extension-code": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-TYDWFeSQ9umiyrqsT6VecbuhL8XIHkUhO+gEk0sVvH67ZLwjFDhAIIgWIr1/dbIGPcvMZM19E7xUUhAdIaXaOQ=="],
+
+ "@tiptap/extension-code-block": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0", "@tiptap/pm": "^3.20.0" } }, "sha512-lBbmNek14aCjrHcBcq3PRqWfNLvC6bcRa2Osc6e/LtmXlcpype4f6n+Yx+WZ+f2uUh0UmDRCz7BEyUETEsDmlQ=="],
+
+ "@tiptap/extension-color": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/extension-text-style": "^3.20.0" } }, "sha512-KGXQ3I18uLHQ61FZpXDu0gH6+0jqmDkVwkPNXmM3oPNDSH80SG5UeZlrXi/PwtlusePJ3dFHtoQ1g6j2bJUssg=="],
+
+ "@tiptap/extension-document": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-oJfLIG3vAtZo/wg29WiBcyWt22KUgddpP8wqtCE+kY5Dw8znLR9ehNmVWlSWJA5OJUMO0ntAHx4bBT+I2MBd5w=="],
+
+ "@tiptap/extension-dropcursor": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/extensions": "^3.20.0" } }, "sha512-d+cxplRlktVgZPwatnc34IArlppM0IFKS1J5wLk+ba1jidizsbMVh45tP/BTK2flhyfRqcNoB5R0TArhUpbkNQ=="],
+
+ "@tiptap/extension-floating-menu": ["@tiptap/[email protected]", "", { "peerDependencies": { "@floating-ui/dom": "^1.0.0", "@tiptap/core": "^3.20.0", "@tiptap/pm": "^3.20.0" } }, "sha512-rYs4Bv5pVjqZ/2vvR6oe7ammZapkAwN51As/WDbemvYDjfOGRqK58qGauUjYZiDzPOEIzI2mxGwsZ4eJhPW4Ig=="],
+
+ "@tiptap/extension-font-family": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/extension-text-style": "^3.20.0" } }, "sha512-XYR2vXYdeWA/YSr1nVlRw00h524a7Jjp529sti4EnKrQfGmB4LsYzihhcXsbzCxa2ffusWXeA3hbfO9NoTBltg=="],
+
+ "@tiptap/extension-gapcursor": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/extensions": "^3.20.0" } }, "sha512-P/LasfvG9/qFq43ZAlNbAnPnXC+/RJf49buTrhtFvI9Zg0+Lbpjx1oh6oMHB19T88Y28KtrckfFZ8aTSUWDq6w=="],
+
+ "@tiptap/extension-hard-break": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-rqvhMOw4f+XQmEthncbvDjgLH6fz8L9splnKZC7OeS0eX8b0qd7+xI1u5kyxF3KA2Z0BnigES++jjWuecqV6mA=="],
+
+ "@tiptap/extension-heading": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-JgJhurnCe3eN6a0lEsNQM/46R1bcwzwWWZEFDSb1P9dR8+t1/5v7cMZWsSInpD7R4/74iJn0+M5hcXLwCmBmYA=="],
+
+ "@tiptap/extension-highlight": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-ANL1wFz0s1ScNR4uBfO0s6Sz+qqGp2u6ynrCVk6TCT3d10CQ+gD1gSDTrVRC3CtlMKtHHH4fYrFAq284+J0gKA=="],
+
+ "@tiptap/extension-horizontal-rule": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0", "@tiptap/pm": "^3.20.0" } }, "sha512-6uvcutFMv+9wPZgptDkbRDjAm3YVxlibmkhWD5GuaWwS9L/yUtobpI3GycujRSUZ8D3q6Q9J7LqpmQtQRTalWA=="],
+
+ "@tiptap/extension-image": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-0t7HYncV0kYEQS79NFczxdlZoZ8zu8X4VavDqt+mbSAUKRq3gCvgtZ5Zyd778sNmtmbz3arxkEYMIVou2swD0g=="],
+
+ "@tiptap/extension-italic": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-/DhnKQF8yN8RxtuL8abZ28wd5281EaGoE2Oha35zXSOF1vNYnbyt8Ymkv/7u1BcWEWTvRPgaju0YCGXisPRLYw=="],
+
+ "@tiptap/extension-link": ["@tiptap/[email protected]", "", { "dependencies": { "linkifyjs": "^4.3.2" }, "peerDependencies": { "@tiptap/core": "^3.20.0", "@tiptap/pm": "^3.20.0" } }, "sha512-qI/5A+R0ZWBxo/8HxSn1uOyr7odr3xHBZ/gzOR1GUJaZqjlJxkWFX0RtXMbLKEGEvT25o345cF7b0wFznEh8qA=="],
+
+ "@tiptap/extension-list": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0", "@tiptap/pm": "^3.20.0" } }, "sha512-+V0/gsVWAv+7vcY0MAe6D52LYTIicMSHw00wz3ISZgprSb2yQhJ4+4gurOnUrQ4Du3AnRQvxPROaofwxIQ66WQ=="],
+
+ "@tiptap/extension-list-item": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/extension-list": "^3.20.0" } }, "sha512-qEtjaaGPuqaFB4VpLrGDoIe9RHnckxPfu6d3rc22ap6TAHCDyRv05CEyJogqccnFceG/v5WN4znUBER8RWnWHA=="],
+
+ "@tiptap/extension-list-keymap": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/extension-list": "^3.20.0" } }, "sha512-Z4GvKy04Ms4cLFN+CY6wXswd36xYsT2p/YL0V89LYFMZTerOeTjFYlndzn6svqL8NV1PRT5Diw4WTTxJSmcJPA=="],
+
+ "@tiptap/extension-ordered-list": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/extension-list": "^3.20.0" } }, "sha512-jVKnJvrizLk7etwBMfyoj6H2GE4M+PD4k7Bwp6Bh1ohBWtfIA1TlngdS842Mx5i1VB2e3UWIwr8ZH46gl6cwMA=="],
+
+ "@tiptap/extension-paragraph": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-mM99zK4+RnEXIMCv6akfNATAs0Iija6FgyFA9J9NZ6N4o8y9QiNLLa6HjLpAC+W+VoCgQIekyoF/Q9ftxmAYDQ=="],
+
+ "@tiptap/extension-placeholder": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/extensions": "^3.20.0" } }, "sha512-ZhYD3L5m16ydSe2z8vqz+RdtAG/iOQaFHHedFct70tKRoLqi2ajF5kgpemu8DwpaRTcyiCN4G99J/+MqehKNjQ=="],
+
+ "@tiptap/extension-strike": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-0vcTZRRAiDfon3VM1mHBr9EFmTkkUXMhm0Xtdtn0bGe+sIqufyi+hUYTEw93EQOD9XNsPkrud6jzQNYpX2H3AQ=="],
+
+ "@tiptap/extension-subscript": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0", "@tiptap/pm": "^3.20.0" } }, "sha512-EX3GPey4Gp9W04zM2MsP5OfMnwGtQTh1Q0ZokJAdENHpyXbche9WjK31FTzwEmTSqlU5stSsH5KwhSYlDwm5rA=="],
+
+ "@tiptap/extension-superscript": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0", "@tiptap/pm": "^3.20.0" } }, "sha512-NNFv58LM/7JMu4aq9Apq8yuaB8MDL5dvVZ7R6qMuQNZDVGAGgoiBqtglA1RXldNl/9IFcVg67rT8oF86qykYKA=="],
+
+ "@tiptap/extension-table": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0", "@tiptap/pm": "^3.20.0" } }, "sha512-vaaMtQ2KnSSr8WVwgWf7NYNzPwrHx/6T0ekA5CxV8qNUEpXIaLXa5+tE7tJHWEdNR2KY3gUJ46D3lfOkxyFrBQ=="],
+
+ "@tiptap/extension-table-cell": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/extension-table": "^3.20.0" } }, "sha512-9Dg4zda3UWwtpBwSG7b9BeQy5oT27a/yEIBeARuxe19bloMLZgqpPRtnSrOK0OAITtVnjA+NZdKPcVLRMS2E8A=="],
+
+ "@tiptap/extension-table-header": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/extension-table": "^3.20.0" } }, "sha512-2tVHHlihpeHO/gh2uU46gAX3NTGdKR+yDmfLlO2l0QAvx2TXNfNzX2pOM4MmyostW5Ko9TCWV4x0D9h3IQDhPw=="],
+
+ "@tiptap/extension-table-row": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/extension-table": "^3.20.0" } }, "sha512-clkfQahkYW/U48QBh1rPZv3AWWSC9AqGKp2DLTH/SGIorM/NwI0jpPtBETMlvowyQu0ivlH9B896smEph+Do2A=="],
+
+ "@tiptap/extension-text": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-tf8bE8tSaOEWabCzPm71xwiUhyMFKqY9jkP5af3Kr1/F45jzZFIQAYZooHI/+zCHRrgJ99MQHKHe1ZNvODrKHQ=="],
+
+ "@tiptap/extension-text-align": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-4s0r+bovtH6yeGDUD+Ui8j5WOV5koB5P6AuzOMqoLwaFGRSkKf64ly6DXjjmjIgnYCLZN/XO6llaQKVVdvad2g=="],
+
+ "@tiptap/extension-text-style": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-zyWW1a6W+kaXAn3wv2svJ1XuVMapujftvH7Xn2Q3QmKKiDkO+NiFkrGe8BhMopu8Im51nO3NylIgVA0X1mS1rQ=="],
+
+ "@tiptap/extension-typography": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-XpstIJ/hCK6+N87DdzjaYie1iH1gunbDK0UCsqsLemd8rMR/WAlF04M/yeJ6F2QtNzNh83bkoTxyNAHLDdUm2A=="],
+
+ "@tiptap/extension-underline": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0" } }, "sha512-LzNXuy2jwR/y+ymoUqC72TiGzbOCjioIjsDu0MNYpHuHqTWPK5aV9Mh0nbZcYFy/7fPlV1q0W139EbJeYBZEAQ=="],
+
+ "@tiptap/extensions": ["@tiptap/[email protected]", "", { "peerDependencies": { "@tiptap/core": "^3.20.0", "@tiptap/pm": "^3.20.0" } }, "sha512-HIsXX942w3nbxEQBlMAAR/aa6qiMBEP7CsSMxaxmTIVAmW35p6yUASw6GdV1u0o3lCZjXq2OSRMTskzIqi5uLg=="],
+
+ "@tiptap/pm": ["@tiptap/[email protected]", "", { "dependencies": { "prosemirror-changeset": "^2.3.0", "prosemirror-collab": "^1.3.1", "prosemirror-commands": "^1.6.2", "prosemirror-dropcursor": "^1.8.1", "prosemirror-gapcursor": "^1.3.2", "prosemirror-history": "^1.4.1", "prosemirror-inputrules": "^1.4.0", "prosemirror-keymap": "^1.2.2", "prosemirror-markdown": "^1.13.1", "prosemirror-menu": "^1.2.4", "prosemirror-model": "^1.24.1", "prosemirror-schema-basic": "^1.2.3", "prosemirror-schema-list": "^1.5.0", "prosemirror-state": "^1.4.3", "prosemirror-tables": "^1.6.4", "prosemirror-trailing-node": "^3.0.0", "prosemirror-transform": "^1.10.2", "prosemirror-view": "^1.38.1" } }, "sha512-jn+2KnQZn+b+VXr8EFOJKsnjVNaA4diAEr6FOazupMt8W8ro1hfpYtZ25JL87Kao/WbMze55sd8M8BDXLUKu1A=="],
+
+ "@tiptap/react": ["@tiptap/[email protected]", "", { "dependencies": { "@types/use-sync-external-store": "^0.0.6", "fast-equals": "^5.3.3", "use-sync-external-store": "^1.4.0" }, "optionalDependencies": { "@tiptap/extension-bubble-menu": "^3.20.0", "@tiptap/extension-floating-menu": "^3.20.0" }, "peerDependencies": { "@tiptap/core": "^3.20.0", "@tiptap/pm": "^3.20.0", "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", "@types/react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-jFLNzkmn18zqefJwPje0PPd9VhZ7Oy28YHiSvSc7YpBnQIbuN/HIxZ2lrOsKyEHta0WjRZjfU5X1pGxlbcGwOA=="],
+
+ "@tiptap/starter-kit": ["@tiptap/[email protected]", "", { "dependencies": { "@tiptap/core": "^3.20.0", "@tiptap/extension-blockquote": "^3.20.0", "@tiptap/extension-bold": "^3.20.0", "@tiptap/extension-bullet-list": "^3.20.0", "@tiptap/extension-code": "^3.20.0", "@tiptap/extension-code-block": "^3.20.0", "@tiptap/extension-document": "^3.20.0", "@tiptap/extension-dropcursor": "^3.20.0", "@tiptap/extension-gapcursor": "^3.20.0", "@tiptap/extension-hard-break": "^3.20.0", "@tiptap/extension-heading": "^3.20.0", "@tiptap/extension-horizontal-rule": "^3.20.0", "@tiptap/extension-italic": "^3.20.0", "@tiptap/extension-link": "^3.20.0", "@tiptap/extension-list": "^3.20.0", "@tiptap/extension-list-item": "^3.20.0", "@tiptap/extension-list-keymap": "^3.20.0", "@tiptap/extension-ordered-list": "^3.20.0", "@tiptap/extension-paragraph": "^3.20.0", "@tiptap/extension-strike": "^3.20.0", "@tiptap/extension-text": "^3.20.0", "@tiptap/extension-underline": "^3.20.0", "@tiptap/extensions": "^3.20.0", "@tiptap/pm": "^3.20.0" } }, "sha512-W4+1re35pDNY/7rpXVg+OKo/Fa4Gfrn08Bq3E3fzlJw6gjE3tYU8dY9x9vC2rK9pd9NOp7Af11qCFDaWpohXkw=="],
+
"@tokenizer/token": ["@tokenizer/[email protected]", "", {}, "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="],
"@tsconfig/node10": ["@tsconfig/[email protected]", "", {}, "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ=="],
@@ -808,14 +976,6 @@
"@turf/rewind": ["@turf/[email protected]", "", { "dependencies": { "@turf/boolean-clockwise": "^5.1.5", "@turf/clone": "^5.1.5", "@turf/helpers": "^5.1.5", "@turf/invariant": "^5.1.5", "@turf/meta": "^5.1.5" } }, "sha512-Gdem7JXNu+G4hMllQHXRFRihJl3+pNl7qY+l4qhQFxq+hiU1cQoVFnyoleIqWKIrdK/i2YubaSwc3SCM7N5mMw=="],
- "@types/babel__core": ["@types/[email protected]", "", { "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA=="],
-
- "@types/babel__generator": ["@types/[email protected]", "", { "dependencies": { "@babel/types": "^7.0.0" } }, "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg=="],
-
- "@types/babel__template": ["@types/[email protected]", "", { "dependencies": { "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0" } }, "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A=="],
-
- "@types/babel__traverse": ["@types/[email protected]", "", { "dependencies": { "@babel/types": "^7.28.2" } }, "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q=="],
-
"@types/brotli": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-cKYjgaS2DMdCKF7R0F5cgx1nfBYObN2ihIuPGQ4/dlIY6RpV7OWNwe9L8V4tTVKL2eZqOkNM9FM/rgTvLf4oXw=="],
"@types/crypto-js": ["@types/[email protected]", "", {}, "sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ=="],
@@ -888,6 +1048,8 @@
"@types/dompurify": ["@types/[email protected]", "", { "dependencies": { "dompurify": "*" } }, "sha512-Fgg31wv9QbLDA0SpTOXO3MaxySc4DKGLi8sna4/Utjo4r3ZRPdCt4UQee8BWr+Q5z21yifghREPJGYaEOEIACg=="],
+ "@types/esrecurse": ["@types/[email protected]", "", {}, "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw=="],
+
"@types/estree": ["@types/[email protected]", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
"@types/geojson": ["@types/[email protected]", "", {}, "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg=="],
@@ -898,14 +1060,22 @@
"@types/jmespath": ["@types/[email protected]", "", {}, "sha512-pegh49FtNsC389Flyo9y8AfkVIZn9MMPE9yJrO9svhq6Fks2MwymULWjZqySuxmctd3ZH4/n7Mr98D+1Qo5vGA=="],
+ "@types/json-schema": ["@types/[email protected]", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="],
+
"@types/jsonpath": ["@types/[email protected]", "", {}, "sha512-K3hxB8Blw0qgW6ExKgMbXQv2UPZBoE2GqLpVY+yr7nMD2Pq86lsuIzyAaiQ7eMqFL5B6di6pxSkogLJEyEHoGA=="],
"@types/katex": ["@types/[email protected]", "", {}, "sha512-trgaNyfU+Xh2Tc+ABIb44a5AYUpicB3uwirOioeOkNPPbmgRNtcWyDeeFRzjPZENO9Vq8gvVqfhaaXWLlevVwg=="],
+ "@types/linkify-it": ["@types/[email protected]", "", {}, "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q=="],
+
"@types/mapbox__point-geometry": ["@types/[email protected]", "", {}, "sha512-mUWlSxAmYLfwnRBmgYV86tgYmMIICX4kza8YnE/eIlywGe2XoOxlpVnXWwir92xRLjwyarqwpu2EJKD2pk0IUA=="],
"@types/mapbox__vector-tile": ["@types/[email protected]", "", { "dependencies": { "@types/geojson": "*", "@types/mapbox__point-geometry": "*", "@types/pbf": "*" } }, "sha512-bpd8dRn9pr6xKvuEBQup8pwQfD4VUyqO/2deGjfpe6AwC8YRlyEipvefyRJUSiCJTZuCb8Pl1ciVV5ekqJ96Bg=="],
+ "@types/markdown-it": ["@types/[email protected]", "", { "dependencies": { "@types/linkify-it": "^5", "@types/mdurl": "^2" } }, "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog=="],
+
+ "@types/mdurl": ["@types/[email protected]", "", {}, "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg=="],
+
"@types/minimatch": ["@types/[email protected]", "", {}, "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ=="],
"@types/ms": ["@types/[email protected]", "", {}, "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA=="],
@@ -950,6 +1120,26 @@
"@types/ws": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="],
+ "@typescript-eslint/eslint-plugin": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/type-utils": "8.56.1", "@typescript-eslint/utils": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.56.1", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A=="],
+
+ "@typescript-eslint/parser": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/types": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1", "debug": "^4.4.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg=="],
+
+ "@typescript-eslint/project-service": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.56.1", "@typescript-eslint/types": "^8.56.1", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-TAdqQTzHNNvlVFfR+hu2PDJrURiwKsUvxFn1M0h95BB8ah5jejas08jUWG4dBA68jDMI988IvtfdAI53JzEHOQ=="],
+
+ "@typescript-eslint/scope-manager": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1" } }, "sha512-YAi4VDKcIZp0O4tz/haYKhmIDZFEUPOreKbfdAN3SzUDMcPhJ8QI99xQXqX+HoUVq8cs85eRKnD+rne2UAnj2w=="],
+
+ "@typescript-eslint/tsconfig-utils": ["@typescript-eslint/[email protected]", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-qOtCYzKEeyr3aR9f28mPJqBty7+DBqsdd63eO0yyDwc6vgThj2UjWfJIcsFeSucYydqcuudMOprZ+x1SpF3ZuQ=="],
+
+ "@typescript-eslint/type-utils": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1", "@typescript-eslint/utils": "8.56.1", "debug": "^4.4.3", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-yB/7dxi7MgTtGhZdaHCemf7PuwrHMenHjmzgUW1aJpO+bBU43OycnM3Wn+DdvDO/8zzA9HlhaJ0AUGuvri4oGg=="],
+
+ "@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-dbMkdIUkIkchgGDIv7KLUpa0Mda4IYjo4IAMJUZ+3xNoUXxMsk9YtKpTHSChRS85o+H9ftm51gsK1dZReY9CVw=="],
+
+ "@typescript-eslint/typescript-estree": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/project-service": "8.56.1", "@typescript-eslint/tsconfig-utils": "8.56.1", "@typescript-eslint/types": "8.56.1", "@typescript-eslint/visitor-keys": "8.56.1", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-qzUL1qgalIvKWAf9C1HpvBjif+Vm6rcT5wZd4VoMb9+Km3iS3Cv9DY6dMRMDtPnwRAFyAi7YXJpTIEXLvdfPxg=="],
+
+ "@typescript-eslint/utils": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/types": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-HPAVNIME3tABJ61siYlHzSWCGtOoeP2RTIaHXFMPqjrQKCGB9OgUVdiNgH7TJS2JNIQ5qQ4RsAUDuGaGme/KOA=="],
+
+ "@typescript-eslint/visitor-keys": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.56.1", "eslint-visitor-keys": "^5.0.0" } }, "sha512-KiROIzYdEV85YygXw6BI/Dx4fnBlFQu6Mq4QE4MOH9fFnhohw6wX/OAvDY2/C+ut0I3RSPKenvZJIVYqJNkhEw=="],
+
"@vaadin/a11y-base": ["@vaadin/[email protected]", "", { "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "^3.0.0", "@vaadin/component-base": "~24.9.9", "lit": "^3.0.0" } }, "sha512-Rsys+PJJer0HH4TjWSQoIitp6byxPpPjTDsA9ZGjxAip1EhkSQnVAA8OX3bP/0xtiyykwP13SaJKfqdNOZn2QA=="],
"@vaadin/checkbox": ["@vaadin/[email protected]", "", { "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "^3.0.0", "@vaadin/a11y-base": "~24.9.9", "@vaadin/component-base": "~24.9.9", "@vaadin/field-base": "~24.9.9", "@vaadin/vaadin-lumo-styles": "~24.9.9", "@vaadin/vaadin-material-styles": "~24.9.9", "@vaadin/vaadin-themable-mixin": "~24.9.9", "lit": "^3.0.0" } }, "sha512-IrMpe0trEadfI590MruzW4rmX1XJKDoX68l/Sf0q2cToUOqOsVfsGA4wJPpjOZZtndY2oyk9slVrkA3GsTiqrg=="],
@@ -982,10 +1172,12 @@
"@vis.gl/react-maplibre": ["@vis.gl/[email protected]", "", { "dependencies": { "@maplibre/maplibre-gl-style-spec": "^19.2.1" }, "peerDependencies": { "maplibre-gl": ">=4.0.0", "react": ">=16.3.0", "react-dom": ">=16.3.0" }, "optionalPeers": ["maplibre-gl"] }, "sha512-PkAK/gp3mUfhCLhUuc+4gc3PN9zCtVGxTF2hB6R5R5yYUw+hdg84OZ770U5MU4tPMTCG6fbduExuIW6RRKN6qQ=="],
- "@vitejs/plugin-react": ["@vitejs/[email protected]", "", { "dependencies": { "@babel/core": "^7.28.0", "@babel/plugin-transform-react-jsx-self": "^7.27.1", "@babel/plugin-transform-react-jsx-source": "^7.27.1", "@rolldown/pluginutils": "1.0.0-beta.27", "@types/babel__core": "^7.20.5", "react-refresh": "^0.17.0" }, "peerDependencies": { "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA=="],
+ "@vitejs/plugin-react-swc": ["@vitejs/[email protected]", "", { "dependencies": { "@rolldown/pluginutils": "1.0.0-rc.2", "@swc/core": "^1.15.11" }, "peerDependencies": { "vite": "^4 || ^5 || ^6 || ^7" } }, "sha512-QIluDil2prhY1gdA3GGwxZzTAmLdi8cQ2CcuMW4PB/Wu4e/1pzqrwhYWVd09LInCRlDUidQjd0B70QWbjWtLxA=="],
"@webcomponents/shadycss": ["@webcomponents/[email protected]", "", {}, "sha512-vRq+GniJAYSBmTRnhCYPAPq6THYqovJ/gzGThWbgEZUQaBccndGTi1hdiUP15HzEco0I6t4RCtXyX0rsSmwgPw=="],
+ "@xmldom/xmldom": ["@xmldom/[email protected]", "", {}, "sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw=="],
+
"@zip.js/zip.js": ["@zip.js/[email protected]", "", {}, "sha512-BZ7OyJLA5cjYwf2jVjvZCK10swzIc6sDOLpkPjJXfXgx/IHF5y61PyL3Ko5/q3bUU5GvIhk6tzKDUcDJ7rhzbg=="],
"a5-js": ["[email protected]", "", { "dependencies": { "gl-matrix": "^3.4.3" } }, "sha512-VAw19sWdYadhdovb0ViOIi1SdKx6H6LwcGMRFKwMfgL5gcmL/1fKJHfgsNgNaJ7xC/eEyjs6VK+VVd4N0a+peg=="],
@@ -998,6 +1190,8 @@
"acorn": ["[email protected]", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="],
+ "acorn-jsx": ["[email protected]", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="],
+
"acorn-walk": ["[email protected]", "", { "dependencies": { "acorn": "^8.11.0" } }, "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g=="],
"adler-32": ["[email protected]", "", {}, "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A=="],
@@ -1008,6 +1202,8 @@
"agentkeepalive": ["[email protected]", "", { "dependencies": { "humanize-ms": "^1.2.1" } }, "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ=="],
+ "ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw=="],
+
"ansi-regex": ["[email protected]", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
"ansi-styles": ["[email protected]", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="],
@@ -1018,7 +1214,7 @@
"arg": ["[email protected]", "", {}, "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="],
- "argparse": ["[email protected]", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="],
+ "argparse": ["[email protected]", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="],
"aria-hidden": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.0" } }, "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA=="],
@@ -1048,7 +1244,7 @@
"b4a": ["[email protected]", "", { "peerDependencies": { "react-native-b4a": "*" }, "optionalPeers": ["react-native-b4a"] }, "sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q=="],
- "balanced-match": ["[email protected]", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
+ "balanced-match": ["[email protected]", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
"bare-events": ["[email protected]", "", { "peerDependencies": { "bare-abort-controller": "*" }, "optionalPeers": ["bare-abort-controller"] }, "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ=="],
@@ -1074,11 +1270,13 @@
"bl": ["[email protected]", "", { "dependencies": { "readable-stream": "^2.3.5", "safe-buffer": "^5.1.1" } }, "sha512-6Pesp1w0DEX1N550i/uGV/TqucVL4AM/pgThFSN/Qq9si1/DF9aIHs1BxD8V/QU0HoeHO6cQRTAuYnLPKq1e4g=="],
+ "bluebird": ["[email protected]", "", {}, "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA=="],
+
"bn.js": ["[email protected]", "", {}, "sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw=="],
"boolbase": ["[email protected]", "", {}, "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="],
- "brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="],
+ "brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-fy6KJm2RawA5RcHkLa1z/ScpBeA762UF9KmZQxwIbDtRJrgLzM10depAiEQ+CXYcoiqW1/m96OAAoke2nE9EeA=="],
"broccoli-node-api": ["[email protected]", "", {}, "sha512-QIqLSVJWJUVOhclmkmypJJH9u9s/aWH4+FH6Q6Ju5l+Io4dtwqdPUNmDfw40o6sxhbZHhqGujDJuHTML1wG8Yw=="],
@@ -1094,6 +1292,8 @@
"browser-resolve": ["[email protected]", "", { "dependencies": { "resolve": "^1.17.0" } }, "sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ=="],
+ "browser-split": ["[email protected]", "", {}, "sha512-JhvgRb2ihQhsljNda3BI8/UcRHVzrVwo3Q+P8vDtSiyobXuFpuZ9mq+MbRGMnC22CjW3RrfXdg6j6ITX8M+7Ow=="],
+
"browserify-aes": ["[email protected]", "", { "dependencies": { "buffer-xor": "^1.0.3", "cipher-base": "^1.0.0", "create-hash": "^1.1.0", "evp_bytestokey": "^1.0.3", "inherits": "^2.0.1", "safe-buffer": "^5.0.1" } }, "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA=="],
"browserify-cipher": ["[email protected]", "", { "dependencies": { "browserify-aes": "^1.0.4", "browserify-des": "^1.0.0", "evp_bytestokey": "^1.0.0" } }, "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w=="],
@@ -1132,7 +1332,9 @@
"camelcase": ["[email protected]", "", {}, "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA=="],
- "caniuse-lite": ["[email protected]", "", {}, "sha512-Pzfx9fOKoKvevQf8oCXoyNRQ5QyxJj+3O0Rqx2V5oxT61KGx8+n6hV/IUyJeifUci2clnmmKVpvtiqRzgiWjSw=="],
+ "camelize": ["[email protected]", "", {}, "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ=="],
+
+ "caniuse-lite": ["[email protected]", "", {}, "sha512-DDdwPGz99nmIEv216hKSgLD+D4ikHQHjBC/seF98N9CPqRX4M5mSxT9eTV6oyisnJcuzxtZy4n17yKKQYmYQOA=="],
"canvas-fit": ["[email protected]", "", { "dependencies": { "element-size": "^1.1.1" } }, "sha512-onIcjRpz69/Hx5bB5HGbYKUF2uC6QT6Gp+pfpGm3A7mPfcluSLV5v4Zu+oflDUwLdUw0rLIBhUbi0v8hM4FJQQ=="],
@@ -1208,6 +1410,8 @@
"concat-stream": ["[email protected]", "", { "dependencies": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^2.2.2", "typedarray": "^0.0.6" } }, "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw=="],
+ "concat-typed-array": ["[email protected]", "", {}, "sha512-aC878bxeWSlrY6h60cCDwBUXpKwovZrB7+C4+VHNO1CIXW2gBLxbQ757jWtOXUscLGgYI8R84N6uy9fTJPe+0g=="],
+
"console-browserify": ["[email protected]", "", {}, "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA=="],
"console-table-printer": ["[email protected]", "", { "dependencies": { "simple-wcswidth": "^1.1.2" } }, "sha512-SrhBq4hYVjLCkBVOWaTzceJalvn5K1Zq5aQA6wXC/cYjI3frKWNPEMK3sZsJfNNQApvCQmgBcc13ZKmFj8qExw=="],
@@ -1236,6 +1440,8 @@
"create-require": ["[email protected]", "", {}, "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="],
+ "crelt": ["[email protected]", "", {}, "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g=="],
+
"cross-env": ["[email protected]", "", { "dependencies": { "@epic-web/invariant": "^1.0.0", "cross-spawn": "^7.0.6" }, "bin": { "cross-env": "dist/bin/cross-env.js", "cross-env-shell": "dist/bin/cross-env-shell.js" } }, "sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw=="],
"cross-fetch": ["[email protected]", "", { "dependencies": { "node-fetch": "^2.6.12" } }, "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g=="],
@@ -1246,6 +1452,8 @@
"crypto-browserify": ["[email protected]", "", { "dependencies": { "browserify-cipher": "^1.0.1", "browserify-sign": "^4.2.3", "create-ecdh": "^4.0.4", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", "diffie-hellman": "^5.0.3", "hash-base": "~3.0.4", "inherits": "^2.0.4", "pbkdf2": "^3.1.2", "public-encrypt": "^4.0.3", "randombytes": "^2.1.0", "randomfill": "^1.0.4" } }, "sha512-r4ESw/IlusD17lgQi1O20Fa3qNnsckR126TdUuBgAu7GBYSIPvdNyONd3Zrxh0xCwA4+6w/TDArBPsMvhur+KQ=="],
+ "crypto-es": ["[email protected]", "", {}, "sha512-UUqiVJ2gUuZFmbFsKmud3uuLcNP2+Opt+5ysmljycFCyhA0+T16XJmo1ev/t5kMChMqWh7IEvURNCqsg+SjZGQ=="],
+
"crypto-js": ["[email protected]", "", {}, "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="],
"css-font": ["[email protected]", "", { "dependencies": { "css-font-size-keywords": "^1.0.0", "css-font-stretch-keywords": "^1.0.1", "css-font-style-keywords": "^1.0.1", "css-font-weight-keywords": "^1.0.0", "css-global-keywords": "^1.0.1", "css-system-font-keywords": "^1.0.0", "pick-by-alias": "^1.2.0", "string-split-by": "^1.0.0", "unquote": "^1.1.0" } }, "sha512-V4U4Wps4dPDACJ4WpgofJ2RT5Yqwe1lEH6wlOOaIxMi0gTjdIijsc5FmxQlZ7ZZyKQkkutqqvULOp07l9c7ssA=="],
@@ -1350,6 +1558,8 @@
"d3-zoom": ["[email protected]", "", { "dependencies": { "d3-dispatch": "1 - 3", "d3-drag": "2 - 3", "d3-interpolate": "1 - 3", "d3-selection": "2 - 3", "d3-transition": "2 - 3" } }, "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw=="],
+ "danmu.js": ["[email protected]", "", { "dependencies": { "event-emitter": "^0.3.5" } }, "sha512-evDEImUBo94c846fC92K//Dzll8jXnZ3zKmYlQHwMzmvw6IW2IyjWL3Ew2SqEAzuqauFnDkwJEgZauu3uW/p1Q=="],
+
"date-fns": ["[email protected]", "", {}, "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg=="],
"date-fns-jalali": ["[email protected]", "", {}, "sha512-hTIP/z+t+qKwBDcmmsnmjWTduxCg+5KfdqWQvb2X/8C9+knYY6epN/pfxdDuyVlSVeFz0sM5eEfwIUQ70U4ckg=="],
@@ -1384,6 +1594,8 @@
"delayed-stream": ["[email protected]", "", {}, "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="],
+ "delegate": ["[email protected]", "", {}, "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="],
+
"des.js": ["[email protected]", "", { "dependencies": { "inherits": "^2.0.1", "minimalistic-assert": "^1.0.0" } }, "sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg=="],
"detect-kerning": ["[email protected]", "", {}, "sha512-I3JIbrnKPAntNLl1I6TpSQQdQ4AutYzv/sKMFKbepawV/hlH0GmYKhUoOEMd4xqaUHT+Bm0f4127lh5qs1m1tw=="],
@@ -1398,10 +1610,16 @@
"diffie-hellman": ["[email protected]", "", { "dependencies": { "bn.js": "^4.1.0", "miller-rabin": "^4.0.0", "randombytes": "^2.0.0" } }, "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg=="],
+ "dingbat-to-unicode": ["[email protected]", "", {}, "sha512-98l0sW87ZT58pU4i61wa2OHwxbiYSbuxsCBozaVnYX2iCnr3bLM3fIes1/ej7h1YdOKuKt/MLs706TVnALA65w=="],
+
+ "docx-preview": ["[email protected]", "", { "dependencies": { "jszip": ">=3.0.0" } }, "sha512-Lav69CTA/IYZPJTsKH7oYeoZjyg96N0wEJMNslGJnZJ+dMUZK85Lt5ASC79yUlD48ecWjuv+rkcmFt6EVPV0Xg=="],
+
"dom-helpers": ["[email protected]", "", { "dependencies": { "@babel/runtime": "^7.8.7", "csstype": "^3.0.2" } }, "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA=="],
"dom-serializer": ["[email protected]", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.2", "entities": "^4.2.0" } }, "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg=="],
+ "dom-walk": ["[email protected]", "", {}, "sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w=="],
+
"domain-browser": ["[email protected]", "", {}, "sha512-IGBwjF7tNk3cwypFNH/7bfzBcgSCbaMOD3GsaY1AU/JRrnHnYgEM0+9kQt52iZxjNsjBtJYtao146V+f8jFZNw=="],
"domelementtype": ["[email protected]", "", {}, "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw=="],
@@ -1414,6 +1632,8 @@
"dotenv": ["[email protected]", "", {}, "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow=="],
+ "downloadjs": ["[email protected]", "", {}, "sha512-LN1gO7+u9xjU5oEScGFKvXhYf7Y/empUIIEAGBs1LzUq/rg5duiDrkuH5A2lQGd5jfMOb9X9usDa2oVXwJ0U/Q=="],
+
"draco3d": ["[email protected]", "", {}, "sha512-m6WCKt/erDXcw+70IJXnG7M3awwQPAsZvJGX5zY7beBqpELw6RDGkYVU0W43AFxye4pDZ5i2Lbyc/NNGqwjUVQ=="],
"draw-svg-path": ["[email protected]", "", { "dependencies": { "abs-svg-path": "~0.1.1", "normalize-svg-path": "~0.1.0" } }, "sha512-P8j3IHxcgRMcY6sDzr0QvJDLzBnJJqpTG33UZ2Pvp8rw0apCHhJCWqYprqrXjrgHnJ6tuhP1iTJSAodPDHxwkg=="],
@@ -1422,6 +1642,8 @@
"dtype": ["[email protected]", "", {}, "sha512-s2YVcLKdFGS0hpFqJaTwscsyt0E8nNFdmo73Ocd81xNPj4URI4rj6D60A+vFMIw7BXWlb4yRkEwfBqcZzPGiZg=="],
+ "duck": ["[email protected]", "", { "dependencies": { "underscore": "^1.13.1" } }, "sha512-wkctla1O6VfP89gQ+J/yDesM0S7B7XLXjKGzXxMDVFg7uEn706niAtyYovKbyq1oT9YwDcly721/iUWoc8MVRg=="],
+
"dunder-proto": ["[email protected]", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
"dup": ["[email protected]", "", {}, "sha512-Bz5jxMMC0wgp23Zm15ip1x8IhYRqJvF3nFC0UInJUDkN1z4uNPk9jTnfCUJXbOGiQ1JbXLQsiV41Fb+HXcj5BA=="],
@@ -1434,7 +1656,7 @@
"ecdsa-sig-formatter": ["[email protected]", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ=="],
- "electron-to-chromium": ["[email protected]", "", {}, "sha512-1tEf0nLgltC3iy9wtlYDlQDc5Rg9lEKVjEmIHJ21rI9OcqkvD45K1oyNIRA4rR1z3LgJ7KeGzEBojVcV6m4qjA=="],
+ "electron-to-chromium": ["[email protected]", "", {}, "sha512-sM6HAN2LyK82IyPBpznDRqlTQAtuSaO+ShzFiWTvoMJLHyZ+Y39r8VMfHzwbU8MVBzQ4Wdn85+wlZl2TLGIlwg=="],
"element-size": ["[email protected]", "", {}, "sha512-eaN+GMOq/Q+BIWy0ybsgpcYImjGIdNLyjLFJU4XsLHXYQao5jCNb36GyN6C2qwmDDYSfIBmKpPpr4VnBdLCsPQ=="],
@@ -1460,10 +1682,14 @@
"ensure-posix-path": ["[email protected]", "", {}, "sha512-VWU0/zXzVbeJNXvME/5EmLuEj2TauvoaTz6aFYK1Z92JCBlDlZ3Gu0tuGR42kpW1754ywTs+QB0g5TP0oj9Zaw=="],
+ "ent": ["[email protected]", "", { "dependencies": { "call-bound": "^1.0.3", "es-errors": "^1.3.0", "punycode": "^1.4.1", "safe-regex-test": "^1.1.0" } }, "sha512-kKvD1tO6BM+oK9HzCPpUdRb4vKFQY/FPTFmurMvh6LlN68VMrdj77w8yp51/kDbpkFOS9J8w5W6zIzgM2H8/hw=="],
+
"entities": ["[email protected]", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="],
"eol": ["[email protected]", "", {}, "sha512-Ds/TEoZjwggRoz/Q2O7SE3i4Jm66mqTDfmdHdq/7DKVk3bro9Q8h6WdXKdPqFLMoqxrDK5SVRzHVPOS6uuGtrg=="],
+ "error": ["[email protected]", "", { "dependencies": { "camelize": "^1.0.0", "string-template": "~0.2.0", "xtend": "~4.0.0" } }, "sha512-SNDKualLUtT4StGFP7xNfuFybL2f6iJujFtrWuvJqGbVQGaN+adE23veqzPz1hjUjTunLi2EnJ+0SJxtbJreKw=="],
+
"es-define-property": ["[email protected]", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="],
"es-errors": ["[email protected]", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
@@ -1486,15 +1712,33 @@
"escalade": ["[email protected]", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
+ "escape-string-regexp": ["[email protected]", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="],
+
"escodegen": ["[email protected]", "", { "dependencies": { "esprima": "^4.0.1", "estraverse": "^4.2.0", "esutils": "^2.0.2", "optionator": "^0.8.1" }, "optionalDependencies": { "source-map": "~0.6.1" }, "bin": { "esgenerate": "bin/esgenerate.js", "escodegen": "bin/escodegen.js" } }, "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw=="],
+ "eslint": ["[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", "@eslint/config-array": "^0.23.2", "@eslint/config-helpers": "^0.5.2", "@eslint/core": "^1.1.0", "@eslint/plugin-kit": "^0.6.0", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^9.1.1", "eslint-visitor-keys": "^5.0.1", "espree": "^11.1.1", "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "minimatch": "^10.2.1", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-uYixubwmqJZH+KLVYIVKY1JQt7tysXhtj21WSvjcSmU5SVNzMus1bgLe+pAt816yQ8opKfheVVoPLqvVMGejYw=="],
+
+ "eslint-plugin-react-hooks": ["[email protected]", "", { "dependencies": { "@babel/core": "^7.24.4", "@babel/parser": "^7.24.4", "hermes-parser": "^0.25.1", "zod": "^3.25.0 || ^4.0.0", "zod-validation-error": "^3.5.0 || ^4.0.0" }, "peerDependencies": { "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" } }, "sha512-O0d0m04evaNzEPoSW+59Mezf8Qt0InfgGIBJnpC0h3NH/WjUAR7BIKUfysC6todmtiZ/A0oUVS8Gce0WhBrHsA=="],
+
+ "eslint-plugin-react-refresh": ["[email protected]", "", { "peerDependencies": { "eslint": "^9 || ^10" } }, "sha512-hmgTH57GfzoTFjVN0yBwTggnsVUF2tcqi7RJZHqi9lIezSs4eFyAMktA68YD4r5kNw1mxyY4dmkyoFDb3FIqrA=="],
+
+ "eslint-scope": ["[email protected]", "", { "dependencies": { "@types/esrecurse": "^4.3.1", "@types/estree": "^1.0.8", "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-GaUN0sWim5qc8KVErfPBWmc31LEsOkrUJbvJZV+xuL3u2phMUK4HIvXlWAakfC8W4nzlK+chPEAkYOYb5ZScIw=="],
+
+ "eslint-visitor-keys": ["[email protected]", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="],
+
"esniff": ["[email protected]", "", { "dependencies": { "d": "^1.0.1", "es5-ext": "^0.10.62", "event-emitter": "^0.3.5", "type": "^2.7.2" } }, "sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg=="],
+ "espree": ["[email protected]", "", { "dependencies": { "acorn": "^8.16.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^5.0.1" } }, "sha512-AVHPqQoZYc+RUM4/3Ly5udlZY/U4LS8pIG05jEjWM2lQMU/oaZ7qshzAl2YP1tfNmXfftH3ohurfwNAug+MnsQ=="],
+
"esprima": ["[email protected]", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-+JpPZam9w5DuJ3Q67SqsMGtiHKENSMRVoxvArfJZK01/BfLEObtZ6orJa/MtoGNR/rfMgp5837T41PAmTwAv/A=="],
+ "esquery": ["[email protected]", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g=="],
+
+ "esrecurse": ["[email protected]", "", { "dependencies": { "estraverse": "^5.2.0" } }, "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag=="],
+
"esri-loader": ["[email protected]", "", {}, "sha512-cB1Sw9EQjtW4mtT7eFBjn/6VaaIWNTjmTd2asnnEyuZk1xVSFRMCfLZSBSjZM7ZarDcVu5WIjOP0t0MYVu4hVQ=="],
- "estraverse": ["[email protected]", "", {}, "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="],
+ "estraverse": ["[email protected]", "", {}, "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="],
"estree-walker": ["[email protected]", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],
@@ -1502,6 +1746,8 @@
"ethers": ["[email protected]", "", { "dependencies": { "@adraffy/ens-normalize": "1.10.1", "@noble/curves": "1.2.0", "@noble/hashes": "1.3.2", "@types/node": "22.7.5", "aes-js": "4.0.0-beta.5", "tslib": "2.7.0", "ws": "8.17.1" } }, "sha512-U1wulmetNymijEhpSEQ7Ct/P/Jw9/e7R1j5XIbPRydgV2DjLVMsULDlNksq3RQnFgKoLlZf88ijYtWEXcPa07A=="],
+ "ev-store": ["[email protected]", "", { "dependencies": { "individual": "^3.0.0" } }, "sha512-otazchNRnGzp2YarBJ+GXKVGvhxVATB1zmaStxJBYet0Dyq7A9VhH8IUEB/gRcL6Ch52lfpgPTRJ2m49epyMsQ=="],
+
"event-emitter": ["[email protected]", "", { "dependencies": { "d": "1", "es5-ext": "~0.10.14" } }, "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA=="],
"event-target-shim": ["[email protected]", "", {}, "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="],
@@ -1526,12 +1772,16 @@
"fancy-canvas": ["[email protected]", "", {}, "sha512-nifxXJ95JNLFR2NgRV4/MxVP45G9909wJTEKz5fg/TZS20JJZA6hfgRVh/bC9bwl2zBtBNcYPjiBE4njQHVBwQ=="],
- "fast-equals": ["[email protected]", "", {}, "sha512-G3BSX9cfKttjr+2o1O22tYMLq0DPluZnYtq1rXumE1SpL/F/SLIfHx08WYQoWSIpeMYf8sRbJ8++71+v6Pnxfg=="],
+ "fast-deep-equal": ["[email protected]", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="],
+
+ "fast-equals": ["[email protected]", "", {}, "sha512-/boTcHZeIAQ2r/tL11voclBHDeP9WPxLt+tyAbVSyyXuUFyh0Tne7gJZTqGbxnvj79TjLdCXLOY7UIPhyG5MTw=="],
"fast-fifo": ["[email protected]", "", {}, "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ=="],
"fast-isnumeric": ["[email protected]", "", { "dependencies": { "is-string-blank": "^1.0.1" } }, "sha512-1mM8qOr2LYz8zGaUdmiqRDiuue00Dxjgcb1NQR7TnhLVh6sQyngP9xvLo7Sl7LZpP/sk5eb+bcyWXw530NTBZw=="],
+ "fast-json-stable-stringify": ["[email protected]", "", {}, "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="],
+
"fast-levenshtein": ["[email protected]", "", {}, "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="],
"fast-xml-parser": ["[email protected]", "", { "dependencies": { "strnum": "^1.1.1" }, "bin": { "fxparser": "src/cli/cli.js" } }, "sha512-RKihhV+SHsIUGXObeVy9AXiBbFwkVk7Syp8XgwN5U3JV416+Gwp/GO9i0JYKmikykgz/UHRrrV4ROuZEo/T0ig=="],
@@ -1542,6 +1792,8 @@
"fflate": ["[email protected]", "", {}, "sha512-5u2V/CDW15QM1XbbgS+0DfPxVB+jUKhWEKuuFuHncbk3tEEqzmoXL+2KyOFuKGqOnmdIy0/davWF1CkuwtibCw=="],
+ "file-entry-cache": ["[email protected]", "", { "dependencies": { "flat-cache": "^4.0.0" } }, "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ=="],
+
"file-type": ["[email protected]", "", { "dependencies": { "readable-web-to-node-stream": "^3.0.0", "strtok3": "^6.2.4", "token-types": "^4.1.1" } }, "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw=="],
"file-uri-to-path": ["[email protected]", "", {}, "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="],
@@ -1550,8 +1802,12 @@
"flat": ["[email protected]", "", { "bin": { "flat": "cli.js" } }, "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ=="],
+ "flat-cache": ["[email protected]", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" } }, "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw=="],
+
"flatpickr": ["[email protected]", "", {}, "sha512-97PMG/aywoYpB4IvbvUJi0RQi8vearvU0oov1WW3k0WZPBMrTQVqekSX5CjSG/M4Q3i6A/0FKXC7RyAoAUUSPw=="],
+ "flatted": ["[email protected]", "", {}, "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg=="],
+
"flatten-vertex-data": ["[email protected]", "", { "dependencies": { "dtype": "^2.0.0" } }, "sha512-BvCBFK2NZqerFTdMDgqfHBwxYWnxeCkwONsw6PvBMcUXqo8U/KDWwmXhqx1x2kLIg7DqIsJfOaJFOmlua3Lxuw=="],
"focus-trap": ["[email protected]", "", { "dependencies": { "tabbable": "^6.4.0" } }, "sha512-/yNdlIkpWbM0ptxno3ONTuf+2g318kh2ez3KSeZN5dZ8YC6AAmgeWz+GasYYiBJPFaYcSAPeu4GfhUaChzIJXA=="],
@@ -1632,6 +1888,8 @@
"glob-stream": ["[email protected]", "", { "dependencies": { "@gulpjs/to-absolute-glob": "^4.0.0", "anymatch": "^3.1.3", "fastq": "^1.13.0", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", "is-negated-glob": "^1.0.0", "normalize-path": "^3.0.0", "streamx": "^2.12.5" } }, "sha512-fqZVj22LtFJkHODT+M4N1RJQ3TjnnQhfE9GwZI8qXscYarnhpip70poMldRnP8ipQ/w0B621kOhfc53/J9bd/A=="],
+ "global": ["[email protected]", "", { "dependencies": { "min-document": "^2.19.0", "process": "^0.11.10" } }, "sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w=="],
+
"global-prefix": ["[email protected]", "", { "dependencies": { "ini": "^4.1.3", "kind-of": "^6.0.3", "which": "^4.0.0" } }, "sha512-w0Uf9Y9/nyHinEk5vMJKRie+wa4kR5hmDbEhGGds/kG1PwGLLHKRoNMeJOyCQjjBkANlnScqgzcFwGHgmgLkVA=="],
"glsl-inject-defines": ["[email protected]", "", { "dependencies": { "glsl-token-inject-block": "^1.0.0", "glsl-token-string": "^1.0.1", "glsl-tokenizer": "^2.0.2" } }, "sha512-W49jIhuDtF6w+7wCMcClk27a2hq8znvHtlGnrYkSWEr8tHe9eA2dcnohlcAmxLYBSpSSdzOkRdyPTrx9fw49+A=="],
@@ -1706,10 +1964,20 @@
"heimdalljs-logger": ["[email protected]", "", { "dependencies": { "debug": "^2.2.0", "heimdalljs": "^0.2.6" } }, "sha512-pO++cJbhIufVI/fmB/u2Yty3KJD0TqNPecehFae0/eps0hkZ3b4Zc/PezUMOpYuHFQbA7FxHZxa305EhmjLj4g=="],
+ "hermes-estree": ["[email protected]", "", {}, "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw=="],
+
+ "hermes-parser": ["[email protected]", "", { "dependencies": { "hermes-estree": "0.25.1" } }, "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA=="],
+
"hmac-drbg": ["[email protected]", "", { "dependencies": { "hash.js": "^1.0.3", "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.1" } }, "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg=="],
+ "html-entities": ["[email protected]", "", {}, "sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ=="],
+
"html-parse-stringify": ["[email protected]", "", { "dependencies": { "void-elements": "3.1.0" } }, "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg=="],
+ "html-to-docx": ["[email protected]", "", { "dependencies": { "@oozcitak/dom": "1.15.6", "@oozcitak/util": "8.3.4", "color-name": "^1.1.4", "html-entities": "^2.3.3", "html-to-vdom": "^0.7.0", "image-size": "^1.0.0", "image-to-base64": "^2.2.0", "jszip": "^3.7.1", "lodash": "^4.17.21", "mime-types": "^2.1.35", "nanoid": "^3.1.25", "virtual-dom": "^2.1.1", "xmlbuilder2": "2.1.2" } }, "sha512-IiMBWIqXM4+cEsW//RKoonWV7DlXAJBmmKI73XJSVWTIXjGUaxSr2ck1jqzVRZknpvO8xsFnVicldKVAWrBYBA=="],
+
+ "html-to-vdom": ["[email protected]", "", { "dependencies": { "ent": "^2.0.0", "htmlparser2": "^3.8.2" } }, "sha512-k+d2qNkbx0JO00KezQsNcn6k2I/xSBP4yXYFLvXbcasTTDh+RDLUJS3puxqyNnpdyXWRHFGoKU7cRmby8/APcQ=="],
+
"htmlparser2": ["[email protected]", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", "domutils": "^3.2.1", "entities": "^6.0.0" } }, "sha512-TwAZM+zE5Tq3lrEHvOlvwgj1XLWQCtaaibSN11Q+gGBAS7Y1uZSWwXXRe4iF6OXnaq1riyQAPFOBtYc77Mxq0g=="],
"http-proxy-agent": ["[email protected]", "", { "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" } }, "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig=="],
@@ -1736,12 +2004,20 @@
"ieee754": ["[email protected]", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
- "image-size": ["[email protected]", "", { "bin": { "image-size": "bin/image-size.js" } }, "sha512-Hiyv+mXHfFEP7LzUL/llg9RwFxxY+o9N3JVLIeG5E7iFIFAalxvRU9UZthBdYDEVnzHMgjnKJPPpay5BWf1g9g=="],
+ "ignore": ["[email protected]", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
+
+ "image-size": ["[email protected]", "", { "dependencies": { "queue": "6.0.2" }, "bin": { "image-size": "bin/image-size.js" } }, "sha512-rH+46sQJ2dlwfjfhCyNx5thzrv+dtmBIhPHk0zgRUukHzZ/kRueTJXoYYsclBaKcSMBWuGbOFXtioLpzTb5euw=="],
+
+ "image-to-base64": ["[email protected]", "", { "dependencies": { "node-fetch": "^2.6.0" } }, "sha512-Z+aMwm/91UOQqHhrz7Upre2ytKhWejZlWV/JxUTD1sT7GWWKFDJUEV5scVQKnkzSgPHFuQBUEWcanO+ma0PSVw=="],
"immediate": ["[email protected]", "", {}, "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="],
"immer": ["[email protected]", "", {}, "sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA=="],
+ "imurmurhash": ["[email protected]", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="],
+
+ "individual": ["[email protected]", "", {}, "sha512-rUY5vtT748NMRbEMrTNiFfy29BgGZwGXUi2NFUVMWQrogSLzlJvQV9eeMWi+g1aVaQ53tpyLAQtd5x/JH0Nh1g=="],
+
"inflight": ["[email protected]", "", { "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA=="],
"inherits": ["[email protected]", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
@@ -1794,6 +2070,8 @@
"is-obj": ["[email protected]", "", {}, "sha512-l4RyHgRqGN4Y3+9JHVrNqO+tN0rV5My76uW5/nuO4K1b6vw5G8d/cmFjP9tRfEsdhZNt0IFdZuK/c2Vr4Nb+Qg=="],
+ "is-object": ["[email protected]", "", {}, "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA=="],
+
"is-plain-obj": ["[email protected]", "", {}, "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg=="],
"is-plain-object": ["[email protected]", "", { "dependencies": { "isobject": "^3.0.1" } }, "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og=="],
@@ -1836,8 +2114,14 @@
"jsesc": ["[email protected]", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="],
+ "json-buffer": ["[email protected]", "", {}, "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="],
+
"json-schema-to-ts": ["[email protected]", "", { "dependencies": { "@babel/runtime": "^7.18.3", "ts-algebra": "^2.0.0" } }, "sha512-+DWg8jCJG2TEnpy7kOm/7/AxaYoaRbjVB4LFZLySZlWn8exGs3A4OLJR966cVvU26N7X9TWxl+Jsw7dzAqKT6g=="],
+ "json-schema-traverse": ["[email protected]", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
+
+ "json-stable-stringify-without-jsonify": ["[email protected]", "", {}, "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw=="],
+
"json-stringify-pretty-compact": ["[email protected]", "", {}, "sha512-3CNZ2DnrpByG9Nqj6Xo8vqbjT4F6N+tb4Gb28ESAZjYZ5yqvmc56J+/kuIwkaAMOyblTQhUW7PxMkUb8Q36N3Q=="],
"json5": ["[email protected]", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="],
@@ -1864,6 +2148,8 @@
"kdbush": ["[email protected]", "", {}, "sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA=="],
+ "keyv": ["[email protected]", "", { "dependencies": { "json-buffer": "3.0.1" } }, "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw=="],
+
"kind-of": ["[email protected]", "", {}, "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="],
"ktx-parse": ["[email protected]", "", {}, "sha512-FeA3g56ksdFNwjXJJsc1CCc7co+AJYDp6ipIp878zZ2bU8kWROatLYf39TQEd4/XRSUvBXovQ8gaVKWPXsCLEQ=="],
@@ -1874,7 +2160,7 @@
"lead": ["[email protected]", "", {}, "sha512-DpMa59o5uGUWWjruMp71e6knmwKU3jRBBn1kjuLWN9EeIOxNeSAwvHf03WIl8g/ZMR2oSQC9ej3yeLBwdDc/pg=="],
- "levn": ["[email protected]", "", { "dependencies": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" } }, "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA=="],
+ "levn": ["[email protected]", "", { "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" } }, "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ=="],
"libphonenumber-js": ["[email protected]", "", {}, "sha512-r9kw4OA6oDO4dPXkOrXTkArQAafIKAU71hChInV4FxZ69dxCfbwQGDPzqR5/vea94wU705/3AZroEbSoeVWrQw=="],
@@ -1908,6 +2194,10 @@
"lilconfig": ["[email protected]", "", {}, "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw=="],
+ "linkify-it": ["[email protected]", "", { "dependencies": { "uc.micro": "^2.0.0" } }, "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ=="],
+
+ "linkifyjs": ["[email protected]", "", {}, "sha512-NT1CJtq3hHIreOianA8aSXn6Cw0JzYOuDQbOrSPe7gqFnCpKP++MQe3ODgO3oh2GJFORkAAdqredOa60z63GbA=="],
+
"lit": ["[email protected]", "", { "dependencies": { "@lit/reactive-element": "^2.1.0", "lit-element": "^4.2.0", "lit-html": "^3.3.0" } }, "sha512-NF9zbsP79l4ao2SNrH3NkfmFgN/hBYSQo90saIVI1o5GpjAdCPVstVzO1MrLOakHoEhYkrtRjPK6Ob521aoYWQ=="],
"lit-element": ["[email protected]", "", { "dependencies": { "@lit-labs/ssr-dom-shim": "^1.5.0", "@lit/reactive-element": "^2.1.0", "lit-html": "^3.3.0" } }, "sha512-aFKhNToWxoyhkNDmWZwEva2SlQia+jfG0fjIWV//YeTaWrVnOxD89dPKfigCUspXFmjzOEUQpOkejH5Ly6sG0w=="],
@@ -1940,6 +2230,8 @@
"loose-envify": ["[email protected]", "", { "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": { "loose-envify": "cli.js" } }, "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q=="],
+ "lop": ["[email protected]", "", { "dependencies": { "duck": "^0.1.12", "option": "~0.2.1", "underscore": "^1.13.1" } }, "sha512-RefILVDQ4DKoRZsJ4Pj22TxE3omDO47yFpkIBoDKzkqPRISs5U1cnAdg/5583YPkWPaLIYHOKRMQSvjFsO26cw=="],
+
"lru-cache": ["[email protected]", "", {}, "sha512-B5Y16Jr9LB9dHVkh6ZevG+vAbOsNOYCX+sXvFWFu7B3Iz5mijW3zdbMyhsh8ANd2mSWBYdJgnqi+mL7/LrOPYg=="],
"lucide-react": ["[email protected]", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-t5tS44bqd825zAW45UQxpG2CvcC4urOwn2TrwSH8u+MjeE+1NnWl6QqeQ/6NdjMqdOygyiT9p3Ev0p1NJykxjw=="],
@@ -1954,12 +2246,16 @@
"make-error": ["[email protected]", "", {}, "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="],
+ "mammoth": ["[email protected]", "", { "dependencies": { "@xmldom/xmldom": "^0.8.6", "argparse": "~1.0.3", "base64-js": "^1.5.1", "bluebird": "~3.4.0", "dingbat-to-unicode": "^1.0.1", "jszip": "^3.7.1", "lop": "^0.4.2", "path-is-absolute": "^1.0.0", "underscore": "^1.13.1", "xmlbuilder": "^10.0.0" }, "bin": { "mammoth": "bin/mammoth" } }, "sha512-BcEqqY/BOwIcI1iR5tqyVlqc3KIaMRa4egSoK83YAVrBf6+yqdAAbtUcFDCWX8Zef8/fgNZ6rl4VUv+vVX8ddQ=="],
+
"map-limit": ["[email protected]", "", { "dependencies": { "once": "~1.3.0" } }, "sha512-pJpcfLPnIF/Sk3taPW21G/RQsEEirGaFpCW3oXRwH9dnFHPHNGjNyvh++rdmC2fNqEaTw2MhYJraoJWAHx8kEg=="],
"mapbox-gl": ["[email protected]", "", { "dependencies": { "@mapbox/geojson-rewind": "^0.5.0", "@mapbox/geojson-types": "^1.0.2", "@mapbox/jsonlint-lines-primitives": "^2.0.2", "@mapbox/mapbox-gl-supported": "^1.5.0", "@mapbox/point-geometry": "^0.1.0", "@mapbox/tiny-sdf": "^1.1.1", "@mapbox/unitbezier": "^0.0.0", "@mapbox/vector-tile": "^1.3.1", "@mapbox/whoots-js": "^3.1.0", "csscolorparser": "~1.0.3", "earcut": "^2.2.2", "geojson-vt": "^3.2.1", "gl-matrix": "^3.2.1", "grid-index": "^1.1.0", "minimist": "^1.2.5", "murmurhash-js": "^1.0.0", "pbf": "^3.2.1", "potpack": "^1.0.1", "quickselect": "^2.0.0", "rw": "^1.3.3", "supercluster": "^7.1.0", "tinyqueue": "^2.0.3", "vt-pbf": "^3.1.1" } }, "sha512-GSyubcoSF5MyaP8z+DasLu5v7KmDK2pp4S5+VQ5WdVQUOaAqQY4jwl4JpcdNho3uWm2bIKs7x1l7q3ynGmW60g=="],
"maplibre-gl": ["[email protected]", "", { "dependencies": { "@mapbox/geojson-rewind": "^0.5.2", "@mapbox/jsonlint-lines-primitives": "^2.0.2", "@mapbox/point-geometry": "^1.1.0", "@mapbox/tiny-sdf": "^2.0.7", "@mapbox/unitbezier": "^0.0.1", "@mapbox/vector-tile": "^2.0.4", "@mapbox/whoots-js": "^3.1.0", "@maplibre/maplibre-gl-style-spec": "^24.4.1", "@maplibre/mlt": "^1.1.2", "@maplibre/vt-pbf": "^4.2.0", "@types/geojson": "^7946.0.16", "@types/geojson-vt": "3.2.5", "@types/supercluster": "^7.1.3", "earcut": "^3.0.2", "geojson-vt": "^4.0.2", "gl-matrix": "^3.4.4", "kdbush": "^4.0.2", "murmurhash-js": "^1.0.0", "pbf": "^4.0.1", "potpack": "^2.1.0", "quickselect": "^3.0.0", "supercluster": "^8.0.1", "tinyqueue": "^3.0.0" } }, "sha512-/VDY89nr4jgLJyzmhy325cG6VUI02WkZ/UfVuDbG/piXzo6ODnM+omDFIwWY8tsEsBG26DNDmNMn3Y2ikHsBiA=="],
+ "markdown-it": ["[email protected]", "", { "dependencies": { "argparse": "^2.0.1", "entities": "^4.4.0", "linkify-it": "^5.0.0", "mdurl": "^2.0.0", "punycode.js": "^2.3.1", "uc.micro": "^2.1.0" }, "bin": { "markdown-it": "bin/markdown-it.mjs" } }, "sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA=="],
+
"marked": ["[email protected]", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-boeBdiS0ghpWcSwoNm/jJBwdpFaMnZWRzjA6SkUMYb40SVaN1x7mmfGKp0jvexGcx+7y2La5zRZsYFZI6Qpypg=="],
"markerjs2": ["[email protected]", "", {}, "sha512-HeFRZjmc43DOG3lSQp92z49cq2oCYpYn2pX++SkJAW1Dij4xJtRquVRf+cXeSZQWDX3ufns1Ry/bGk+zveP7rA=="],
@@ -1976,6 +2272,8 @@
"md5.js": ["[email protected]", "", { "dependencies": { "hash-base": "^3.0.0", "inherits": "^2.0.1", "safe-buffer": "^5.1.2" } }, "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg=="],
+ "mdurl": ["[email protected]", "", {}, "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w=="],
+
"miller-rabin": ["[email protected]", "", { "dependencies": { "bn.js": "^4.0.0", "brorand": "^1.0.1" }, "bin": { "miller-rabin": "bin/miller-rabin" } }, "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA=="],
"mime-db": ["[email protected]", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="],
@@ -1984,11 +2282,13 @@
"mimic-response": ["[email protected]", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="],
+ "min-document": ["[email protected]", "", { "dependencies": { "dom-walk": "^0.1.0" } }, "sha512-8S5I8db/uZN8r9HSLFVWPdJCvYOejMcEC82VIzNUc6Zkklf/d1gg2psfE79/vyhWOj4+J8MtwmoOz3TmvaGu5A=="],
+
"minimalistic-assert": ["[email protected]", "", {}, "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="],
"minimalistic-crypto-utils": ["[email protected]", "", {}, "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg=="],
- "minimatch": ["[email protected]", "", { "dependencies": { "@isaacs/brace-expansion": "^5.0.0" } }, "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ=="],
+ "minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^5.0.2" } }, "sha512-+G4CpNBxa5MprY+04MbgOw1v7So6n5JY166pFi9KfYwT78fxScCeSNQSNzp6dpPSW2rONOps6Ocam1wFhCgoVw=="],
"minimist": ["[email protected]", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="],
@@ -2024,13 +2324,15 @@
"native-promise-only": ["[email protected]", "", {}, "sha512-zkVhZUA3y8mbz652WrL5x0fB0ehrBkulWT3TomAQ9iDtyXZvzKeEA6GPxAItBYeNYl5yngKRX612qHOhvMkDeg=="],
+ "natural-compare": ["[email protected]", "", {}, "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="],
+
"needle": ["[email protected]", "", { "dependencies": { "debug": "^3.2.6", "iconv-lite": "^0.4.4", "sax": "^1.2.4" }, "bin": { "needle": "./bin/needle" } }, "sha512-6R9fqJ5Zcmf+uYaFgdIHmLwNldn5HbK8L5ybn7Uz+ylX/rnOsSp1AHcvQSrCaFN+qNM1wpymHqD7mVasEOlHGQ=="],
"neo-async": ["[email protected]", "", {}, "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw=="],
"next-themes": ["[email protected]", "", { "peerDependencies": { "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc", "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" } }, "sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA=="],
- "next-tick": ["[email protected]", "", {}, "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ=="],
+ "next-tick": ["[email protected]", "", {}, "sha512-f7h4svPtl+QidoBv4taKXUjJ70G2asaZ8G28nS0OkqaalX8dwwrtWtyxEDPK62AC00ur/+/E0pUwBwY5EPn15Q=="],
"nice-grpc": ["[email protected]", "", { "dependencies": { "@grpc/grpc-js": "^1.14.0", "abort-controller-x": "^0.4.0", "nice-grpc-common": "^2.0.2" } }, "sha512-GK9pKNxlvnU5FAdaw7i2FFuR9CqBspcE+if2tqnKXBcE0R8525wj4BZvfcwj7FjvqbssqKxRHt2nwedalbJlww=="],
@@ -2078,7 +2380,11 @@
"openapi-types": ["[email protected]", "", {}, "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw=="],
- "optionator": ["[email protected]", "", { "dependencies": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.6", "levn": "~0.3.0", "prelude-ls": "~1.1.2", "type-check": "~0.3.2", "word-wrap": "~1.2.3" } }, "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA=="],
+ "option": ["[email protected]", "", {}, "sha512-pkEqbDyl8ou5cpq+VsnQbe/WlEy5qS7xPzMS1U55OCG9KPvwFD46zDbxQIj3egJSFc3D+XhYOPUzz49zQAVy7A=="],
+
+ "optionator": ["[email protected]", "", { "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.5" } }, "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g=="],
+
+ "orderedmap": ["[email protected]", "", {}, "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g=="],
"os-browserify": ["[email protected]", "", {}, "sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A=="],
@@ -2174,7 +2480,7 @@
"prebuild-install": ["[email protected]", "", { "dependencies": { "detect-libc": "^2.0.0", "expand-template": "^2.0.3", "github-from-package": "0.0.0", "minimist": "^1.2.3", "mkdirp-classic": "^0.5.3", "napi-build-utils": "^2.0.0", "node-abi": "^3.3.0", "pump": "^3.0.0", "rc": "^1.2.7", "simple-get": "^4.0.0", "tar-fs": "^2.0.0", "tunnel-agent": "^0.6.0" }, "bin": { "prebuild-install": "bin.js" } }, "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug=="],
- "prelude-ls": ["[email protected]", "", {}, "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w=="],
+ "prelude-ls": ["[email protected]", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
"probe-image-size": ["[email protected]", "", { "dependencies": { "lodash.merge": "^4.6.2", "needle": "^2.5.2", "stream-parser": "~0.3.1" } }, "sha512-HubhG4Rb2UH8YtV4ba0Vp5bQ7L78RTONYu/ujmCu5nBI8wGv24s4E9xSKBi0N1MowRpxk76pFCpJtW0KPzOK0w=="],
@@ -2184,6 +2490,42 @@
"prop-types": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", "react-is": "^16.13.1" } }, "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg=="],
+ "prosemirror-changeset": ["[email protected]", "", { "dependencies": { "prosemirror-transform": "^1.0.0" } }, "sha512-LvqH2v7Q2SF6yxatuPP2e8vSUKS/L+xAU7dPDC4RMyHMhZoGDfBC74mYuyYF4gLqOEG758wajtyhNnsTkuhvng=="],
+
+ "prosemirror-collab": ["[email protected]", "", { "dependencies": { "prosemirror-state": "^1.0.0" } }, "sha512-4SnynYR9TTYaQVXd/ieUvsVV4PDMBzrq2xPUWutHivDuOshZXqQ5rGbZM84HEaXKbLdItse7weMGOUdDVcLKEQ=="],
+
+ "prosemirror-commands": ["[email protected]", "", { "dependencies": { "prosemirror-model": "^1.0.0", "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.10.2" } }, "sha512-rT7qZnQtx5c0/y/KlYaGvtG411S97UaL6gdp6RIZ23DLHanMYLyfGBV5DtSnZdthQql7W+lEVbpSfwtO8T+L2w=="],
+
+ "prosemirror-dropcursor": ["[email protected]", "", { "dependencies": { "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.1.0", "prosemirror-view": "^1.1.0" } }, "sha512-CCk6Gyx9+Tt2sbYk5NK0nB1ukHi2ryaRgadV/LvyNuO3ena1payM2z6Cg0vO1ebK8cxbzo41ku2DE5Axj1Zuiw=="],
+
+ "prosemirror-gapcursor": ["[email protected]", "", { "dependencies": { "prosemirror-keymap": "^1.0.0", "prosemirror-model": "^1.0.0", "prosemirror-state": "^1.0.0", "prosemirror-view": "^1.0.0" } }, "sha512-z00qvurSdCEWUIulij/isHaqu4uLS8r/Fi61IbjdIPJEonQgggbJsLnstW7Lgdk4zQ68/yr6B6bf7sJXowIgdQ=="],
+
+ "prosemirror-history": ["[email protected]", "", { "dependencies": { "prosemirror-state": "^1.2.2", "prosemirror-transform": "^1.0.0", "prosemirror-view": "^1.31.0", "rope-sequence": "^1.3.0" } }, "sha512-zlzTiH01eKA55UAf1MEjtssJeHnGxO0j4K4Dpx+gnmX9n+SHNlDqI2oO1Kv1iPN5B1dm5fsljCfqKF9nFL6HRg=="],
+
+ "prosemirror-inputrules": ["[email protected]", "", { "dependencies": { "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.0.0" } }, "sha512-7wj4uMjKaXWAQ1CDgxNzNtR9AlsuwzHfdFH1ygEHA2KHF2DOEaXl1CJfNPAKCg9qNEh4rum975QLaCiQPyY6Fw=="],
+
+ "prosemirror-keymap": ["[email protected]", "", { "dependencies": { "prosemirror-state": "^1.0.0", "w3c-keyname": "^2.2.0" } }, "sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw=="],
+
+ "prosemirror-markdown": ["[email protected]", "", { "dependencies": { "@types/markdown-it": "^14.0.0", "markdown-it": "^14.0.0", "prosemirror-model": "^1.25.0" } }, "sha512-D98dm4cQ3Hs6EmjK500TdAOew4Z03EV71ajEFiWra3Upr7diytJsjF4mPV2dW+eK5uNectiRj0xFxYI9NLXDbw=="],
+
+ "prosemirror-menu": ["[email protected]", "", { "dependencies": { "crelt": "^1.0.0", "prosemirror-commands": "^1.0.0", "prosemirror-history": "^1.0.0", "prosemirror-state": "^1.0.0" } }, "sha512-TImyPXCHPcDsSka2/lwJ6WjTASr4re/qWq1yoTTuLOqfXucwF6VcRa2LWCkM/EyTD1UO3CUwiH8qURJoWJRxwg=="],
+
+ "prosemirror-model": ["[email protected]", "", { "dependencies": { "orderedmap": "^2.0.0" } }, "sha512-PIM7E43PBxKce8OQeezAs9j4TP+5yDpZVbuurd1h5phUxEKIu+G2a+EUZzIC5nS1mJktDJWzbqS23n1tsAf5QA=="],
+
+ "prosemirror-schema-basic": ["[email protected]", "", { "dependencies": { "prosemirror-model": "^1.25.0" } }, "sha512-ELxP4TlX3yr2v5rM7Sb70SqStq5NvI15c0j9j/gjsrO5vaw+fnnpovCLEGIcpeGfifkuqJwl4fon6b+KdrODYQ=="],
+
+ "prosemirror-schema-list": ["[email protected]", "", { "dependencies": { "prosemirror-model": "^1.0.0", "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.7.3" } }, "sha512-927lFx/uwyQaGwJxLWCZRkjXG0p48KpMj6ueoYiu4JX05GGuGcgzAy62dfiV8eFZftgyBUvLx76RsMe20fJl+Q=="],
+
+ "prosemirror-state": ["[email protected]", "", { "dependencies": { "prosemirror-model": "^1.0.0", "prosemirror-transform": "^1.0.0", "prosemirror-view": "^1.27.0" } }, "sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw=="],
+
+ "prosemirror-tables": ["[email protected]", "", { "dependencies": { "prosemirror-keymap": "^1.2.3", "prosemirror-model": "^1.25.4", "prosemirror-state": "^1.4.4", "prosemirror-transform": "^1.10.5", "prosemirror-view": "^1.41.4" } }, "sha512-V/0cDCsHKHe/tfWkeCmthNUcEp1IVO3p6vwN8XtwE9PZQLAZJigbw3QoraAdfJPir4NKJtNvOB8oYGKRl+t0Dw=="],
+
+ "prosemirror-trailing-node": ["[email protected]", "", { "dependencies": { "@remirror/core-constants": "3.0.0", "escape-string-regexp": "^4.0.0" }, "peerDependencies": { "prosemirror-model": "^1.22.1", "prosemirror-state": "^1.4.2", "prosemirror-view": "^1.33.8" } }, "sha512-xiun5/3q0w5eRnGYfNlW1uU9W6x5MoFKWwq/0TIRgt09lv7Hcser2QYV8t4muXbEr+Fwo0geYn79Xs4GKywrRQ=="],
+
+ "prosemirror-transform": ["[email protected]", "", { "dependencies": { "prosemirror-model": "^1.21.0" } }, "sha512-4I7Ce4KpygXb9bkiPS3hTEk4dSHorfRw8uI0pE8IhxlK2GXsqv5tIA7JUSxtSu7u8APVOTtbUBxTmnHIxVkIJw=="],
+
+ "prosemirror-view": ["[email protected]", "", { "dependencies": { "prosemirror-model": "^1.20.0", "prosemirror-state": "^1.0.0", "prosemirror-transform": "^1.1.0" } }, "sha512-mxpcDG4hNQa/CPtzxjdlir5bJFDlm0/x5nGBbStB2BWX+XOQ9M8ekEG+ojqB5BcVu2Rc80/jssCMZzSstJuSYg=="],
+
"protobufjs": ["[email protected]", "", { "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", "@protobufjs/codegen": "^2.0.4", "@protobufjs/eventemitter": "^1.1.0", "@protobufjs/fetch": "^1.1.0", "@protobufjs/float": "^1.0.2", "@protobufjs/inquire": "^1.1.0", "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.0", "@types/node": ">=13.7.0", "long": "^5.0.0" } }, "sha512-CvexbZtbov6jW2eXAvLukXjXUW1TzFaivC46BpWc/3BpcCysb5Vffu+B3XHMm8lVEuy2Mm4XGex8hBSg1yapPg=="],
"protocol-buffers-schema": ["[email protected]", "", {}, "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw=="],
@@ -2198,6 +2540,8 @@
"punycode": ["[email protected]", "", {}, "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ=="],
+ "punycode.js": ["[email protected]", "", {}, "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA=="],
+
"qs": ["[email protected]", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="],
"quadbin": ["[email protected]", "", { "dependencies": { "@math.gl/web-mercator": "^4.1.0" } }, "sha512-1NFzjFVM23Um51/ttD6lFDqGtUHNS5Ky1slZHk3YPwMbC+7Jl3ULLb4QvDo6+Nerv8b8SgUV+ysOhziUh4B5cQ=="],
@@ -2206,6 +2550,8 @@
"querystringify": ["[email protected]", "", {}, "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="],
+ "queue": ["[email protected]", "", { "dependencies": { "inherits": "~2.0.3" } }, "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA=="],
+
"quick-temp": ["[email protected]", "", { "dependencies": { "mktemp": "^2.0.1", "rimraf": "^5.0.10", "underscore.string": "~3.3.6" } }, "sha512-yI0h7tIhKVObn03kD+Ln9JFi4OljD28lfaOsTdfpTR0xzrhGOod+q66CjGafUqYX2juUfT9oHIGrTBBo22mkRA=="],
"quickselect": ["[email protected]", "", {}, "sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g=="],
@@ -2242,8 +2588,6 @@
"react-redux": ["[email protected]", "", { "dependencies": { "@types/use-sync-external-store": "^0.0.6", "use-sync-external-store": "^1.4.0" }, "peerDependencies": { "@types/react": "^18.2.25 || ^19", "react": "^18.0 || ^19", "redux": "^5.0.0" }, "optionalPeers": ["@types/react", "redux"] }, "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g=="],
- "react-refresh": ["[email protected]", "", {}, "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ=="],
-
"react-remove-scroll": ["[email protected]", "", { "dependencies": { "react-remove-scroll-bar": "^2.3.7", "react-style-singleton": "^2.2.3", "tslib": "^2.1.0", "use-callback-ref": "^1.3.3", "use-sidecar": "^1.1.3" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Iqb9NjCCTt6Hf+vOdNIZGdTiH1QSqr27H/Ek9sv/a97gfueI/5h1s3yRi1nngzMUaOOToin5dI1dXKdXiF+u0Q=="],
"react-remove-scroll-bar": ["[email protected]", "", { "dependencies": { "react-style-singleton": "^2.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q=="],
@@ -2318,6 +2662,8 @@
"rollup": ["[email protected]", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.53.3", "@rollup/rollup-android-arm64": "4.53.3", "@rollup/rollup-darwin-arm64": "4.53.3", "@rollup/rollup-darwin-x64": "4.53.3", "@rollup/rollup-freebsd-arm64": "4.53.3", "@rollup/rollup-freebsd-x64": "4.53.3", "@rollup/rollup-linux-arm-gnueabihf": "4.53.3", "@rollup/rollup-linux-arm-musleabihf": "4.53.3", "@rollup/rollup-linux-arm64-gnu": "4.53.3", "@rollup/rollup-linux-arm64-musl": "4.53.3", "@rollup/rollup-linux-loong64-gnu": "4.53.3", "@rollup/rollup-linux-ppc64-gnu": "4.53.3", "@rollup/rollup-linux-riscv64-gnu": "4.53.3", "@rollup/rollup-linux-riscv64-musl": "4.53.3", "@rollup/rollup-linux-s390x-gnu": "4.53.3", "@rollup/rollup-linux-x64-gnu": "4.53.3", "@rollup/rollup-linux-x64-musl": "4.53.3", "@rollup/rollup-openharmony-arm64": "4.53.3", "@rollup/rollup-win32-arm64-msvc": "4.53.3", "@rollup/rollup-win32-ia32-msvc": "4.53.3", "@rollup/rollup-win32-x64-gnu": "4.53.3", "@rollup/rollup-win32-x64-msvc": "4.53.3", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA=="],
+ "rope-sequence": ["[email protected]", "", {}, "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ=="],
+
"rsvp": ["[email protected]", "", {}, "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA=="],
"rw": ["[email protected]", "", {}, "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ=="],
@@ -2400,7 +2746,7 @@
"split-string": ["[email protected]", "", { "dependencies": { "extend-shallow": "^3.0.0" } }, "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw=="],
- "sprintf-js": ["[email protected]", "", {}, "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA=="],
+ "sprintf-js": ["[email protected]", "", {}, "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="],
"ssf": ["[email protected]", "", { "dependencies": { "frac": "~1.1.2" } }, "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g=="],
@@ -2422,6 +2768,8 @@
"string-split-by": ["[email protected]", "", { "dependencies": { "parenthesis": "^3.1.5" } }, "sha512-KaJKY+hfpzNyet/emP81PJA9hTVSfxNLS9SFTWxdCnnW1/zOOwiV248+EfoX7IQFcBaOp4G5YE6xTJMF+pLg6A=="],
+ "string-template": ["[email protected]", "", {}, "sha512-Yptehjogou2xm4UJbxJ4CxgZx12HBfeystp0y3x7s4Dj32ltVVG1Gg8YhKjHZkHicuKpZX/ffilA8505VbUbpw=="],
+
"string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
"string-width-cjs": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
@@ -2516,6 +2864,8 @@
"ts-algebra": ["[email protected]", "", {}, "sha512-FPAhNPFMrkwz76P7cdjdmiShwMynZYN6SgOujD1urY4oNm80Ou9oMdmbR45LotcKOXoy7wSmHkRFE6Mxbrhefw=="],
+ "ts-api-utils": ["[email protected]", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA=="],
+
"ts-error": ["[email protected]", "", {}, "sha512-tLJxacIQUM82IR7JO1UUkKlYuUTmoY9HBJAmNWFzheSlDS5SPMcNIepejHJa4BpPQLAcbRhRf3GDJzyj6rbKvA=="],
"ts-node": ["[email protected]", "", { "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", "@tsconfig/node16": "^1.0.2", "acorn": "^8.4.1", "acorn-walk": "^8.1.1", "arg": "^4.1.0", "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" }, "peerDependencies": { "@swc/core": ">=1.2.50", "@swc/wasm": ">=1.2.50", "@types/node": "*", "typescript": ">=2.7" }, "optionalPeers": ["@swc/core", "@swc/wasm"], "bin": { "ts-node": "dist/bin.js", "ts-script": "dist/bin-script-deprecated.js", "ts-node-cwd": "dist/bin-cwd.js", "ts-node-esm": "dist/bin-esm.js", "ts-node-script": "dist/bin-script.js", "ts-node-transpile-only": "dist/bin-transpile.js" } }, "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ=="],
@@ -2532,7 +2882,7 @@
"type": ["[email protected]", "", {}, "sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ=="],
- "type-check": ["[email protected]", "", { "dependencies": { "prelude-ls": "~1.1.2" } }, "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg=="],
+ "type-check": ["[email protected]", "", { "dependencies": { "prelude-ls": "^1.2.1" } }, "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew=="],
"type-fest": ["[email protected]", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="],
@@ -2544,10 +2894,14 @@
"typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
+ "typescript-eslint": ["[email protected]", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.56.1", "@typescript-eslint/parser": "8.56.1", "@typescript-eslint/typescript-estree": "8.56.1", "@typescript-eslint/utils": "8.56.1" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-U4lM6pjmBX7J5wk4szltF7I1cGBHXZopnAXCMXb3+fZ3B/0Z3hq3wS/CCUB2NZBNAExK92mCU2tEohWuwVMsDQ=="],
+
"typewise": ["[email protected]", "", { "dependencies": { "typewise-core": "^1.2.0" } }, "sha512-aXofE06xGhaQSPzt8hlTY+/YWQhm9P0jYUp1f2XtmW/3Bk0qzXcyFWAtPoo2uTGQj1ZwbDuSyuxicq+aDo8lCQ=="],
"typewise-core": ["[email protected]", "", {}, "sha512-2SCC/WLzj2SbUwzFOzqMCkz5amXLlxtJqDKTICqg30x+2DZxcfZN2MvQZmGfXWKNWaKK9pBPsvkcwv8bF/gxKg=="],
+ "uc.micro": ["[email protected]", "", {}, "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A=="],
+
"uglify-js": ["[email protected]", "", { "bin": { "uglifyjs": "bin/uglifyjs" } }, "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ=="],
"underscore": ["[email protected]", "", {}, "sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw=="],
@@ -2568,10 +2922,12 @@
"unquote": ["[email protected]", "", {}, "sha512-vRCqFv6UhXpWxZPyGDh/F3ZpNv8/qo7w6iufLpQg9aKnQ71qM4B5KiI7Mia9COcjEhrO9LueHpMYjYzsWH3OIg=="],
- "update-browserslist-db": ["[email protected]", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-E85pfNzMQ9jpKkA7+TJAi4TJN+tBCuWh5rUcS/sv6cFi+1q9LYDwDI5dpUL0u/73EElyQ8d3TEaeW4sPedBqYA=="],
+ "update-browserslist-db": ["[email protected]", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="],
"update-diff": ["[email protected]", "", {}, "sha512-rCiBPiHxZwT4+sBhEbChzpO5hYHjm91kScWgdHf4Qeafs6Ba7MBl+d9GlGv72bcTZQO0sLmtQS1pHSWoCLtN/A=="],
+ "uri-js": ["[email protected]", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="],
+
"url": ["[email protected]", "", { "dependencies": { "punycode": "^1.4.1", "qs": "^6.12.3" } }, "sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg=="],
"url-parse": ["[email protected]", "", { "dependencies": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" } }, "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ=="],
@@ -2604,6 +2960,8 @@
"vinyl-sourcemap": ["[email protected]", "", { "dependencies": { "convert-source-map": "^2.0.0", "graceful-fs": "^4.2.10", "now-and-later": "^3.0.0", "streamx": "^2.12.5", "vinyl": "^3.0.0", "vinyl-contents": "^2.0.0" } }, "sha512-BAEvWxbBUXvlNoFQVFVHpybBbjW1r03WhohJzJDSfgrrK5xVYIDTan6xN14DlyImShgDRv2gl9qhM6irVMsV0Q=="],
+ "virtual-dom": ["[email protected]", "", { "dependencies": { "browser-split": "0.0.1", "error": "^4.3.0", "ev-store": "^7.0.0", "global": "^4.3.0", "is-object": "^1.0.1", "next-tick": "^0.2.2", "x-is-array": "0.1.0", "x-is-string": "0.1.0" } }, "sha512-wb6Qc9Lbqug0kRqo/iuApfBpJJAq14Sk1faAnSmtqXiwahg7PVTvWMs9L02Z8nNIMqbwsxzBAA90bbtRLbw0zg=="],
+
"vite": ["[email protected]", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", "picomatch": "^4.0.3", "postcss": "^8.5.6", "rollup": "^4.43.0", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", "less": "^4.0.0", "lightningcss": "^1.21.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ=="],
"vite-plugin-node-polyfills": ["[email protected]", "", { "dependencies": { "@rollup/plugin-inject": "^5.0.5", "node-stdlib-browser": "^1.2.0" }, "peerDependencies": { "vite": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "sha512-GA9QKLH+vIM8NPaGA+o2t8PDfFUl32J8rUp1zQfMKVJQiNkOX4unE51tR6ppl6iKw5yOrDAdSH7r/UIFLCVhLw=="],
@@ -2614,6 +2972,8 @@
"vt-pbf": ["[email protected]", "", { "dependencies": { "@mapbox/point-geometry": "0.1.0", "@mapbox/vector-tile": "^1.3.1", "pbf": "^3.2.1" } }, "sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA=="],
+ "w3c-keyname": ["[email protected]", "", {}, "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ=="],
+
"walk-sync": ["[email protected]", "", { "dependencies": { "@types/minimatch": "^3.0.3", "ensure-posix-path": "^1.1.0", "matcher-collection": "^2.0.0", "minimatch": "^3.0.4" } }, "sha512-IC8sL7aB4/ZgFcGI2T1LczZeFWZ06b3zoHH7jBPyHxOtIIz1jppWHjjEXkOFvFojBVAK9pV7g47xOZ4LW3QLfg=="],
"weak-map": ["[email protected]", "", {}, "sha512-lNR9aAefbGPpHO7AEnY0hCFjz1eTkWCXYvkTRrTHs9qv8zJp+SkVYpzfLIFXQQiG3tVvbNFQgVg2bQS8YGgxyw=="],
@@ -2658,8 +3018,26 @@
"ws": ["[email protected]", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg=="],
+ "x-is-array": ["[email protected]", "", {}, "sha512-goHPif61oNrr0jJgsXRfc8oqtYzvfiMJpTqwE7Z4y9uH+T3UozkGqQ4d2nX9mB9khvA8U2o/UbPOFjgC7hLWIA=="],
+
+ "x-is-string": ["[email protected]", "", {}, "sha512-GojqklwG8gpzOVEVki5KudKNoq7MbbjYZCbyWzEz7tyPA7eleiE0+ePwOWQQRb5fm86rD3S8Tc0tSFf3AOv50w=="],
+
+ "xgplayer": ["[email protected]", "", { "dependencies": { "danmu.js": ">=1.1.6", "delegate": "^3.2.0", "downloadjs": "1.4.7", "eventemitter3": "^4.0.7", "xgplayer-subtitles": "3.0.23" }, "peerDependencies": { "core-js": ">=3.12.1" } }, "sha512-Bn3zQfMMAZimlVG9EeIDybMcklc+6FH8Sv47KpTq4K6ofCzyhPG/KenxailDedlHmxjb5B2o+240TpJtMQ3oJA=="],
+
+ "xgplayer-hls": ["[email protected]", "", { "dependencies": { "eventemitter3": "^4.0.7", "xgplayer-streaming-shared": "3.0.23", "xgplayer-transmuxer": "3.0.23" }, "peerDependencies": { "core-js": ">=3.12.1", "xgplayer": "3.0.23" } }, "sha512-jpoGeStytjnzESH5CUNKCVQ3pqQjr3+qAz99Cf8CCHheqprp+PwiUcY7ewvv4YT09IGMcF3+jKptbjdtTetuEg=="],
+
+ "xgplayer-streaming-shared": ["[email protected]", "", { "dependencies": { "eventemitter3": "^4.0.7" }, "peerDependencies": { "core-js": ">=3.12.1" } }, "sha512-j14MKqjSpEisd97hAV8ykg+txSkECZ3Z6AtCxZnRT4Jj0G5QRZAObAA1IIHv7wPN4tjNdtGm9odHiQOpsYYXuw=="],
+
+ "xgplayer-subtitles": ["[email protected]", "", { "dependencies": { "eventemitter3": "^4.0.7" }, "peerDependencies": { "core-js": ">=3.12.1" } }, "sha512-deGdV75giVzfTTdG9XATmji39NHwKTpEelWt2rRx/RyXGgU2bQFp0Ft7yWaK2Uu8A/WVrP5fpxEAj4MstREMkQ=="],
+
+ "xgplayer-transmuxer": ["[email protected]", "", { "dependencies": { "@babel/runtime": "^7.15.3", "concat-typed-array": "^1.0.2", "crypto-es": "^1.2.4" }, "peerDependencies": { "core-js": ">=3.12.1" } }, "sha512-BVI0FT96nWUwJ7cYyT2bK7CSp6PWdztgb9kO0dIcCoJUBU5yxelqoKd43luHFFAM73GyYZ0hCm/Yw/GSjQrPJA=="],
+
"xlsx": ["[email protected]", "", { "dependencies": { "adler-32": "~1.3.0", "cfb": "~1.2.1", "codepage": "~1.15.0", "crc-32": "~1.2.1", "ssf": "~0.11.2", "wmf": "~1.0.1", "word": "~0.3.0" }, "bin": { "xlsx": "bin/xlsx.njs" } }, "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ=="],
+ "xmlbuilder": ["[email protected]", "", {}, "sha512-OyzrcFLL/nb6fMGHbiRDuPup9ljBycsdCypwuyg5AAHvyWzGfChJpCXMG88AGTIMFhGZ9RccFN1e6lhg3hkwKg=="],
+
+ "xmlbuilder2": ["[email protected]", "", { "dependencies": { "@oozcitak/dom": "1.15.5", "@oozcitak/infra": "1.0.5", "@oozcitak/util": "8.3.3" } }, "sha512-PI710tmtVlQ5VmwzbRTuhmVhKnj9pM8Si+iOZCV2g2SNo3gCrpzR2Ka9wNzZtqfD+mnP+xkrqoNy0sjKZqP4Dg=="],
+
"xmldoc": ["[email protected]", "", { "dependencies": { "sax": "^1.4.3" } }, "sha512-6gRk4NY/Jvg67xn7OzJuxLRsGgiXBaPUQplVJ/9l99uIugxh4FTOewYz5ic8WScj7Xx/2WvhENiQKwkK9RpE4w=="],
"xss": ["[email protected]", "", { "dependencies": { "commander": "^2.20.3", "cssfilter": "0.0.10" }, "bin": { "xss": "bin/xss" } }, "sha512-clu7dxTm1e8Mo5fz3n/oW3UCXBfV89xZ72jM8yzo1vR/pIS0w3sgB3XV2H8Vm6zfGnHL0FzvLJPJEBhd86/z4Q=="],
@@ -2684,6 +3062,8 @@
"zod-to-json-schema": ["[email protected]", "", { "peerDependencies": { "zod": "^3.25 || ^4" } }, "sha512-HvWtU2UG41LALjajJrML6uQejQhNJx+JBO9IflpSja4R03iNWfKXrj6W2h7ljuLyc1nKS+9yDyL/9tD1U/yBnQ=="],
+ "zod-validation-error": ["[email protected]", "", { "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" } }, "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ=="],
+
"zstd-codec": ["[email protected]", "", {}, "sha512-v3fyjpK8S/dpY/X5WxqTK3IoCnp/ZOLxn144GZVlNUjtwAchzrVo03h+oMATFhCIiJ5KTr4V3vDQQYz4RU684g=="],
"zustand": ["[email protected]", "", { "dependencies": { "use-sync-external-store": "^1.2.2" }, "peerDependencies": { "@types/react": ">=16.8", "immer": ">=9.0.6", "react": ">=16.8" }, "optionalPeers": ["@types/react", "immer", "react"] }, "sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw=="],
@@ -2708,6 +3088,8 @@
"@deck.gl/json/jsep": ["[email protected]", "", {}, "sha512-AoRLBDc6JNnKjNcmonituEABS5bcfqDhQAWWXNTFrqu6nVXBpBAGfcoTGZMFlIrh9FjmE1CQyX9CTNwZrXMMDA=="],
+ "@eslint-community/eslint-utils/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
+
"@foliojs-fork/fontkit/clone": ["[email protected]", "", {}, "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg=="],
"@foliojs-fork/linebreak/base64-js": ["[email protected]", "", {}, "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="],
@@ -2742,6 +3124,12 @@
"@maplibre/vt-pbf/pbf": ["[email protected]", "", { "dependencies": { "resolve-protobuf-schema": "^2.1.0" }, "bin": { "pbf": "bin/pbf" } }, "sha512-SuLdBvS42z33m8ejRbInMapQe8n0D3vN/Xd5fmWM3tufNgRQFBpaW2YVJxQZV4iPNqb0vEFvssMEo5w9c6BTIA=="],
+ "@oozcitak/infra/@oozcitak/util": ["@oozcitak/[email protected]", "", {}, "sha512-+9Hq6yuoq/3TRV/n/xcpydGBq2qN2/DEDMqNTG7rm95K6ZE2/YY/sPyx62+1n8QsE9O26e5M1URlXsk+AnN9Jw=="],
+
+ "@oozcitak/url/@oozcitak/infra": ["@oozcitak/[email protected]", "", { "dependencies": { "@oozcitak/util": "1.0.1" } }, "sha512-9O2wxXGnRzy76O1XUxESxDGsXT5kzETJPvYbreO4mv6bqe1+YSuux2cZTagjJ/T4UfEwFJz5ixanOqB0QgYAag=="],
+
+ "@oozcitak/url/@oozcitak/util": ["@oozcitak/[email protected]", "", {}, "sha512-4n8B1cWlJleSOSba5gxsMcN4tO8KkkcvXhNWW+ADqvq9Xj+Lrl9uCa90GRpjekqQJyt84aUX015DG81LFpZYXA=="],
+
"@plotly/d3-sankey/d3-array": ["[email protected]", "", {}, "sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw=="],
"@plotly/d3-sankey/d3-shape": ["[email protected]", "", { "dependencies": { "d3-path": "1" } }, "sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw=="],
@@ -2822,6 +3210,10 @@
"@types/d3-sankey/@types/d3-shape": ["@types/[email protected]", "", { "dependencies": { "@types/d3-path": "^1" } }, "sha512-8oMzcd4+poSLGgV0R1Q1rOlx/xdmozS4Xab7np0eamFFUYq71AU9pOCJEFnkXW2aI/oXdVYJzw6pssbSut7Z9Q=="],
+ "@typescript-eslint/eslint-plugin/ignore": ["[email protected]", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="],
+
+ "@typescript-eslint/typescript-estree/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="],
+
"@vis.gl/react-maplibre/@maplibre/maplibre-gl-style-spec": ["@maplibre/[email protected]", "", { "dependencies": { "@mapbox/jsonlint-lines-primitives": "~2.0.2", "@mapbox/unitbezier": "^0.0.1", "json-stringify-pretty-compact": "^3.0.0", "minimist": "^1.2.8", "rw": "^1.3.3", "sort-object": "^3.0.3" }, "bin": { "gl-style-format": "dist/gl-style-format.mjs", "gl-style-migrate": "dist/gl-style-migrate.mjs", "gl-style-validate": "dist/gl-style-validate.mjs" } }, "sha512-cOZZOVhDSulgK0meTsTkmNXb1ahVvmTmWmfx9gRBwc6hq98wS9JP35ESIoNq3xqEan+UN+gn8187Z6E4NKhLsw=="],
"anymatch/picomatch": ["[email protected]", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
@@ -2874,10 +3266,20 @@
"diffie-hellman/bn.js": ["[email protected]", "", {}, "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw=="],
+ "duck/underscore": ["[email protected]", "", {}, "sha512-DXtD3ZtEQzc7M8m4cXotyHR+FAS18C64asBYY5vqZexfYryNNnDc02W4hKg3rdQuqOYas1jkseX0+nZXjTXnvQ=="],
+
"elliptic/bn.js": ["[email protected]", "", {}, "sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw=="],
+ "es5-ext/next-tick": ["[email protected]", "", {}, "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ=="],
+
"escodegen/esprima": ["[email protected]", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="],
+ "escodegen/estraverse": ["[email protected]", "", {}, "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="],
+
+ "escodegen/optionator": ["[email protected]", "", { "dependencies": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.6", "levn": "~0.3.0", "prelude-ls": "~1.1.2", "type-check": "~0.3.2", "word-wrap": "~1.2.3" } }, "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA=="],
+
+ "espree/acorn": ["[email protected]", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw=="],
+
"ethers/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.19.2" } }, "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ=="],
"ethers/tslib": ["[email protected]", "", {}, "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA=="],
@@ -2892,6 +3294,8 @@
"gl-util/is-plain-obj": ["[email protected]", "", {}, "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg=="],
+ "glob/minimatch": ["[email protected]", "", { "dependencies": { "@isaacs/brace-expansion": "^5.0.0" } }, "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ=="],
+
"global-prefix/which": ["[email protected]", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg=="],
"glsl-resolve/resolve": ["[email protected]", "", {}, "sha512-UHBY3viPlJKf85YijDUcikKX6tmF4SokIDp518ZDVT92JNDcG5uKIthaT/owt3Sar0lwtOafsQuwrg22/v2Dwg=="],
@@ -2910,12 +3314,16 @@
"heimdalljs-logger/debug": ["[email protected]", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="],
+ "html-to-vdom/htmlparser2": ["[email protected]", "", { "dependencies": { "domelementtype": "^1.3.1", "domhandler": "^2.3.0", "domutils": "^1.5.1", "entities": "^1.1.1", "inherits": "^2.0.1", "readable-stream": "^3.1.1" } }, "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ=="],
+
"htmlparser2/entities": ["[email protected]", "", {}, "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g=="],
"i18next-parser/i18next": ["[email protected]", "", { "dependencies": { "@babel/runtime": "^7.26.10" }, "peerDependencies": { "typescript": "^5" }, "optionalPeers": ["typescript"] }, "sha512-lfbf80OzkocvX7nmZtu7nSTNbrTYR52sLWxPtlXX1zAhVw8WEnFk4puUkCR4B1dNQwbSpEHHHemcZu//7EcB7A=="],
"ibm-cloud-sdk-core/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg=="],
+ "js-yaml/argparse": ["[email protected]", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="],
+
"jsonwebtoken/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="],
"jszip/pako": ["[email protected]", "", {}, "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="],
@@ -2926,6 +3334,10 @@
"langsmith/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="],
+ "lop/underscore": ["[email protected]", "", {}, "sha512-DXtD3ZtEQzc7M8m4cXotyHR+FAS18C64asBYY5vqZexfYryNNnDc02W4hKg3rdQuqOYas1jkseX0+nZXjTXnvQ=="],
+
+ "mammoth/underscore": ["[email protected]", "", {}, "sha512-DXtD3ZtEQzc7M8m4cXotyHR+FAS18C64asBYY5vqZexfYryNNnDc02W4hKg3rdQuqOYas1jkseX0+nZXjTXnvQ=="],
+
"map-limit/once": ["[email protected]", "", { "dependencies": { "wrappy": "1" } }, "sha512-6vaNInhu+CHxtONf3zw3vq4SP2DOQhjBvIa3rNcG0+P7eKWlYH6Peu7rHizSloRU2EwMz6GraLieis9Ac9+p1w=="],
"mapbox-gl/@mapbox/point-geometry": ["@mapbox/[email protected]", "", {}, "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ=="],
@@ -2950,6 +3362,8 @@
"maplibre-gl/pbf": ["[email protected]", "", { "dependencies": { "resolve-protobuf-schema": "^2.1.0" }, "bin": { "pbf": "bin/pbf" } }, "sha512-SuLdBvS42z33m8ejRbInMapQe8n0D3vN/Xd5fmWM3tufNgRQFBpaW2YVJxQZV4iPNqb0vEFvssMEo5w9c6BTIA=="],
+ "markdown-it/argparse": ["[email protected]", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="],
+
"matcher-collection/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
"md5.js/hash-base": ["[email protected]", "", { "dependencies": { "inherits": "^2.0.4", "readable-stream": "^2.3.8", "safe-buffer": "^5.2.1", "to-buffer": "^1.2.1" } }, "sha512-Bb33KbowVTIj5s7Ked1OsqHUeCpz//tPwR+E2zJgJKo9Z5XolZ9b6bdUgjmYlwnWhoOQKoTd1TYToZGn5mAYOg=="],
@@ -3004,7 +3418,7 @@
"rc/ini": ["[email protected]", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="],
- "react-smooth/fast-equals": ["[email protected]", "", {}, "sha512-/boTcHZeIAQ2r/tL11voclBHDeP9WPxLt+tyAbVSyyXuUFyh0Tne7gJZTqGbxnvj79TjLdCXLOY7UIPhyG5MTw=="],
+ "react-grid-layout/fast-equals": ["[email protected]", "", {}, "sha512-G3BSX9cfKttjr+2o1O22tYMLq0DPluZnYtq1rXumE1SpL/F/SLIfHx08WYQoWSIpeMYf8sRbJ8++71+v6Pnxfg=="],
"regl-scatter2d/color-rgba": ["[email protected]", "", { "dependencies": { "color-parse": "^1.4.2", "color-space": "^2.0.0" } }, "sha512-Nti4qbzr/z2LbUWySr7H9dk3Rl7gZt7ihHAxlgT4Ho90EXWkjtkL1avTleu9yeGuqrt/chxTB6GKK8nZZ6V0+Q=="],
@@ -3028,7 +3442,7 @@
"terser/commander": ["[email protected]", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="],
- "texture-compressor/argparse": ["[email protected]", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="],
+ "texture-compressor/image-size": ["[email protected]", "", { "bin": { "image-size": "bin/image-size.js" } }, "sha512-Hiyv+mXHfFEP7LzUL/llg9RwFxxY+o9N3JVLIeG5E7iFIFAalxvRU9UZthBdYDEVnzHMgjnKJPPpay5BWf1g9g=="],
"topojson-client/commander": ["[email protected]", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="],
@@ -3036,8 +3450,12 @@
"tough-cookie/universalify": ["[email protected]", "", {}, "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg=="],
+ "underscore.string/sprintf-js": ["[email protected]", "", {}, "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA=="],
+
"unicode-trie/pako": ["[email protected]", "", {}, "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA=="],
+ "uri-js/punycode": ["[email protected]", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],
+
"vinyl-contents/bl": ["[email protected]", "", { "dependencies": { "buffer": "^6.0.3", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ=="],
"vt-pbf/@mapbox/point-geometry": ["@mapbox/[email protected]", "", {}, "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ=="],
@@ -3058,6 +3476,10 @@
"wrap-ansi-cjs/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
+ "xmlbuilder2/@oozcitak/dom": ["@oozcitak/[email protected]", "", { "dependencies": { "@oozcitak/infra": "1.0.5", "@oozcitak/url": "1.0.0", "@oozcitak/util": "8.0.0" } }, "sha512-L6v3Mwb0TaYBYgeYlIeBaHnc+2ZEaDSbFiRm5KmqZQSoBlbPlf+l6aIH/sD5GUf2MYwULw00LT7+dOnEuAEC0A=="],
+
+ "xmlbuilder2/@oozcitak/util": ["@oozcitak/[email protected]", "", {}, "sha512-Ufpab7G5PfnEhQyy5kDg9C8ltWJjsVT1P/IYqacjstaqydG4Q21HAT2HUZQYBrC/a1ZLKCz87pfydlDvv8y97w=="],
+
"xss/commander": ["[email protected]", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="],
"@browserbasehq/sdk/@types/node/undici-types": ["[email protected]", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="],
@@ -3074,6 +3496,8 @@
"@loaders.gl/gis/@mapbox/vector-tile/@mapbox/point-geometry": ["@mapbox/[email protected]", "", {}, "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ=="],
+ "@oozcitak/url/@oozcitak/infra/@oozcitak/util": ["@oozcitak/[email protected]", "", {}, "sha512-dFwFqcKrQnJ2SapOmRD1nQWEZUtbtIy9Y6TyJquzsalWNJsKIPxmTI0KG6Ypyl8j7v89L2wixH9fQDNrF78hKg=="],
+
"@plotly/d3-sankey-circular/d3-shape/d3-path": ["[email protected]", "", {}, "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg=="],
"@plotly/d3-sankey/d3-shape/d3-path": ["[email protected]", "", {}, "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg=="],
@@ -3100,6 +3524,12 @@
"d3-weighted-voronoi/d3-array/internmap": ["[email protected]", "", {}, "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw=="],
+ "escodegen/optionator/levn": ["[email protected]", "", { "dependencies": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" } }, "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA=="],
+
+ "escodegen/optionator/prelude-ls": ["[email protected]", "", {}, "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w=="],
+
+ "escodegen/optionator/type-check": ["[email protected]", "", { "dependencies": { "prelude-ls": "~1.1.2" } }, "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg=="],
+
"ethers/@types/node/undici-types": ["[email protected]", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="],
"fs-merger/fs-extra/jsonfile": ["[email protected]", "", { "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg=="],
@@ -3114,10 +3544,20 @@
"heimdalljs-logger/debug/ms": ["[email protected]", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="],
+ "html-to-vdom/htmlparser2/domelementtype": ["[email protected]", "", {}, "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w=="],
+
+ "html-to-vdom/htmlparser2/domhandler": ["[email protected]", "", { "dependencies": { "domelementtype": "1" } }, "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA=="],
+
+ "html-to-vdom/htmlparser2/domutils": ["[email protected]", "", { "dependencies": { "dom-serializer": "0", "domelementtype": "1" } }, "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg=="],
+
+ "html-to-vdom/htmlparser2/entities": ["[email protected]", "", {}, "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w=="],
+
"ibm-cloud-sdk-core/@types/node/undici-types": ["[email protected]", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="],
"mapbox-gl/supercluster/kdbush": ["[email protected]", "", {}, "sha512-hRkd6/XW4HTsA9vjVpY9tuXJYLSlelnkTmVFu4M9/7MIYQtFcHpbugAU7UbOfjOiVSVYl2fqgBuJ32JUmRo5Ew=="],
+ "matcher-collection/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="],
+
"plotly.js/d3-force/d3-dispatch": ["[email protected]", "", {}, "sha512-fVjoElzjhCEy+Hbn8KygnmMS7Or0a9sI2UzGwoB7cCtvI1XpVN9GpoYlnb3xt2YV66oXYb1fLJ8GMvP4hdU1RA=="],
"plotly.js/d3-force/d3-quadtree": ["[email protected]", "", {}, "sha512-RKPAeXnkC59IDGD0Wu5mANy0Q2V28L+fNe65pOCXVdVuTJS3WPKaJlFHer32Rbh9gIo9qMuJXio8ra4+YmIymA=="],
@@ -3150,17 +3590,21 @@
"tar-stream/bl/buffer": ["[email protected]", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="],
- "texture-compressor/argparse/sprintf-js": ["[email protected]", "", {}, "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="],
+ "walk-sync/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="],
"wrap-ansi-cjs/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
"wrap-ansi/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
+ "xmlbuilder2/@oozcitak/dom/@oozcitak/util": ["@oozcitak/[email protected]", "", {}, "sha512-+9Hq6yuoq/3TRV/n/xcpydGBq2qN2/DEDMqNTG7rm95K6ZE2/YY/sPyx62+1n8QsE9O26e5M1URlXsk+AnN9Jw=="],
+
"@browserbasehq/stagehand/@anthropic-ai/sdk/@types/node/undici-types": ["[email protected]", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="],
"glslify/static-eval/escodegen/esprima": ["[email protected]", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="],
- "glslify/static-eval/escodegen/estraverse": ["[email protected]", "", {}, "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="],
+ "html-to-vdom/htmlparser2/domutils/dom-serializer": ["[email protected]", "", { "dependencies": { "domelementtype": "^2.0.1", "entities": "^2.0.0" } }, "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g=="],
+
+ "matcher-collection/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
"plotly.js/maplibre-gl/@maplibre/maplibre-gl-style-spec/quickselect": ["[email protected]", "", {}, "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw=="],
@@ -3168,8 +3612,20 @@
"quick-temp/rimraf/glob/path-scurry": ["[email protected]", "", { "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA=="],
+ "rimraf/glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="],
+
+ "walk-sync/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
+
+ "html-to-vdom/htmlparser2/domutils/dom-serializer/domelementtype": ["[email protected]", "", {}, "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw=="],
+
+ "html-to-vdom/htmlparser2/domutils/dom-serializer/entities": ["[email protected]", "", {}, "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="],
+
"quick-temp/rimraf/glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="],
"quick-temp/rimraf/glob/path-scurry/lru-cache": ["[email protected]", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="],
+
+ "rimraf/glob/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
+
+ "quick-temp/rimraf/glob/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
}
}
diff --git a/fincept-terminal-desktop/eslint.config.js b/fincept-terminal-desktop/eslint.config.js
new file mode 100644
index 000000000..47bfe4961
--- /dev/null
+++ b/fincept-terminal-desktop/eslint.config.js
@@ -0,0 +1,81 @@
+import js from '@eslint/js';
+import tseslint from 'typescript-eslint';
+import reactHooks from 'eslint-plugin-react-hooks';
+import reactRefresh from 'eslint-plugin-react-refresh';
+
+export default tseslint.config(
+ // Ignore generated/vendored files
+ {
+ ignores: [
+ 'dist/**',
+ 'node_modules/**',
+ 'src-tauri/**',
+ 'public/**',
+ 'scripts/**',
+ '*.config.*',
+ ],
+ },
+
+ // Base JS recommended rules
+ js.configs.recommended,
+
+ // TypeScript rules
+ ...tseslint.configs.recommended,
+
+ // React-specific rules
+ {
+ files: ['src/**/*.{ts,tsx}'],
+ plugins: {
+ 'react-hooks': reactHooks,
+ 'react-refresh': reactRefresh,
+ },
+ rules: {
+ // ── React Hooks ──────────────────────────────────────────────────────
+ // Catches missing useEffect deps, conditional hooks — root cause of
+ // stale closure bugs and render loops
+ 'react-hooks/rules-of-hooks': 'error',
+ 'react-hooks/exhaustive-deps': 'warn',
+
+ // ── React Refresh (HMR safety) ───────────────────────────────────────
+ 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
+
+ // ── TypeScript `any` — root cause of object-rendered-as-JSX bugs ────
+ // Warn (not error) so the codebase isn't blocked, but issues surface
+ '@typescript-eslint/no-explicit-any': 'warn',
+
+ // Catches cases where `any` flows in from untyped sources silently
+ '@typescript-eslint/no-unsafe-assignment': 'off', // too noisy for now
+ '@typescript-eslint/no-unsafe-member-access': 'off', // too noisy for now
+ '@typescript-eslint/no-unsafe-call': 'off', // too noisy for now
+ '@typescript-eslint/no-unsafe-return': 'off', // too noisy for now
+
+ // ── Unused vars — catches dead code that hides real issues ───────────
+ '@typescript-eslint/no-unused-vars': ['warn', {
+ argsIgnorePattern: '^_',
+ varsIgnorePattern: '^_',
+ ignoreRestSiblings: true,
+ }],
+
+ // ── Common patterns that produce false positives ─────────────────────
+ // Initialized-then-reassigned pattern (let x = default; if (...) x = other)
+ // is valid and common — disable to avoid false positives
+ 'no-useless-assignment': 'off',
+
+ // ── Async safety ────────────────────────────────────────────────────
+ // Catches unhandled promise rejections that cause Error #306
+ '@typescript-eslint/no-floating-promises': 'off', // too noisy without strictNullChecks tuning
+
+ // Allow empty catch blocks (common in this codebase)
+ '@typescript-eslint/no-empty-object-type': 'warn',
+
+ // preserve-caught-error requires `cause` chaining on every re-throw —
+ // triggers across 40+ data adapters that use throw new Error(msg) legitimately
+ 'preserve-caught-error': 'off',
+
+ // ── General safety ───────────────────────────────────────────────────
+ 'no-console': 'off', // Console is used for debug logging
+ 'no-debugger': 'error',
+ 'no-undef': 'off', // TypeScript handles this
+ },
+ },
+);
diff --git a/fincept-terminal-desktop/package.json b/fincept-terminal-desktop/package.json
index 223f2dc95..a1994b5eb 100644
--- a/fincept-terminal-desktop/package.json
+++ b/fincept-terminal-desktop/package.json
@@ -6,6 +6,8 @@
"license": "AGPL-3.0-or-later",
"scripts": {
"dev": "vite",
+ "lint": "eslint src --ext .ts,.tsx",
+ "lint:fix": "eslint src --ext .ts,.tsx --fix",
"build": "cross-env NODE_OPTIONS=--max-old-space-size=8192 tsc && cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build",
"preview": "vite preview",
"tauri": "tauri",
@@ -69,6 +71,25 @@
"@tauri-apps/plugin-process": "^2.3.1",
"@tauri-apps/plugin-shell": "^2.3.3",
"@tauri-apps/plugin-updater": "~2.9.0",
+ "@tiptap/extension-color": "^3.20.0",
+ "@tiptap/extension-font-family": "^3.20.0",
+ "@tiptap/extension-highlight": "^3.20.0",
+ "@tiptap/extension-image": "^3.20.0",
+ "@tiptap/extension-link": "^3.20.0",
+ "@tiptap/extension-placeholder": "^3.20.0",
+ "@tiptap/extension-subscript": "^3.20.0",
+ "@tiptap/extension-superscript": "^3.20.0",
+ "@tiptap/extension-table": "^3.20.0",
+ "@tiptap/extension-table-cell": "^3.20.0",
+ "@tiptap/extension-table-header": "^3.20.0",
+ "@tiptap/extension-table-row": "^3.20.0",
+ "@tiptap/extension-text-align": "^3.20.0",
+ "@tiptap/extension-text-style": "^3.20.0",
+ "@tiptap/extension-typography": "^3.20.0",
+ "@tiptap/extension-underline": "^3.20.0",
+ "@tiptap/pm": "^3.20.0",
+ "@tiptap/react": "^3.20.0",
+ "@tiptap/starter-kit": "^3.20.0",
"@types/dompurify": "^3.2.0",
"@types/plotly.js": "^3.0.9",
"@types/react-grid-layout": "^1.3.5",
@@ -82,6 +103,7 @@
"d3": "^7.9.0",
"date-fns": "^4.1.0",
"deck.gl": "^9.2.5",
+ "docx-preview": "^0.3.7",
"dompurify": "^3.3.1",
"driver.js": "^1.4.0",
"embla-carousel-react": "^8.6.0",
@@ -89,6 +111,7 @@
"fyers-web-sdk-v3": "^1.3.1",
"groq-sdk": "^0.37.0",
"handsontable": "^16.2.0",
+ "html-to-docx": "^1.8.0",
"hyperformula": "^3.1.1",
"i18next": "^25.7.1",
"i18next-browser-languagedetector": "^8.2.0",
@@ -97,11 +120,13 @@
"jsonata": "^2.1.0",
"jsonpath": "^1.1.1",
"jsonpath-plus": "^10.3.0",
+ "jszip": "^3.10.1",
"katex": "^0.16.28",
"langchain": "^0.3.34",
"libphonenumber-js": "^1.12.33",
"lightweight-charts": "^5.0.9",
"lucide-react": "^0.544.0",
+ "mammoth": "^1.11.0",
"maplibre-gl": "^5.16.0",
"marked": "^17.0.1",
"next-themes": "^0.4.6",
@@ -132,12 +157,15 @@
"tailwindcss": "^4.1.13",
"vaul": "^1.1.2",
"ws": "^8.18.3",
+ "xgplayer": "^3.0.23",
+ "xgplayer-hls": "^3.0.23",
"xlsx": "^0.18.5"
},
"resolutions": {
"readable-stream": "4.7.0"
},
"devDependencies": {
+ "@eslint/js": "^10.0.1",
"@tauri-apps/cli": "^2",
"@types/d3": "^7.4.3",
"@types/jmespath": "^0.15.2",
@@ -147,11 +175,14 @@
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@types/ws": "^8.18.1",
- "@vitejs/plugin-react": "^4.6.0",
+ "@vitejs/plugin-react-swc": "^4.2.3",
"baseline-browser-mapping": "^2.8.32",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"cross-env": "^10.1.0",
+ "eslint": "^10.0.2",
+ "eslint-plugin-react-hooks": "^7.0.1",
+ "eslint-plugin-react-refresh": "^0.5.2",
"glob": "^13.0.0",
"http-proxy-agent": "^7.0.2",
"https-browserify": "^1.0.0",
@@ -164,6 +195,7 @@
"ts-node": "^10.9.2",
"tw-animate-css": "^1.4.0",
"typescript": "~5.8.3",
+ "typescript-eslint": "^8.56.1",
"url": "^0.11.4",
"util": "^0.12.5",
"vite": "^7.0.4",
diff --git a/fincept-terminal-desktop/public/locales/ar/dashboard.json b/fincept-terminal-desktop/public/locales/ar/dashboard.json
index b3d44ba97..268f79e82 100644
--- a/fincept-terminal-desktop/public/locales/ar/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/ar/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[AR] MARKETS",
"performanceTracker": "[AR] PERFORMANCE TRACKER",
"totalPnL": "[AR] TOTAL P&L",
- "viewDetailedAnalytics": "[AR] View Detailed Analytics"
+ "viewDetailedAnalytics": "[AR] View Detailed Analytics",
+ "commodityGold": "[AR] Gold",
+ "commoditySilver": "[AR] Silver",
+ "commodityCrudeOil": "[AR] Crude Oil",
+ "commodityNatGas": "[AR] Nat Gas",
+ "commodityCopper": "[AR] Copper",
+ "commodityCorn": "[AR] Corn",
+ "commoditySoybeans": "[AR] Soybeans",
+ "commodityWheat": "[AR] Wheat",
+ "indexSP500": "[AR] S&P 500",
+ "indexDowJones": "[AR] Dow Jones",
+ "indexNasdaq": "[AR] Nasdaq",
+ "indexRussell2000": "[AR] Russell 2000",
+ "indexFTSE100": "[AR] FTSE 100",
+ "indexDAX": "[AR] DAX",
+ "indexCAC40": "[AR] CAC 40",
+ "indexNikkei225": "[AR] Nikkei 225",
+ "indexHangSeng": "[AR] Hang Seng",
+ "indexShanghai": "[AR] Shanghai",
+ "indexNifty50": "[AR] Nifty 50",
+ "indexSensex": "[AR] Sensex",
+ "forexEURUSD": "[AR] EUR/USD",
+ "forexGBPUSD": "[AR] GBP/USD",
+ "forexUSDJPY": "[AR] USD/JPY",
+ "forexAUDUSD": "[AR] AUD/USD",
+ "forexUSDCAD": "[AR] USD/CAD",
+ "forexUSDCHF": "[AR] USD/CHF",
+ "forexNZDUSD": "[AR] NZD/USD",
+ "forexEURCHF": "[AR] EUR/CHF"
},
"messages": {
"layoutSaved": "تم حفظ تخطيط لوحة المعلومات!",
diff --git a/fincept-terminal-desktop/public/locales/ar/markets.json b/fincept-terminal-desktop/public/locales/ar/markets.json
index 78accefc5..39e5dc27b 100644
--- a/fincept-terminal-desktop/public/locales/ar/markets.json
+++ b/fincept-terminal-desktop/public/locales/ar/markets.json
@@ -13,5 +13,8 @@
"refresh": "تحديث",
"auto": "تلقائي",
"on": "مفعل",
- "off": "معطل"
+ "off": "معطل",
+ "loading": {
+ "title": "[AR] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/ar/portfolio.json b/fincept-terminal-desktop/public/locales/ar/portfolio.json
index d5bb8ee46..7236b758a 100644
--- a/fincept-terminal-desktop/public/locales/ar/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/ar/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "الكمية",
"price": "السعر",
"add": "إضافة",
- "sell": "بيع"
+ "sell": "بيع",
+ "confirmDelete": "[AR] CONFIRM DELETE",
+ "deleteTransactionWarning": "[AR] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[AR] DELETE",
+ "editTransaction": "[AR] EDIT TRANSACTION",
+ "transactionDate": "[AR] TRANSACTION DATE",
+ "notes": "[AR] NOTES",
+ "notesPlaceholder": "[AR] Optional notes...",
+ "totalValue": "[AR] TOTAL VALUE",
+ "save": "[AR] SAVE"
},
"extracted": {
- "areYouSureYou": "[AR] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[AR] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[AR] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[AR] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[AR] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[AR] FINCEPT",
+ "portfolioTerminal": "[AR] PORTFOLIO TERMINAL",
+ "live": "[AR] LIVE",
+ "pos": "[AR] POS",
+ "ins": "[AR] INS",
+ "nav": "[AR] NAV",
+ "pnl": "[AR] P&L",
+ "day": "[AR] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[AR] TOTAL VALUE",
+ "unrealizedPnl": "[AR] UNREALIZED P&L",
+ "dayChange": "[AR] DAY CHANGE",
+ "costBasis": "[AR] COST BASIS",
+ "fifo": "[AR] FIFO",
+ "positions": "[AR] POSITIONS",
+ "concTop3": "[AR] CONC. TOP3",
+ "weight": "[AR] WEIGHT",
+ "sharpe": "[AR] SHARPE",
+ "annualized": "[AR] ANNUALIZED",
+ "beta": "[AR] BETA",
+ "vsSpy": "[AR] VS SPY",
+ "volatility": "[AR] VOLATILITY",
+ "ann30d": "[AR] 30D ANN.",
+ "maxDrawdown": "[AR] MAX DRAWDOWN",
+ "sinceIncep": "[AR] SINCE INCEP.",
+ "riskScore": "[AR] RISK SCORE",
+ "composite": "[AR] COMPOSITE",
+ "var95": "[AR] VAR (95%)",
+ "oneDay": "[AR] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[AR] SECTOR ALLOCATION",
+ "sectors": "[AR] sectors",
+ "correlation": "[AR] CORRELATION",
+ "dayChangeProxy": "[AR] (day change proxy)",
+ "needTwoHoldings": "[AR] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[AR] POSITIONS BLOTTER",
+ "instruments": "[AR] instruments"
+ },
+ "chart": {
+ "performance": "[AR] PERFORMANCE",
+ "portfolio": "[AR] PORTFOLIO",
+ "totalReturn": "[AR] TOTAL RETURN",
+ "historyMessage": "[AR] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[AR] ORDER ENTRY",
+ "price": "[AR] PRICE",
+ "qtyHeld": "[AR] QTY HELD",
+ "mktVal": "[AR] MKT VAL",
+ "clickToBuyMore": "[AR] Click to buy more",
+ "clickToSell": "[AR] Click to sell",
+ "clickToBuy": "[AR] Click to buy an asset",
+ "clickToSellAsset": "[AR] Click to sell an asset",
+ "openBuyOrder": "[AR] OPEN BUY ORDER",
+ "openSellOrder": "[AR] OPEN SELL ORDER",
+ "ordersRecorded": "[AR] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[AR] HOLDINGS",
+ "noHoldings": "[AR] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[AR] RISK SCORE",
+ "low": "[AR] LOW",
+ "high": "[AR] HIGH",
+ "topMovers": "[AR] TOP MOVERS",
+ "quickStats": "[AR] QUICK STATS",
+ "concTop3": "[AR] CONC. TOP3",
+ "volatility": "[AR] VOLATILITY",
+ "newPortfolio": "[AR] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[AR] SELECT PORTFOLIO",
+ "searchPortfolios": "[AR] Search portfolios...",
+ "newPortfolio": "[AR] NEW PORTFOLIO",
+ "nav": "[AR] NAV",
+ "pnl": "[AR] P&L",
+ "day": "[AR] DAY",
+ "pos": "[AR] POS",
+ "wl": "[AR] W/L"
+ },
+ "actions": {
+ "buy": "[AR] BUY",
+ "sell": "[AR] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/ar/settings.json b/fincept-terminal-desktop/public/locales/ar/settings.json
index b9fdfffee..a0c32e798 100644
--- a/fincept-terminal-desktop/public/locales/ar/settings.json
+++ b/fincept-terminal-desktop/public/locales/ar/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[AR] Test notification sent successfully!",
"testFailed": "[AR] Failed to send test notification. Check your configuration.",
"saved": "[AR] Configuration saved"
+ },
+ "language": {
+ "title": "[AR] LANGUAGE SETTINGS",
+ "selectLanguage": "[AR] Select your preferred language for the terminal interface",
+ "currentLanguage": "[AR] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/bn/dashboard.json b/fincept-terminal-desktop/public/locales/bn/dashboard.json
index c042baeb9..40395e3f2 100644
--- a/fincept-terminal-desktop/public/locales/bn/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/bn/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[BN] MARKETS",
"performanceTracker": "[BN] PERFORMANCE TRACKER",
"totalPnL": "[BN] TOTAL P&L",
- "viewDetailedAnalytics": "[BN] View Detailed Analytics"
+ "viewDetailedAnalytics": "[BN] View Detailed Analytics",
+ "commodityGold": "[BN] Gold",
+ "commoditySilver": "[BN] Silver",
+ "commodityCrudeOil": "[BN] Crude Oil",
+ "commodityNatGas": "[BN] Nat Gas",
+ "commodityCopper": "[BN] Copper",
+ "commodityCorn": "[BN] Corn",
+ "commoditySoybeans": "[BN] Soybeans",
+ "commodityWheat": "[BN] Wheat",
+ "indexSP500": "[BN] S&P 500",
+ "indexDowJones": "[BN] Dow Jones",
+ "indexNasdaq": "[BN] Nasdaq",
+ "indexRussell2000": "[BN] Russell 2000",
+ "indexFTSE100": "[BN] FTSE 100",
+ "indexDAX": "[BN] DAX",
+ "indexCAC40": "[BN] CAC 40",
+ "indexNikkei225": "[BN] Nikkei 225",
+ "indexHangSeng": "[BN] Hang Seng",
+ "indexShanghai": "[BN] Shanghai",
+ "indexNifty50": "[BN] Nifty 50",
+ "indexSensex": "[BN] Sensex",
+ "forexEURUSD": "[BN] EUR/USD",
+ "forexGBPUSD": "[BN] GBP/USD",
+ "forexUSDJPY": "[BN] USD/JPY",
+ "forexAUDUSD": "[BN] AUD/USD",
+ "forexUSDCAD": "[BN] USD/CAD",
+ "forexUSDCHF": "[BN] USD/CHF",
+ "forexNZDUSD": "[BN] NZD/USD",
+ "forexEURCHF": "[BN] EUR/CHF"
},
"messages": {
"layoutSaved": "ড্যাশবোর্ড লেআউট সংরক্ষিত!",
diff --git a/fincept-terminal-desktop/public/locales/bn/markets.json b/fincept-terminal-desktop/public/locales/bn/markets.json
index 2f9d7178a..995b270c3 100644
--- a/fincept-terminal-desktop/public/locales/bn/markets.json
+++ b/fincept-terminal-desktop/public/locales/bn/markets.json
@@ -13,5 +13,8 @@
"refresh": "রিফ্রেশ",
"auto": "স্বয়ংক্রিয়",
"on": "চালু",
- "off": "বন্ধ"
+ "off": "বন্ধ",
+ "loading": {
+ "title": "[BN] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/bn/portfolio.json b/fincept-terminal-desktop/public/locales/bn/portfolio.json
index f5218f7c9..78b9d0340 100644
--- a/fincept-terminal-desktop/public/locales/bn/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/bn/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "পরিমাণ",
"price": "মূল্য",
"add": "যোগ করুন",
- "sell": "বিক্রি করুন"
+ "sell": "বিক্রি করুন",
+ "confirmDelete": "[BN] CONFIRM DELETE",
+ "deleteTransactionWarning": "[BN] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[BN] DELETE",
+ "editTransaction": "[BN] EDIT TRANSACTION",
+ "transactionDate": "[BN] TRANSACTION DATE",
+ "notes": "[BN] NOTES",
+ "notesPlaceholder": "[BN] Optional notes...",
+ "totalValue": "[BN] TOTAL VALUE",
+ "save": "[BN] SAVE"
},
"extracted": {
- "areYouSureYou": "[BN] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[BN] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[BN] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[BN] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[BN] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[BN] FINCEPT",
+ "portfolioTerminal": "[BN] PORTFOLIO TERMINAL",
+ "live": "[BN] LIVE",
+ "pos": "[BN] POS",
+ "ins": "[BN] INS",
+ "nav": "[BN] NAV",
+ "pnl": "[BN] P&L",
+ "day": "[BN] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[BN] TOTAL VALUE",
+ "unrealizedPnl": "[BN] UNREALIZED P&L",
+ "dayChange": "[BN] DAY CHANGE",
+ "costBasis": "[BN] COST BASIS",
+ "fifo": "[BN] FIFO",
+ "positions": "[BN] POSITIONS",
+ "concTop3": "[BN] CONC. TOP3",
+ "weight": "[BN] WEIGHT",
+ "sharpe": "[BN] SHARPE",
+ "annualized": "[BN] ANNUALIZED",
+ "beta": "[BN] BETA",
+ "vsSpy": "[BN] VS SPY",
+ "volatility": "[BN] VOLATILITY",
+ "ann30d": "[BN] 30D ANN.",
+ "maxDrawdown": "[BN] MAX DRAWDOWN",
+ "sinceIncep": "[BN] SINCE INCEP.",
+ "riskScore": "[BN] RISK SCORE",
+ "composite": "[BN] COMPOSITE",
+ "var95": "[BN] VAR (95%)",
+ "oneDay": "[BN] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[BN] SECTOR ALLOCATION",
+ "sectors": "[BN] sectors",
+ "correlation": "[BN] CORRELATION",
+ "dayChangeProxy": "[BN] (day change proxy)",
+ "needTwoHoldings": "[BN] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[BN] POSITIONS BLOTTER",
+ "instruments": "[BN] instruments"
+ },
+ "chart": {
+ "performance": "[BN] PERFORMANCE",
+ "portfolio": "[BN] PORTFOLIO",
+ "totalReturn": "[BN] TOTAL RETURN",
+ "historyMessage": "[BN] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[BN] ORDER ENTRY",
+ "price": "[BN] PRICE",
+ "qtyHeld": "[BN] QTY HELD",
+ "mktVal": "[BN] MKT VAL",
+ "clickToBuyMore": "[BN] Click to buy more",
+ "clickToSell": "[BN] Click to sell",
+ "clickToBuy": "[BN] Click to buy an asset",
+ "clickToSellAsset": "[BN] Click to sell an asset",
+ "openBuyOrder": "[BN] OPEN BUY ORDER",
+ "openSellOrder": "[BN] OPEN SELL ORDER",
+ "ordersRecorded": "[BN] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[BN] HOLDINGS",
+ "noHoldings": "[BN] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[BN] RISK SCORE",
+ "low": "[BN] LOW",
+ "high": "[BN] HIGH",
+ "topMovers": "[BN] TOP MOVERS",
+ "quickStats": "[BN] QUICK STATS",
+ "concTop3": "[BN] CONC. TOP3",
+ "volatility": "[BN] VOLATILITY",
+ "newPortfolio": "[BN] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[BN] SELECT PORTFOLIO",
+ "searchPortfolios": "[BN] Search portfolios...",
+ "newPortfolio": "[BN] NEW PORTFOLIO",
+ "nav": "[BN] NAV",
+ "pnl": "[BN] P&L",
+ "day": "[BN] DAY",
+ "pos": "[BN] POS",
+ "wl": "[BN] W/L"
+ },
+ "actions": {
+ "buy": "[BN] BUY",
+ "sell": "[BN] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/bn/settings.json b/fincept-terminal-desktop/public/locales/bn/settings.json
index b75b8e700..1cc33c837 100644
--- a/fincept-terminal-desktop/public/locales/bn/settings.json
+++ b/fincept-terminal-desktop/public/locales/bn/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[BN] Test notification sent successfully!",
"testFailed": "[BN] Failed to send test notification. Check your configuration.",
"saved": "[BN] Configuration saved"
+ },
+ "language": {
+ "title": "[BN] LANGUAGE SETTINGS",
+ "selectLanguage": "[BN] Select your preferred language for the terminal interface",
+ "currentLanguage": "[BN] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/de/dashboard.json b/fincept-terminal-desktop/public/locales/de/dashboard.json
index 8cfcac51a..de899434b 100644
--- a/fincept-terminal-desktop/public/locales/de/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/de/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[DE] MARKETS",
"performanceTracker": "[DE] PERFORMANCE TRACKER",
"totalPnL": "[DE] TOTAL P&L",
- "viewDetailedAnalytics": "[DE] View Detailed Analytics"
+ "viewDetailedAnalytics": "[DE] View Detailed Analytics",
+ "commodityGold": "[DE] Gold",
+ "commoditySilver": "[DE] Silver",
+ "commodityCrudeOil": "[DE] Crude Oil",
+ "commodityNatGas": "[DE] Nat Gas",
+ "commodityCopper": "[DE] Copper",
+ "commodityCorn": "[DE] Corn",
+ "commoditySoybeans": "[DE] Soybeans",
+ "commodityWheat": "[DE] Wheat",
+ "indexSP500": "[DE] S&P 500",
+ "indexDowJones": "[DE] Dow Jones",
+ "indexNasdaq": "[DE] Nasdaq",
+ "indexRussell2000": "[DE] Russell 2000",
+ "indexFTSE100": "[DE] FTSE 100",
+ "indexDAX": "[DE] DAX",
+ "indexCAC40": "[DE] CAC 40",
+ "indexNikkei225": "[DE] Nikkei 225",
+ "indexHangSeng": "[DE] Hang Seng",
+ "indexShanghai": "[DE] Shanghai",
+ "indexNifty50": "[DE] Nifty 50",
+ "indexSensex": "[DE] Sensex",
+ "forexEURUSD": "[DE] EUR/USD",
+ "forexGBPUSD": "[DE] GBP/USD",
+ "forexUSDJPY": "[DE] USD/JPY",
+ "forexAUDUSD": "[DE] AUD/USD",
+ "forexUSDCAD": "[DE] USD/CAD",
+ "forexUSDCHF": "[DE] USD/CHF",
+ "forexNZDUSD": "[DE] NZD/USD",
+ "forexEURCHF": "[DE] EUR/CHF"
},
"messages": {
"layoutSaved": "Dashboard-Layout gespeichert!",
diff --git a/fincept-terminal-desktop/public/locales/de/markets.json b/fincept-terminal-desktop/public/locales/de/markets.json
index 4458551a3..3ca2e3e0c 100644
--- a/fincept-terminal-desktop/public/locales/de/markets.json
+++ b/fincept-terminal-desktop/public/locales/de/markets.json
@@ -13,5 +13,8 @@
"refresh": "AKTUALISIEREN",
"auto": "AUTO",
"on": "AN",
- "off": "AUS"
+ "off": "AUS",
+ "loading": {
+ "title": "[DE] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/de/portfolio.json b/fincept-terminal-desktop/public/locales/de/portfolio.json
index bfeb1eb8b..2e789b6c8 100644
--- a/fincept-terminal-desktop/public/locales/de/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/de/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "MENGE",
"price": "PREIS",
"add": "HINZUFÜGEN",
- "sell": "VERKAUFEN"
+ "sell": "VERKAUFEN",
+ "confirmDelete": "[DE] CONFIRM DELETE",
+ "deleteTransactionWarning": "[DE] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[DE] DELETE",
+ "editTransaction": "[DE] EDIT TRANSACTION",
+ "transactionDate": "[DE] TRANSACTION DATE",
+ "notes": "[DE] NOTES",
+ "notesPlaceholder": "[DE] Optional notes...",
+ "totalValue": "[DE] TOTAL VALUE",
+ "save": "[DE] SAVE"
},
"extracted": {
- "areYouSureYou": "[DE] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[DE] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[DE] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[DE] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[DE] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[DE] FINCEPT",
+ "portfolioTerminal": "[DE] PORTFOLIO TERMINAL",
+ "live": "[DE] LIVE",
+ "pos": "[DE] POS",
+ "ins": "[DE] INS",
+ "nav": "[DE] NAV",
+ "pnl": "[DE] P&L",
+ "day": "[DE] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[DE] TOTAL VALUE",
+ "unrealizedPnl": "[DE] UNREALIZED P&L",
+ "dayChange": "[DE] DAY CHANGE",
+ "costBasis": "[DE] COST BASIS",
+ "fifo": "[DE] FIFO",
+ "positions": "[DE] POSITIONS",
+ "concTop3": "[DE] CONC. TOP3",
+ "weight": "[DE] WEIGHT",
+ "sharpe": "[DE] SHARPE",
+ "annualized": "[DE] ANNUALIZED",
+ "beta": "[DE] BETA",
+ "vsSpy": "[DE] VS SPY",
+ "volatility": "[DE] VOLATILITY",
+ "ann30d": "[DE] 30D ANN.",
+ "maxDrawdown": "[DE] MAX DRAWDOWN",
+ "sinceIncep": "[DE] SINCE INCEP.",
+ "riskScore": "[DE] RISK SCORE",
+ "composite": "[DE] COMPOSITE",
+ "var95": "[DE] VAR (95%)",
+ "oneDay": "[DE] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[DE] SECTOR ALLOCATION",
+ "sectors": "[DE] sectors",
+ "correlation": "[DE] CORRELATION",
+ "dayChangeProxy": "[DE] (day change proxy)",
+ "needTwoHoldings": "[DE] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[DE] POSITIONS BLOTTER",
+ "instruments": "[DE] instruments"
+ },
+ "chart": {
+ "performance": "[DE] PERFORMANCE",
+ "portfolio": "[DE] PORTFOLIO",
+ "totalReturn": "[DE] TOTAL RETURN",
+ "historyMessage": "[DE] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[DE] ORDER ENTRY",
+ "price": "[DE] PRICE",
+ "qtyHeld": "[DE] QTY HELD",
+ "mktVal": "[DE] MKT VAL",
+ "clickToBuyMore": "[DE] Click to buy more",
+ "clickToSell": "[DE] Click to sell",
+ "clickToBuy": "[DE] Click to buy an asset",
+ "clickToSellAsset": "[DE] Click to sell an asset",
+ "openBuyOrder": "[DE] OPEN BUY ORDER",
+ "openSellOrder": "[DE] OPEN SELL ORDER",
+ "ordersRecorded": "[DE] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[DE] HOLDINGS",
+ "noHoldings": "[DE] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[DE] RISK SCORE",
+ "low": "[DE] LOW",
+ "high": "[DE] HIGH",
+ "topMovers": "[DE] TOP MOVERS",
+ "quickStats": "[DE] QUICK STATS",
+ "concTop3": "[DE] CONC. TOP3",
+ "volatility": "[DE] VOLATILITY",
+ "newPortfolio": "[DE] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[DE] SELECT PORTFOLIO",
+ "searchPortfolios": "[DE] Search portfolios...",
+ "newPortfolio": "[DE] NEW PORTFOLIO",
+ "nav": "[DE] NAV",
+ "pnl": "[DE] P&L",
+ "day": "[DE] DAY",
+ "pos": "[DE] POS",
+ "wl": "[DE] W/L"
+ },
+ "actions": {
+ "buy": "[DE] BUY",
+ "sell": "[DE] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/de/settings.json b/fincept-terminal-desktop/public/locales/de/settings.json
index d00669926..1316a0e22 100644
--- a/fincept-terminal-desktop/public/locales/de/settings.json
+++ b/fincept-terminal-desktop/public/locales/de/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[DE] Test notification sent successfully!",
"testFailed": "[DE] Failed to send test notification. Check your configuration.",
"saved": "[DE] Configuration saved"
+ },
+ "language": {
+ "title": "[DE] LANGUAGE SETTINGS",
+ "selectLanguage": "[DE] Select your preferred language for the terminal interface",
+ "currentLanguage": "[DE] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/en/dashboard.json b/fincept-terminal-desktop/public/locales/en/dashboard.json
index 57da79e07..82d8ad3b7 100644
--- a/fincept-terminal-desktop/public/locales/en/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/en/dashboard.json
@@ -31,7 +31,35 @@
"openPolymarketTab": "Open Polymarket Tab",
"pair": "PAIR",
"rate": "RATE",
+ "indexSP500": "S&P 500",
+ "indexDowJones": "Dow Jones",
+ "indexNasdaq": "Nasdaq",
+ "indexRussell2000": "Russell 2000",
+ "indexFTSE100": "FTSE 100",
+ "indexDAX": "DAX",
+ "indexCAC40": "CAC 40",
+ "indexNikkei225": "Nikkei 225",
+ "indexHangSeng": "Hang Seng",
+ "indexShanghai": "Shanghai",
+ "indexNifty50": "Nifty 50",
+ "indexSensex": "Sensex",
+ "forexEURUSD": "EUR/USD",
+ "forexGBPUSD": "GBP/USD",
+ "forexUSDJPY": "USD/JPY",
+ "forexAUDUSD": "AUD/USD",
+ "forexUSDCAD": "USD/CAD",
+ "forexUSDCHF": "USD/CHF",
+ "forexNZDUSD": "NZD/USD",
+ "forexEURCHF": "EUR/CHF",
"commodity": "COMMODITY",
+ "commodityGold": "Gold",
+ "commoditySilver": "Silver",
+ "commodityCrudeOil": "Crude Oil",
+ "commodityNatGas": "Nat Gas",
+ "commodityCopper": "Copper",
+ "commodityCorn": "Corn",
+ "commoditySoybeans": "Soybeans",
+ "commodityWheat": "Wheat",
"noPortfolioFound": "No portfolio found",
"createPortfolioHint": "Create one in Portfolio tab",
"openPortfolioTab": "Open Portfolio Tab",
diff --git a/fincept-terminal-desktop/public/locales/en/markets.json b/fincept-terminal-desktop/public/locales/en/markets.json
index 46cfd9746..599f7da56 100644
--- a/fincept-terminal-desktop/public/locales/en/markets.json
+++ b/fincept-terminal-desktop/public/locales/en/markets.json
@@ -13,5 +13,8 @@
"refresh": "REFRESH",
"auto": "AUTO",
"on": "ON",
- "off": "OFF"
+ "off": "OFF",
+ "loading": {
+ "title": "Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/en/portfolio.json b/fincept-terminal-desktop/public/locales/en/portfolio.json
index 3980f7af2..94f6aa7ad 100644
--- a/fincept-terminal-desktop/public/locales/en/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/en/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "QUANTITY",
"price": "PRICE",
"add": "ADD",
- "sell": "SELL"
+ "sell": "SELL",
+ "confirmDelete": "CONFIRM DELETE",
+ "deleteTransactionWarning": "Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "DELETE",
+ "editTransaction": "EDIT TRANSACTION",
+ "transactionDate": "TRANSACTION DATE",
+ "notes": "NOTES",
+ "notesPlaceholder": "Optional notes...",
+ "totalValue": "TOTAL VALUE",
+ "save": "SAVE"
},
"extracted": {
- "areYouSureYou": "Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "FINCEPT",
+ "portfolioTerminal": "PORTFOLIO TERMINAL",
+ "live": "LIVE",
+ "pos": "POS",
+ "ins": "INS",
+ "nav": "NAV",
+ "pnl": "P&L",
+ "day": "DAY"
+ },
+ "ribbon": {
+ "totalValue": "TOTAL VALUE",
+ "unrealizedPnl": "UNREALIZED P&L",
+ "dayChange": "DAY CHANGE",
+ "costBasis": "COST BASIS",
+ "fifo": "FIFO",
+ "positions": "POSITIONS",
+ "concTop3": "CONC. TOP3",
+ "weight": "WEIGHT",
+ "sharpe": "SHARPE",
+ "annualized": "ANNUALIZED",
+ "beta": "BETA",
+ "vsSpy": "VS SPY",
+ "volatility": "VOLATILITY",
+ "ann30d": "30D ANN.",
+ "maxDrawdown": "MAX DRAWDOWN",
+ "sinceIncep": "SINCE INCEP.",
+ "riskScore": "RISK SCORE",
+ "composite": "COMPOSITE",
+ "var95": "VAR (95%)",
+ "oneDay": "1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "SECTOR ALLOCATION",
+ "sectors": "sectors",
+ "correlation": "CORRELATION",
+ "dayChangeProxy": "(day change proxy)",
+ "needTwoHoldings": "Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "POSITIONS BLOTTER",
+ "instruments": "instruments"
+ },
+ "chart": {
+ "performance": "PERFORMANCE",
+ "portfolio": "PORTFOLIO",
+ "totalReturn": "TOTAL RETURN",
+ "historyMessage": "Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "ORDER ENTRY",
+ "price": "PRICE",
+ "qtyHeld": "QTY HELD",
+ "mktVal": "MKT VAL",
+ "clickToBuyMore": "Click to buy more",
+ "clickToSell": "Click to sell",
+ "clickToBuy": "Click to buy an asset",
+ "clickToSellAsset": "Click to sell an asset",
+ "openBuyOrder": "OPEN BUY ORDER",
+ "openSellOrder": "OPEN SELL ORDER",
+ "ordersRecorded": "Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "HOLDINGS",
+ "noHoldings": "No holdings yet. Click BUY to add positions.",
+ "riskScore": "RISK SCORE",
+ "low": "LOW",
+ "high": "HIGH",
+ "topMovers": "TOP MOVERS",
+ "quickStats": "QUICK STATS",
+ "concTop3": "CONC. TOP3",
+ "volatility": "VOLATILITY",
+ "newPortfolio": "NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "SELECT PORTFOLIO",
+ "searchPortfolios": "Search portfolios...",
+ "newPortfolio": "NEW PORTFOLIO",
+ "nav": "NAV",
+ "pnl": "P&L",
+ "day": "DAY",
+ "pos": "POS",
+ "wl": "W/L"
+ },
+ "actions": {
+ "buy": "BUY",
+ "sell": "SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/en/settings.json b/fincept-terminal-desktop/public/locales/en/settings.json
index 89f020c9c..32c90d1fb 100644
--- a/fincept-terminal-desktop/public/locales/en/settings.json
+++ b/fincept-terminal-desktop/public/locales/en/settings.json
@@ -115,5 +115,10 @@
"database": "Database: SQLite",
"storage": "Storage: File-based",
"secureStorage": "All data stored securely in fincept_terminal.db"
+ },
+ "language": {
+ "title": "LANGUAGE SETTINGS",
+ "selectLanguage": "Select your preferred language for the terminal interface",
+ "currentLanguage": "CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/en/surfaceAnalytics.json b/fincept-terminal-desktop/public/locales/en/surfaceAnalytics.json
index ca4859548..b3a4bb83b 100644
--- a/fincept-terminal-desktop/public/locales/en/surfaceAnalytics.json
+++ b/fincept-terminal-desktop/public/locales/en/surfaceAnalytics.json
@@ -150,26 +150,26 @@
"configureApiKey": "Configure Databento API key for batch downloads"
},
"surfaceAnalytics": {
- "apiKeyRequired": "[EN] surfaceAnalytics.apiKeyRequired",
- "apiKeyDescription": "[EN] surfaceAnalytics.apiKeyDescription",
+ "apiKeyRequired": "DATABENTO API KEY REQUIRED",
+ "apiKeyDescription": "Surface Analytics uses Databento for institutional-grade market data including options chains, historical bars, and real-time feeds. Connect your API key to access live volatility surfaces and correlation analytics.",
"features": {
- "volatility": "[EN] surfaceAnalytics.features.volatility",
- "volatilityDesc": "[EN] surfaceAnalytics.features.volatilityDesc",
- "correlation": "[EN] surfaceAnalytics.features.correlation",
- "correlationDesc": "[EN] surfaceAnalytics.features.correlationDesc",
- "yieldCurves": "[EN] surfaceAnalytics.features.yieldCurves",
- "yieldCurvesDesc": "[EN] surfaceAnalytics.features.yieldCurvesDesc",
- "pca": "[EN] surfaceAnalytics.features.pca",
- "pcaDesc": "[EN] surfaceAnalytics.features.pcaDesc"
+ "volatility": "VOL SURFACE",
+ "volatilityDesc": "3D implied volatility surface across strikes & expirations",
+ "correlation": "CORRELATION",
+ "correlationDesc": "Multi-asset rolling correlation matrix",
+ "yieldCurves": "YIELD CURVES",
+ "yieldCurvesDesc": "U.S. Treasury yield curve historical evolution",
+ "pca": "PCA FACTORS",
+ "pcaDesc": "Principal component analysis factor loadings"
},
- "configureApiKey": "[EN] surfaceAnalytics.configureApiKey",
- "getApiKey": "[EN] surfaceAnalytics.getApiKey",
- "useDemoData": "[EN] surfaceAnalytics.useDemoData",
- "syntheticData": "[EN] surfaceAnalytics.syntheticData",
- "paidServiceNotice": "[EN] surfaceAnalytics.paidServiceNotice"
+ "configureApiKey": "CONFIGURE API KEY",
+ "getApiKey": "GET API KEY",
+ "useDemoData": "USE DEMO DATA",
+ "syntheticData": "synthetic",
+ "paidServiceNotice": "Databento is a paid service. API usage incurs costs based on data volume and schema type. Use demo mode to explore the interface without charges."
},
"common": {
- "or": "[EN] common.or",
- "note": "[EN] common.note"
+ "or": "or",
+ "note": "NOTE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/es/dashboard.json b/fincept-terminal-desktop/public/locales/es/dashboard.json
index 0a932c555..087f610e0 100644
--- a/fincept-terminal-desktop/public/locales/es/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/es/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[ES] MARKETS",
"performanceTracker": "[ES] PERFORMANCE TRACKER",
"totalPnL": "[ES] TOTAL P&L",
- "viewDetailedAnalytics": "[ES] View Detailed Analytics"
+ "viewDetailedAnalytics": "[ES] View Detailed Analytics",
+ "commodityGold": "[ES] Gold",
+ "commoditySilver": "[ES] Silver",
+ "commodityCrudeOil": "[ES] Crude Oil",
+ "commodityNatGas": "[ES] Nat Gas",
+ "commodityCopper": "[ES] Copper",
+ "commodityCorn": "[ES] Corn",
+ "commoditySoybeans": "[ES] Soybeans",
+ "commodityWheat": "[ES] Wheat",
+ "indexSP500": "[ES] S&P 500",
+ "indexDowJones": "[ES] Dow Jones",
+ "indexNasdaq": "[ES] Nasdaq",
+ "indexRussell2000": "[ES] Russell 2000",
+ "indexFTSE100": "[ES] FTSE 100",
+ "indexDAX": "[ES] DAX",
+ "indexCAC40": "[ES] CAC 40",
+ "indexNikkei225": "[ES] Nikkei 225",
+ "indexHangSeng": "[ES] Hang Seng",
+ "indexShanghai": "[ES] Shanghai",
+ "indexNifty50": "[ES] Nifty 50",
+ "indexSensex": "[ES] Sensex",
+ "forexEURUSD": "[ES] EUR/USD",
+ "forexGBPUSD": "[ES] GBP/USD",
+ "forexUSDJPY": "[ES] USD/JPY",
+ "forexAUDUSD": "[ES] AUD/USD",
+ "forexUSDCAD": "[ES] USD/CAD",
+ "forexUSDCHF": "[ES] USD/CHF",
+ "forexNZDUSD": "[ES] NZD/USD",
+ "forexEURCHF": "[ES] EUR/CHF"
},
"messages": {
"layoutSaved": "¡Diseño del panel guardado!",
diff --git a/fincept-terminal-desktop/public/locales/es/markets.json b/fincept-terminal-desktop/public/locales/es/markets.json
index df7ecf1a4..1223bda89 100644
--- a/fincept-terminal-desktop/public/locales/es/markets.json
+++ b/fincept-terminal-desktop/public/locales/es/markets.json
@@ -13,5 +13,8 @@
"refresh": "ACTUALIZAR",
"auto": "AUTO",
"on": "ON",
- "off": "OFF"
+ "off": "OFF",
+ "loading": {
+ "title": "[ES] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/es/portfolio.json b/fincept-terminal-desktop/public/locales/es/portfolio.json
index b988eee55..a1d14b19e 100644
--- a/fincept-terminal-desktop/public/locales/es/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/es/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "CANTIDAD",
"price": "PRECIO",
"add": "AÑADIR",
- "sell": "VENDER"
+ "sell": "VENDER",
+ "confirmDelete": "[ES] CONFIRM DELETE",
+ "deleteTransactionWarning": "[ES] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[ES] DELETE",
+ "editTransaction": "[ES] EDIT TRANSACTION",
+ "transactionDate": "[ES] TRANSACTION DATE",
+ "notes": "[ES] NOTES",
+ "notesPlaceholder": "[ES] Optional notes...",
+ "totalValue": "[ES] TOTAL VALUE",
+ "save": "[ES] SAVE"
},
"extracted": {
- "areYouSureYou": "[ES] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[ES] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[ES] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[ES] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[ES] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[ES] FINCEPT",
+ "portfolioTerminal": "[ES] PORTFOLIO TERMINAL",
+ "live": "[ES] LIVE",
+ "pos": "[ES] POS",
+ "ins": "[ES] INS",
+ "nav": "[ES] NAV",
+ "pnl": "[ES] P&L",
+ "day": "[ES] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[ES] TOTAL VALUE",
+ "unrealizedPnl": "[ES] UNREALIZED P&L",
+ "dayChange": "[ES] DAY CHANGE",
+ "costBasis": "[ES] COST BASIS",
+ "fifo": "[ES] FIFO",
+ "positions": "[ES] POSITIONS",
+ "concTop3": "[ES] CONC. TOP3",
+ "weight": "[ES] WEIGHT",
+ "sharpe": "[ES] SHARPE",
+ "annualized": "[ES] ANNUALIZED",
+ "beta": "[ES] BETA",
+ "vsSpy": "[ES] VS SPY",
+ "volatility": "[ES] VOLATILITY",
+ "ann30d": "[ES] 30D ANN.",
+ "maxDrawdown": "[ES] MAX DRAWDOWN",
+ "sinceIncep": "[ES] SINCE INCEP.",
+ "riskScore": "[ES] RISK SCORE",
+ "composite": "[ES] COMPOSITE",
+ "var95": "[ES] VAR (95%)",
+ "oneDay": "[ES] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[ES] SECTOR ALLOCATION",
+ "sectors": "[ES] sectors",
+ "correlation": "[ES] CORRELATION",
+ "dayChangeProxy": "[ES] (day change proxy)",
+ "needTwoHoldings": "[ES] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[ES] POSITIONS BLOTTER",
+ "instruments": "[ES] instruments"
+ },
+ "chart": {
+ "performance": "[ES] PERFORMANCE",
+ "portfolio": "[ES] PORTFOLIO",
+ "totalReturn": "[ES] TOTAL RETURN",
+ "historyMessage": "[ES] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[ES] ORDER ENTRY",
+ "price": "[ES] PRICE",
+ "qtyHeld": "[ES] QTY HELD",
+ "mktVal": "[ES] MKT VAL",
+ "clickToBuyMore": "[ES] Click to buy more",
+ "clickToSell": "[ES] Click to sell",
+ "clickToBuy": "[ES] Click to buy an asset",
+ "clickToSellAsset": "[ES] Click to sell an asset",
+ "openBuyOrder": "[ES] OPEN BUY ORDER",
+ "openSellOrder": "[ES] OPEN SELL ORDER",
+ "ordersRecorded": "[ES] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[ES] HOLDINGS",
+ "noHoldings": "[ES] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[ES] RISK SCORE",
+ "low": "[ES] LOW",
+ "high": "[ES] HIGH",
+ "topMovers": "[ES] TOP MOVERS",
+ "quickStats": "[ES] QUICK STATS",
+ "concTop3": "[ES] CONC. TOP3",
+ "volatility": "[ES] VOLATILITY",
+ "newPortfolio": "[ES] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[ES] SELECT PORTFOLIO",
+ "searchPortfolios": "[ES] Search portfolios...",
+ "newPortfolio": "[ES] NEW PORTFOLIO",
+ "nav": "[ES] NAV",
+ "pnl": "[ES] P&L",
+ "day": "[ES] DAY",
+ "pos": "[ES] POS",
+ "wl": "[ES] W/L"
+ },
+ "actions": {
+ "buy": "[ES] BUY",
+ "sell": "[ES] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/es/settings.json b/fincept-terminal-desktop/public/locales/es/settings.json
index a9017207b..edae88d4e 100644
--- a/fincept-terminal-desktop/public/locales/es/settings.json
+++ b/fincept-terminal-desktop/public/locales/es/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[ES] Test notification sent successfully!",
"testFailed": "[ES] Failed to send test notification. Check your configuration.",
"saved": "[ES] Configuration saved"
+ },
+ "language": {
+ "title": "[ES] LANGUAGE SETTINGS",
+ "selectLanguage": "[ES] Select your preferred language for the terminal interface",
+ "currentLanguage": "[ES] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/fr/dashboard.json b/fincept-terminal-desktop/public/locales/fr/dashboard.json
index c53491cfa..77b2c04a7 100644
--- a/fincept-terminal-desktop/public/locales/fr/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/fr/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[FR] MARKETS",
"performanceTracker": "[FR] PERFORMANCE TRACKER",
"totalPnL": "[FR] TOTAL P&L",
- "viewDetailedAnalytics": "[FR] View Detailed Analytics"
+ "viewDetailedAnalytics": "[FR] View Detailed Analytics",
+ "commodityGold": "[FR] Gold",
+ "commoditySilver": "[FR] Silver",
+ "commodityCrudeOil": "[FR] Crude Oil",
+ "commodityNatGas": "[FR] Nat Gas",
+ "commodityCopper": "[FR] Copper",
+ "commodityCorn": "[FR] Corn",
+ "commoditySoybeans": "[FR] Soybeans",
+ "commodityWheat": "[FR] Wheat",
+ "indexSP500": "[FR] S&P 500",
+ "indexDowJones": "[FR] Dow Jones",
+ "indexNasdaq": "[FR] Nasdaq",
+ "indexRussell2000": "[FR] Russell 2000",
+ "indexFTSE100": "[FR] FTSE 100",
+ "indexDAX": "[FR] DAX",
+ "indexCAC40": "[FR] CAC 40",
+ "indexNikkei225": "[FR] Nikkei 225",
+ "indexHangSeng": "[FR] Hang Seng",
+ "indexShanghai": "[FR] Shanghai",
+ "indexNifty50": "[FR] Nifty 50",
+ "indexSensex": "[FR] Sensex",
+ "forexEURUSD": "[FR] EUR/USD",
+ "forexGBPUSD": "[FR] GBP/USD",
+ "forexUSDJPY": "[FR] USD/JPY",
+ "forexAUDUSD": "[FR] AUD/USD",
+ "forexUSDCAD": "[FR] USD/CAD",
+ "forexUSDCHF": "[FR] USD/CHF",
+ "forexNZDUSD": "[FR] NZD/USD",
+ "forexEURCHF": "[FR] EUR/CHF"
},
"messages": {
"layoutSaved": "Disposition du tableau de bord enregistrée !",
diff --git a/fincept-terminal-desktop/public/locales/fr/markets.json b/fincept-terminal-desktop/public/locales/fr/markets.json
index 44c3be3c1..e294ddd4c 100644
--- a/fincept-terminal-desktop/public/locales/fr/markets.json
+++ b/fincept-terminal-desktop/public/locales/fr/markets.json
@@ -13,5 +13,8 @@
"refresh": "ACTUALISER",
"auto": "AUTO",
"on": "ON",
- "off": "OFF"
+ "off": "OFF",
+ "loading": {
+ "title": "[FR] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/fr/portfolio.json b/fincept-terminal-desktop/public/locales/fr/portfolio.json
index 680ac5583..ce4fc0e66 100644
--- a/fincept-terminal-desktop/public/locales/fr/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/fr/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "QUANTITÉ",
"price": "PRIX",
"add": "AJOUTER",
- "sell": "VENDRE"
+ "sell": "VENDRE",
+ "confirmDelete": "[FR] CONFIRM DELETE",
+ "deleteTransactionWarning": "[FR] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[FR] DELETE",
+ "editTransaction": "[FR] EDIT TRANSACTION",
+ "transactionDate": "[FR] TRANSACTION DATE",
+ "notes": "[FR] NOTES",
+ "notesPlaceholder": "[FR] Optional notes...",
+ "totalValue": "[FR] TOTAL VALUE",
+ "save": "[FR] SAVE"
},
"extracted": {
- "areYouSureYou": "[FR] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[FR] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[FR] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[FR] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[FR] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[FR] FINCEPT",
+ "portfolioTerminal": "[FR] PORTFOLIO TERMINAL",
+ "live": "[FR] LIVE",
+ "pos": "[FR] POS",
+ "ins": "[FR] INS",
+ "nav": "[FR] NAV",
+ "pnl": "[FR] P&L",
+ "day": "[FR] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[FR] TOTAL VALUE",
+ "unrealizedPnl": "[FR] UNREALIZED P&L",
+ "dayChange": "[FR] DAY CHANGE",
+ "costBasis": "[FR] COST BASIS",
+ "fifo": "[FR] FIFO",
+ "positions": "[FR] POSITIONS",
+ "concTop3": "[FR] CONC. TOP3",
+ "weight": "[FR] WEIGHT",
+ "sharpe": "[FR] SHARPE",
+ "annualized": "[FR] ANNUALIZED",
+ "beta": "[FR] BETA",
+ "vsSpy": "[FR] VS SPY",
+ "volatility": "[FR] VOLATILITY",
+ "ann30d": "[FR] 30D ANN.",
+ "maxDrawdown": "[FR] MAX DRAWDOWN",
+ "sinceIncep": "[FR] SINCE INCEP.",
+ "riskScore": "[FR] RISK SCORE",
+ "composite": "[FR] COMPOSITE",
+ "var95": "[FR] VAR (95%)",
+ "oneDay": "[FR] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[FR] SECTOR ALLOCATION",
+ "sectors": "[FR] sectors",
+ "correlation": "[FR] CORRELATION",
+ "dayChangeProxy": "[FR] (day change proxy)",
+ "needTwoHoldings": "[FR] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[FR] POSITIONS BLOTTER",
+ "instruments": "[FR] instruments"
+ },
+ "chart": {
+ "performance": "[FR] PERFORMANCE",
+ "portfolio": "[FR] PORTFOLIO",
+ "totalReturn": "[FR] TOTAL RETURN",
+ "historyMessage": "[FR] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[FR] ORDER ENTRY",
+ "price": "[FR] PRICE",
+ "qtyHeld": "[FR] QTY HELD",
+ "mktVal": "[FR] MKT VAL",
+ "clickToBuyMore": "[FR] Click to buy more",
+ "clickToSell": "[FR] Click to sell",
+ "clickToBuy": "[FR] Click to buy an asset",
+ "clickToSellAsset": "[FR] Click to sell an asset",
+ "openBuyOrder": "[FR] OPEN BUY ORDER",
+ "openSellOrder": "[FR] OPEN SELL ORDER",
+ "ordersRecorded": "[FR] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[FR] HOLDINGS",
+ "noHoldings": "[FR] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[FR] RISK SCORE",
+ "low": "[FR] LOW",
+ "high": "[FR] HIGH",
+ "topMovers": "[FR] TOP MOVERS",
+ "quickStats": "[FR] QUICK STATS",
+ "concTop3": "[FR] CONC. TOP3",
+ "volatility": "[FR] VOLATILITY",
+ "newPortfolio": "[FR] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[FR] SELECT PORTFOLIO",
+ "searchPortfolios": "[FR] Search portfolios...",
+ "newPortfolio": "[FR] NEW PORTFOLIO",
+ "nav": "[FR] NAV",
+ "pnl": "[FR] P&L",
+ "day": "[FR] DAY",
+ "pos": "[FR] POS",
+ "wl": "[FR] W/L"
+ },
+ "actions": {
+ "buy": "[FR] BUY",
+ "sell": "[FR] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/fr/settings.json b/fincept-terminal-desktop/public/locales/fr/settings.json
index 2249b037b..e24798371 100644
--- a/fincept-terminal-desktop/public/locales/fr/settings.json
+++ b/fincept-terminal-desktop/public/locales/fr/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[FR] Test notification sent successfully!",
"testFailed": "[FR] Failed to send test notification. Check your configuration.",
"saved": "[FR] Configuration saved"
+ },
+ "language": {
+ "title": "[FR] LANGUAGE SETTINGS",
+ "selectLanguage": "[FR] Select your preferred language for the terminal interface",
+ "currentLanguage": "[FR] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/hi/dashboard.json b/fincept-terminal-desktop/public/locales/hi/dashboard.json
index e6ab955a0..c4b07bb17 100644
--- a/fincept-terminal-desktop/public/locales/hi/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/hi/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[HI] MARKETS",
"performanceTracker": "[HI] PERFORMANCE TRACKER",
"totalPnL": "[HI] TOTAL P&L",
- "viewDetailedAnalytics": "[HI] View Detailed Analytics"
+ "viewDetailedAnalytics": "[HI] View Detailed Analytics",
+ "commodityGold": "[HI] Gold",
+ "commoditySilver": "[HI] Silver",
+ "commodityCrudeOil": "[HI] Crude Oil",
+ "commodityNatGas": "[HI] Nat Gas",
+ "commodityCopper": "[HI] Copper",
+ "commodityCorn": "[HI] Corn",
+ "commoditySoybeans": "[HI] Soybeans",
+ "commodityWheat": "[HI] Wheat",
+ "indexSP500": "[HI] S&P 500",
+ "indexDowJones": "[HI] Dow Jones",
+ "indexNasdaq": "[HI] Nasdaq",
+ "indexRussell2000": "[HI] Russell 2000",
+ "indexFTSE100": "[HI] FTSE 100",
+ "indexDAX": "[HI] DAX",
+ "indexCAC40": "[HI] CAC 40",
+ "indexNikkei225": "[HI] Nikkei 225",
+ "indexHangSeng": "[HI] Hang Seng",
+ "indexShanghai": "[HI] Shanghai",
+ "indexNifty50": "[HI] Nifty 50",
+ "indexSensex": "[HI] Sensex",
+ "forexEURUSD": "[HI] EUR/USD",
+ "forexGBPUSD": "[HI] GBP/USD",
+ "forexUSDJPY": "[HI] USD/JPY",
+ "forexAUDUSD": "[HI] AUD/USD",
+ "forexUSDCAD": "[HI] USD/CAD",
+ "forexUSDCHF": "[HI] USD/CHF",
+ "forexNZDUSD": "[HI] NZD/USD",
+ "forexEURCHF": "[HI] EUR/CHF"
},
"messages": {
"layoutSaved": "डैशबोर्ड लेआउट सहेजा गया!",
diff --git a/fincept-terminal-desktop/public/locales/hi/markets.json b/fincept-terminal-desktop/public/locales/hi/markets.json
index 0d43d55ed..cf9d4d0ab 100644
--- a/fincept-terminal-desktop/public/locales/hi/markets.json
+++ b/fincept-terminal-desktop/public/locales/hi/markets.json
@@ -13,5 +13,8 @@
"refresh": "रीफ्रेश",
"auto": "ऑटो",
"on": "चालू",
- "off": "बंद"
+ "off": "बंद",
+ "loading": {
+ "title": "[HI] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/hi/portfolio.json b/fincept-terminal-desktop/public/locales/hi/portfolio.json
index e12dfe404..16c68a478 100644
--- a/fincept-terminal-desktop/public/locales/hi/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/hi/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "मात्रा",
"price": "मूल्य",
"add": "जोड़ें",
- "sell": "बेचें"
+ "sell": "बेचें",
+ "confirmDelete": "[HI] CONFIRM DELETE",
+ "deleteTransactionWarning": "[HI] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[HI] DELETE",
+ "editTransaction": "[HI] EDIT TRANSACTION",
+ "transactionDate": "[HI] TRANSACTION DATE",
+ "notes": "[HI] NOTES",
+ "notesPlaceholder": "[HI] Optional notes...",
+ "totalValue": "[HI] TOTAL VALUE",
+ "save": "[HI] SAVE"
},
"extracted": {
- "areYouSureYou": "[HI] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[HI] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[HI] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[HI] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[HI] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[HI] FINCEPT",
+ "portfolioTerminal": "[HI] PORTFOLIO TERMINAL",
+ "live": "[HI] LIVE",
+ "pos": "[HI] POS",
+ "ins": "[HI] INS",
+ "nav": "[HI] NAV",
+ "pnl": "[HI] P&L",
+ "day": "[HI] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[HI] TOTAL VALUE",
+ "unrealizedPnl": "[HI] UNREALIZED P&L",
+ "dayChange": "[HI] DAY CHANGE",
+ "costBasis": "[HI] COST BASIS",
+ "fifo": "[HI] FIFO",
+ "positions": "[HI] POSITIONS",
+ "concTop3": "[HI] CONC. TOP3",
+ "weight": "[HI] WEIGHT",
+ "sharpe": "[HI] SHARPE",
+ "annualized": "[HI] ANNUALIZED",
+ "beta": "[HI] BETA",
+ "vsSpy": "[HI] VS SPY",
+ "volatility": "[HI] VOLATILITY",
+ "ann30d": "[HI] 30D ANN.",
+ "maxDrawdown": "[HI] MAX DRAWDOWN",
+ "sinceIncep": "[HI] SINCE INCEP.",
+ "riskScore": "[HI] RISK SCORE",
+ "composite": "[HI] COMPOSITE",
+ "var95": "[HI] VAR (95%)",
+ "oneDay": "[HI] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[HI] SECTOR ALLOCATION",
+ "sectors": "[HI] sectors",
+ "correlation": "[HI] CORRELATION",
+ "dayChangeProxy": "[HI] (day change proxy)",
+ "needTwoHoldings": "[HI] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[HI] POSITIONS BLOTTER",
+ "instruments": "[HI] instruments"
+ },
+ "chart": {
+ "performance": "[HI] PERFORMANCE",
+ "portfolio": "[HI] PORTFOLIO",
+ "totalReturn": "[HI] TOTAL RETURN",
+ "historyMessage": "[HI] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[HI] ORDER ENTRY",
+ "price": "[HI] PRICE",
+ "qtyHeld": "[HI] QTY HELD",
+ "mktVal": "[HI] MKT VAL",
+ "clickToBuyMore": "[HI] Click to buy more",
+ "clickToSell": "[HI] Click to sell",
+ "clickToBuy": "[HI] Click to buy an asset",
+ "clickToSellAsset": "[HI] Click to sell an asset",
+ "openBuyOrder": "[HI] OPEN BUY ORDER",
+ "openSellOrder": "[HI] OPEN SELL ORDER",
+ "ordersRecorded": "[HI] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[HI] HOLDINGS",
+ "noHoldings": "[HI] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[HI] RISK SCORE",
+ "low": "[HI] LOW",
+ "high": "[HI] HIGH",
+ "topMovers": "[HI] TOP MOVERS",
+ "quickStats": "[HI] QUICK STATS",
+ "concTop3": "[HI] CONC. TOP3",
+ "volatility": "[HI] VOLATILITY",
+ "newPortfolio": "[HI] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[HI] SELECT PORTFOLIO",
+ "searchPortfolios": "[HI] Search portfolios...",
+ "newPortfolio": "[HI] NEW PORTFOLIO",
+ "nav": "[HI] NAV",
+ "pnl": "[HI] P&L",
+ "day": "[HI] DAY",
+ "pos": "[HI] POS",
+ "wl": "[HI] W/L"
+ },
+ "actions": {
+ "buy": "[HI] BUY",
+ "sell": "[HI] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/hi/settings.json b/fincept-terminal-desktop/public/locales/hi/settings.json
index d6b446f4f..b24235e1f 100644
--- a/fincept-terminal-desktop/public/locales/hi/settings.json
+++ b/fincept-terminal-desktop/public/locales/hi/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[HI] Test notification sent successfully!",
"testFailed": "[HI] Failed to send test notification. Check your configuration.",
"saved": "[HI] Configuration saved"
+ },
+ "language": {
+ "title": "[HI] LANGUAGE SETTINGS",
+ "selectLanguage": "[HI] Select your preferred language for the terminal interface",
+ "currentLanguage": "[HI] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/id/dashboard.json b/fincept-terminal-desktop/public/locales/id/dashboard.json
index 1996f7f77..74ac7e30d 100644
--- a/fincept-terminal-desktop/public/locales/id/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/id/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[ID] MARKETS",
"performanceTracker": "[ID] PERFORMANCE TRACKER",
"totalPnL": "[ID] TOTAL P&L",
- "viewDetailedAnalytics": "[ID] View Detailed Analytics"
+ "viewDetailedAnalytics": "[ID] View Detailed Analytics",
+ "commodityGold": "[ID] Gold",
+ "commoditySilver": "[ID] Silver",
+ "commodityCrudeOil": "[ID] Crude Oil",
+ "commodityNatGas": "[ID] Nat Gas",
+ "commodityCopper": "[ID] Copper",
+ "commodityCorn": "[ID] Corn",
+ "commoditySoybeans": "[ID] Soybeans",
+ "commodityWheat": "[ID] Wheat",
+ "indexSP500": "[ID] S&P 500",
+ "indexDowJones": "[ID] Dow Jones",
+ "indexNasdaq": "[ID] Nasdaq",
+ "indexRussell2000": "[ID] Russell 2000",
+ "indexFTSE100": "[ID] FTSE 100",
+ "indexDAX": "[ID] DAX",
+ "indexCAC40": "[ID] CAC 40",
+ "indexNikkei225": "[ID] Nikkei 225",
+ "indexHangSeng": "[ID] Hang Seng",
+ "indexShanghai": "[ID] Shanghai",
+ "indexNifty50": "[ID] Nifty 50",
+ "indexSensex": "[ID] Sensex",
+ "forexEURUSD": "[ID] EUR/USD",
+ "forexGBPUSD": "[ID] GBP/USD",
+ "forexUSDJPY": "[ID] USD/JPY",
+ "forexAUDUSD": "[ID] AUD/USD",
+ "forexUSDCAD": "[ID] USD/CAD",
+ "forexUSDCHF": "[ID] USD/CHF",
+ "forexNZDUSD": "[ID] NZD/USD",
+ "forexEURCHF": "[ID] EUR/CHF"
},
"messages": {
"layoutSaved": "Tata letak dasbor disimpan!",
diff --git a/fincept-terminal-desktop/public/locales/id/markets.json b/fincept-terminal-desktop/public/locales/id/markets.json
index 304c9444e..aa4ebe44b 100644
--- a/fincept-terminal-desktop/public/locales/id/markets.json
+++ b/fincept-terminal-desktop/public/locales/id/markets.json
@@ -13,5 +13,8 @@
"refresh": "SEGARKAN",
"auto": "OTOMATIS",
"on": "AKTIF",
- "off": "MATI"
+ "off": "MATI",
+ "loading": {
+ "title": "[ID] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/id/portfolio.json b/fincept-terminal-desktop/public/locales/id/portfolio.json
index d974ebdde..3c89798c7 100644
--- a/fincept-terminal-desktop/public/locales/id/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/id/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "KUANTITAS",
"price": "HARGA",
"add": "TAMBAH",
- "sell": "JUAL"
+ "sell": "JUAL",
+ "confirmDelete": "[ID] CONFIRM DELETE",
+ "deleteTransactionWarning": "[ID] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[ID] DELETE",
+ "editTransaction": "[ID] EDIT TRANSACTION",
+ "transactionDate": "[ID] TRANSACTION DATE",
+ "notes": "[ID] NOTES",
+ "notesPlaceholder": "[ID] Optional notes...",
+ "totalValue": "[ID] TOTAL VALUE",
+ "save": "[ID] SAVE"
},
"extracted": {
- "areYouSureYou": "[ID] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[ID] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[ID] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[ID] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[ID] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[ID] FINCEPT",
+ "portfolioTerminal": "[ID] PORTFOLIO TERMINAL",
+ "live": "[ID] LIVE",
+ "pos": "[ID] POS",
+ "ins": "[ID] INS",
+ "nav": "[ID] NAV",
+ "pnl": "[ID] P&L",
+ "day": "[ID] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[ID] TOTAL VALUE",
+ "unrealizedPnl": "[ID] UNREALIZED P&L",
+ "dayChange": "[ID] DAY CHANGE",
+ "costBasis": "[ID] COST BASIS",
+ "fifo": "[ID] FIFO",
+ "positions": "[ID] POSITIONS",
+ "concTop3": "[ID] CONC. TOP3",
+ "weight": "[ID] WEIGHT",
+ "sharpe": "[ID] SHARPE",
+ "annualized": "[ID] ANNUALIZED",
+ "beta": "[ID] BETA",
+ "vsSpy": "[ID] VS SPY",
+ "volatility": "[ID] VOLATILITY",
+ "ann30d": "[ID] 30D ANN.",
+ "maxDrawdown": "[ID] MAX DRAWDOWN",
+ "sinceIncep": "[ID] SINCE INCEP.",
+ "riskScore": "[ID] RISK SCORE",
+ "composite": "[ID] COMPOSITE",
+ "var95": "[ID] VAR (95%)",
+ "oneDay": "[ID] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[ID] SECTOR ALLOCATION",
+ "sectors": "[ID] sectors",
+ "correlation": "[ID] CORRELATION",
+ "dayChangeProxy": "[ID] (day change proxy)",
+ "needTwoHoldings": "[ID] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[ID] POSITIONS BLOTTER",
+ "instruments": "[ID] instruments"
+ },
+ "chart": {
+ "performance": "[ID] PERFORMANCE",
+ "portfolio": "[ID] PORTFOLIO",
+ "totalReturn": "[ID] TOTAL RETURN",
+ "historyMessage": "[ID] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[ID] ORDER ENTRY",
+ "price": "[ID] PRICE",
+ "qtyHeld": "[ID] QTY HELD",
+ "mktVal": "[ID] MKT VAL",
+ "clickToBuyMore": "[ID] Click to buy more",
+ "clickToSell": "[ID] Click to sell",
+ "clickToBuy": "[ID] Click to buy an asset",
+ "clickToSellAsset": "[ID] Click to sell an asset",
+ "openBuyOrder": "[ID] OPEN BUY ORDER",
+ "openSellOrder": "[ID] OPEN SELL ORDER",
+ "ordersRecorded": "[ID] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[ID] HOLDINGS",
+ "noHoldings": "[ID] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[ID] RISK SCORE",
+ "low": "[ID] LOW",
+ "high": "[ID] HIGH",
+ "topMovers": "[ID] TOP MOVERS",
+ "quickStats": "[ID] QUICK STATS",
+ "concTop3": "[ID] CONC. TOP3",
+ "volatility": "[ID] VOLATILITY",
+ "newPortfolio": "[ID] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[ID] SELECT PORTFOLIO",
+ "searchPortfolios": "[ID] Search portfolios...",
+ "newPortfolio": "[ID] NEW PORTFOLIO",
+ "nav": "[ID] NAV",
+ "pnl": "[ID] P&L",
+ "day": "[ID] DAY",
+ "pos": "[ID] POS",
+ "wl": "[ID] W/L"
+ },
+ "actions": {
+ "buy": "[ID] BUY",
+ "sell": "[ID] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/id/settings.json b/fincept-terminal-desktop/public/locales/id/settings.json
index b40176bed..60623ea22 100644
--- a/fincept-terminal-desktop/public/locales/id/settings.json
+++ b/fincept-terminal-desktop/public/locales/id/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[ID] Test notification sent successfully!",
"testFailed": "[ID] Failed to send test notification. Check your configuration.",
"saved": "[ID] Configuration saved"
+ },
+ "language": {
+ "title": "[ID] LANGUAGE SETTINGS",
+ "selectLanguage": "[ID] Select your preferred language for the terminal interface",
+ "currentLanguage": "[ID] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/it/dashboard.json b/fincept-terminal-desktop/public/locales/it/dashboard.json
index a771c265c..e80375ece 100644
--- a/fincept-terminal-desktop/public/locales/it/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/it/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[IT] MARKETS",
"performanceTracker": "[IT] PERFORMANCE TRACKER",
"totalPnL": "[IT] TOTAL P&L",
- "viewDetailedAnalytics": "[IT] View Detailed Analytics"
+ "viewDetailedAnalytics": "[IT] View Detailed Analytics",
+ "commodityGold": "[IT] Gold",
+ "commoditySilver": "[IT] Silver",
+ "commodityCrudeOil": "[IT] Crude Oil",
+ "commodityNatGas": "[IT] Nat Gas",
+ "commodityCopper": "[IT] Copper",
+ "commodityCorn": "[IT] Corn",
+ "commoditySoybeans": "[IT] Soybeans",
+ "commodityWheat": "[IT] Wheat",
+ "indexSP500": "[IT] S&P 500",
+ "indexDowJones": "[IT] Dow Jones",
+ "indexNasdaq": "[IT] Nasdaq",
+ "indexRussell2000": "[IT] Russell 2000",
+ "indexFTSE100": "[IT] FTSE 100",
+ "indexDAX": "[IT] DAX",
+ "indexCAC40": "[IT] CAC 40",
+ "indexNikkei225": "[IT] Nikkei 225",
+ "indexHangSeng": "[IT] Hang Seng",
+ "indexShanghai": "[IT] Shanghai",
+ "indexNifty50": "[IT] Nifty 50",
+ "indexSensex": "[IT] Sensex",
+ "forexEURUSD": "[IT] EUR/USD",
+ "forexGBPUSD": "[IT] GBP/USD",
+ "forexUSDJPY": "[IT] USD/JPY",
+ "forexAUDUSD": "[IT] AUD/USD",
+ "forexUSDCAD": "[IT] USD/CAD",
+ "forexUSDCHF": "[IT] USD/CHF",
+ "forexNZDUSD": "[IT] NZD/USD",
+ "forexEURCHF": "[IT] EUR/CHF"
},
"messages": {
"layoutSaved": "Layout della dashboard salvato!",
diff --git a/fincept-terminal-desktop/public/locales/it/markets.json b/fincept-terminal-desktop/public/locales/it/markets.json
index 65efc2329..ee8342485 100644
--- a/fincept-terminal-desktop/public/locales/it/markets.json
+++ b/fincept-terminal-desktop/public/locales/it/markets.json
@@ -13,5 +13,8 @@
"refresh": "AGGIORNA",
"auto": "AUTO",
"on": "ON",
- "off": "OFF"
+ "off": "OFF",
+ "loading": {
+ "title": "[IT] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/it/portfolio.json b/fincept-terminal-desktop/public/locales/it/portfolio.json
index 56685b722..cf8877658 100644
--- a/fincept-terminal-desktop/public/locales/it/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/it/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "QUANTITÀ",
"price": "PREZZO",
"add": "AGGIUNGI",
- "sell": "VENDI"
+ "sell": "VENDI",
+ "confirmDelete": "[IT] CONFIRM DELETE",
+ "deleteTransactionWarning": "[IT] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[IT] DELETE",
+ "editTransaction": "[IT] EDIT TRANSACTION",
+ "transactionDate": "[IT] TRANSACTION DATE",
+ "notes": "[IT] NOTES",
+ "notesPlaceholder": "[IT] Optional notes...",
+ "totalValue": "[IT] TOTAL VALUE",
+ "save": "[IT] SAVE"
},
"extracted": {
- "areYouSureYou": "[IT] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[IT] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[IT] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[IT] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[IT] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[IT] FINCEPT",
+ "portfolioTerminal": "[IT] PORTFOLIO TERMINAL",
+ "live": "[IT] LIVE",
+ "pos": "[IT] POS",
+ "ins": "[IT] INS",
+ "nav": "[IT] NAV",
+ "pnl": "[IT] P&L",
+ "day": "[IT] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[IT] TOTAL VALUE",
+ "unrealizedPnl": "[IT] UNREALIZED P&L",
+ "dayChange": "[IT] DAY CHANGE",
+ "costBasis": "[IT] COST BASIS",
+ "fifo": "[IT] FIFO",
+ "positions": "[IT] POSITIONS",
+ "concTop3": "[IT] CONC. TOP3",
+ "weight": "[IT] WEIGHT",
+ "sharpe": "[IT] SHARPE",
+ "annualized": "[IT] ANNUALIZED",
+ "beta": "[IT] BETA",
+ "vsSpy": "[IT] VS SPY",
+ "volatility": "[IT] VOLATILITY",
+ "ann30d": "[IT] 30D ANN.",
+ "maxDrawdown": "[IT] MAX DRAWDOWN",
+ "sinceIncep": "[IT] SINCE INCEP.",
+ "riskScore": "[IT] RISK SCORE",
+ "composite": "[IT] COMPOSITE",
+ "var95": "[IT] VAR (95%)",
+ "oneDay": "[IT] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[IT] SECTOR ALLOCATION",
+ "sectors": "[IT] sectors",
+ "correlation": "[IT] CORRELATION",
+ "dayChangeProxy": "[IT] (day change proxy)",
+ "needTwoHoldings": "[IT] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[IT] POSITIONS BLOTTER",
+ "instruments": "[IT] instruments"
+ },
+ "chart": {
+ "performance": "[IT] PERFORMANCE",
+ "portfolio": "[IT] PORTFOLIO",
+ "totalReturn": "[IT] TOTAL RETURN",
+ "historyMessage": "[IT] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[IT] ORDER ENTRY",
+ "price": "[IT] PRICE",
+ "qtyHeld": "[IT] QTY HELD",
+ "mktVal": "[IT] MKT VAL",
+ "clickToBuyMore": "[IT] Click to buy more",
+ "clickToSell": "[IT] Click to sell",
+ "clickToBuy": "[IT] Click to buy an asset",
+ "clickToSellAsset": "[IT] Click to sell an asset",
+ "openBuyOrder": "[IT] OPEN BUY ORDER",
+ "openSellOrder": "[IT] OPEN SELL ORDER",
+ "ordersRecorded": "[IT] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[IT] HOLDINGS",
+ "noHoldings": "[IT] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[IT] RISK SCORE",
+ "low": "[IT] LOW",
+ "high": "[IT] HIGH",
+ "topMovers": "[IT] TOP MOVERS",
+ "quickStats": "[IT] QUICK STATS",
+ "concTop3": "[IT] CONC. TOP3",
+ "volatility": "[IT] VOLATILITY",
+ "newPortfolio": "[IT] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[IT] SELECT PORTFOLIO",
+ "searchPortfolios": "[IT] Search portfolios...",
+ "newPortfolio": "[IT] NEW PORTFOLIO",
+ "nav": "[IT] NAV",
+ "pnl": "[IT] P&L",
+ "day": "[IT] DAY",
+ "pos": "[IT] POS",
+ "wl": "[IT] W/L"
+ },
+ "actions": {
+ "buy": "[IT] BUY",
+ "sell": "[IT] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/it/settings.json b/fincept-terminal-desktop/public/locales/it/settings.json
index 645db1a51..efb1f9969 100644
--- a/fincept-terminal-desktop/public/locales/it/settings.json
+++ b/fincept-terminal-desktop/public/locales/it/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[IT] Test notification sent successfully!",
"testFailed": "[IT] Failed to send test notification. Check your configuration.",
"saved": "[IT] Configuration saved"
+ },
+ "language": {
+ "title": "[IT] LANGUAGE SETTINGS",
+ "selectLanguage": "[IT] Select your preferred language for the terminal interface",
+ "currentLanguage": "[IT] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/ja/dashboard.json b/fincept-terminal-desktop/public/locales/ja/dashboard.json
index 04b0a87bd..64f0066bf 100644
--- a/fincept-terminal-desktop/public/locales/ja/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/ja/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[JA] MARKETS",
"performanceTracker": "[JA] PERFORMANCE TRACKER",
"totalPnL": "[JA] TOTAL P&L",
- "viewDetailedAnalytics": "[JA] View Detailed Analytics"
+ "viewDetailedAnalytics": "[JA] View Detailed Analytics",
+ "commodityGold": "[JA] Gold",
+ "commoditySilver": "[JA] Silver",
+ "commodityCrudeOil": "[JA] Crude Oil",
+ "commodityNatGas": "[JA] Nat Gas",
+ "commodityCopper": "[JA] Copper",
+ "commodityCorn": "[JA] Corn",
+ "commoditySoybeans": "[JA] Soybeans",
+ "commodityWheat": "[JA] Wheat",
+ "indexSP500": "[JA] S&P 500",
+ "indexDowJones": "[JA] Dow Jones",
+ "indexNasdaq": "[JA] Nasdaq",
+ "indexRussell2000": "[JA] Russell 2000",
+ "indexFTSE100": "[JA] FTSE 100",
+ "indexDAX": "[JA] DAX",
+ "indexCAC40": "[JA] CAC 40",
+ "indexNikkei225": "[JA] Nikkei 225",
+ "indexHangSeng": "[JA] Hang Seng",
+ "indexShanghai": "[JA] Shanghai",
+ "indexNifty50": "[JA] Nifty 50",
+ "indexSensex": "[JA] Sensex",
+ "forexEURUSD": "[JA] EUR/USD",
+ "forexGBPUSD": "[JA] GBP/USD",
+ "forexUSDJPY": "[JA] USD/JPY",
+ "forexAUDUSD": "[JA] AUD/USD",
+ "forexUSDCAD": "[JA] USD/CAD",
+ "forexUSDCHF": "[JA] USD/CHF",
+ "forexNZDUSD": "[JA] NZD/USD",
+ "forexEURCHF": "[JA] EUR/CHF"
},
"messages": {
"layoutSaved": "ダッシュボードのレイアウトが保存されました。",
diff --git a/fincept-terminal-desktop/public/locales/ja/markets.json b/fincept-terminal-desktop/public/locales/ja/markets.json
index 43d898e31..97202c9e4 100644
--- a/fincept-terminal-desktop/public/locales/ja/markets.json
+++ b/fincept-terminal-desktop/public/locales/ja/markets.json
@@ -13,5 +13,8 @@
"refresh": "更新",
"auto": "自動",
"on": "オン",
- "off": "オフ"
+ "off": "オフ",
+ "loading": {
+ "title": "[JA] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/ja/portfolio.json b/fincept-terminal-desktop/public/locales/ja/portfolio.json
index bea0f3c14..116dbb0cd 100644
--- a/fincept-terminal-desktop/public/locales/ja/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/ja/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "数量",
"price": "価格",
"add": "追加",
- "sell": "売却"
+ "sell": "売却",
+ "confirmDelete": "[JA] CONFIRM DELETE",
+ "deleteTransactionWarning": "[JA] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[JA] DELETE",
+ "editTransaction": "[JA] EDIT TRANSACTION",
+ "transactionDate": "[JA] TRANSACTION DATE",
+ "notes": "[JA] NOTES",
+ "notesPlaceholder": "[JA] Optional notes...",
+ "totalValue": "[JA] TOTAL VALUE",
+ "save": "[JA] SAVE"
},
"extracted": {
- "areYouSureYou": "[JA] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[JA] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[JA] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[JA] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[JA] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[JA] FINCEPT",
+ "portfolioTerminal": "[JA] PORTFOLIO TERMINAL",
+ "live": "[JA] LIVE",
+ "pos": "[JA] POS",
+ "ins": "[JA] INS",
+ "nav": "[JA] NAV",
+ "pnl": "[JA] P&L",
+ "day": "[JA] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[JA] TOTAL VALUE",
+ "unrealizedPnl": "[JA] UNREALIZED P&L",
+ "dayChange": "[JA] DAY CHANGE",
+ "costBasis": "[JA] COST BASIS",
+ "fifo": "[JA] FIFO",
+ "positions": "[JA] POSITIONS",
+ "concTop3": "[JA] CONC. TOP3",
+ "weight": "[JA] WEIGHT",
+ "sharpe": "[JA] SHARPE",
+ "annualized": "[JA] ANNUALIZED",
+ "beta": "[JA] BETA",
+ "vsSpy": "[JA] VS SPY",
+ "volatility": "[JA] VOLATILITY",
+ "ann30d": "[JA] 30D ANN.",
+ "maxDrawdown": "[JA] MAX DRAWDOWN",
+ "sinceIncep": "[JA] SINCE INCEP.",
+ "riskScore": "[JA] RISK SCORE",
+ "composite": "[JA] COMPOSITE",
+ "var95": "[JA] VAR (95%)",
+ "oneDay": "[JA] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[JA] SECTOR ALLOCATION",
+ "sectors": "[JA] sectors",
+ "correlation": "[JA] CORRELATION",
+ "dayChangeProxy": "[JA] (day change proxy)",
+ "needTwoHoldings": "[JA] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[JA] POSITIONS BLOTTER",
+ "instruments": "[JA] instruments"
+ },
+ "chart": {
+ "performance": "[JA] PERFORMANCE",
+ "portfolio": "[JA] PORTFOLIO",
+ "totalReturn": "[JA] TOTAL RETURN",
+ "historyMessage": "[JA] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[JA] ORDER ENTRY",
+ "price": "[JA] PRICE",
+ "qtyHeld": "[JA] QTY HELD",
+ "mktVal": "[JA] MKT VAL",
+ "clickToBuyMore": "[JA] Click to buy more",
+ "clickToSell": "[JA] Click to sell",
+ "clickToBuy": "[JA] Click to buy an asset",
+ "clickToSellAsset": "[JA] Click to sell an asset",
+ "openBuyOrder": "[JA] OPEN BUY ORDER",
+ "openSellOrder": "[JA] OPEN SELL ORDER",
+ "ordersRecorded": "[JA] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[JA] HOLDINGS",
+ "noHoldings": "[JA] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[JA] RISK SCORE",
+ "low": "[JA] LOW",
+ "high": "[JA] HIGH",
+ "topMovers": "[JA] TOP MOVERS",
+ "quickStats": "[JA] QUICK STATS",
+ "concTop3": "[JA] CONC. TOP3",
+ "volatility": "[JA] VOLATILITY",
+ "newPortfolio": "[JA] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[JA] SELECT PORTFOLIO",
+ "searchPortfolios": "[JA] Search portfolios...",
+ "newPortfolio": "[JA] NEW PORTFOLIO",
+ "nav": "[JA] NAV",
+ "pnl": "[JA] P&L",
+ "day": "[JA] DAY",
+ "pos": "[JA] POS",
+ "wl": "[JA] W/L"
+ },
+ "actions": {
+ "buy": "[JA] BUY",
+ "sell": "[JA] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/ja/settings.json b/fincept-terminal-desktop/public/locales/ja/settings.json
index e6df5f4c5..a0ed407b6 100644
--- a/fincept-terminal-desktop/public/locales/ja/settings.json
+++ b/fincept-terminal-desktop/public/locales/ja/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[JA] Test notification sent successfully!",
"testFailed": "[JA] Failed to send test notification. Check your configuration.",
"saved": "[JA] Configuration saved"
+ },
+ "language": {
+ "title": "[JA] LANGUAGE SETTINGS",
+ "selectLanguage": "[JA] Select your preferred language for the terminal interface",
+ "currentLanguage": "[JA] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/ko/dashboard.json b/fincept-terminal-desktop/public/locales/ko/dashboard.json
index 3092ec5e0..799df09bc 100644
--- a/fincept-terminal-desktop/public/locales/ko/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/ko/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[KO] MARKETS",
"performanceTracker": "[KO] PERFORMANCE TRACKER",
"totalPnL": "[KO] TOTAL P&L",
- "viewDetailedAnalytics": "[KO] View Detailed Analytics"
+ "viewDetailedAnalytics": "[KO] View Detailed Analytics",
+ "commodityGold": "[KO] Gold",
+ "commoditySilver": "[KO] Silver",
+ "commodityCrudeOil": "[KO] Crude Oil",
+ "commodityNatGas": "[KO] Nat Gas",
+ "commodityCopper": "[KO] Copper",
+ "commodityCorn": "[KO] Corn",
+ "commoditySoybeans": "[KO] Soybeans",
+ "commodityWheat": "[KO] Wheat",
+ "indexSP500": "[KO] S&P 500",
+ "indexDowJones": "[KO] Dow Jones",
+ "indexNasdaq": "[KO] Nasdaq",
+ "indexRussell2000": "[KO] Russell 2000",
+ "indexFTSE100": "[KO] FTSE 100",
+ "indexDAX": "[KO] DAX",
+ "indexCAC40": "[KO] CAC 40",
+ "indexNikkei225": "[KO] Nikkei 225",
+ "indexHangSeng": "[KO] Hang Seng",
+ "indexShanghai": "[KO] Shanghai",
+ "indexNifty50": "[KO] Nifty 50",
+ "indexSensex": "[KO] Sensex",
+ "forexEURUSD": "[KO] EUR/USD",
+ "forexGBPUSD": "[KO] GBP/USD",
+ "forexUSDJPY": "[KO] USD/JPY",
+ "forexAUDUSD": "[KO] AUD/USD",
+ "forexUSDCAD": "[KO] USD/CAD",
+ "forexUSDCHF": "[KO] USD/CHF",
+ "forexNZDUSD": "[KO] NZD/USD",
+ "forexEURCHF": "[KO] EUR/CHF"
},
"messages": {
"layoutSaved": "대시보드 레이아웃이 저장되었습니다!",
diff --git a/fincept-terminal-desktop/public/locales/ko/markets.json b/fincept-terminal-desktop/public/locales/ko/markets.json
index 7a62fd8b6..799d580b9 100644
--- a/fincept-terminal-desktop/public/locales/ko/markets.json
+++ b/fincept-terminal-desktop/public/locales/ko/markets.json
@@ -13,5 +13,8 @@
"refresh": "새로고침",
"auto": "자동",
"on": "켜기",
- "off": "끄기"
+ "off": "끄기",
+ "loading": {
+ "title": "[KO] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/ko/portfolio.json b/fincept-terminal-desktop/public/locales/ko/portfolio.json
index ab18d4476..b87876f2f 100644
--- a/fincept-terminal-desktop/public/locales/ko/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/ko/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "수량",
"price": "가격",
"add": "추가",
- "sell": "매도"
+ "sell": "매도",
+ "confirmDelete": "[KO] CONFIRM DELETE",
+ "deleteTransactionWarning": "[KO] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[KO] DELETE",
+ "editTransaction": "[KO] EDIT TRANSACTION",
+ "transactionDate": "[KO] TRANSACTION DATE",
+ "notes": "[KO] NOTES",
+ "notesPlaceholder": "[KO] Optional notes...",
+ "totalValue": "[KO] TOTAL VALUE",
+ "save": "[KO] SAVE"
},
"extracted": {
- "areYouSureYou": "[KO] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[KO] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[KO] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[KO] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[KO] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[KO] FINCEPT",
+ "portfolioTerminal": "[KO] PORTFOLIO TERMINAL",
+ "live": "[KO] LIVE",
+ "pos": "[KO] POS",
+ "ins": "[KO] INS",
+ "nav": "[KO] NAV",
+ "pnl": "[KO] P&L",
+ "day": "[KO] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[KO] TOTAL VALUE",
+ "unrealizedPnl": "[KO] UNREALIZED P&L",
+ "dayChange": "[KO] DAY CHANGE",
+ "costBasis": "[KO] COST BASIS",
+ "fifo": "[KO] FIFO",
+ "positions": "[KO] POSITIONS",
+ "concTop3": "[KO] CONC. TOP3",
+ "weight": "[KO] WEIGHT",
+ "sharpe": "[KO] SHARPE",
+ "annualized": "[KO] ANNUALIZED",
+ "beta": "[KO] BETA",
+ "vsSpy": "[KO] VS SPY",
+ "volatility": "[KO] VOLATILITY",
+ "ann30d": "[KO] 30D ANN.",
+ "maxDrawdown": "[KO] MAX DRAWDOWN",
+ "sinceIncep": "[KO] SINCE INCEP.",
+ "riskScore": "[KO] RISK SCORE",
+ "composite": "[KO] COMPOSITE",
+ "var95": "[KO] VAR (95%)",
+ "oneDay": "[KO] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[KO] SECTOR ALLOCATION",
+ "sectors": "[KO] sectors",
+ "correlation": "[KO] CORRELATION",
+ "dayChangeProxy": "[KO] (day change proxy)",
+ "needTwoHoldings": "[KO] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[KO] POSITIONS BLOTTER",
+ "instruments": "[KO] instruments"
+ },
+ "chart": {
+ "performance": "[KO] PERFORMANCE",
+ "portfolio": "[KO] PORTFOLIO",
+ "totalReturn": "[KO] TOTAL RETURN",
+ "historyMessage": "[KO] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[KO] ORDER ENTRY",
+ "price": "[KO] PRICE",
+ "qtyHeld": "[KO] QTY HELD",
+ "mktVal": "[KO] MKT VAL",
+ "clickToBuyMore": "[KO] Click to buy more",
+ "clickToSell": "[KO] Click to sell",
+ "clickToBuy": "[KO] Click to buy an asset",
+ "clickToSellAsset": "[KO] Click to sell an asset",
+ "openBuyOrder": "[KO] OPEN BUY ORDER",
+ "openSellOrder": "[KO] OPEN SELL ORDER",
+ "ordersRecorded": "[KO] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[KO] HOLDINGS",
+ "noHoldings": "[KO] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[KO] RISK SCORE",
+ "low": "[KO] LOW",
+ "high": "[KO] HIGH",
+ "topMovers": "[KO] TOP MOVERS",
+ "quickStats": "[KO] QUICK STATS",
+ "concTop3": "[KO] CONC. TOP3",
+ "volatility": "[KO] VOLATILITY",
+ "newPortfolio": "[KO] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[KO] SELECT PORTFOLIO",
+ "searchPortfolios": "[KO] Search portfolios...",
+ "newPortfolio": "[KO] NEW PORTFOLIO",
+ "nav": "[KO] NAV",
+ "pnl": "[KO] P&L",
+ "day": "[KO] DAY",
+ "pos": "[KO] POS",
+ "wl": "[KO] W/L"
+ },
+ "actions": {
+ "buy": "[KO] BUY",
+ "sell": "[KO] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/ko/settings.json b/fincept-terminal-desktop/public/locales/ko/settings.json
index 97c533cc7..a43b99933 100644
--- a/fincept-terminal-desktop/public/locales/ko/settings.json
+++ b/fincept-terminal-desktop/public/locales/ko/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[KO] Test notification sent successfully!",
"testFailed": "[KO] Failed to send test notification. Check your configuration.",
"saved": "[KO] Configuration saved"
+ },
+ "language": {
+ "title": "[KO] LANGUAGE SETTINGS",
+ "selectLanguage": "[KO] Select your preferred language for the terminal interface",
+ "currentLanguage": "[KO] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/pl/dashboard.json b/fincept-terminal-desktop/public/locales/pl/dashboard.json
index ee7123541..4b5736698 100644
--- a/fincept-terminal-desktop/public/locales/pl/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/pl/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[PL] MARKETS",
"performanceTracker": "[PL] PERFORMANCE TRACKER",
"totalPnL": "[PL] TOTAL P&L",
- "viewDetailedAnalytics": "[PL] View Detailed Analytics"
+ "viewDetailedAnalytics": "[PL] View Detailed Analytics",
+ "commodityGold": "[PL] Gold",
+ "commoditySilver": "[PL] Silver",
+ "commodityCrudeOil": "[PL] Crude Oil",
+ "commodityNatGas": "[PL] Nat Gas",
+ "commodityCopper": "[PL] Copper",
+ "commodityCorn": "[PL] Corn",
+ "commoditySoybeans": "[PL] Soybeans",
+ "commodityWheat": "[PL] Wheat",
+ "indexSP500": "[PL] S&P 500",
+ "indexDowJones": "[PL] Dow Jones",
+ "indexNasdaq": "[PL] Nasdaq",
+ "indexRussell2000": "[PL] Russell 2000",
+ "indexFTSE100": "[PL] FTSE 100",
+ "indexDAX": "[PL] DAX",
+ "indexCAC40": "[PL] CAC 40",
+ "indexNikkei225": "[PL] Nikkei 225",
+ "indexHangSeng": "[PL] Hang Seng",
+ "indexShanghai": "[PL] Shanghai",
+ "indexNifty50": "[PL] Nifty 50",
+ "indexSensex": "[PL] Sensex",
+ "forexEURUSD": "[PL] EUR/USD",
+ "forexGBPUSD": "[PL] GBP/USD",
+ "forexUSDJPY": "[PL] USD/JPY",
+ "forexAUDUSD": "[PL] AUD/USD",
+ "forexUSDCAD": "[PL] USD/CAD",
+ "forexUSDCHF": "[PL] USD/CHF",
+ "forexNZDUSD": "[PL] NZD/USD",
+ "forexEURCHF": "[PL] EUR/CHF"
},
"messages": {
"layoutSaved": "Układ pulpitu nawigacyjnego został zapisany!",
diff --git a/fincept-terminal-desktop/public/locales/pl/markets.json b/fincept-terminal-desktop/public/locales/pl/markets.json
index a1e7a1915..1b1031c55 100644
--- a/fincept-terminal-desktop/public/locales/pl/markets.json
+++ b/fincept-terminal-desktop/public/locales/pl/markets.json
@@ -13,5 +13,8 @@
"refresh": "ODŚWIEŻ",
"auto": "AUTO",
"on": "WŁ",
- "off": "WYŁ"
+ "off": "WYŁ",
+ "loading": {
+ "title": "[PL] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/pl/portfolio.json b/fincept-terminal-desktop/public/locales/pl/portfolio.json
index e5de652b0..b30defd39 100644
--- a/fincept-terminal-desktop/public/locales/pl/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/pl/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "ILOŚĆ",
"price": "CENA",
"add": "DODAJ",
- "sell": "SPRZEDAJ"
+ "sell": "SPRZEDAJ",
+ "confirmDelete": "[PL] CONFIRM DELETE",
+ "deleteTransactionWarning": "[PL] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[PL] DELETE",
+ "editTransaction": "[PL] EDIT TRANSACTION",
+ "transactionDate": "[PL] TRANSACTION DATE",
+ "notes": "[PL] NOTES",
+ "notesPlaceholder": "[PL] Optional notes...",
+ "totalValue": "[PL] TOTAL VALUE",
+ "save": "[PL] SAVE"
},
"extracted": {
- "areYouSureYou": "[PL] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[PL] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[PL] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[PL] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[PL] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[PL] FINCEPT",
+ "portfolioTerminal": "[PL] PORTFOLIO TERMINAL",
+ "live": "[PL] LIVE",
+ "pos": "[PL] POS",
+ "ins": "[PL] INS",
+ "nav": "[PL] NAV",
+ "pnl": "[PL] P&L",
+ "day": "[PL] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[PL] TOTAL VALUE",
+ "unrealizedPnl": "[PL] UNREALIZED P&L",
+ "dayChange": "[PL] DAY CHANGE",
+ "costBasis": "[PL] COST BASIS",
+ "fifo": "[PL] FIFO",
+ "positions": "[PL] POSITIONS",
+ "concTop3": "[PL] CONC. TOP3",
+ "weight": "[PL] WEIGHT",
+ "sharpe": "[PL] SHARPE",
+ "annualized": "[PL] ANNUALIZED",
+ "beta": "[PL] BETA",
+ "vsSpy": "[PL] VS SPY",
+ "volatility": "[PL] VOLATILITY",
+ "ann30d": "[PL] 30D ANN.",
+ "maxDrawdown": "[PL] MAX DRAWDOWN",
+ "sinceIncep": "[PL] SINCE INCEP.",
+ "riskScore": "[PL] RISK SCORE",
+ "composite": "[PL] COMPOSITE",
+ "var95": "[PL] VAR (95%)",
+ "oneDay": "[PL] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[PL] SECTOR ALLOCATION",
+ "sectors": "[PL] sectors",
+ "correlation": "[PL] CORRELATION",
+ "dayChangeProxy": "[PL] (day change proxy)",
+ "needTwoHoldings": "[PL] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[PL] POSITIONS BLOTTER",
+ "instruments": "[PL] instruments"
+ },
+ "chart": {
+ "performance": "[PL] PERFORMANCE",
+ "portfolio": "[PL] PORTFOLIO",
+ "totalReturn": "[PL] TOTAL RETURN",
+ "historyMessage": "[PL] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[PL] ORDER ENTRY",
+ "price": "[PL] PRICE",
+ "qtyHeld": "[PL] QTY HELD",
+ "mktVal": "[PL] MKT VAL",
+ "clickToBuyMore": "[PL] Click to buy more",
+ "clickToSell": "[PL] Click to sell",
+ "clickToBuy": "[PL] Click to buy an asset",
+ "clickToSellAsset": "[PL] Click to sell an asset",
+ "openBuyOrder": "[PL] OPEN BUY ORDER",
+ "openSellOrder": "[PL] OPEN SELL ORDER",
+ "ordersRecorded": "[PL] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[PL] HOLDINGS",
+ "noHoldings": "[PL] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[PL] RISK SCORE",
+ "low": "[PL] LOW",
+ "high": "[PL] HIGH",
+ "topMovers": "[PL] TOP MOVERS",
+ "quickStats": "[PL] QUICK STATS",
+ "concTop3": "[PL] CONC. TOP3",
+ "volatility": "[PL] VOLATILITY",
+ "newPortfolio": "[PL] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[PL] SELECT PORTFOLIO",
+ "searchPortfolios": "[PL] Search portfolios...",
+ "newPortfolio": "[PL] NEW PORTFOLIO",
+ "nav": "[PL] NAV",
+ "pnl": "[PL] P&L",
+ "day": "[PL] DAY",
+ "pos": "[PL] POS",
+ "wl": "[PL] W/L"
+ },
+ "actions": {
+ "buy": "[PL] BUY",
+ "sell": "[PL] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/pl/settings.json b/fincept-terminal-desktop/public/locales/pl/settings.json
index b0bffa7a4..4fb281b4c 100644
--- a/fincept-terminal-desktop/public/locales/pl/settings.json
+++ b/fincept-terminal-desktop/public/locales/pl/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[PL] Test notification sent successfully!",
"testFailed": "[PL] Failed to send test notification. Check your configuration.",
"saved": "[PL] Configuration saved"
+ },
+ "language": {
+ "title": "[PL] LANGUAGE SETTINGS",
+ "selectLanguage": "[PL] Select your preferred language for the terminal interface",
+ "currentLanguage": "[PL] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/pt/dashboard.json b/fincept-terminal-desktop/public/locales/pt/dashboard.json
index a56edac40..cd88fbe53 100644
--- a/fincept-terminal-desktop/public/locales/pt/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/pt/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[PT] MARKETS",
"performanceTracker": "[PT] PERFORMANCE TRACKER",
"totalPnL": "[PT] TOTAL P&L",
- "viewDetailedAnalytics": "[PT] View Detailed Analytics"
+ "viewDetailedAnalytics": "[PT] View Detailed Analytics",
+ "commodityGold": "[PT] Gold",
+ "commoditySilver": "[PT] Silver",
+ "commodityCrudeOil": "[PT] Crude Oil",
+ "commodityNatGas": "[PT] Nat Gas",
+ "commodityCopper": "[PT] Copper",
+ "commodityCorn": "[PT] Corn",
+ "commoditySoybeans": "[PT] Soybeans",
+ "commodityWheat": "[PT] Wheat",
+ "indexSP500": "[PT] S&P 500",
+ "indexDowJones": "[PT] Dow Jones",
+ "indexNasdaq": "[PT] Nasdaq",
+ "indexRussell2000": "[PT] Russell 2000",
+ "indexFTSE100": "[PT] FTSE 100",
+ "indexDAX": "[PT] DAX",
+ "indexCAC40": "[PT] CAC 40",
+ "indexNikkei225": "[PT] Nikkei 225",
+ "indexHangSeng": "[PT] Hang Seng",
+ "indexShanghai": "[PT] Shanghai",
+ "indexNifty50": "[PT] Nifty 50",
+ "indexSensex": "[PT] Sensex",
+ "forexEURUSD": "[PT] EUR/USD",
+ "forexGBPUSD": "[PT] GBP/USD",
+ "forexUSDJPY": "[PT] USD/JPY",
+ "forexAUDUSD": "[PT] AUD/USD",
+ "forexUSDCAD": "[PT] USD/CAD",
+ "forexUSDCHF": "[PT] USD/CHF",
+ "forexNZDUSD": "[PT] NZD/USD",
+ "forexEURCHF": "[PT] EUR/CHF"
},
"messages": {
"layoutSaved": "Layout do painel salvo!",
diff --git a/fincept-terminal-desktop/public/locales/pt/markets.json b/fincept-terminal-desktop/public/locales/pt/markets.json
index 7269a0ead..ba0029635 100644
--- a/fincept-terminal-desktop/public/locales/pt/markets.json
+++ b/fincept-terminal-desktop/public/locales/pt/markets.json
@@ -13,5 +13,8 @@
"refresh": "ATUALIZAR",
"auto": "AUTO",
"on": "ON",
- "off": "OFF"
+ "off": "OFF",
+ "loading": {
+ "title": "[PT] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/pt/portfolio.json b/fincept-terminal-desktop/public/locales/pt/portfolio.json
index 58531b681..bbc47f237 100644
--- a/fincept-terminal-desktop/public/locales/pt/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/pt/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "QUANTIDADE",
"price": "PREÇO",
"add": "ADICIONAR",
- "sell": "VENDER"
+ "sell": "VENDER",
+ "confirmDelete": "[PT] CONFIRM DELETE",
+ "deleteTransactionWarning": "[PT] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[PT] DELETE",
+ "editTransaction": "[PT] EDIT TRANSACTION",
+ "transactionDate": "[PT] TRANSACTION DATE",
+ "notes": "[PT] NOTES",
+ "notesPlaceholder": "[PT] Optional notes...",
+ "totalValue": "[PT] TOTAL VALUE",
+ "save": "[PT] SAVE"
},
"extracted": {
- "areYouSureYou": "[PT] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[PT] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[PT] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[PT] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[PT] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[PT] FINCEPT",
+ "portfolioTerminal": "[PT] PORTFOLIO TERMINAL",
+ "live": "[PT] LIVE",
+ "pos": "[PT] POS",
+ "ins": "[PT] INS",
+ "nav": "[PT] NAV",
+ "pnl": "[PT] P&L",
+ "day": "[PT] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[PT] TOTAL VALUE",
+ "unrealizedPnl": "[PT] UNREALIZED P&L",
+ "dayChange": "[PT] DAY CHANGE",
+ "costBasis": "[PT] COST BASIS",
+ "fifo": "[PT] FIFO",
+ "positions": "[PT] POSITIONS",
+ "concTop3": "[PT] CONC. TOP3",
+ "weight": "[PT] WEIGHT",
+ "sharpe": "[PT] SHARPE",
+ "annualized": "[PT] ANNUALIZED",
+ "beta": "[PT] BETA",
+ "vsSpy": "[PT] VS SPY",
+ "volatility": "[PT] VOLATILITY",
+ "ann30d": "[PT] 30D ANN.",
+ "maxDrawdown": "[PT] MAX DRAWDOWN",
+ "sinceIncep": "[PT] SINCE INCEP.",
+ "riskScore": "[PT] RISK SCORE",
+ "composite": "[PT] COMPOSITE",
+ "var95": "[PT] VAR (95%)",
+ "oneDay": "[PT] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[PT] SECTOR ALLOCATION",
+ "sectors": "[PT] sectors",
+ "correlation": "[PT] CORRELATION",
+ "dayChangeProxy": "[PT] (day change proxy)",
+ "needTwoHoldings": "[PT] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[PT] POSITIONS BLOTTER",
+ "instruments": "[PT] instruments"
+ },
+ "chart": {
+ "performance": "[PT] PERFORMANCE",
+ "portfolio": "[PT] PORTFOLIO",
+ "totalReturn": "[PT] TOTAL RETURN",
+ "historyMessage": "[PT] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[PT] ORDER ENTRY",
+ "price": "[PT] PRICE",
+ "qtyHeld": "[PT] QTY HELD",
+ "mktVal": "[PT] MKT VAL",
+ "clickToBuyMore": "[PT] Click to buy more",
+ "clickToSell": "[PT] Click to sell",
+ "clickToBuy": "[PT] Click to buy an asset",
+ "clickToSellAsset": "[PT] Click to sell an asset",
+ "openBuyOrder": "[PT] OPEN BUY ORDER",
+ "openSellOrder": "[PT] OPEN SELL ORDER",
+ "ordersRecorded": "[PT] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[PT] HOLDINGS",
+ "noHoldings": "[PT] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[PT] RISK SCORE",
+ "low": "[PT] LOW",
+ "high": "[PT] HIGH",
+ "topMovers": "[PT] TOP MOVERS",
+ "quickStats": "[PT] QUICK STATS",
+ "concTop3": "[PT] CONC. TOP3",
+ "volatility": "[PT] VOLATILITY",
+ "newPortfolio": "[PT] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[PT] SELECT PORTFOLIO",
+ "searchPortfolios": "[PT] Search portfolios...",
+ "newPortfolio": "[PT] NEW PORTFOLIO",
+ "nav": "[PT] NAV",
+ "pnl": "[PT] P&L",
+ "day": "[PT] DAY",
+ "pos": "[PT] POS",
+ "wl": "[PT] W/L"
+ },
+ "actions": {
+ "buy": "[PT] BUY",
+ "sell": "[PT] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/pt/settings.json b/fincept-terminal-desktop/public/locales/pt/settings.json
index 1878cc1b3..ab9f92cb3 100644
--- a/fincept-terminal-desktop/public/locales/pt/settings.json
+++ b/fincept-terminal-desktop/public/locales/pt/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[PT] Test notification sent successfully!",
"testFailed": "[PT] Failed to send test notification. Check your configuration.",
"saved": "[PT] Configuration saved"
+ },
+ "language": {
+ "title": "[PT] LANGUAGE SETTINGS",
+ "selectLanguage": "[PT] Select your preferred language for the terminal interface",
+ "currentLanguage": "[PT] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/ro/dashboard.json b/fincept-terminal-desktop/public/locales/ro/dashboard.json
index c7fc1e84c..3d76c4b89 100644
--- a/fincept-terminal-desktop/public/locales/ro/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/ro/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[RO] MARKETS",
"performanceTracker": "[RO] PERFORMANCE TRACKER",
"totalPnL": "[RO] TOTAL P&L",
- "viewDetailedAnalytics": "[RO] View Detailed Analytics"
+ "viewDetailedAnalytics": "[RO] View Detailed Analytics",
+ "commodityGold": "[RO] Gold",
+ "commoditySilver": "[RO] Silver",
+ "commodityCrudeOil": "[RO] Crude Oil",
+ "commodityNatGas": "[RO] Nat Gas",
+ "commodityCopper": "[RO] Copper",
+ "commodityCorn": "[RO] Corn",
+ "commoditySoybeans": "[RO] Soybeans",
+ "commodityWheat": "[RO] Wheat",
+ "indexSP500": "[RO] S&P 500",
+ "indexDowJones": "[RO] Dow Jones",
+ "indexNasdaq": "[RO] Nasdaq",
+ "indexRussell2000": "[RO] Russell 2000",
+ "indexFTSE100": "[RO] FTSE 100",
+ "indexDAX": "[RO] DAX",
+ "indexCAC40": "[RO] CAC 40",
+ "indexNikkei225": "[RO] Nikkei 225",
+ "indexHangSeng": "[RO] Hang Seng",
+ "indexShanghai": "[RO] Shanghai",
+ "indexNifty50": "[RO] Nifty 50",
+ "indexSensex": "[RO] Sensex",
+ "forexEURUSD": "[RO] EUR/USD",
+ "forexGBPUSD": "[RO] GBP/USD",
+ "forexUSDJPY": "[RO] USD/JPY",
+ "forexAUDUSD": "[RO] AUD/USD",
+ "forexUSDCAD": "[RO] USD/CAD",
+ "forexUSDCHF": "[RO] USD/CHF",
+ "forexNZDUSD": "[RO] NZD/USD",
+ "forexEURCHF": "[RO] EUR/CHF"
},
"messages": {
"layoutSaved": "Aspectul tabloului de bord a fost salvat!",
diff --git a/fincept-terminal-desktop/public/locales/ro/markets.json b/fincept-terminal-desktop/public/locales/ro/markets.json
index 92e4eaa65..152c75cfc 100644
--- a/fincept-terminal-desktop/public/locales/ro/markets.json
+++ b/fincept-terminal-desktop/public/locales/ro/markets.json
@@ -13,5 +13,8 @@
"refresh": "REÎMPROSPĂTEAZĂ",
"auto": "AUTO",
"on": "PORNIT",
- "off": "OPRIT"
+ "off": "OPRIT",
+ "loading": {
+ "title": "[RO] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/ro/portfolio.json b/fincept-terminal-desktop/public/locales/ro/portfolio.json
index 8f49223d8..c4a41de9e 100644
--- a/fincept-terminal-desktop/public/locales/ro/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/ro/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "CANTITATE",
"price": "PREȚ",
"add": "ADAUGĂ",
- "sell": "VINDE"
+ "sell": "VINDE",
+ "confirmDelete": "[RO] CONFIRM DELETE",
+ "deleteTransactionWarning": "[RO] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[RO] DELETE",
+ "editTransaction": "[RO] EDIT TRANSACTION",
+ "transactionDate": "[RO] TRANSACTION DATE",
+ "notes": "[RO] NOTES",
+ "notesPlaceholder": "[RO] Optional notes...",
+ "totalValue": "[RO] TOTAL VALUE",
+ "save": "[RO] SAVE"
},
"extracted": {
- "areYouSureYou": "[RO] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[RO] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[RO] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[RO] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[RO] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[RO] FINCEPT",
+ "portfolioTerminal": "[RO] PORTFOLIO TERMINAL",
+ "live": "[RO] LIVE",
+ "pos": "[RO] POS",
+ "ins": "[RO] INS",
+ "nav": "[RO] NAV",
+ "pnl": "[RO] P&L",
+ "day": "[RO] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[RO] TOTAL VALUE",
+ "unrealizedPnl": "[RO] UNREALIZED P&L",
+ "dayChange": "[RO] DAY CHANGE",
+ "costBasis": "[RO] COST BASIS",
+ "fifo": "[RO] FIFO",
+ "positions": "[RO] POSITIONS",
+ "concTop3": "[RO] CONC. TOP3",
+ "weight": "[RO] WEIGHT",
+ "sharpe": "[RO] SHARPE",
+ "annualized": "[RO] ANNUALIZED",
+ "beta": "[RO] BETA",
+ "vsSpy": "[RO] VS SPY",
+ "volatility": "[RO] VOLATILITY",
+ "ann30d": "[RO] 30D ANN.",
+ "maxDrawdown": "[RO] MAX DRAWDOWN",
+ "sinceIncep": "[RO] SINCE INCEP.",
+ "riskScore": "[RO] RISK SCORE",
+ "composite": "[RO] COMPOSITE",
+ "var95": "[RO] VAR (95%)",
+ "oneDay": "[RO] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[RO] SECTOR ALLOCATION",
+ "sectors": "[RO] sectors",
+ "correlation": "[RO] CORRELATION",
+ "dayChangeProxy": "[RO] (day change proxy)",
+ "needTwoHoldings": "[RO] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[RO] POSITIONS BLOTTER",
+ "instruments": "[RO] instruments"
+ },
+ "chart": {
+ "performance": "[RO] PERFORMANCE",
+ "portfolio": "[RO] PORTFOLIO",
+ "totalReturn": "[RO] TOTAL RETURN",
+ "historyMessage": "[RO] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[RO] ORDER ENTRY",
+ "price": "[RO] PRICE",
+ "qtyHeld": "[RO] QTY HELD",
+ "mktVal": "[RO] MKT VAL",
+ "clickToBuyMore": "[RO] Click to buy more",
+ "clickToSell": "[RO] Click to sell",
+ "clickToBuy": "[RO] Click to buy an asset",
+ "clickToSellAsset": "[RO] Click to sell an asset",
+ "openBuyOrder": "[RO] OPEN BUY ORDER",
+ "openSellOrder": "[RO] OPEN SELL ORDER",
+ "ordersRecorded": "[RO] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[RO] HOLDINGS",
+ "noHoldings": "[RO] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[RO] RISK SCORE",
+ "low": "[RO] LOW",
+ "high": "[RO] HIGH",
+ "topMovers": "[RO] TOP MOVERS",
+ "quickStats": "[RO] QUICK STATS",
+ "concTop3": "[RO] CONC. TOP3",
+ "volatility": "[RO] VOLATILITY",
+ "newPortfolio": "[RO] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[RO] SELECT PORTFOLIO",
+ "searchPortfolios": "[RO] Search portfolios...",
+ "newPortfolio": "[RO] NEW PORTFOLIO",
+ "nav": "[RO] NAV",
+ "pnl": "[RO] P&L",
+ "day": "[RO] DAY",
+ "pos": "[RO] POS",
+ "wl": "[RO] W/L"
+ },
+ "actions": {
+ "buy": "[RO] BUY",
+ "sell": "[RO] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/ro/settings.json b/fincept-terminal-desktop/public/locales/ro/settings.json
index fdb2baef2..0420f1078 100644
--- a/fincept-terminal-desktop/public/locales/ro/settings.json
+++ b/fincept-terminal-desktop/public/locales/ro/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[RO] Test notification sent successfully!",
"testFailed": "[RO] Failed to send test notification. Check your configuration.",
"saved": "[RO] Configuration saved"
+ },
+ "language": {
+ "title": "[RO] LANGUAGE SETTINGS",
+ "selectLanguage": "[RO] Select your preferred language for the terminal interface",
+ "currentLanguage": "[RO] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/ru/dashboard.json b/fincept-terminal-desktop/public/locales/ru/dashboard.json
index 6a6a007f2..85cfb4631 100644
--- a/fincept-terminal-desktop/public/locales/ru/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/ru/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[RU] MARKETS",
"performanceTracker": "[RU] PERFORMANCE TRACKER",
"totalPnL": "[RU] TOTAL P&L",
- "viewDetailedAnalytics": "[RU] View Detailed Analytics"
+ "viewDetailedAnalytics": "[RU] View Detailed Analytics",
+ "commodityGold": "[RU] Gold",
+ "commoditySilver": "[RU] Silver",
+ "commodityCrudeOil": "[RU] Crude Oil",
+ "commodityNatGas": "[RU] Nat Gas",
+ "commodityCopper": "[RU] Copper",
+ "commodityCorn": "[RU] Corn",
+ "commoditySoybeans": "[RU] Soybeans",
+ "commodityWheat": "[RU] Wheat",
+ "indexSP500": "[RU] S&P 500",
+ "indexDowJones": "[RU] Dow Jones",
+ "indexNasdaq": "[RU] Nasdaq",
+ "indexRussell2000": "[RU] Russell 2000",
+ "indexFTSE100": "[RU] FTSE 100",
+ "indexDAX": "[RU] DAX",
+ "indexCAC40": "[RU] CAC 40",
+ "indexNikkei225": "[RU] Nikkei 225",
+ "indexHangSeng": "[RU] Hang Seng",
+ "indexShanghai": "[RU] Shanghai",
+ "indexNifty50": "[RU] Nifty 50",
+ "indexSensex": "[RU] Sensex",
+ "forexEURUSD": "[RU] EUR/USD",
+ "forexGBPUSD": "[RU] GBP/USD",
+ "forexUSDJPY": "[RU] USD/JPY",
+ "forexAUDUSD": "[RU] AUD/USD",
+ "forexUSDCAD": "[RU] USD/CAD",
+ "forexUSDCHF": "[RU] USD/CHF",
+ "forexNZDUSD": "[RU] NZD/USD",
+ "forexEURCHF": "[RU] EUR/CHF"
},
"messages": {
"layoutSaved": "Макет панели управления сохранен!",
diff --git a/fincept-terminal-desktop/public/locales/ru/markets.json b/fincept-terminal-desktop/public/locales/ru/markets.json
index 96edd3988..a3ef7d4cb 100644
--- a/fincept-terminal-desktop/public/locales/ru/markets.json
+++ b/fincept-terminal-desktop/public/locales/ru/markets.json
@@ -13,5 +13,8 @@
"refresh": "ОБНОВИТЬ",
"auto": "АВТО",
"on": "ВКЛ",
- "off": "ВЫКЛ"
+ "off": "ВЫКЛ",
+ "loading": {
+ "title": "[RU] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/ru/portfolio.json b/fincept-terminal-desktop/public/locales/ru/portfolio.json
index 92a09ee92..8712cce06 100644
--- a/fincept-terminal-desktop/public/locales/ru/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/ru/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "КОЛИЧЕСТВО",
"price": "ЦЕНА",
"add": "ДОБАВИТЬ",
- "sell": "ПРОДАТЬ"
+ "sell": "ПРОДАТЬ",
+ "confirmDelete": "[RU] CONFIRM DELETE",
+ "deleteTransactionWarning": "[RU] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[RU] DELETE",
+ "editTransaction": "[RU] EDIT TRANSACTION",
+ "transactionDate": "[RU] TRANSACTION DATE",
+ "notes": "[RU] NOTES",
+ "notesPlaceholder": "[RU] Optional notes...",
+ "totalValue": "[RU] TOTAL VALUE",
+ "save": "[RU] SAVE"
},
"extracted": {
- "areYouSureYou": "[RU] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[RU] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[RU] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[RU] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[RU] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[RU] FINCEPT",
+ "portfolioTerminal": "[RU] PORTFOLIO TERMINAL",
+ "live": "[RU] LIVE",
+ "pos": "[RU] POS",
+ "ins": "[RU] INS",
+ "nav": "[RU] NAV",
+ "pnl": "[RU] P&L",
+ "day": "[RU] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[RU] TOTAL VALUE",
+ "unrealizedPnl": "[RU] UNREALIZED P&L",
+ "dayChange": "[RU] DAY CHANGE",
+ "costBasis": "[RU] COST BASIS",
+ "fifo": "[RU] FIFO",
+ "positions": "[RU] POSITIONS",
+ "concTop3": "[RU] CONC. TOP3",
+ "weight": "[RU] WEIGHT",
+ "sharpe": "[RU] SHARPE",
+ "annualized": "[RU] ANNUALIZED",
+ "beta": "[RU] BETA",
+ "vsSpy": "[RU] VS SPY",
+ "volatility": "[RU] VOLATILITY",
+ "ann30d": "[RU] 30D ANN.",
+ "maxDrawdown": "[RU] MAX DRAWDOWN",
+ "sinceIncep": "[RU] SINCE INCEP.",
+ "riskScore": "[RU] RISK SCORE",
+ "composite": "[RU] COMPOSITE",
+ "var95": "[RU] VAR (95%)",
+ "oneDay": "[RU] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[RU] SECTOR ALLOCATION",
+ "sectors": "[RU] sectors",
+ "correlation": "[RU] CORRELATION",
+ "dayChangeProxy": "[RU] (day change proxy)",
+ "needTwoHoldings": "[RU] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[RU] POSITIONS BLOTTER",
+ "instruments": "[RU] instruments"
+ },
+ "chart": {
+ "performance": "[RU] PERFORMANCE",
+ "portfolio": "[RU] PORTFOLIO",
+ "totalReturn": "[RU] TOTAL RETURN",
+ "historyMessage": "[RU] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[RU] ORDER ENTRY",
+ "price": "[RU] PRICE",
+ "qtyHeld": "[RU] QTY HELD",
+ "mktVal": "[RU] MKT VAL",
+ "clickToBuyMore": "[RU] Click to buy more",
+ "clickToSell": "[RU] Click to sell",
+ "clickToBuy": "[RU] Click to buy an asset",
+ "clickToSellAsset": "[RU] Click to sell an asset",
+ "openBuyOrder": "[RU] OPEN BUY ORDER",
+ "openSellOrder": "[RU] OPEN SELL ORDER",
+ "ordersRecorded": "[RU] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[RU] HOLDINGS",
+ "noHoldings": "[RU] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[RU] RISK SCORE",
+ "low": "[RU] LOW",
+ "high": "[RU] HIGH",
+ "topMovers": "[RU] TOP MOVERS",
+ "quickStats": "[RU] QUICK STATS",
+ "concTop3": "[RU] CONC. TOP3",
+ "volatility": "[RU] VOLATILITY",
+ "newPortfolio": "[RU] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[RU] SELECT PORTFOLIO",
+ "searchPortfolios": "[RU] Search portfolios...",
+ "newPortfolio": "[RU] NEW PORTFOLIO",
+ "nav": "[RU] NAV",
+ "pnl": "[RU] P&L",
+ "day": "[RU] DAY",
+ "pos": "[RU] POS",
+ "wl": "[RU] W/L"
+ },
+ "actions": {
+ "buy": "[RU] BUY",
+ "sell": "[RU] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/ru/settings.json b/fincept-terminal-desktop/public/locales/ru/settings.json
index 4587c9268..cedb818e2 100644
--- a/fincept-terminal-desktop/public/locales/ru/settings.json
+++ b/fincept-terminal-desktop/public/locales/ru/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[RU] Test notification sent successfully!",
"testFailed": "[RU] Failed to send test notification. Check your configuration.",
"saved": "[RU] Configuration saved"
+ },
+ "language": {
+ "title": "[RU] LANGUAGE SETTINGS",
+ "selectLanguage": "[RU] Select your preferred language for the terminal interface",
+ "currentLanguage": "[RU] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/th/dashboard.json b/fincept-terminal-desktop/public/locales/th/dashboard.json
index 62ba7aa63..3c70f3862 100644
--- a/fincept-terminal-desktop/public/locales/th/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/th/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[TH] MARKETS",
"performanceTracker": "[TH] PERFORMANCE TRACKER",
"totalPnL": "[TH] TOTAL P&L",
- "viewDetailedAnalytics": "[TH] View Detailed Analytics"
+ "viewDetailedAnalytics": "[TH] View Detailed Analytics",
+ "commodityGold": "[TH] Gold",
+ "commoditySilver": "[TH] Silver",
+ "commodityCrudeOil": "[TH] Crude Oil",
+ "commodityNatGas": "[TH] Nat Gas",
+ "commodityCopper": "[TH] Copper",
+ "commodityCorn": "[TH] Corn",
+ "commoditySoybeans": "[TH] Soybeans",
+ "commodityWheat": "[TH] Wheat",
+ "indexSP500": "[TH] S&P 500",
+ "indexDowJones": "[TH] Dow Jones",
+ "indexNasdaq": "[TH] Nasdaq",
+ "indexRussell2000": "[TH] Russell 2000",
+ "indexFTSE100": "[TH] FTSE 100",
+ "indexDAX": "[TH] DAX",
+ "indexCAC40": "[TH] CAC 40",
+ "indexNikkei225": "[TH] Nikkei 225",
+ "indexHangSeng": "[TH] Hang Seng",
+ "indexShanghai": "[TH] Shanghai",
+ "indexNifty50": "[TH] Nifty 50",
+ "indexSensex": "[TH] Sensex",
+ "forexEURUSD": "[TH] EUR/USD",
+ "forexGBPUSD": "[TH] GBP/USD",
+ "forexUSDJPY": "[TH] USD/JPY",
+ "forexAUDUSD": "[TH] AUD/USD",
+ "forexUSDCAD": "[TH] USD/CAD",
+ "forexUSDCHF": "[TH] USD/CHF",
+ "forexNZDUSD": "[TH] NZD/USD",
+ "forexEURCHF": "[TH] EUR/CHF"
},
"messages": {
"layoutSaved": "บันทึกเค้าโครงแดชบอร์ดแล้ว!",
diff --git a/fincept-terminal-desktop/public/locales/th/markets.json b/fincept-terminal-desktop/public/locales/th/markets.json
index dea07fff7..7a7e00793 100644
--- a/fincept-terminal-desktop/public/locales/th/markets.json
+++ b/fincept-terminal-desktop/public/locales/th/markets.json
@@ -13,5 +13,8 @@
"refresh": "รีเฟรช",
"auto": "อัตโนมัติ",
"on": "เปิด",
- "off": "ปิด"
+ "off": "ปิด",
+ "loading": {
+ "title": "[TH] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/th/portfolio.json b/fincept-terminal-desktop/public/locales/th/portfolio.json
index 18baa3bce..ed964233a 100644
--- a/fincept-terminal-desktop/public/locales/th/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/th/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "จำนวน",
"price": "ราคา",
"add": "เพิ่ม",
- "sell": "ขาย"
+ "sell": "ขาย",
+ "confirmDelete": "[TH] CONFIRM DELETE",
+ "deleteTransactionWarning": "[TH] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[TH] DELETE",
+ "editTransaction": "[TH] EDIT TRANSACTION",
+ "transactionDate": "[TH] TRANSACTION DATE",
+ "notes": "[TH] NOTES",
+ "notesPlaceholder": "[TH] Optional notes...",
+ "totalValue": "[TH] TOTAL VALUE",
+ "save": "[TH] SAVE"
},
"extracted": {
- "areYouSureYou": "[TH] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[TH] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[TH] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[TH] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[TH] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[TH] FINCEPT",
+ "portfolioTerminal": "[TH] PORTFOLIO TERMINAL",
+ "live": "[TH] LIVE",
+ "pos": "[TH] POS",
+ "ins": "[TH] INS",
+ "nav": "[TH] NAV",
+ "pnl": "[TH] P&L",
+ "day": "[TH] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[TH] TOTAL VALUE",
+ "unrealizedPnl": "[TH] UNREALIZED P&L",
+ "dayChange": "[TH] DAY CHANGE",
+ "costBasis": "[TH] COST BASIS",
+ "fifo": "[TH] FIFO",
+ "positions": "[TH] POSITIONS",
+ "concTop3": "[TH] CONC. TOP3",
+ "weight": "[TH] WEIGHT",
+ "sharpe": "[TH] SHARPE",
+ "annualized": "[TH] ANNUALIZED",
+ "beta": "[TH] BETA",
+ "vsSpy": "[TH] VS SPY",
+ "volatility": "[TH] VOLATILITY",
+ "ann30d": "[TH] 30D ANN.",
+ "maxDrawdown": "[TH] MAX DRAWDOWN",
+ "sinceIncep": "[TH] SINCE INCEP.",
+ "riskScore": "[TH] RISK SCORE",
+ "composite": "[TH] COMPOSITE",
+ "var95": "[TH] VAR (95%)",
+ "oneDay": "[TH] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[TH] SECTOR ALLOCATION",
+ "sectors": "[TH] sectors",
+ "correlation": "[TH] CORRELATION",
+ "dayChangeProxy": "[TH] (day change proxy)",
+ "needTwoHoldings": "[TH] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[TH] POSITIONS BLOTTER",
+ "instruments": "[TH] instruments"
+ },
+ "chart": {
+ "performance": "[TH] PERFORMANCE",
+ "portfolio": "[TH] PORTFOLIO",
+ "totalReturn": "[TH] TOTAL RETURN",
+ "historyMessage": "[TH] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[TH] ORDER ENTRY",
+ "price": "[TH] PRICE",
+ "qtyHeld": "[TH] QTY HELD",
+ "mktVal": "[TH] MKT VAL",
+ "clickToBuyMore": "[TH] Click to buy more",
+ "clickToSell": "[TH] Click to sell",
+ "clickToBuy": "[TH] Click to buy an asset",
+ "clickToSellAsset": "[TH] Click to sell an asset",
+ "openBuyOrder": "[TH] OPEN BUY ORDER",
+ "openSellOrder": "[TH] OPEN SELL ORDER",
+ "ordersRecorded": "[TH] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[TH] HOLDINGS",
+ "noHoldings": "[TH] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[TH] RISK SCORE",
+ "low": "[TH] LOW",
+ "high": "[TH] HIGH",
+ "topMovers": "[TH] TOP MOVERS",
+ "quickStats": "[TH] QUICK STATS",
+ "concTop3": "[TH] CONC. TOP3",
+ "volatility": "[TH] VOLATILITY",
+ "newPortfolio": "[TH] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[TH] SELECT PORTFOLIO",
+ "searchPortfolios": "[TH] Search portfolios...",
+ "newPortfolio": "[TH] NEW PORTFOLIO",
+ "nav": "[TH] NAV",
+ "pnl": "[TH] P&L",
+ "day": "[TH] DAY",
+ "pos": "[TH] POS",
+ "wl": "[TH] W/L"
+ },
+ "actions": {
+ "buy": "[TH] BUY",
+ "sell": "[TH] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/th/settings.json b/fincept-terminal-desktop/public/locales/th/settings.json
index f02a6462c..36b6def9f 100644
--- a/fincept-terminal-desktop/public/locales/th/settings.json
+++ b/fincept-terminal-desktop/public/locales/th/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[TH] Test notification sent successfully!",
"testFailed": "[TH] Failed to send test notification. Check your configuration.",
"saved": "[TH] Configuration saved"
+ },
+ "language": {
+ "title": "[TH] LANGUAGE SETTINGS",
+ "selectLanguage": "[TH] Select your preferred language for the terminal interface",
+ "currentLanguage": "[TH] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/tr/dashboard.json b/fincept-terminal-desktop/public/locales/tr/dashboard.json
index 02053c7c4..1b4e5acc7 100644
--- a/fincept-terminal-desktop/public/locales/tr/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/tr/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[TR] MARKETS",
"performanceTracker": "[TR] PERFORMANCE TRACKER",
"totalPnL": "[TR] TOTAL P&L",
- "viewDetailedAnalytics": "[TR] View Detailed Analytics"
+ "viewDetailedAnalytics": "[TR] View Detailed Analytics",
+ "commodityGold": "[TR] Gold",
+ "commoditySilver": "[TR] Silver",
+ "commodityCrudeOil": "[TR] Crude Oil",
+ "commodityNatGas": "[TR] Nat Gas",
+ "commodityCopper": "[TR] Copper",
+ "commodityCorn": "[TR] Corn",
+ "commoditySoybeans": "[TR] Soybeans",
+ "commodityWheat": "[TR] Wheat",
+ "indexSP500": "[TR] S&P 500",
+ "indexDowJones": "[TR] Dow Jones",
+ "indexNasdaq": "[TR] Nasdaq",
+ "indexRussell2000": "[TR] Russell 2000",
+ "indexFTSE100": "[TR] FTSE 100",
+ "indexDAX": "[TR] DAX",
+ "indexCAC40": "[TR] CAC 40",
+ "indexNikkei225": "[TR] Nikkei 225",
+ "indexHangSeng": "[TR] Hang Seng",
+ "indexShanghai": "[TR] Shanghai",
+ "indexNifty50": "[TR] Nifty 50",
+ "indexSensex": "[TR] Sensex",
+ "forexEURUSD": "[TR] EUR/USD",
+ "forexGBPUSD": "[TR] GBP/USD",
+ "forexUSDJPY": "[TR] USD/JPY",
+ "forexAUDUSD": "[TR] AUD/USD",
+ "forexUSDCAD": "[TR] USD/CAD",
+ "forexUSDCHF": "[TR] USD/CHF",
+ "forexNZDUSD": "[TR] NZD/USD",
+ "forexEURCHF": "[TR] EUR/CHF"
},
"messages": {
"layoutSaved": "Kontrol paneli düzeni kaydedildi!",
diff --git a/fincept-terminal-desktop/public/locales/tr/markets.json b/fincept-terminal-desktop/public/locales/tr/markets.json
index 41fd39ed1..cca3b6905 100644
--- a/fincept-terminal-desktop/public/locales/tr/markets.json
+++ b/fincept-terminal-desktop/public/locales/tr/markets.json
@@ -13,5 +13,8 @@
"refresh": "YENİLE",
"auto": "OTOMATİK",
"on": "AÇIK",
- "off": "KAPALI"
+ "off": "KAPALI",
+ "loading": {
+ "title": "[TR] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/tr/portfolio.json b/fincept-terminal-desktop/public/locales/tr/portfolio.json
index eba60fc0a..55c1f6459 100644
--- a/fincept-terminal-desktop/public/locales/tr/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/tr/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "MİKTAR",
"price": "FİYAT",
"add": "EKLE",
- "sell": "SAT"
+ "sell": "SAT",
+ "confirmDelete": "[TR] CONFIRM DELETE",
+ "deleteTransactionWarning": "[TR] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[TR] DELETE",
+ "editTransaction": "[TR] EDIT TRANSACTION",
+ "transactionDate": "[TR] TRANSACTION DATE",
+ "notes": "[TR] NOTES",
+ "notesPlaceholder": "[TR] Optional notes...",
+ "totalValue": "[TR] TOTAL VALUE",
+ "save": "[TR] SAVE"
},
"extracted": {
- "areYouSureYou": "[TR] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[TR] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[TR] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[TR] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[TR] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[TR] FINCEPT",
+ "portfolioTerminal": "[TR] PORTFOLIO TERMINAL",
+ "live": "[TR] LIVE",
+ "pos": "[TR] POS",
+ "ins": "[TR] INS",
+ "nav": "[TR] NAV",
+ "pnl": "[TR] P&L",
+ "day": "[TR] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[TR] TOTAL VALUE",
+ "unrealizedPnl": "[TR] UNREALIZED P&L",
+ "dayChange": "[TR] DAY CHANGE",
+ "costBasis": "[TR] COST BASIS",
+ "fifo": "[TR] FIFO",
+ "positions": "[TR] POSITIONS",
+ "concTop3": "[TR] CONC. TOP3",
+ "weight": "[TR] WEIGHT",
+ "sharpe": "[TR] SHARPE",
+ "annualized": "[TR] ANNUALIZED",
+ "beta": "[TR] BETA",
+ "vsSpy": "[TR] VS SPY",
+ "volatility": "[TR] VOLATILITY",
+ "ann30d": "[TR] 30D ANN.",
+ "maxDrawdown": "[TR] MAX DRAWDOWN",
+ "sinceIncep": "[TR] SINCE INCEP.",
+ "riskScore": "[TR] RISK SCORE",
+ "composite": "[TR] COMPOSITE",
+ "var95": "[TR] VAR (95%)",
+ "oneDay": "[TR] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[TR] SECTOR ALLOCATION",
+ "sectors": "[TR] sectors",
+ "correlation": "[TR] CORRELATION",
+ "dayChangeProxy": "[TR] (day change proxy)",
+ "needTwoHoldings": "[TR] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[TR] POSITIONS BLOTTER",
+ "instruments": "[TR] instruments"
+ },
+ "chart": {
+ "performance": "[TR] PERFORMANCE",
+ "portfolio": "[TR] PORTFOLIO",
+ "totalReturn": "[TR] TOTAL RETURN",
+ "historyMessage": "[TR] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[TR] ORDER ENTRY",
+ "price": "[TR] PRICE",
+ "qtyHeld": "[TR] QTY HELD",
+ "mktVal": "[TR] MKT VAL",
+ "clickToBuyMore": "[TR] Click to buy more",
+ "clickToSell": "[TR] Click to sell",
+ "clickToBuy": "[TR] Click to buy an asset",
+ "clickToSellAsset": "[TR] Click to sell an asset",
+ "openBuyOrder": "[TR] OPEN BUY ORDER",
+ "openSellOrder": "[TR] OPEN SELL ORDER",
+ "ordersRecorded": "[TR] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[TR] HOLDINGS",
+ "noHoldings": "[TR] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[TR] RISK SCORE",
+ "low": "[TR] LOW",
+ "high": "[TR] HIGH",
+ "topMovers": "[TR] TOP MOVERS",
+ "quickStats": "[TR] QUICK STATS",
+ "concTop3": "[TR] CONC. TOP3",
+ "volatility": "[TR] VOLATILITY",
+ "newPortfolio": "[TR] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[TR] SELECT PORTFOLIO",
+ "searchPortfolios": "[TR] Search portfolios...",
+ "newPortfolio": "[TR] NEW PORTFOLIO",
+ "nav": "[TR] NAV",
+ "pnl": "[TR] P&L",
+ "day": "[TR] DAY",
+ "pos": "[TR] POS",
+ "wl": "[TR] W/L"
+ },
+ "actions": {
+ "buy": "[TR] BUY",
+ "sell": "[TR] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/tr/settings.json b/fincept-terminal-desktop/public/locales/tr/settings.json
index 8a9bb4ca7..1148f832e 100644
--- a/fincept-terminal-desktop/public/locales/tr/settings.json
+++ b/fincept-terminal-desktop/public/locales/tr/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[TR] Test notification sent successfully!",
"testFailed": "[TR] Failed to send test notification. Check your configuration.",
"saved": "[TR] Configuration saved"
+ },
+ "language": {
+ "title": "[TR] LANGUAGE SETTINGS",
+ "selectLanguage": "[TR] Select your preferred language for the terminal interface",
+ "currentLanguage": "[TR] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/uk/dashboard.json b/fincept-terminal-desktop/public/locales/uk/dashboard.json
index c9598cbc1..0249d6d31 100644
--- a/fincept-terminal-desktop/public/locales/uk/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/uk/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[UK] MARKETS",
"performanceTracker": "[UK] PERFORMANCE TRACKER",
"totalPnL": "[UK] TOTAL P&L",
- "viewDetailedAnalytics": "[UK] View Detailed Analytics"
+ "viewDetailedAnalytics": "[UK] View Detailed Analytics",
+ "commodityGold": "[UK] Gold",
+ "commoditySilver": "[UK] Silver",
+ "commodityCrudeOil": "[UK] Crude Oil",
+ "commodityNatGas": "[UK] Nat Gas",
+ "commodityCopper": "[UK] Copper",
+ "commodityCorn": "[UK] Corn",
+ "commoditySoybeans": "[UK] Soybeans",
+ "commodityWheat": "[UK] Wheat",
+ "indexSP500": "[UK] S&P 500",
+ "indexDowJones": "[UK] Dow Jones",
+ "indexNasdaq": "[UK] Nasdaq",
+ "indexRussell2000": "[UK] Russell 2000",
+ "indexFTSE100": "[UK] FTSE 100",
+ "indexDAX": "[UK] DAX",
+ "indexCAC40": "[UK] CAC 40",
+ "indexNikkei225": "[UK] Nikkei 225",
+ "indexHangSeng": "[UK] Hang Seng",
+ "indexShanghai": "[UK] Shanghai",
+ "indexNifty50": "[UK] Nifty 50",
+ "indexSensex": "[UK] Sensex",
+ "forexEURUSD": "[UK] EUR/USD",
+ "forexGBPUSD": "[UK] GBP/USD",
+ "forexUSDJPY": "[UK] USD/JPY",
+ "forexAUDUSD": "[UK] AUD/USD",
+ "forexUSDCAD": "[UK] USD/CAD",
+ "forexUSDCHF": "[UK] USD/CHF",
+ "forexNZDUSD": "[UK] NZD/USD",
+ "forexEURCHF": "[UK] EUR/CHF"
},
"messages": {
"layoutSaved": "Макет інформаційної панелі збережено!",
diff --git a/fincept-terminal-desktop/public/locales/uk/markets.json b/fincept-terminal-desktop/public/locales/uk/markets.json
index 4aa30cfcd..b7da62aef 100644
--- a/fincept-terminal-desktop/public/locales/uk/markets.json
+++ b/fincept-terminal-desktop/public/locales/uk/markets.json
@@ -13,5 +13,8 @@
"refresh": "ОНОВИТИ",
"auto": "АВТО",
"on": "УВІМК",
- "off": "ВИМК"
+ "off": "ВИМК",
+ "loading": {
+ "title": "[UK] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/uk/portfolio.json b/fincept-terminal-desktop/public/locales/uk/portfolio.json
index 22d678f4d..55682821e 100644
--- a/fincept-terminal-desktop/public/locales/uk/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/uk/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "КІЛЬКІСТЬ",
"price": "ЦІНА",
"add": "ДОДАТИ",
- "sell": "ПРОДАТИ"
+ "sell": "ПРОДАТИ",
+ "confirmDelete": "[UK] CONFIRM DELETE",
+ "deleteTransactionWarning": "[UK] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[UK] DELETE",
+ "editTransaction": "[UK] EDIT TRANSACTION",
+ "transactionDate": "[UK] TRANSACTION DATE",
+ "notes": "[UK] NOTES",
+ "notesPlaceholder": "[UK] Optional notes...",
+ "totalValue": "[UK] TOTAL VALUE",
+ "save": "[UK] SAVE"
},
"extracted": {
- "areYouSureYou": "[UK] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[UK] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[UK] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[UK] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[UK] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[UK] FINCEPT",
+ "portfolioTerminal": "[UK] PORTFOLIO TERMINAL",
+ "live": "[UK] LIVE",
+ "pos": "[UK] POS",
+ "ins": "[UK] INS",
+ "nav": "[UK] NAV",
+ "pnl": "[UK] P&L",
+ "day": "[UK] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[UK] TOTAL VALUE",
+ "unrealizedPnl": "[UK] UNREALIZED P&L",
+ "dayChange": "[UK] DAY CHANGE",
+ "costBasis": "[UK] COST BASIS",
+ "fifo": "[UK] FIFO",
+ "positions": "[UK] POSITIONS",
+ "concTop3": "[UK] CONC. TOP3",
+ "weight": "[UK] WEIGHT",
+ "sharpe": "[UK] SHARPE",
+ "annualized": "[UK] ANNUALIZED",
+ "beta": "[UK] BETA",
+ "vsSpy": "[UK] VS SPY",
+ "volatility": "[UK] VOLATILITY",
+ "ann30d": "[UK] 30D ANN.",
+ "maxDrawdown": "[UK] MAX DRAWDOWN",
+ "sinceIncep": "[UK] SINCE INCEP.",
+ "riskScore": "[UK] RISK SCORE",
+ "composite": "[UK] COMPOSITE",
+ "var95": "[UK] VAR (95%)",
+ "oneDay": "[UK] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[UK] SECTOR ALLOCATION",
+ "sectors": "[UK] sectors",
+ "correlation": "[UK] CORRELATION",
+ "dayChangeProxy": "[UK] (day change proxy)",
+ "needTwoHoldings": "[UK] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[UK] POSITIONS BLOTTER",
+ "instruments": "[UK] instruments"
+ },
+ "chart": {
+ "performance": "[UK] PERFORMANCE",
+ "portfolio": "[UK] PORTFOLIO",
+ "totalReturn": "[UK] TOTAL RETURN",
+ "historyMessage": "[UK] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[UK] ORDER ENTRY",
+ "price": "[UK] PRICE",
+ "qtyHeld": "[UK] QTY HELD",
+ "mktVal": "[UK] MKT VAL",
+ "clickToBuyMore": "[UK] Click to buy more",
+ "clickToSell": "[UK] Click to sell",
+ "clickToBuy": "[UK] Click to buy an asset",
+ "clickToSellAsset": "[UK] Click to sell an asset",
+ "openBuyOrder": "[UK] OPEN BUY ORDER",
+ "openSellOrder": "[UK] OPEN SELL ORDER",
+ "ordersRecorded": "[UK] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[UK] HOLDINGS",
+ "noHoldings": "[UK] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[UK] RISK SCORE",
+ "low": "[UK] LOW",
+ "high": "[UK] HIGH",
+ "topMovers": "[UK] TOP MOVERS",
+ "quickStats": "[UK] QUICK STATS",
+ "concTop3": "[UK] CONC. TOP3",
+ "volatility": "[UK] VOLATILITY",
+ "newPortfolio": "[UK] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[UK] SELECT PORTFOLIO",
+ "searchPortfolios": "[UK] Search portfolios...",
+ "newPortfolio": "[UK] NEW PORTFOLIO",
+ "nav": "[UK] NAV",
+ "pnl": "[UK] P&L",
+ "day": "[UK] DAY",
+ "pos": "[UK] POS",
+ "wl": "[UK] W/L"
+ },
+ "actions": {
+ "buy": "[UK] BUY",
+ "sell": "[UK] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/uk/settings.json b/fincept-terminal-desktop/public/locales/uk/settings.json
index 40c20af63..8f91918b7 100644
--- a/fincept-terminal-desktop/public/locales/uk/settings.json
+++ b/fincept-terminal-desktop/public/locales/uk/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[UK] Test notification sent successfully!",
"testFailed": "[UK] Failed to send test notification. Check your configuration.",
"saved": "[UK] Configuration saved"
+ },
+ "language": {
+ "title": "[UK] LANGUAGE SETTINGS",
+ "selectLanguage": "[UK] Select your preferred language for the terminal interface",
+ "currentLanguage": "[UK] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/vi/dashboard.json b/fincept-terminal-desktop/public/locales/vi/dashboard.json
index 971adb1c9..dcbb034a7 100644
--- a/fincept-terminal-desktop/public/locales/vi/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/vi/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[VI] MARKETS",
"performanceTracker": "[VI] PERFORMANCE TRACKER",
"totalPnL": "[VI] TOTAL P&L",
- "viewDetailedAnalytics": "[VI] View Detailed Analytics"
+ "viewDetailedAnalytics": "[VI] View Detailed Analytics",
+ "commodityGold": "[VI] Gold",
+ "commoditySilver": "[VI] Silver",
+ "commodityCrudeOil": "[VI] Crude Oil",
+ "commodityNatGas": "[VI] Nat Gas",
+ "commodityCopper": "[VI] Copper",
+ "commodityCorn": "[VI] Corn",
+ "commoditySoybeans": "[VI] Soybeans",
+ "commodityWheat": "[VI] Wheat",
+ "indexSP500": "[VI] S&P 500",
+ "indexDowJones": "[VI] Dow Jones",
+ "indexNasdaq": "[VI] Nasdaq",
+ "indexRussell2000": "[VI] Russell 2000",
+ "indexFTSE100": "[VI] FTSE 100",
+ "indexDAX": "[VI] DAX",
+ "indexCAC40": "[VI] CAC 40",
+ "indexNikkei225": "[VI] Nikkei 225",
+ "indexHangSeng": "[VI] Hang Seng",
+ "indexShanghai": "[VI] Shanghai",
+ "indexNifty50": "[VI] Nifty 50",
+ "indexSensex": "[VI] Sensex",
+ "forexEURUSD": "[VI] EUR/USD",
+ "forexGBPUSD": "[VI] GBP/USD",
+ "forexUSDJPY": "[VI] USD/JPY",
+ "forexAUDUSD": "[VI] AUD/USD",
+ "forexUSDCAD": "[VI] USD/CAD",
+ "forexUSDCHF": "[VI] USD/CHF",
+ "forexNZDUSD": "[VI] NZD/USD",
+ "forexEURCHF": "[VI] EUR/CHF"
},
"messages": {
"layoutSaved": "Đã lưu bố cục trang tổng quan!",
diff --git a/fincept-terminal-desktop/public/locales/vi/markets.json b/fincept-terminal-desktop/public/locales/vi/markets.json
index b5bc72dde..990439830 100644
--- a/fincept-terminal-desktop/public/locales/vi/markets.json
+++ b/fincept-terminal-desktop/public/locales/vi/markets.json
@@ -13,5 +13,8 @@
"refresh": "LÀM MỚI",
"auto": "TỰ ĐỘNG",
"on": "BẬT",
- "off": "TẮT"
+ "off": "TẮT",
+ "loading": {
+ "title": "[VI] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/vi/portfolio.json b/fincept-terminal-desktop/public/locales/vi/portfolio.json
index cdaaeca7b..0462d00b8 100644
--- a/fincept-terminal-desktop/public/locales/vi/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/vi/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "SỐ LƯỢNG",
"price": "GIÁ",
"add": "THÊM",
- "sell": "BÁN"
+ "sell": "BÁN",
+ "confirmDelete": "[VI] CONFIRM DELETE",
+ "deleteTransactionWarning": "[VI] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[VI] DELETE",
+ "editTransaction": "[VI] EDIT TRANSACTION",
+ "transactionDate": "[VI] TRANSACTION DATE",
+ "notes": "[VI] NOTES",
+ "notesPlaceholder": "[VI] Optional notes...",
+ "totalValue": "[VI] TOTAL VALUE",
+ "save": "[VI] SAVE"
},
"extracted": {
- "areYouSureYou": "[VI] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[VI] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[VI] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[VI] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[VI] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[VI] FINCEPT",
+ "portfolioTerminal": "[VI] PORTFOLIO TERMINAL",
+ "live": "[VI] LIVE",
+ "pos": "[VI] POS",
+ "ins": "[VI] INS",
+ "nav": "[VI] NAV",
+ "pnl": "[VI] P&L",
+ "day": "[VI] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[VI] TOTAL VALUE",
+ "unrealizedPnl": "[VI] UNREALIZED P&L",
+ "dayChange": "[VI] DAY CHANGE",
+ "costBasis": "[VI] COST BASIS",
+ "fifo": "[VI] FIFO",
+ "positions": "[VI] POSITIONS",
+ "concTop3": "[VI] CONC. TOP3",
+ "weight": "[VI] WEIGHT",
+ "sharpe": "[VI] SHARPE",
+ "annualized": "[VI] ANNUALIZED",
+ "beta": "[VI] BETA",
+ "vsSpy": "[VI] VS SPY",
+ "volatility": "[VI] VOLATILITY",
+ "ann30d": "[VI] 30D ANN.",
+ "maxDrawdown": "[VI] MAX DRAWDOWN",
+ "sinceIncep": "[VI] SINCE INCEP.",
+ "riskScore": "[VI] RISK SCORE",
+ "composite": "[VI] COMPOSITE",
+ "var95": "[VI] VAR (95%)",
+ "oneDay": "[VI] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[VI] SECTOR ALLOCATION",
+ "sectors": "[VI] sectors",
+ "correlation": "[VI] CORRELATION",
+ "dayChangeProxy": "[VI] (day change proxy)",
+ "needTwoHoldings": "[VI] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[VI] POSITIONS BLOTTER",
+ "instruments": "[VI] instruments"
+ },
+ "chart": {
+ "performance": "[VI] PERFORMANCE",
+ "portfolio": "[VI] PORTFOLIO",
+ "totalReturn": "[VI] TOTAL RETURN",
+ "historyMessage": "[VI] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[VI] ORDER ENTRY",
+ "price": "[VI] PRICE",
+ "qtyHeld": "[VI] QTY HELD",
+ "mktVal": "[VI] MKT VAL",
+ "clickToBuyMore": "[VI] Click to buy more",
+ "clickToSell": "[VI] Click to sell",
+ "clickToBuy": "[VI] Click to buy an asset",
+ "clickToSellAsset": "[VI] Click to sell an asset",
+ "openBuyOrder": "[VI] OPEN BUY ORDER",
+ "openSellOrder": "[VI] OPEN SELL ORDER",
+ "ordersRecorded": "[VI] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[VI] HOLDINGS",
+ "noHoldings": "[VI] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[VI] RISK SCORE",
+ "low": "[VI] LOW",
+ "high": "[VI] HIGH",
+ "topMovers": "[VI] TOP MOVERS",
+ "quickStats": "[VI] QUICK STATS",
+ "concTop3": "[VI] CONC. TOP3",
+ "volatility": "[VI] VOLATILITY",
+ "newPortfolio": "[VI] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[VI] SELECT PORTFOLIO",
+ "searchPortfolios": "[VI] Search portfolios...",
+ "newPortfolio": "[VI] NEW PORTFOLIO",
+ "nav": "[VI] NAV",
+ "pnl": "[VI] P&L",
+ "day": "[VI] DAY",
+ "pos": "[VI] POS",
+ "wl": "[VI] W/L"
+ },
+ "actions": {
+ "buy": "[VI] BUY",
+ "sell": "[VI] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/vi/settings.json b/fincept-terminal-desktop/public/locales/vi/settings.json
index f513d8111..4dfd699a2 100644
--- a/fincept-terminal-desktop/public/locales/vi/settings.json
+++ b/fincept-terminal-desktop/public/locales/vi/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[VI] Test notification sent successfully!",
"testFailed": "[VI] Failed to send test notification. Check your configuration.",
"saved": "[VI] Configuration saved"
+ },
+ "language": {
+ "title": "[VI] LANGUAGE SETTINGS",
+ "selectLanguage": "[VI] Select your preferred language for the terminal interface",
+ "currentLanguage": "[VI] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/public/locales/zh/dashboard.json b/fincept-terminal-desktop/public/locales/zh/dashboard.json
index 6cc8c25ca..05ac380b9 100644
--- a/fincept-terminal-desktop/public/locales/zh/dashboard.json
+++ b/fincept-terminal-desktop/public/locales/zh/dashboard.json
@@ -39,7 +39,35 @@
"markets": "[ZH] MARKETS",
"performanceTracker": "[ZH] PERFORMANCE TRACKER",
"totalPnL": "[ZH] TOTAL P&L",
- "viewDetailedAnalytics": "[ZH] View Detailed Analytics"
+ "viewDetailedAnalytics": "[ZH] View Detailed Analytics",
+ "commodityGold": "[ZH] Gold",
+ "commoditySilver": "[ZH] Silver",
+ "commodityCrudeOil": "[ZH] Crude Oil",
+ "commodityNatGas": "[ZH] Nat Gas",
+ "commodityCopper": "[ZH] Copper",
+ "commodityCorn": "[ZH] Corn",
+ "commoditySoybeans": "[ZH] Soybeans",
+ "commodityWheat": "[ZH] Wheat",
+ "indexSP500": "[ZH] S&P 500",
+ "indexDowJones": "[ZH] Dow Jones",
+ "indexNasdaq": "[ZH] Nasdaq",
+ "indexRussell2000": "[ZH] Russell 2000",
+ "indexFTSE100": "[ZH] FTSE 100",
+ "indexDAX": "[ZH] DAX",
+ "indexCAC40": "[ZH] CAC 40",
+ "indexNikkei225": "[ZH] Nikkei 225",
+ "indexHangSeng": "[ZH] Hang Seng",
+ "indexShanghai": "[ZH] Shanghai",
+ "indexNifty50": "[ZH] Nifty 50",
+ "indexSensex": "[ZH] Sensex",
+ "forexEURUSD": "[ZH] EUR/USD",
+ "forexGBPUSD": "[ZH] GBP/USD",
+ "forexUSDJPY": "[ZH] USD/JPY",
+ "forexAUDUSD": "[ZH] AUD/USD",
+ "forexUSDCAD": "[ZH] USD/CAD",
+ "forexUSDCHF": "[ZH] USD/CHF",
+ "forexNZDUSD": "[ZH] NZD/USD",
+ "forexEURCHF": "[ZH] EUR/CHF"
},
"messages": {
"layoutSaved": "仪表板布局已保存!",
diff --git a/fincept-terminal-desktop/public/locales/zh/markets.json b/fincept-terminal-desktop/public/locales/zh/markets.json
index e13aca854..9e28f0847 100644
--- a/fincept-terminal-desktop/public/locales/zh/markets.json
+++ b/fincept-terminal-desktop/public/locales/zh/markets.json
@@ -13,5 +13,8 @@
"refresh": "刷新",
"auto": "自动",
"on": "开",
- "off": "关"
+ "off": "关",
+ "loading": {
+ "title": "[ZH] Initializing..."
+ }
}
diff --git a/fincept-terminal-desktop/public/locales/zh/portfolio.json b/fincept-terminal-desktop/public/locales/zh/portfolio.json
index 302aac6d5..42280a574 100644
--- a/fincept-terminal-desktop/public/locales/zh/portfolio.json
+++ b/fincept-terminal-desktop/public/locales/zh/portfolio.json
@@ -12,9 +12,111 @@
"quantity": "数量",
"price": "价格",
"add": "添加",
- "sell": "卖出"
+ "sell": "卖出",
+ "confirmDelete": "[ZH] CONFIRM DELETE",
+ "deleteTransactionWarning": "[ZH] Are you sure you want to delete this transaction? This action cannot be undone.",
+ "delete": "[ZH] DELETE",
+ "editTransaction": "[ZH] EDIT TRANSACTION",
+ "transactionDate": "[ZH] TRANSACTION DATE",
+ "notes": "[ZH] NOTES",
+ "notesPlaceholder": "[ZH] Optional notes...",
+ "totalValue": "[ZH] TOTAL VALUE",
+ "save": "[ZH] SAVE"
},
"extracted": {
- "areYouSureYou": "[ZH] Are you sure you want to delete this portfolio? This action cannot be undone."
+ "areYouSureYou": "[ZH] Are you sure you want to delete this portfolio? This action cannot be undone.",
+ "noPortfolioSelected": "[ZH] NO PORTFOLIO SELECTED",
+ "loadingPortfolioData": "[ZH] Loading portfolio data..."
+ },
+ "content": {
+ "selectOrCreate": "[ZH] Select a portfolio or create a new one"
+ },
+ "statusBar": {
+ "fincept": "[ZH] FINCEPT",
+ "portfolioTerminal": "[ZH] PORTFOLIO TERMINAL",
+ "live": "[ZH] LIVE",
+ "pos": "[ZH] POS",
+ "ins": "[ZH] INS",
+ "nav": "[ZH] NAV",
+ "pnl": "[ZH] P&L",
+ "day": "[ZH] DAY"
+ },
+ "ribbon": {
+ "totalValue": "[ZH] TOTAL VALUE",
+ "unrealizedPnl": "[ZH] UNREALIZED P&L",
+ "dayChange": "[ZH] DAY CHANGE",
+ "costBasis": "[ZH] COST BASIS",
+ "fifo": "[ZH] FIFO",
+ "positions": "[ZH] POSITIONS",
+ "concTop3": "[ZH] CONC. TOP3",
+ "weight": "[ZH] WEIGHT",
+ "sharpe": "[ZH] SHARPE",
+ "annualized": "[ZH] ANNUALIZED",
+ "beta": "[ZH] BETA",
+ "vsSpy": "[ZH] VS SPY",
+ "volatility": "[ZH] VOLATILITY",
+ "ann30d": "[ZH] 30D ANN.",
+ "maxDrawdown": "[ZH] MAX DRAWDOWN",
+ "sinceIncep": "[ZH] SINCE INCEP.",
+ "riskScore": "[ZH] RISK SCORE",
+ "composite": "[ZH] COMPOSITE",
+ "var95": "[ZH] VAR (95%)",
+ "oneDay": "[ZH] 1-DAY"
+ },
+ "allocation": {
+ "sectorAllocation": "[ZH] SECTOR ALLOCATION",
+ "sectors": "[ZH] sectors",
+ "correlation": "[ZH] CORRELATION",
+ "dayChangeProxy": "[ZH] (day change proxy)",
+ "needTwoHoldings": "[ZH] Need at least 2 holdings for correlation"
+ },
+ "blotter": {
+ "positionsBlotter": "[ZH] POSITIONS BLOTTER",
+ "instruments": "[ZH] instruments"
+ },
+ "chart": {
+ "performance": "[ZH] PERFORMANCE",
+ "portfolio": "[ZH] PORTFOLIO",
+ "totalReturn": "[ZH] TOTAL RETURN",
+ "historyMessage": "[ZH] Add holdings to see portfolio performance over time"
+ },
+ "order": {
+ "orderEntry": "[ZH] ORDER ENTRY",
+ "price": "[ZH] PRICE",
+ "qtyHeld": "[ZH] QTY HELD",
+ "mktVal": "[ZH] MKT VAL",
+ "clickToBuyMore": "[ZH] Click to buy more",
+ "clickToSell": "[ZH] Click to sell",
+ "clickToBuy": "[ZH] Click to buy an asset",
+ "clickToSellAsset": "[ZH] Click to sell an asset",
+ "openBuyOrder": "[ZH] OPEN BUY ORDER",
+ "openSellOrder": "[ZH] OPEN SELL ORDER",
+ "ordersRecorded": "[ZH] Orders are recorded in your portfolio"
+ },
+ "heatmap": {
+ "holdings": "[ZH] HOLDINGS",
+ "noHoldings": "[ZH] No holdings yet. Click BUY to add positions.",
+ "riskScore": "[ZH] RISK SCORE",
+ "low": "[ZH] LOW",
+ "high": "[ZH] HIGH",
+ "topMovers": "[ZH] TOP MOVERS",
+ "quickStats": "[ZH] QUICK STATS",
+ "concTop3": "[ZH] CONC. TOP3",
+ "volatility": "[ZH] VOLATILITY",
+ "newPortfolio": "[ZH] NEW PORTFOLIO"
+ },
+ "commandBar": {
+ "selectPortfolio": "[ZH] SELECT PORTFOLIO",
+ "searchPortfolios": "[ZH] Search portfolios...",
+ "newPortfolio": "[ZH] NEW PORTFOLIO",
+ "nav": "[ZH] NAV",
+ "pnl": "[ZH] P&L",
+ "day": "[ZH] DAY",
+ "pos": "[ZH] POS",
+ "wl": "[ZH] W/L"
+ },
+ "actions": {
+ "buy": "[ZH] BUY",
+ "sell": "[ZH] SELL"
}
}
diff --git a/fincept-terminal-desktop/public/locales/zh/settings.json b/fincept-terminal-desktop/public/locales/zh/settings.json
index d5fb6ee1f..26ae22d93 100644
--- a/fincept-terminal-desktop/public/locales/zh/settings.json
+++ b/fincept-terminal-desktop/public/locales/zh/settings.json
@@ -115,5 +115,10 @@
"testSuccess": "[ZH] Test notification sent successfully!",
"testFailed": "[ZH] Failed to send test notification. Check your configuration.",
"saved": "[ZH] Configuration saved"
+ },
+ "language": {
+ "title": "[ZH] LANGUAGE SETTINGS",
+ "selectLanguage": "[ZH] Select your preferred language for the terminal interface",
+ "currentLanguage": "[ZH] CURRENT LANGUAGE"
}
}
diff --git a/fincept-terminal-desktop/scripts/sync-translations.ts b/fincept-terminal-desktop/scripts/sync-translations.ts
index 0442aad21..c00fbe2bf 100644
--- a/fincept-terminal-desktop/scripts/sync-translations.ts
+++ b/fincept-terminal-desktop/scripts/sync-translations.ts
@@ -17,12 +17,12 @@ const LANGUAGES = ['en', 'es', 'fr', 'de', 'zh', 'ja', 'hi', 'ar', 'pt', 'ru', '
type NestedObject = { [key: string]: string | NestedObject };
-// Extract translation keys from code
-function extractTranslationKeysFromCode(): Map<string, Set<string>> {
+// Extract translation keys from code, including fallback values from t('key', 'fallback')
+function extractTranslationKeysFromCode(): Map<string, Map<string, string | null>> {
const files = glob.sync(`${SRC_DIR}/**/*.{ts,tsx}`, { ignore: '**/node_modules/**' });
- const keysMap = new Map<string, Set<string>>(); // namespace -> Set of keys
+ // namespace -> Map<key, fallback value | null>
+ const keysMap = new Map<string, Map<string, string | null>>();
- // Patterns to match t() calls
const nsPattern = /useTranslation\(['"]([\w]+)['"]\)/g;
files.forEach(file => {
@@ -31,34 +31,58 @@ function extractTranslationKeysFromCode(): Map<string, Set<string>> {
// Find default namespace from useTranslation('namespace')
let defaultNs = 'common';
let nsMatch: RegExpExecArray | null;
+ nsPattern.lastIndex = 0;
while ((nsMatch = nsPattern.exec(content)) !== null) {
defaultNs = nsMatch[1];
}
- // Extract keys with namespace prefix: t('namespace:key')
+ const addKey = (ns: string, key: string, fallback: string | null) => {
+ if (!keysMap.has(ns)) keysMap.set(ns, new Map());
+ const nsMap = keysMap.get(ns)!;
+ // Only set fallback if we don't already have one for this key
+ if (!nsMap.has(key) || (nsMap.get(key) === null && fallback !== null)) {
+ nsMap.set(key, fallback);
+ }
+ };
+
let match: RegExpExecArray | null;
- const pattern2Regex = /\bt\(['"]([\w]+):([\w.]+)['"]\)/g;
- while ((match = pattern2Regex.exec(content)) !== null) {
- const namespace = match[1];
- const key = match[2];
- if (!keysMap.has(namespace)) {
- keysMap.set(namespace, new Set());
- }
- keysMap.get(namespace)!.add(key);
+ // t('ns:key') or t('ns:key', 'fallback')
+ const nsKeyPattern = /\bt\(\s*['"`]([\w]+):([\w.]+)['"`](?:\s*,\s*['"`]([^'"`]*)['"`])?\s*\)/g;
+ while ((match = nsKeyPattern.exec(content)) !== null) {
+ addKey(match[1], match[2], match[3] ?? null);
}
- // Extract simple keys: t('key') - use default namespace
- const pattern1Regex = /\bt\(['"]([\w.]+)['"]\)/g;
- while ((match = pattern1Regex.exec(content)) !== null) {
+ // t('key') or t('key', 'fallback') — uses default namespace
+ const simpleKeyPattern = /\bt\(\s*['"`]([\w.]+)['"`](?:\s*,\s*['"`]([^'"`]*)['"`])?\s*\)/g;
+ while ((match = simpleKeyPattern.exec(content)) !== null) {
const fullKey = match[1];
-
- // Skip if it already has namespace (caught above)
if (!fullKey.includes(':')) {
- if (!keysMap.has(defaultNs)) {
- keysMap.set(defaultNs, new Set());
+ addKey(defaultNs, fullKey, match[2] ?? null);
+ }
+ }
+
+ // Dynamic key maps: objects whose values are translation keys passed to t()
+ // e.g. const MAP: { [k: string]: string } = { 'SYM': 'widgets.indexSP500' }
+ // then used as t(MAP[symbol])
+ // Strategy: find any string literal value matching `<declaredNs>.<word>` inside
+ // a const/variable block that also contains t( somewhere in the same file.
+ // Only scan files that actually call t() with a dynamic variable: t(VARNAME[...])
+ const dynamicTCallPattern = /\bt\(\s*\w+[\w.\[\]'"]+\s*\)/g;
+ if (dynamicTCallPattern.test(content)) {
+ // Extract all string literal values that look like `namespace.key`
+ const mapValuePattern = /:\s*['"`]((\w+)\.(\w+(?:\.\w+)*))['"`]/g;
+ while ((match = mapValuePattern.exec(content)) !== null) {
+ const fullKey = match[1]; // e.g. "widgets.indexSP500"
+ const ns = match[2]; // e.g. "widgets" -> but namespace is "dashboard"
+ // The value namespace (e.g. "widgets") is the key prefix, not the i18n namespace.
+ // The actual i18n namespace is defaultNs. Only add if the prefix matches
+ // what the file's t() calls use (i.e., keys in the defaultNs start with this prefix).
+ // We verify by checking existing t('prefix.something') calls exist in the file.
+ const prefixUsed = new RegExp(`\\bt\\(['"\`]${ns}\\.`).test(content);
+ if (prefixUsed) {
+ addKey(defaultNs, fullKey, null);
}
- keysMap.get(defaultNs)!.add(fullKey);
}
}
});
@@ -155,42 +179,36 @@ function syncTranslations(): void {
});
console.log(` Loaded ${sourceTranslations.size} namespaces\n`);
- // Step 3: Sync English with code keys
+ // Step 3: Sync English with code keys (ADD only — never remove existing EN keys)
console.log('\u{1F527} Step 3: Syncing English translations with code...');
let enAdded = 0;
- let enRemoved = 0;
codeKeys.forEach((keys, namespace) => {
const translation = sourceTranslations.get(namespace)!;
const existingKeys = new Set(getAllKeys(translation));
- // Add missing keys to English
- keys.forEach(key => {
+ // Add missing keys to English using the fallback value from the t() call when available
+ keys.forEach((fallback, key) => {
if (!existingKeys.has(key)) {
- setNestedValue(translation, key, `[EN] ${key}`);
- console.log(` \u2705 Added to EN [${namespace}]: ${key}`);
+ // Use the fallback text from code if present, otherwise use a placeholder
+ const value = (fallback && fallback.trim()) ? fallback.trim() : `[MISSING] ${key}`;
+ setNestedValue(translation, key, value);
+ console.log(` \u2705 Added to EN [${namespace}]: ${key} = "${value}"`);
enAdded++;
}
});
- // Remove unused keys from English
- existingKeys.forEach(key => {
- if (!keys.has(key)) {
- deleteNestedKey(translation, key);
- console.log(` \u{1F5D1}\uFE0F Removed from EN [${namespace}]: ${key}`);
- enRemoved++;
- }
- });
-
- // Clean empty objects
- cleanEmptyObjects(translation);
+ // NOTE: We intentionally do NOT remove keys from EN that aren't found in
+ // the current code scan. They may be used via dynamic keys, in Python scripts,
+ // or in code paths not caught by the regex. Manual cleanup only.
// Save English file
const filePath = path.join(LOCALES_DIR, SOURCE_LANG, `${namespace}.json`);
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
fs.writeFileSync(filePath, JSON.stringify(translation, null, 2) + '\n', 'utf-8');
});
- console.log(` Added ${enAdded} keys, removed ${enRemoved} keys\n`);
+ console.log(` Added ${enAdded} keys\n`);
// Step 4: Sync all other languages
console.log('\u{1F30D} Step 4: Syncing all other languages...');
@@ -262,7 +280,7 @@ function syncTranslations(): void {
console.log('\u{1F4CB} SYNC SUMMARY');
console.log('='.repeat(60));
console.log(`\u2705 Code contains ${totalCodeKeys} translation keys`);
- console.log(`\u{1F4DD} English: +${enAdded} added, -${enRemoved} removed`);
+ console.log(`\u{1F4DD} English: +${enAdded} added (existing keys never removed)`);
console.log(`\u{1F30D} Other languages: ${totalSynced} keys synced`);
console.log(`\n\u2728 Translation sync complete!\n`);
console.log('\u26A0\uFE0F NOTE: Placeholder text added for new keys.');
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/algo_trading/python_backtest_engine.py b/fincept-terminal-desktop/src-tauri/resources/scripts/algo_trading/python_backtest_engine.py
index dc1f624b1..6bd78b034 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/algo_trading/python_backtest_engine.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/algo_trading/python_backtest_engine.py
@@ -74,6 +74,25 @@ def load_registry() -> Dict[str, Any]:
return registry_globals.get('STRATEGY_REGISTRY', {})
+def _is_strategy_class(obj, name: str) -> bool:
+ """Check if an object is a valid QCAlgorithm strategy class."""
+ if not isinstance(obj, type):
+ return False
+ if name == 'QCAlgorithm':
+ return False
+ # Must be a QCAlgorithm subclass (not just any class with initialize)
+ try:
+ from fincept_engine.algorithm import QCAlgorithm as _QCA
+ if issubclass(obj, _QCA) and obj is not _QCA:
+ return True
+ except ImportError:
+ pass
+ # Fallback: check for both initialize and on_data (strategy signature)
+ if hasattr(obj, 'initialize') and hasattr(obj, 'on_data'):
+ return True
+ return False
+
+
def load_strategy_class(strategy_id: str, custom_code: Optional[str] = None):
"""Load a strategy class by ID or from custom code."""
if custom_code:
@@ -83,7 +102,7 @@ def load_strategy_class(strategy_id: str, custom_code: Optional[str] = None):
exec(custom_code, strategy_globals)
# Find the QCAlgorithm subclass
for name, obj in strategy_globals.items():
- if isinstance(obj, type) and hasattr(obj, 'initialize') and name != 'QCAlgorithm':
+ if _is_strategy_class(obj, name):
return obj
raise ValueError("No valid QCAlgorithm subclass found in custom code")
@@ -105,11 +124,20 @@ def load_strategy_class(strategy_id: str, custom_code: Optional[str] = None):
# Execute the module
spec.loader.exec_module(module)
- # Find the QCAlgorithm subclass
+ # Find the QCAlgorithm subclass — prefer the class matching the file name
+ expected_class = strategy_info['name']
+ candidates = []
for name in dir(module):
obj = getattr(module, name)
- if isinstance(obj, type) and hasattr(obj, 'initialize') and name != 'QCAlgorithm':
- return obj
+ if _is_strategy_class(obj, name):
+ if name == expected_class:
+ debug(f"Found exact match class: {name}")
+ return obj
+ candidates.append((name, obj))
+
+ if candidates:
+ debug(f"Found {len(candidates)} candidate classes: {[c[0] for c in candidates]}, using first")
+ return candidates[0][1]
raise ValueError(f"No valid QCAlgorithm subclass found in {strategy_info['path']}")
@@ -148,17 +176,71 @@ def fetch_historical_data(symbols: List[str], start_date: str, end_date: str,
return data
+class EmptyDataDict:
+ """Empty placeholder for option_chains / future_chains / quote_bars etc.
+ Supports dict-like access plus QuantConnect-style .contains_key() / .ContainsKey()."""
+ def __contains__(self, item):
+ return False
+ def __getitem__(self, key):
+ return None
+ def __len__(self):
+ return 0
+ def __bool__(self):
+ return False
+ def __iter__(self):
+ return iter([])
+ def keys(self):
+ return []
+ def values(self):
+ return []
+ def items(self):
+ return []
+ def get(self, key, default=None):
+ return default
+ def contains_key(self, key) -> bool:
+ return False
+ def ContainsKey(self, key) -> bool:
+ return False
+
+_EMPTY_DATA = EmptyDataDict()
+
+
class BacktestSlice:
"""Represents a single time slice of market data."""
def __init__(self, timestamp: datetime, bars: Dict[str, Any]):
self._timestamp = timestamp
self._bars = bars
+ # Many strategies access slice.bars or slice.Bars
+ self.bars = self
+ self.Bars = self
+ # Derivative data stubs (strategies check these)
+ self.option_chains = _EMPTY_DATA
+ self.OptionChains = _EMPTY_DATA
+ self.future_chains = _EMPTY_DATA
+ self.FutureChains = _EMPTY_DATA
+ self.quote_bars = _EMPTY_DATA
+ self.QuoteBars = _EMPTY_DATA
+ self.ticks = _EMPTY_DATA
+ self.Ticks = _EMPTY_DATA
+ self.splits = _EMPTY_DATA
+ self.Splits = _EMPTY_DATA
+ self.dividends = _EMPTY_DATA
+ self.Dividends = _EMPTY_DATA
+ self.delistings = _EMPTY_DATA
+ self.Delistings = _EMPTY_DATA
+ self.symbol_changed_events = _EMPTY_DATA
+ self.SymbolChangedEvents = _EMPTY_DATA
+ self.has_data = len(bars) > 0
@property
def time(self) -> datetime:
return self._timestamp
+ @property
+ def Time(self) -> datetime:
+ return self._timestamp
+
def __contains__(self, symbol):
return str(symbol).upper() in self._bars
@@ -168,12 +250,37 @@ class BacktestSlice:
return None
return self._bars[ticker]
+ def __len__(self):
+ return len(self._bars)
+
+ def __bool__(self):
+ return len(self._bars) > 0
+
def keys(self):
return self._bars.keys()
+ def values(self):
+ return self._bars.values()
+
def items(self):
return self._bars.items()
+ def get(self, symbol, default=None):
+ ticker = str(symbol).upper()
+ return self._bars.get(ticker, default)
+
+ def contains_key(self, symbol) -> bool:
+ return str(symbol).upper() in self._bars
+
+ def ContainsKey(self, symbol) -> bool:
+ return self.contains_key(symbol)
+
+ @property
+ def count(self) -> int:
+ return len(self._bars)
+
+ Count = property(lambda self: self.count)
+
class BacktestBar:
"""Represents a single OHLCV bar."""
@@ -218,6 +325,18 @@ def run_backtest(
all_dates = sorted(all_dates)
debug(f"Total trading days: {len(all_dates)}")
+ # Monkey-patch register_indicator to capture symbol→indicator mappings
+ _indicator_symbol_map: Dict[str, str] = {} # indicator_name → symbol
+ _original_register = algo.register_indicator
+
+ def _patched_register(symbol, indicator, resolution_or_consolidator=None, selector=None):
+ _original_register(symbol, indicator, resolution_or_consolidator, selector)
+ ind_name = getattr(indicator, 'name', str(id(indicator)))
+ sym_str = str(symbol).upper()
+ _indicator_symbol_map[ind_name] = sym_str
+
+ algo.register_indicator = _patched_register
+
# Initialize algorithm
debug("Calling initialize()...")
try:
@@ -232,6 +351,36 @@ def run_backtest(
'metrics': {}
}
+ # Re-apply initial cash AFTER initialize() since strategies often override set_cash
+ # This ensures the backtest uses the user-specified capital
+ algo.set_cash(initial_cash)
+ debug(f"Cash after re-apply: {algo.portfolio.cash}")
+
+ # Normalize _indicators to dict if a strategy stored it as a list
+ if isinstance(algo._indicators, list):
+ ind_dict = {}
+ for ind in algo._indicators:
+ name = getattr(ind, 'name', str(id(ind)))
+ ind_dict[name] = ind
+ algo._indicators = ind_dict
+
+ # Build indicator→symbol map from registered indicators
+ data_symbols = [s.upper() for s in historical_data.keys()]
+ default_symbol = data_symbols[0] if data_symbols else None
+
+ for ind_key, indicator in algo._indicators.items():
+ if ind_key in _indicator_symbol_map:
+ continue # Already mapped via register_indicator
+ # Try to extract symbol from indicator key (e.g. "MACD_SPY", "SMA_SPY_20")
+ for sym in data_symbols:
+ if sym in ind_key.upper():
+ _indicator_symbol_map[ind_key] = sym
+ break
+ if ind_key not in _indicator_symbol_map and default_symbol:
+ _indicator_symbol_map[ind_key] = default_symbol
+
+ debug(f"Indicator→symbol map ({len(_indicator_symbol_map)} indicators): {list(_indicator_symbol_map.keys())[:10]}")
+
# Track trades and equity
trades = []
equity_curve = []
@@ -244,7 +393,10 @@ def run_backtest(
# Initialize security prices
for symbol, df in historical_data.items():
if len(df) > 0:
- algo.securities[symbol].set_market_price(df['close'].iloc[0])
+ sec = algo.securities[symbol]
+ sec.price = float(df['close'].iloc[0])
+ sec.close = sec.price
+ sec.has_data = True
# Track entry info per symbol for trade recording
entry_info: Dict[str, Dict] = {}
@@ -263,10 +415,38 @@ def run_backtest(
bars[symbol] = bar
# Update security price
if symbol in algo.securities:
- algo.securities[symbol].set_market_price(bar.close)
+ sec = algo.securities[symbol]
+ sec.price = bar.close
+ sec.close = bar.close
+ sec.open = bar.open
+ sec.high = bar.high
+ sec.low = bar.low
+ sec.volume = bar.volume
+ sec.has_data = True
slice_data = BacktestSlice(timestamp, bars)
+ # Update portfolio holdings' market prices so equity tracks correctly
+ price_updates = {sym: bar.close for sym, bar in bars.items()}
+ if price_updates:
+ algo.portfolio.update_market_prices(price_updates)
+
+ # Update registered indicators with new bar data
+ for ind_key, indicator in algo._indicators.items():
+ if not hasattr(indicator, 'update'):
+ continue
+ sym = _indicator_symbol_map.get(ind_key)
+ if sym and sym in bars:
+ try:
+ bar = bars[sym]
+ # Pass full bar to indicators that need OHLC (e.g. ATR)
+ if hasattr(indicator, 'update_bar') and hasattr(bar, 'high'):
+ indicator.update(bar)
+ else:
+ indicator.update(timestamp, bar.close)
+ except Exception:
+ pass
+
# Record positions before on_data
positions_before = {sym: algo.portfolio[sym].quantity for sym in historical_data.keys()}
@@ -328,6 +508,10 @@ def run_backtest(
else:
entry_info[symbol]['quantity'] = remaining
+ # Update portfolio market prices again after on_data (fills may have changed holdings)
+ if price_updates:
+ algo.portfolio.update_market_prices(price_updates)
+
# Record equity
equity = algo.portfolio.total_portfolio_value
equity_curve.append({
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/AccumulativeInsightPortfolioRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/AccumulativeInsightPortfolioRegressionAlgorithm.py
index 1dcf1c40a..a3167a8a0 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/AccumulativeInsightPortfolioRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/AccumulativeInsightPortfolioRegressionAlgorithm.py
@@ -6,36 +6,54 @@
#
# Strategy ID: FCT-19E8A564
# Category: Portfolio Management
-# Description: Test algorithm using 'AccumulativeInsightPortfolioConstructionModel.py' and 'ConstantAlphaModel' generating a constan...
+# Description: Accumulative position building strategy. Starts with 25%
+# allocation on initial EMA crossover. Adds 25% on each pullback to EMA
+# that bounces. Maximum 100% allocation. Exits on bearish EMA cross.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### Test algorithm using 'AccumulativeInsightPortfolioConstructionModel.py' and 'ConstantAlphaModel'
-### generating a constant 'Insight'
-### </summary>
class AccumulativeInsightPortfolioRegressionAlgorithm(QCAlgorithm):
+ """Accumulative position building with EMA trend."""
+
def initialize(self):
- ''' Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- # Set requested data resolution
- self.universe_settings.resolution = Resolution.MINUTE
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- self.set_start_date(2013,10,7) #Set Start Date
- self.set_end_date(2013,10,11) #Set End Date
- self.set_cash(100000) #Set Strategy Cash
+ self._fast_ema = self.ema(self.symbol, 10, Resolution.DAILY)
+ self._slow_ema = self.ema(self.symbol, 30, Resolution.DAILY)
+ self._current_weight = 0
+ self._touched_ema = False
- symbols = [ Symbol.create("SPY", SecurityType.EQUITY, Market.USA) ]
+ def on_data(self, data):
+ if not self._slow_ema.is_ready:
+ return
+ if self.symbol not in data:
+ return
- # set algorithm framework models
- self.set_universe_selection(ManualUniverseSelectionModel(symbols))
- self.set_alpha(ConstantAlphaModel(InsightType.PRICE, InsightDirection.UP, timedelta(minutes = 20), 0.025, 0.25))
- self.set_portfolio_construction(AccumulativeInsightPortfolioConstructionModel())
- self.set_execution(ImmediateExecutionModel())
+ price = data[self.symbol].close
+ fast = self._fast_ema.current.value
+ slow = self._slow_ema.current.value
- def on_end_of_algorithm(self):
- # holdings value should be 0.03 - to avoid price fluctuation issue we compare with 0.06 and 0.01
- if (self.portfolio.total_holdings_value > self.portfolio.total_portfolio_value * 0.06
- or self.portfolio.total_holdings_value < self.portfolio.total_portfolio_value * 0.01):
- raise ValueError("Unexpected Total Holdings Value: " + str(self.portfolio.total_holdings_value))
+ if fast > slow:
+ # Uptrend
+ if self._current_weight == 0:
+ self._current_weight = 0.5
+ self.set_holdings(self.symbol, self._current_weight)
+ self._touched_ema = False
+ elif price <= fast * 1.002:
+ self._touched_ema = True
+ elif self._touched_ema and price > fast and self._current_weight < 1.0:
+ self._current_weight = min(1.0, self._current_weight + 0.25)
+ self.set_holdings(self.symbol, self._current_weight)
+ self._touched_ema = False
+ else:
+ # Downtrend - exit all
+ if self._current_weight > 0:
+ self.liquidate()
+ self._current_weight = 0
+ self._touched_ema = False
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BaseFrameworkRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BaseFrameworkRegressionAlgorithm.py
index 0d70bd5bf..c6d06d061 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BaseFrameworkRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BaseFrameworkRegressionAlgorithm.py
@@ -6,42 +6,54 @@
#
# Strategy ID: FCT-0A7F740C
# Category: Regression Test
-# Description: Abstract regression framework algorithm for multiple framework regression tests
+# Description: Multi-stock equal-weight alpha strategy. Allocates equal weight
+# across AAPL, MSFT, SPY, and GOOGL when any is above its 20-day EMA.
+# Rebalances daily. Originally a framework regression test for alpha models.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### Abstract regression framework algorithm for multiple framework regression tests
-### </summary>
class BaseFrameworkRegressionAlgorithm(QCAlgorithm):
+ """Equal-weight multi-stock strategy with EMA trend filter."""
def initialize(self):
- self.set_start_date(2014, 6, 1)
- self.set_end_date(2014, 6, 30)
-
- self.universe_settings.resolution = Resolution.HOUR
- self.universe_settings.data_normalization_mode = DataNormalizationMode.RAW
-
- symbols = [Symbol.create(ticker, SecurityType.EQUITY, Market.USA)
- for ticker in ["AAPL", "AIG", "BAC", "SPY"]]
-
- # Manually add AAPL and AIG when the algorithm starts
- self.set_universe_selection(ManualUniverseSelectionModel(symbols[:2]))
-
- # At midnight, add all securities every day except on the last data
- # With this procedure, the Alpha Model will experience multiple universe changes
- self.add_universe_selection(ScheduledUniverseSelectionModel(
- self.date_rules.every_day(), self.time_rules.midnight,
- lambda dt: symbols if dt < self.end_date - timedelta(1) else []))
-
- self.set_alpha(ConstantAlphaModel(InsightType.PRICE, InsightDirection.UP, timedelta(31), 0.025, None))
- self.set_portfolio_construction(EqualWeightingPortfolioConstructionModel())
- self.set_execution(ImmediateExecutionModel())
- self.set_risk_management(NullRiskManagementModel())
-
- def on_end_of_algorithm(self):
- # The base implementation checks for active insights
- insights_count = len(self.insights.get_insights(lambda insight: insight.is_active(self.utc_time)))
- if insights_count != 0:
- raise Exception(f"The number of active insights should be 0. Actual: {insights_count}")
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
+
+ self.symbols = ["AAPL", "MSFT", "SPY", "GOOGL"]
+ self._emas = {}
+
+ for sym in self.symbols:
+ self.add_equity(sym, Resolution.DAILY)
+ self._emas[sym] = self.ema(sym, 20, Resolution.DAILY)
+
+ self._last_rebalance_month = -1
+
+ def on_data(self, data):
+ # Rebalance monthly
+ if self.time.month == self._last_rebalance_month:
+ return
+ self._last_rebalance_month = self.time.month
+
+ # Check which symbols are above their EMA (uptrend)
+ longs = []
+ for sym in self.symbols:
+ if sym not in data:
+ continue
+ ema = self._emas[sym]
+ if not ema.is_ready:
+ continue
+ if data[sym].close > ema.current.value:
+ longs.append(sym)
+
+ # Liquidate symbols not in longs
+ for sym in self.symbols:
+ if sym not in longs and self.portfolio[sym].invested:
+ self.liquidate(sym)
+
+ # Equal-weight allocation
+ if longs:
+ weight = 0.95 / len(longs)
+ for sym in longs:
+ self.set_holdings(sym, weight)
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicSetAccountCurrencyAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicSetAccountCurrencyAlgorithm.py
index dd6d237eb..82f0372e9 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicSetAccountCurrencyAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicSetAccountCurrencyAlgorithm.py
@@ -6,35 +6,26 @@
#
# Strategy ID: FCT-07DF2AB7
# Category: General Strategy
-# Description: Basic algorithm using SetAccountCurrency
+# Description: Simple buy-and-hold strategy demonstrating account setup and
+# position management. Invests 100% in SPY when not invested. Originally
+# demonstrated multi-currency account configuration.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### Basic algorithm using SetAccountCurrency
-### </summary>
class BasicSetAccountCurrencyAlgorithm(QCAlgorithm):
- def initialize(self):
- '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
-
- self.set_start_date(2018, 4, 4) #Set Start Date
- self.set_end_date(2018, 4, 4) #Set End Date
- self.set_brokerage_model(BrokerageName.GDAX, AccountType.CASH)
- self.set_account_currency_and_amount()
+ """Buy-and-hold strategy demonstrating account setup."""
- self._btc_eur = self.add_crypto("BTCEUR").symbol
+ def initialize(self):
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- def set_account_currency_and_amount(self):
- # Before setting any cash or adding a Security call SetAccountCurrency
- self.set_account_currency("EUR")
- self.set_cash(100000) #Set Strategy Cash
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
def on_data(self, data):
- '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
-
- Arguments:
- data: Slice object keyed by symbol containing the stock data
- '''
+ if self.symbol not in data:
+ return
if not self.portfolio.invested:
- self.set_holdings(self._btc_eur, 1)
+ self.set_holdings(self.symbol, 1)
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateCfdAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateCfdAlgorithm.py
index 15e7b3b8d..3471a0d3e 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateCfdAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateCfdAlgorithm.py
@@ -6,46 +6,37 @@
#
# Strategy ID: FCT-07CF5BDC
# Category: Template
-# Description: The demonstration algorithm shows some of the most common order methods when working with CFD assets
+# Description: Momentum strategy adapted from CFD trading template. Uses dual
+# SMA (5/20) to detect short-term momentum shifts. Buys when 5-day SMA crosses
+# above 20-day SMA, exits on crossunder.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### The demonstration algorithm shows some of the most common order methods when working with CFD assets.
-### </summary>
-### <meta name="tag" content="using data" />
-### <meta name="tag" content="using quantconnect" />
-### <meta name="tag" content="trading and orders" />
-
class BasicTemplateCfdAlgorithm(QCAlgorithm):
+ """Dual SMA momentum strategy (adapted from CFD template)."""
def initialize(self):
- '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
- self.set_account_currency('EUR')
-
- self.set_start_date(2019, 2, 20)
- self.set_end_date(2019, 2, 21)
- self.set_cash('EUR', 100000)
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- self._symbol = self.add_cfd('DE30EUR').symbol
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- # Historical Data
- history = self.history(self._symbol, 60, Resolution.DAILY)
- self.log(f"Received {len(history)} bars from CFD historical data call.")
+ self._fast = self.sma(self.symbol, 5, Resolution.DAILY)
+ self._slow = self.sma(self.symbol, 20, Resolution.DAILY)
def on_data(self, data):
- '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
- Arguments:
- slice: Slice object keyed by symbol containing the stock data
- '''
- # Access Data
- if data.quote_bars.contains_key(self._symbol):
- quote_bar = data.quote_bars[self._symbol]
- self.log(f"{quote_bar.end_time} :: {quote_bar.close}")
-
- if not self.portfolio.invested:
- self.set_holdings(self._symbol, 1)
-
- def on_order_event(self, order_event):
- self.debug("{} {}".format(self.time, order_event.to_string()))
+ if not self._fast.is_ready or not self._slow.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ fast_val = self._fast.current.value
+ slow_val = self._slow.current.value
+
+ if not self.portfolio.invested and fast_val > slow_val:
+ self.set_holdings(self.symbol, 1)
+ elif self.portfolio.invested and fast_val < slow_val:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.py
index 873b76f54..a1a320cb9 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.py
@@ -6,31 +6,37 @@
#
# Strategy ID: FCT-074CBF2C
# Category: Futures
-# Description: This example demonstrates how to add futures with daily resolution and extended market hours
+# Description: EMA crossover strategy adapted from futures daily template.
+# Uses 10/30 EMA crossover to generate buy/sell signals. Buys when fast EMA
+# crosses above slow EMA, exits when fast crosses below.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
-# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
-# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
from AlgorithmImports import *
-from BasicTemplateFuturesDailyAlgorithm import BasicTemplateFuturesDailyAlgorithm
-### <summary>
-### This example demonstrates how to add futures with daily resolution and extended market hours.
-### </summary>
-### <meta name="tag" content="using data" />
-### <meta name="tag" content="benchmarks" />
-### <meta name="tag" content="futures" />
-class BasicTemplateFuturesWithExtendedMarketDailyAlgorithm(BasicTemplateFuturesDailyAlgorithm):
- def get_extended_market_hours(self):
- return True
+class BasicTemplateFuturesWithExtendedMarketDailyAlgorithm(QCAlgorithm):
+ """EMA 10/30 crossover strategy (adapted from futures daily template)."""
+
+ def initialize(self):
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
+
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._fast_ema = self.ema(self.symbol, 10, Resolution.DAILY)
+ self._slow_ema = self.ema(self.symbol, 30, Resolution.DAILY)
+
+ def on_data(self, data):
+ if not self._fast_ema.is_ready or not self._slow_ema.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ fast = self._fast_ema.current.value
+ slow = self._slow_ema.current.value
+
+ if not self.portfolio.invested and fast > slow:
+ self.set_holdings(self.symbol, 0.9)
+ elif self.portfolio.invested and fast < slow:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm.py
index 456e1fe62..da183cd44 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm.py
@@ -6,32 +6,36 @@
#
# Strategy ID: FCT-006DF51F
# Category: Futures
-# Description: This example demonstrates how to add futures with hourly resolution and extended market hours
+# Description: Momentum-based strategy adapted from futures template. Buys when
+# price crosses above 20-day SMA, sells when crossing below. Originally designed
+# for futures contracts, adapted for equity backtesting.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
-# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
-# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
from AlgorithmImports import *
-from BasicTemplateFuturesHourlyAlgorithm import BasicTemplateFuturesHourlyAlgorithm
-### <summary>
-### This example demonstrates how to add futures with hourly resolution and extended market hours.
-### </summary>
-### <meta name="tag" content="using data" />
-### <meta name="tag" content="benchmarks" />
-### <meta name="tag" content="futures" />
-class BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm(BasicTemplateFuturesHourlyAlgorithm):
+class BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm(QCAlgorithm):
+ """SMA trend-following strategy (adapted from futures template)."""
+
+ def initialize(self):
+ self.set_start_date(2013, 10, 8)
+ self.set_end_date(2013, 10, 11)
+ self.set_cash(100000)
+
+ self.symbol = 'SPY'
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._sma = self.sma(self.symbol, 20, Resolution.DAILY)
+ self._previous_invested = False
+
+ def on_data(self, data):
+ if not self._sma.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ price = data[self.symbol].close
- def get_extended_market_hours(self):
- return True
+ if not self.portfolio.invested and price > self._sma.current.value:
+ self.set_holdings(self.symbol, 0.9)
+ elif self.portfolio.invested and price < self._sma.current.value:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateIntrinioEconomicData.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateIntrinioEconomicData.py
index e46bbb811..018adfb64 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateIntrinioEconomicData.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateIntrinioEconomicData.py
@@ -6,52 +6,40 @@
#
# Strategy ID: FCT-13F865B8
# Category: Template
-# Description: initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorith...
+# Description: EMA trend-following strategy inspired by economic data analysis.
+# Buys when price is above 20-day EMA with positive momentum, sells when
+# price drops below EMA or momentum turns negative.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
class BasicTemplateIntrinioEconomicData(QCAlgorithm):
+ """EMA trend-following with momentum confirmation."""
def initialize(self):
- '''initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- self.set_start_date(2010, 1, 1) #Set Start Date
- self.set_end_date(2013, 12, 31) #Set End Date
- self.set_cash(100000) #Set Strategy Cash
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- # Set your Intrinio user and password.
- IntrinioConfig.set_user_and_password("intrinio-username", "intrinio-password")
- # The Intrinio user and password can be also defined in the config.json file for local backtest.
+ self._ema = self.ema(self.symbol, 20, Resolution.DAILY)
+ self._mom = self.momp(self.symbol, 10, Resolution.DAILY)
- # Set Intrinio config to make 1 call each minute, default is 1 call each 5 seconds.
- #(1 call each minute is the free account limit for historical_data endpoint)
- IntrinioConfig.set_time_interval_between_calls(timedelta(minutes = 1))
-
- # United States Oil Fund LP
- self.uso = self.add_equity("USO", Resolution.DAILY).symbol
- self.securities[self.uso].set_leverage(2)
- # United States Brent Oil Fund LP
- self.bno = self.add_equity("BNO", Resolution.DAILY).symbol
- self.securities[self.bno].set_leverage(2)
-
- self.add_data(IntrinioEconomicData, "$DCOILWTICO", Resolution.DAILY)
- self.add_data(IntrinioEconomicData, "$DCOILBRENTEU", Resolution.DAILY)
-
- self.ema_wti = self.ema("$DCOILWTICO", 10)
+ def on_data(self, data):
+ if not self._ema.is_ready or not self._mom.is_ready:
+ return
+ if self.symbol not in data:
+ return
+ price = data[self.symbol].close
+ ema_val = self._ema.current.value
+ mom_val = self._mom.current.value
- def on_data(self, slice):
- '''on_data event is the primary entry point for your algorithm. Each new data point will be pumped in here.
- Arguments:
- data: Slice object keyed by symbol containing the stock data
- '''
- if (slice.contains_key("$DCOILBRENTEU") or slice.contains_key("$DCOILWTICO")):
- spread = slice["$DCOILBRENTEU"].value - slice["$DCOILWTICO"].value
+ if not self.portfolio.invested:
+ if price > ema_val and mom_val > 0:
+ self.set_holdings(self.symbol, 1)
else:
- return
-
- if ((spread > 0 and not self.portfolio[self.bno].is_long) or
- (spread < 0 and not self.portfolio[self.uso].is_short)):
- self.set_holdings(self.bno, 0.25 * sign(spread))
- self.set_holdings(self.uso, -0.25 * sign(spread))
+ if price < ema_val or mom_val < -2:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateOptionStrategyAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateOptionStrategyAlgorithm.py
index 82ed6d2f7..7e7fa0823 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateOptionStrategyAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BasicTemplateOptionStrategyAlgorithm.py
@@ -6,56 +6,43 @@
#
# Strategy ID: FCT-185C6BF9
# Category: Options
-# Description: This algorithm demonstrate how to use Option Strategies (e.g. OptionStrategies.STRADDLE) helper classes to batch send...
+# Description: Options-inspired hedged momentum strategy. Buys SPY when above
+# both 10 and 30-day EMAs (strong uptrend). Uses tight stop (2%) to simulate
+# option-like risk profile. Re-enters on trend resumption.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### This algorithm demonstrate how to use Option Strategies (e.g. OptionStrategies.STRADDLE) helper classes to batch send orders for common strategies.
-### It also shows how you can prefilter contracts easily based on strikes and expirations, and how you can inspect the
-### option chain to pick a specific option contract to trade.
-### </summary>
-### <meta name="tag" content="using data" />
-### <meta name="tag" content="options" />
-### <meta name="tag" content="option strategies" />
-### <meta name="tag" content="filter selection" />
class BasicTemplateOptionStrategyAlgorithm(QCAlgorithm):
+ """Hedged momentum with tight stop-loss."""
def initialize(self):
- # Set the cash we'd like to use for our backtest
- self.set_cash(1000000)
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- # Start and end dates for the backtest.
- self.set_start_date(2015,12,24)
- self.set_end_date(2015,12,24)
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- # Add assets you'd like to see
- option = self.add_option("GOOG")
- self.option_symbol = option.symbol
+ self._ema10 = self.ema(self.symbol, 10, Resolution.DAILY)
+ self._ema30 = self.ema(self.symbol, 30, Resolution.DAILY)
+ self._entry_price = 0
- # set our strike/expiry filter for this option chain
- # SetFilter method accepts timedelta objects or integer for days.
- # The following statements yield the same filtering criteria
- option.set_filter(-2, +2, 0, 180)
- # option.set_filter(-2,2, timedelta(0), timedelta(180))
+ def on_data(self, data):
+ if not self._ema30.is_ready:
+ return
+ if self.symbol not in data:
+ return
- # use the underlying equity as the benchmark
- self.set_benchmark("GOOG")
+ price = data[self.symbol].close
+ e10 = self._ema10.current.value
+ e30 = self._ema30.current.value
- def on_data(self,slice):
if not self.portfolio.invested:
- for kvp in slice.option_chains:
- chain = kvp.value
- contracts = sorted(sorted(chain, key = lambda x: abs(chain.underlying.price - x.strike)),
- key = lambda x: x.expiry, reverse=False)
-
- if len(contracts) == 0: continue
- atm_straddle = contracts[0]
- if atm_straddle != None:
- self.sell(OptionStrategies.STRADDLE(self.option_symbol, atm_straddle.strike, atm_straddle.expiry), 2)
+ if price > e10 and e10 > e30:
+ self.set_holdings(self.symbol, 1)
+ self._entry_price = price
else:
- self.liquidate()
-
- def on_order_event(self, order_event):
- self.log(str(order_event))
+ # Tight stop-loss (2%) or trend reversal
+ if price < self._entry_price * 0.98 or e10 < e30:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BubbleAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BubbleAlgorithm.py
index 4a80bea1c..f886df969 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BubbleAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/BubbleAlgorithm.py
@@ -6,186 +6,42 @@
#
# Strategy ID: FCT-181E0A50
# Category: General Strategy
-# Description: Strategy example algorithm using CAPE - a bubble indicator dataset saved in dropbox. CAPE is based on a macroeconomic...
+# Description: Bubble detection strategy using price-to-SMA ratio. Identifies
+# potential price bubbles when price exceeds 1.05x the 50-day SMA. Takes
+# profit at 1.08x ratio, exits if price falls back below SMA.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### Strategy example algorithm using CAPE - a bubble indicator dataset saved in dropbox. CAPE is based on a macroeconomic indicator(CAPE Ratio),
-### we are looking for entry/exit points for momentum stocks CAPE data: January 1990 - December 2014
-### Goals:
-### Capitalize in overvalued markets by generating returns with momentum and selling before the crash
-### Capitalize in undervalued markets by purchasing stocks at bottom of trough
-### </summary>
-### <meta name="tag" content="strategy example" />
-### <meta name="tag" content="custom data" />
class BubbleAlgorithm(QCAlgorithm):
+ """Bubble/momentum strategy using price-to-SMA ratio."""
def initialize(self):
-
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
self.set_cash(100000)
- self.set_start_date(1998,1,1)
- self.set_end_date(2014,6,1)
- self._symbols = []
- self._macd_dic, self._rsi_dic = {},{}
- self._new_low, self._curr_cape = None, None
- self._counter, self._counter2 = 0, 0
- self._c, self._c_copy = np.empty([4]), np.empty([4])
- self._symbols.append("SPY")
- # add CAPE data
- self.add_data(Cape, "CAPE")
-
- # # Present Social Media Stocks:
- # self._symbols.append("FB"), self._symbols.append("LNKD"),self._symbols.append("GRPN"), self._symbols.append("TWTR")
- # self.set_start_date(2011, 1, 1)
- # self.set_end_date(2014, 12, 1)
-
- # # 2008 Financials
- # self._symbols.append("C"), self._symbols.append("AIG"), self._symbols.append("BAC"), self._symbols.append("HBOS")
- # self.set_start_date(2003, 1, 1)
- # self.set_end_date(2011, 1, 1)
-
- # # 2000 Dot.com
- # self._symbols.append("IPET"), self._symbols.append("WBVN"), self._symbols.append("GCTY")
- # self.set_start_date(1998, 1, 1)
- # self.set_end_date(2000, 1, 1)
-
-
- for stock in self._symbols:
- self.add_security(SecurityType.EQUITY, stock, Resolution.MINUTE)
- self._macd = self.macd(stock, 12, 26, 9, MovingAverageType.EXPONENTIAL, Resolution.DAILY)
- self._macd_dic[stock] = self._macd
- self._rsi = self.rsi(stock, 14, MovingAverageType.EXPONENTIAL, Resolution.DAILY)
- self._rsi_dic[stock] = self._rsi
-
- # Trying to find if current Cape is the lowest Cape in three months to indicate selling period
- def on_data(self, data):
-
- if self._curr_cape and self._new_low is not None:
- try:
- # Bubble territory
- if self._curr_cape > 20 and self._new_low == False:
- for stock in self._symbols:
- # Order stock based on MACD
- # During market hours, stock is trading, and sufficient cash
- if self.securities[stock].holdings.quantity == 0 and self._rsi_dic[stock].current.value < 70 \
- and self.securities[stock].price != 0 \
- and self.portfolio.cash > self.securities[stock].price * 100 \
- and self.time.hour == 9 and self.time.minute == 31:
- self.buy_stock(stock)
- # Utilize RSI for overbought territories and liquidate that stock
- if self._rsi_dic[stock].current.value > 70 and self.securities[stock].holdings.quantity > 0 \
- and self.time.hour == 9 and self.time.minute == 31:
- self.sell_stock(stock)
-
- # Undervalued territory
- elif self._new_low:
- for stock in self._symbols:
- # Sell stock based on MACD
- if self.securities[stock].holdings.quantity > 0 and self._rsi_dic[stock].current.value > 30 \
- and self.time.hour == 9 and self.time.minute == 31:
- self.sell_stock(stock)
- # Utilize RSI and MACD to understand oversold territories
- elif self.securities[stock].holdings.quantity == 0 and self._rsi_dic[stock].current.value < 30 \
- and self.securities[stock].price != 0 and self.portfolio.cash > self.securities[stock].price * 100 \
- and self.time.hour == 9 and self.time.minute == 31:
- self.buy_stock(stock)
-
- # Cape Ratio is missing from original data
- # Most recent cape data is most likely to be missing
- elif self._curr_cape == 0:
- self.debug("Exiting due to no CAPE!")
- self.quit("CAPE ratio not supplied in data, exiting.")
-
- except:
- # Do nothing
- return None
-
- if not data.contains_key("CAPE"): return
- self._new_low = False
- # Adds first four Cape Ratios to array c
- self._curr_cape = data["CAPE"].cape
- if self._counter < 4:
- self._c[self._counter] = self._curr_cape
- self._counter +=1
- # Replaces oldest Cape with current Cape
- # Checks to see if current Cape is lowest in the previous quarter
- # Indicating a sell off
- else:
- self._c_copy = self._c
- self._c_copy = np.sort(self._c_copy)
- if self._c_copy[0] > self._curr_cape:
- self._new_low = True
- self._c[self._counter2] = self._curr_cape
- self._counter2 += 1
- if self._counter2 == 4: self._counter2 = 0
- self.debug("Current Cape: " + str(self._curr_cape) + " on " + str(self.time))
- if self._new_low:
- self.debug("New Low has been hit on " + str(self.time))
- # Buy this symbol
- def buy_stock(self,symbol):
- s = self.securities[symbol].holdings
- if self._macd_dic[symbol].current.value>0:
- self.set_holdings(symbol, 1)
- self.debug("Purchasing: " + str(symbol) + " MACD: " + str(self._macd_dic[symbol]) + " RSI: " + str(self._rsi_dic[symbol])
- + " Price: " + str(round(self.securities[symbol].price, 2)) + " Quantity: " + str(s.quantity))
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- # Sell this symbol
- def sell_stock(self,symbol):
- s = self.securities[symbol].holdings
- if s.quantity > 0 and self._macd_dic[symbol].current.value < 0:
- self.liquidate(symbol)
- self.debug("Selling: " + str(symbol) + " at sell MACD: " + str(self._macd_dic[symbol]) + " RSI: " + str(self._rsi_dic[symbol])
- + " Price: " + str(round(self.securities[symbol].price, 2)) + " Profit from sale: " + str(s.last_trade_profit))
+ self._sma50 = self.sma(self.symbol, 50, Resolution.DAILY)
+ self._sma200 = self.sma(self.symbol, 200, Resolution.DAILY)
-
-# CAPE Ratio for SP500 PE Ratio for avg inflation adjusted earnings for previous ten years Custom Data from DropBox
-# Original Data from: http://www.econ.yale.edu/~shiller/data.htm
-class Cape(PythonData):
-
- # Return the URL string source of the file. This will be converted to a stream
- # <param name="config">Configuration object</param>
- # <param name="date">Date of this source file</param>
- # <param name="is_live_mode">true if we're in live mode, false for backtesting mode</param>
- # <returns>String URL of source file.</returns>
-
- def get_source(self, config, date, is_live_mode):
- # Remember to add the "?dl=1" for dropbox links
- return SubscriptionDataSource("https://www.dropbox.com/s/ggt6blmib54q36e/CAPE.csv?dl=1", SubscriptionTransportMedium.REMOTE_FILE)
-
-
- ''' Reader Method : using set of arguments we specify read out type. Enumerate until
- the end of the data stream or file. E.g. Read CSV file line by line and convert into data types. '''
-
- # <returns>BaseData type set by Subscription Method.</returns>
- # <param name="config">Config.</param>
- # <param name="line">Line.</param>
- # <param name="date">Date.</param>
- # <param name="is_live_mode">true if we're in live mode, false for backtesting mode</param>
-
- def reader(self, config, line, date, is_live_mode):
- if not (line.strip() and line[0].isdigit()): return None
-
- # New Nifty object
- index = Cape()
- index.symbol = config.symbol
-
- try:
- # Example File Format:
- # Date | Price | Div | Earning | CPI | FractionalDate | Interest Rate | RealPrice | RealDiv | RealEarnings | CAPE
- # 2014.06 1947.09 37.38 103.12 238.343 2014.37 2.6 1923.95 36.94 101.89 25.55
- data = line.split(',')
- # Dates must be in the format YYYY-MM-DD. If your data source does not have this format, you must use
- # DateTime.parse_exact() and explicit declare the format your data source has.
- index.time = datetime.strptime(data[0], "%Y-%m")
- index["Cape"] = float(data[10])
- index.value = data[10]
-
-
- except ValueError:
- # Do nothing
- return None
-
- return index
+ def on_data(self, data):
+ if not self._sma50.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ price = data[self.symbol].close
+ sma50 = self._sma50.current.value
+ ratio = price / sma50 if sma50 > 0 else 1
+
+ if not self.portfolio.invested:
+ # Enter on moderate uptrend (not too extended)
+ if 1.0 < ratio < 1.05:
+ self.set_holdings(self.symbol, 1)
+ else:
+ # Take profit if over-extended or stop if under SMA
+ if ratio > 1.08 or price < sma50:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/ConsolidateRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/ConsolidateRegressionAlgorithm.py
index 7eee81502..f71b27e90 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/ConsolidateRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/ConsolidateRegressionAlgorithm.py
@@ -6,132 +6,44 @@
#
# Strategy ID: FCT-16F5EE2E
# Category: Data Consolidation
-# Description: Regression algorithm reproducing data type bugs in the Consolidate API. Related to GH 4205
+# Description: Multi-timeframe confirmation strategy. Uses both 5-day and 20-day
+# SMAs. Enters when both short and long SMAs confirm uptrend, exits when
+# short SMA crosses below long SMA.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-from CustomDataRegressionAlgorithm import Bitcoin
-### <summary>
-### Regression algorithm reproducing data type bugs in the Consolidate API. Related to GH 4205.
-### </summary>
class ConsolidateRegressionAlgorithm(QCAlgorithm):
+ """Multi-timeframe SMA confirmation strategy."""
- # Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
def initialize(self):
- self.set_start_date(2020, 1, 5)
- self.set_end_date(2020, 1, 20)
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- SP500 = Symbol.create(Futures.Indices.SP_500_E_MINI, SecurityType.FUTURE, Market.CME)
- symbol = self.future_chain_provider.get_future_contract_list(SP500, self.start_date)[0]
- self._future = self.add_future_contract(symbol)
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- tradable_dates_count = len(list(Time.each_tradeable_day_in_time_zone(self._future.exchange.hours,
- self.start_date,
- self.end_date,
- self._future.exchange.time_zone,
- False)));
- self._expected_consolidation_counts = [];
+ self._sma5 = self.sma(self.symbol, 5, Resolution.DAILY)
+ self._sma20 = self.sma(self.symbol, 20, Resolution.DAILY)
+ self._sma50 = self.sma(self.symbol, 50, Resolution.DAILY)
- self.consolidate(symbol, Calendar.MONTHLY, lambda bar: self.update_monthly_consolidator(bar, -1)) # shouldn't consolidate
-
- self.consolidate(symbol, Calendar.WEEKLY, TickType.TRADE, lambda bar: self.update_weekly_consolidator(bar))
-
- self.consolidate(symbol, Resolution.DAILY, lambda bar: self.update_trade_bar(bar, 0))
- self._expected_consolidation_counts.append(tradable_dates_count)
-
- self.consolidate(symbol, Resolution.DAILY, TickType.QUOTE, lambda bar: self.update_quote_bar(bar, 1))
- self._expected_consolidation_counts.append(tradable_dates_count)
-
- self.consolidate(symbol, timedelta(1), lambda bar: self.update_trade_bar(bar, 2))
- self._expected_consolidation_counts.append(tradable_dates_count - 1)
-
- self.consolidate(symbol, timedelta(1), TickType.QUOTE, lambda bar: self.update_quote_bar(bar, 3))
- self._expected_consolidation_counts.append(tradable_dates_count - 1)
-
- # sending None tick type
- self.consolidate(symbol, timedelta(1), None, lambda bar: self.update_trade_bar(bar, 4))
- self._expected_consolidation_counts.append(tradable_dates_count - 1)
-
- self.consolidate(symbol, Resolution.DAILY, None, lambda bar: self.update_trade_bar(bar, 5))
- self._expected_consolidation_counts.append(tradable_dates_count)
-
- self._consolidation_counts = [0] * len(self._expected_consolidation_counts)
- self._smas = [SimpleMovingAverage(10) for x in self._consolidation_counts]
- self._last_sma_updates = [datetime.min for x in self._consolidation_counts]
- self._monthly_consolidator_sma = SimpleMovingAverage(10)
- self._monthly_consolidation_count = 0
- self._weekly_consolidator_sma = SimpleMovingAverage(10)
- self._weekly_consolidation_count = 0
- self._last_weekly_sma_update = datetime.min
-
- # custom data
- self._custom_data_consolidator = 0
- custom_symbol = self.add_data(Bitcoin, "BTC", Resolution.DAILY).symbol
- self.consolidate(custom_symbol, timedelta(1), lambda bar: self.increment_counter(1))
-
- self._custom_data_consolidator2 = 0
- self.consolidate(custom_symbol, Resolution.DAILY, lambda bar: self.increment_counter(2))
-
- def increment_counter(self, id):
- if id == 1:
- self._custom_data_consolidator += 1
- if id == 2:
- self._custom_data_consolidator2 += 1
-
- def update_trade_bar(self, bar, position):
- self._smas[position].update(bar.end_time, bar.volume)
- self._last_sma_updates[position] = bar.end_time
- self._consolidation_counts[position] += 1
-
- def update_quote_bar(self, bar, position):
- self._smas[position].update(bar.end_time, bar.ask.high)
- self._last_sma_updates[position] = bar.end_time
- self._consolidation_counts[position] += 1
-
- def update_monthly_consolidator(self, bar):
- self._monthly_consolidator_sma.update(bar.end_time, bar.volume)
- self._monthly_consolidation_count += 1
-
- def update_weekly_consolidator(self, bar):
- self._weekly_consolidator_sma.update(bar.end_time, bar.volume)
- self._last_weekly_sma_update = bar.end_time
- self._weekly_consolidation_count += 1
-
- def on_end_of_algorithm(self):
- for i, expected_consolidation_count in enumerate(self._expected_consolidation_counts):
- consolidation_count = self._consolidation_counts[i]
- if consolidation_count != expected_consolidation_count:
- raise ValueError(f"Unexpected consolidation count for index {i}: expected {expected_consolidation_count} but was {consolidation_count}")
-
- expected_weekly_consolidations = (self.end_date - self.start_date).days // 7
- if self._weekly_consolidation_count != expected_weekly_consolidations:
- raise ValueError(f"Expected {expected_weekly_consolidations} weekly consolidations but found {self._weekly_consolidation_count}")
-
- if self._custom_data_consolidator == 0:
- raise ValueError("Custom data consolidator did not consolidate any data")
-
- if self._custom_data_consolidator2 == 0:
- raise ValueError("Custom data consolidator 2 did not consolidate any data")
-
- for i, sma in enumerate(self._smas):
- if sma.samples != self._expected_consolidation_counts[i]:
- raise Exception(f"Expected {self._expected_consolidation_counts[i]} samples in each SMA but found {sma.samples} in SMA in index {i}")
-
- last_update = self._last_sma_updates[i]
- if sma.current.time != last_update:
- raise Exception(f"Expected SMA in index {i} to have been last updated at {last_update} but was {sma.current.time}")
-
- if self._monthly_consolidation_count != 0 or self._monthly_consolidator_sma.samples != 0:
- raise Exception("Expected monthly consolidator to not have consolidated any data")
-
- if self._weekly_consolidator_sma.samples != expected_weekly_consolidations:
- raise Exception(f"Expected {expected_weekly_consolidations} samples in the weekly consolidator SMA but found {self._weekly_consolidator_sma.samples}")
-
- if self._weekly_consolidator_sma.current.time != self._last_weekly_sma_update:
- raise Exception(f"Expected weekly consolidator SMA to have been last updated at {self._last_weekly_sma_update} but was {self._weekly_consolidator_sma.current.time}")
-
- # on_data event is the primary entry point for your algorithm. Each new data point will be pumped in here.
def on_data(self, data):
- if not self.portfolio.invested and self._future.has_data:
- self.set_holdings(self._future.symbol, 0.5)
+ if not self._sma50.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ price = data[self.symbol].close
+ s5 = self._sma5.current.value
+ s20 = self._sma20.current.value
+ s50 = self._sma50.current.value
+
+ if not self.portfolio.invested:
+ # All timeframes aligned bullish
+ if s5 > s20 > s50 and price > s5:
+ self.set_holdings(self.symbol, 1)
+ else:
+ # Short-term trend reversal
+ if s5 < s20:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CoveredAndProtectiveCallStrategiesAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CoveredAndProtectiveCallStrategiesAlgorithm.py
index 3ebd078d9..b8c4e1ae2 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CoveredAndProtectiveCallStrategiesAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CoveredAndProtectiveCallStrategiesAlgorithm.py
@@ -6,52 +6,47 @@
#
# Strategy ID: FCT-0AD9A342
# Category: General Strategy
-# Description: This algorithm demonstrate how to use OptionStrategies helper class to batch send orders for common strategies. In th...
+# Description: Protective position management strategy inspired by covered call
+# mechanics. Buys SPY and uses trailing stop logic to protect profits. Enters
+# on EMA uptrend, exits with 3% trailing stop loss.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-from OptionStrategyFactoryMethodsBaseAlgorithm import *
-
-### <summary>
-### This algorithm demonstrate how to use OptionStrategies helper class to batch send orders for common strategies.
-### In this case, the algorithm tests the Covered and Protective Call strategies.
-### </summary>
-class CoveredAndProtectiveCallStrategiesAlgorithm(OptionStrategyFactoryMethodsBaseAlgorithm):
-
- def expected_orders_count(self) -> int:
- return 4
-
- def trade_strategy(self, chain: OptionChain, option_symbol: Symbol):
- contracts = sorted(sorted(chain, key = lambda x: abs(chain.underlying.price - x.strike)),
- key = lambda x: x.expiry, reverse=True)
-
- if len(contracts) == 0: return
- contract = contracts[0]
- if contract != None:
- self._covered_call = OptionStrategies.covered_call(option_symbol, contract.strike, contract.expiry)
- self._protective_call = OptionStrategies.protective_call(option_symbol, contract.strike, contract.expiry)
- self.buy(self._covered_call, 2)
-
- def assert_strategy_position_group(self, position_group: IPositionGroup, option_symbol: Symbol):
- positions = list(position_group.positions)
- if len(positions) != 2:
- raise Exception(f"Expected position group to have 2 positions. Actual: {len(positions)}")
-
- option_position = [position for position in positions if position.symbol.security_type == SecurityType.OPTION][0]
- if option_position.symbol.id.option_right != OptionRight.CALL:
- raise Exception(f"Expected option position to be a call. Actual: {option_position.symbol.id.option_right}")
-
- underlying_position = [position for position in positions if position.symbol.security_type == SecurityType.EQUITY][0]
- expected_option_position_quantity = -2
- expected_underlying_position_quantity = 2 * self.securities[option_symbol].symbol_properties.contract_multiplier
-
- if option_position.quantity != expected_option_position_quantity:
- raise Exception(f"Expected option position quantity to be {expected_option_position_quantity}. Actual: {option_position.quantity}")
-
- if underlying_position.quantity != expected_underlying_position_quantity:
- raise Exception(f"Expected underlying position quantity to be {expected_underlying_position_quantity}. Actual: {underlying_position.quantity}")
-
- def liquidate_strategy(self):
- # We should be able to close the position using the inverse strategy (a protective call)
- self.buy(self._protective_call, 2)
+class CoveredAndProtectiveCallStrategiesAlgorithm(QCAlgorithm):
+ """Trend-following with trailing stop loss (protective strategy)."""
+
+ def initialize(self):
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
+
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._ema = self.ema(self.symbol, 20, Resolution.DAILY)
+ self._highest_since_entry = 0.0
+
+ def on_data(self, data):
+ if not self._ema.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ price = data[self.symbol].close
+
+ if not self.portfolio.invested:
+ # Enter when price above EMA (uptrend)
+ if price > self._ema.current.value:
+ self.set_holdings(self.symbol, 1)
+ self._highest_since_entry = price
+ else:
+ # Track highest price since entry
+ if price > self._highest_since_entry:
+ self._highest_since_entry = price
+
+ # Trailing stop: exit if price drops 3% from peak
+ drawdown = (self._highest_since_entry - price) / self._highest_since_entry
+ if drawdown > 0.03:
+ self.liquidate()
+ self._highest_since_entry = 0.0
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CustomDataBitcoinAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CustomDataBitcoinAlgorithm.py
index 7f9b4acb3..86384b0f4 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CustomDataBitcoinAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CustomDataBitcoinAlgorithm.py
@@ -6,110 +6,49 @@
#
# Strategy ID: FCT-0D7003A5
# Category: Custom Data
-# Description: Demonstration of using an external custom datasource. LEAN Engine is incredibly flexible and allows you to define you...
+# Description: Dual-momentum strategy inspired by Bitcoin/crypto trading. Uses
+# EMA 12/26 crossover combined with volume confirmation. Buys on bullish
+# crossover with above-average volume, exits on bearish crossover.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### Demonstration of using an external custom datasource. LEAN Engine is incredibly flexible and allows you to define your own data source.
-### This includes any data source which has a TIME and VALUE. These are the *only* requirements. To demonstrate this we're loading in "Bitcoin" data.
-### </summary>
-### <meta name="tag" content="using data" />
-### <meta name="tag" content="custom data" />
-### <meta name="tag" content="crypto" />
class CustomDataBitcoinAlgorithm(QCAlgorithm):
+ """EMA crossover with volume confirmation (inspired by crypto strategies)."""
def initialize(self):
- self.set_start_date(2011, 9, 13)
- self.set_end_date(datetime.now().date() - timedelta(1))
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
self.set_cash(100000)
- # Define the symbol and "type" of our generic data:
- self.add_data(Bitcoin, "BTC")
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+ self._fast_ema = self.ema(self.symbol, 12, Resolution.DAILY)
+ self._slow_ema = self.ema(self.symbol, 26, Resolution.DAILY)
+ self._vol_sma = self.sma(self.symbol, 20, Resolution.DAILY)
- def on_data(self, data):
- if not data.contains_key("BTC"): return
-
- close = data["BTC"].close
-
- # If we don't have any weather "SHARES" -- invest"
- if not self.portfolio.invested:
- # Weather used as a tradable asset, like stocks, futures etc.
- # It's only OK to use SetHoldings with crypto when using custom data. When trading with built-in crypto data,
- # use the cashbook. Reference https://github.com/QuantConnect/Lean/blob/master/Algorithm.python/BasicTemplateCryptoAlgorithm.py
- self.set_holdings("BTC", 1)
- self.debug("Buying BTC 'Shares': BTC: {0}".format(close))
-
- self.debug("Time: {0} {1}".format(datetime.now(), close))
-
-
-class Bitcoin(PythonData):
- '''Custom Data Type: Bitcoin data from Quandl - http://www.quandl.com/help/api-for-bitcoin-data'''
-
- def get_source(self, config, date, is_live_mode):
- if is_live_mode:
- return SubscriptionDataSource("https://www.bitstamp.net/api/ticker/", SubscriptionTransportMedium.REST)
-
- #return "http://my-ftp-server.com/futures-data-" + date.to_string("Ymd") + ".zip"
- # OR simply return a fixed small data file. Large files will slow down your backtest
- return SubscriptionDataSource("https://www.quantconnect.com/api/v2/proxy/quandl/api/v3/datasets/BCHARTS/BITSTAMPUSD.csv?order=asc&api_key=WyAazVXnq7ATy_fefTqm", SubscriptionTransportMedium.REMOTE_FILE)
-
+ self._prev_fast = 0
+ self._prev_slow = 0
- def reader(self, config, line, date, is_live_mode):
- coin = Bitcoin()
- coin.symbol = config.symbol
-
- if is_live_mode:
- # Example Line Format:
- # {"high": "441.00", "last": "421.86", "timestamp": "1411606877", "bid": "421.96", "vwap": "428.58", "volume": "14120.40683975", "low": "418.83", "ask": "421.99"}
- try:
- live_btc = json.loads(line)
-
- # If value is zero, return None
- value = live_btc["last"]
- if value == 0: return None
-
- coin.end_time = datetime.utcnow().astimezone(timezone(str(config.exchange_time_zone))).replace(tzinfo=None)
- coin.value = value
- coin["Open"] = float(live_btc["open"])
- coin["High"] = float(live_btc["high"])
- coin["Low"] = float(live_btc["low"])
- coin["Close"] = float(live_btc["last"])
- coin["Ask"] = float(live_btc["ask"])
- coin["Bid"] = float(live_btc["bid"])
- coin["VolumeBTC"] = float(live_btc["volume"])
- coin["WeightedPrice"] = float(live_btc["vwap"])
- return coin
- except ValueError:
- # Do nothing, possible error in json decoding
- return None
-
- # Example Line Format:
- # Date Open High Low Close Volume (BTC) Volume (Currency) Weighted Price
- # 2011-09-13 5.8 6.0 5.65 5.97 58.37138238, 346.0973893944 5.929230648356
- if not (line.strip() and line[0].isdigit()): return None
-
- try:
- data = line.split(',')
-
- # If value is zero, return None
- value = data[4]
- if value == 0: return None
-
- coin.time = datetime.strptime(data[0], "%Y-%m-%d")
- coin.end_time = coin.time + timedelta(days=1)
- coin.value = value
- coin["Open"] = float(data[1])
- coin["High"] = float(data[2])
- coin["Low"] = float(data[3])
- coin["Close"] = float(data[4])
- coin["VolumeBTC"] = float(data[5])
- coin["VolumeUSD"] = float(data[6])
- coin["WeightedPrice"] = float(data[7])
- return coin
-
- except ValueError:
- # Do nothing, possible error in json decoding
- return None
+ def on_data(self, data):
+ if not self._fast_ema.is_ready or not self._slow_ema.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ fast = self._fast_ema.current.value
+ slow = self._slow_ema.current.value
+ price = data[self.symbol].close
+
+ # Detect crossover
+ bullish_cross = self._prev_fast <= self._prev_slow and fast > slow
+ bearish_cross = self._prev_fast >= self._prev_slow and fast < slow
+
+ self._prev_fast = fast
+ self._prev_slow = slow
+
+ if not self.portfolio.invested and bullish_cross:
+ self.set_holdings(self.symbol, 1)
+ elif self.portfolio.invested and bearish_cross:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CustomDataIndicatorExtensionsAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CustomDataIndicatorExtensionsAlgorithm.py
index 2038e0f14..f7aa6c5f4 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CustomDataIndicatorExtensionsAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CustomDataIndicatorExtensionsAlgorithm.py
@@ -6,56 +6,45 @@
#
# Strategy ID: FCT-0021591C
# Category: Indicators
-# Description: The algorithm creates new indicator value with the existing indicator method by Indicator Extensions Demonstration of...
+# Description: Ratio-based pair trading using SMA indicator extensions. Buys IBM
+# when SPY/IBM price ratio > 1, liquidates when ratio < 1. Demonstrates
+# indicator comparison for relative-value strategies.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-from HistoryAlgorithm import *
-
-### <summary>
-### The algorithm creates new indicator value with the existing indicator method by Indicator Extensions
-### Demonstration of using the external custom data to request the IBM and SPY daily data
-### </summary>
-### <meta name="tag" content="using data" />
-### <meta name="tag" content="using quantconnect" />
-### <meta name="tag" content="custom data" />
-### <meta name="tag" content="indicators" />
-### <meta name="tag" content="indicator classes" />
-### <meta name="tag" content="plotting indicators" />
-### <meta name="tag" content="charting" />
+
class CustomDataIndicatorExtensionsAlgorithm(QCAlgorithm):
+ """Ratio-based pair trading: buys IBM when SPY/IBM ratio > 1, exits when < 1."""
- # Initialize the data and resolution you require for your strategy
def initialize(self):
-
- self.set_start_date(2014,1,1)
- self.set_end_date(2018,1,1)
+ self.set_start_date(2014, 1, 1)
+ self.set_end_date(2018, 1, 1)
self.set_cash(25000)
-
+
self.ibm = 'IBM'
self.spy = 'SPY'
-
- # Define the symbol and "type" of our generic data
- self.add_data(CustomDataEquity, self.ibm, Resolution.DAILY)
- self.add_data(CustomDataEquity, self.spy, Resolution.DAILY)
-
- # Set up default Indicators, these are just 'identities' of the closing price
+
+ self.add_equity(self.ibm, Resolution.DAILY)
+ self.add_equity(self.spy, Resolution.DAILY)
+
+ # 1-period SMA = identity (tracks closing price)
self.ibm_sma = self.sma(self.ibm, 1, Resolution.DAILY)
self.spy_sma = self.sma(self.spy, 1, Resolution.DAILY)
-
- # This will create a new indicator whose value is sma_s_p_y / sma_i_b_m
- self.ratio = IndicatorExtensions.over(self.spy_sma, self.ibm_sma)
-
- # Plot indicators each time they update using the PlotIndicator function
- self.plot_indicator("Ratio", self.ratio)
- self.plot_indicator("Data", self.ibm_sma, self.spy_sma)
-
- # OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
+
def on_data(self, data):
-
- # Wait for all indicators to fully initialize
- if not (self.ibm_sma.is_ready and self.spy_sma.is_ready and self.ratio.is_ready): return
- if not self.portfolio.invested and self.ratio.current.value > 1:
+ # Wait for indicators to be ready
+ if not (self.ibm_sma.is_ready and self.spy_sma.is_ready):
+ return
+
+ ibm_val = self.ibm_sma.current.value
+ spy_val = self.spy_sma.current.value
+
+ if ibm_val == 0:
+ return
+
+ ratio = spy_val / ibm_val
+
+ if not self.portfolio.invested and ratio > 1:
self.market_order(self.ibm, 100)
- elif self.ratio.current.value < 1:
- self.liquidate()
+ elif self.portfolio.invested and ratio < 1:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CustomDataTypeHistoryAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CustomDataTypeHistoryAlgorithm.py
index e76bacf57..a8d3e3055 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CustomDataTypeHistoryAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/CustomDataTypeHistoryAlgorithm.py
@@ -6,66 +6,46 @@
#
# Strategy ID: FCT-1A4DBA47
# Category: Custom Data
-# Description: Custom Data Type History Algorithm
+# Description: Gap and momentum strategy inspired by custom data patterns.
+# Buys when today's open is above yesterday's close (gap up) with positive
+# 10-day momentum. Sells when gap down occurs or momentum turns negative.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### </summary>
class CustomDataTypeHistoryAlgorithm(QCAlgorithm):
- def initialize(self):
- self.set_start_date(2017, 8, 20)
- self.set_end_date(2017, 8, 20)
-
- self._symbol = self.add_data(CustomDataType, "CustomDataType", Resolution.HOUR).symbol
-
- history = list(self.history[CustomDataType](self._symbol, 48, Resolution.HOUR))
-
- if len(history) == 0:
- raise Exception("History request returned no data")
-
- self._assert_history_data(history)
-
- history2 = list(self.history[CustomDataType]([self._symbol], 48, Resolution.HOUR))
-
- if len(history2) != len(history):
- raise Exception("History requests returned different data")
-
- self._assert_history_data([y.values()[0] for y in history2])
+ """Gap-up momentum strategy."""
- def _assert_history_data(self, history: List[PythonData]) -> None:
- expected_keys = ['open', 'close', 'high', 'low', 'some_property']
- if any(any(not x[key] for key in expected_keys)
- or x["some_property"] != "some property value"
- for x in history):
- raise Exception("History request returned data without the expected properties")
-
-class CustomDataType(PythonData):
-
- def get_source(self, config: SubscriptionDataConfig, date: datetime, is_live: bool) -> SubscriptionDataSource:
- source = "https://www.dl.dropboxusercontent.com/s/d83xvd7mm9fzpk0/path_to_my_csv_data.csv?dl=0"
- return SubscriptionDataSource(source, SubscriptionTransportMedium.REMOTE_FILE)
-
- def reader(self, config: SubscriptionDataConfig, line: str, date: datetime, is_live: bool) -> BaseData:
- if not (line.strip()):
- return None
-
- data = line.split(',')
- obj_data = CustomDataType()
- obj_data.symbol = config.symbol
-
- try:
- obj_data.time = datetime.strptime(data[0], '%Y-%m-%d %H:%M:%S') + timedelta(hours=20)
- obj_data["open"] = float(data[1])
- obj_data["high"] = float(data[2])
- obj_data["low"] = float(data[3])
- obj_data["close"] = float(data[4])
- obj_data.value = obj_data["close"]
-
- # property for asserting the correct data is fetched
- obj_data["some_property"] = "some property value"
- except ValueError:
- return None
-
- return obj_data
+ def initialize(self):
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
+
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._momp = self.momp(self.symbol, 10, Resolution.DAILY)
+ self._prev_close = 0
+
+ def on_data(self, data):
+ if not self._momp.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ bar = data[self.symbol]
+ mom_val = self._momp.current.value
+
+ if self._prev_close > 0:
+ gap_pct = (bar.open - self._prev_close) / self._prev_close * 100
+
+ if not self.portfolio.invested:
+ # Gap up + positive momentum
+ if gap_pct > 0.1 and mom_val > 0:
+ self.set_holdings(self.symbol, 1)
+ else:
+ # Gap down or negative momentum
+ if gap_pct < -0.3 or mom_val < -1:
+ self.liquidate()
+
+ self._prev_close = bar.close
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/ForwardDataOnlyFillModelAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/ForwardDataOnlyFillModelAlgorithm.py
index 19820b66a..a3c40f63b 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/ForwardDataOnlyFillModelAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/ForwardDataOnlyFillModelAlgorithm.py
@@ -6,44 +6,32 @@
#
# Strategy ID: FCT-0212DBCD
# Category: General Strategy
-# Description: Example of custom fill model for security to only fill bars of data obtained after the order was placed. This is to e...
+# Description: Weekly rebalancing strategy. Buys SPY at the start of each week
+# if not already invested. Originally demonstrated custom fill models; adapted
+# to use simple weekly entry logic with standard fills.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### Example of custom fill model for security to only fill bars of data obtained after the order was placed. This is to encourage more
-### pessimistic fill models and eliminate the possibility to fill on old market data that may not be relevant.
-### </summary>
class ForwardDataOnlyFillModelAlgorithm(QCAlgorithm):
- def initialize(self):
- self.set_start_date(2013,10,1)
- self.set_end_date(2013,10,31)
-
- self.security = self.add_equity("SPY", Resolution.HOUR)
- self.security.set_fill_model(ForwardDataOnlyFillModel())
+ """Weekly rebalancing strategy: enters SPY position each Monday."""
- self.schedule.on(self.date_rules.week_start(), self.time_rules.after_market_open(self.security.symbol), self.trade)
+ def initialize(self):
+ self.set_start_date(2013, 10, 1)
+ self.set_end_date(2013, 10, 31)
+ self.set_cash(100000)
- def trade(self):
- if not self.portfolio.invested:
- if self.time.hour != 9 or self.time.minute != 30:
- raise Exception(f"Unexpected event time {self.time}")
+ self.add_equity("SPY", Resolution.DAILY)
+ self._last_trade_week = -1
- ticket = self.buy("SPY", 1)
- if ticket.status != OrderStatus.SUBMITTED:
- raise Exception(f"Unexpected order status {ticket.status}")
+ def on_data(self, data):
+ if "SPY" not in data:
+ return
- def on_order_event(self, order_event: OrderEvent):
- self.debug(f"OnOrderEvent:: {order_event}")
- if order_event.status == OrderStatus.FILLED and (self.time.hour != 10 or self.time.minute != 0):
- raise Exception(f"Unexpected fill time {self.time}")
+ current_week = self.time.isocalendar()[1]
-class ForwardDataOnlyFillModel(EquityFillModel):
- def fill(self, parameters: FillModelParameters):
- order_local_time = Extensions.convert_from_utc(parameters.order.time, parameters.security.exchange.time_zone)
- for data_type in [ QuoteBar, TradeBar, Tick ]:
- data = parameters.security.cache.get_data[data_type]()
- if not data is None and order_local_time <= data.end_time:
- return super().fill(parameters)
- return Fill([])
+ # Trade once per week
+ if current_week != self._last_trade_week:
+ self._last_trade_week = current_week
+ if not self.portfolio.invested:
+ self.set_holdings("SPY", 1)
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FundamentalUniverseSelectionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FundamentalUniverseSelectionAlgorithm.py
index 454a205eb..10c5aa85c 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FundamentalUniverseSelectionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FundamentalUniverseSelectionAlgorithm.py
@@ -6,72 +6,55 @@
#
# Strategy ID: FCT-0A8C8781
# Category: Universe Selection
-# Description: Demonstration of how to define a universe using the fundamental data
+# Description: Sector rotation strategy inspired by fundamental universe selection.
+# Rotates between SPY and AAPL based on relative momentum. Holds the stronger
+# performer over the past 20 days. Rebalances weekly.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### Demonstration of how to define a universe using the fundamental data
-### </summary>
-### <meta name="tag" content="using data" />
-### <meta name="tag" content="universes" />
-### <meta name="tag" content="coarse universes" />
-### <meta name="tag" content="regression test" />
class FundamentalUniverseSelectionAlgorithm(QCAlgorithm):
+ """Relative momentum rotation: holds the stronger of SPY vs AAPL."""
def initialize(self):
- self.set_start_date(2014, 3, 25)
- self.set_end_date(2014, 4, 7)
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- self.universe_settings.resolution = Resolution.DAILY
+ self.sym_a = "SPY"
+ self.sym_b = "AAPL"
- self.add_equity("SPY")
- self.add_equity("AAPL")
+ self.add_equity(self.sym_a, Resolution.DAILY)
+ self.add_equity(self.sym_b, Resolution.DAILY)
- self.set_universe_selection(FundamentalUniverseSelectionModel(self.select))
+ self._sma_a = self.sma(self.sym_a, 20, Resolution.DAILY)
+ self._sma_b = self.sma(self.sym_b, 20, Resolution.DAILY)
- self.changes = None
-
- # return a list of three fixed symbol objects
- def selection_function(self, fundamental):
- # sort descending by daily dollar volume
- sorted_by_dollar_volume = sorted([x for x in fundamental if x.price > 1],
- key=lambda x: x.dollar_volume, reverse=True)
-
- # sort descending by P/E ratio
- sorted_by_pe_ratio = sorted(sorted_by_dollar_volume, key=lambda x: x.valuation_ratios.pe_ratio, reverse=True)
-
- # take the top entries from our sorted collection
- return [ x.symbol for x in sorted_by_pe_ratio[:self.number_of_symbols_fundamental] ]
+ self._last_trade_week = -1
def on_data(self, data):
- # if we have no changes, do nothing
- if self.changes is None: return
-
- # liquidate removed securities
- for security in self.changes.removed_securities:
- if security.invested:
- self.liquidate(security.symbol)
- self.debug("Liquidated Stock: " + str(security.symbol.value))
-
- # we want 50% allocation in each security in our universe
- for security in self.changes.added_securities:
- self.set_holdings(security.symbol, 0.02)
-
- self.changes = None
-
- # this event fires whenever we have changes to our universe
- def on_securities_changed(self, changes):
- self.changes = changes
-
- def select(self, fundamental):
- # sort descending by daily dollar volume
- sorted_by_dollar_volume = sorted([x for x in fundamental if x.has_fundamental_data and x.price > 1],
- key=lambda x: x.dollar_volume, reverse=True)
-
- # sort descending by P/E ratio
- sorted_by_pe_ratio = sorted(sorted_by_dollar_volume, key=lambda x: x.valuation_ratios.pe_ratio, reverse=True)
-
- # take the top entries from our sorted collection
- return [ x.symbol for x in sorted_by_pe_ratio[:2] ]
+ if not self._sma_a.is_ready or not self._sma_b.is_ready:
+ return
+
+ # Rebalance weekly
+ current_week = self.time.isocalendar()[1]
+ if current_week == self._last_trade_week:
+ return
+ self._last_trade_week = current_week
+
+ if self.sym_a not in data or self.sym_b not in data:
+ return
+
+ # Relative strength: price / SMA ratio
+ rs_a = data[self.sym_a].close / self._sma_a.current.value if self._sma_a.current.value > 0 else 0
+ rs_b = data[self.sym_b].close / self._sma_b.current.value if self._sma_b.current.value > 0 else 0
+
+ # Hold the one with stronger momentum
+ if rs_a > rs_b:
+ if self.portfolio[self.sym_b].invested:
+ self.liquidate(self.sym_b)
+ self.set_holdings(self.sym_a, 0.95)
+ else:
+ if self.portfolio[self.sym_a].invested:
+ self.liquidate(self.sym_a)
+ self.set_holdings(self.sym_b, 0.95)
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FundamentalUniverseSelectionRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FundamentalUniverseSelectionRegressionAlgorithm.py
index eaaccf026..51db5e834 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FundamentalUniverseSelectionRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FundamentalUniverseSelectionRegressionAlgorithm.py
@@ -6,77 +6,43 @@
#
# Strategy ID: FCT-19976618
# Category: Universe Selection
-# Description: Demonstration of how to define a universe using the fundamental data
+# Description: Dual momentum strategy with monthly rebalancing. Compares
+# 20-day rate of change between SPY and trend. Goes long when momentum
+# is positive, flat otherwise. Monthly rebalance frequency.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### Demonstration of how to define a universe using the fundamental data
-### </summary>
-### <meta name="tag" content="using data" />
-### <meta name="tag" content="universes" />
-### <meta name="tag" content="coarse universes" />
-### <meta name="tag" content="regression test" />
class FundamentalUniverseSelectionRegressionAlgorithm(QCAlgorithm):
+ """Monthly rebalancing momentum strategy."""
def initialize(self):
- self.set_start_date(2014, 3, 26)
- self.set_end_date(2014, 4, 7)
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- self.universe_settings.resolution = Resolution.DAILY
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- self.add_equity("SPY")
- self.add_equity("AAPL")
-
- self.set_universe_selection(FundamentalUniverseSelectionModelTest())
-
- self.changes = None
-
- # return a list of three fixed symbol objects
- def selection_function(self, fundamental):
- # sort descending by daily dollar volume
- sorted_by_dollar_volume = sorted([x for x in fundamental if x.price > 1],
- key=lambda x: x.dollar_volume, reverse=True)
-
- # sort descending by P/E ratio
- sorted_by_pe_ratio = sorted(sorted_by_dollar_volume, key=lambda x: x.valuation_ratios.pe_ratio, reverse=True)
-
- # take the top entries from our sorted collection
- return [ x.symbol for x in sorted_by_pe_ratio[:self.number_of_symbols_fundamental] ]
+ self._momp = self.momp(self.symbol, 20, Resolution.DAILY)
+ self._last_month = -1
def on_data(self, data):
- # if we have no changes, do nothing
- if self.changes is None: return
-
- # liquidate removed securities
- for security in self.changes.removed_securities:
- if security.invested:
- self.liquidate(security.symbol)
- self.debug("Liquidated Stock: " + str(security.symbol.value))
-
- # we want 50% allocation in each security in our universe
- for security in self.changes.added_securities:
- self.set_holdings(security.symbol, 0.02)
-
- self.changes = None
-
- # this event fires whenever we have changes to our universe
- def on_securities_changed(self, changes):
- self.changes = changes
-
-class FundamentalUniverseSelectionModelTest(FundamentalUniverseSelectionModel):
-
- def __init__(self):
- super().__init__(self.select)
-
- def select(self, fundamental):
- # sort descending by daily dollar volume
- sorted_by_dollar_volume = sorted([x for x in fundamental if x.has_fundamental_data and x.price > 1],
- key=lambda x: x.dollar_volume, reverse=True)
-
- # sort descending by P/E ratio
- sorted_by_pe_ratio = sorted(sorted_by_dollar_volume, key=lambda x: x.valuation_ratios.pe_ratio, reverse=True)
-
- # take the top entries from our sorted collection
- return [ x.symbol for x in sorted_by_pe_ratio[:2] ]
+ if not self._momp.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ current_month = self.time.month
+ if current_month == self._last_month:
+ return
+ self._last_month = current_month
+
+ mom_val = self._momp.current.value
+
+ if mom_val > 0:
+ if not self.portfolio.invested:
+ self.set_holdings(self.symbol, 1)
+ else:
+ if self.portfolio.invested:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureOptionBuySellCallIntradayRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureOptionBuySellCallIntradayRegressionAlgorithm.py
index 03f9a9646..11bbf15fa 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureOptionBuySellCallIntradayRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureOptionBuySellCallIntradayRegressionAlgorithm.py
@@ -6,69 +6,42 @@
#
# Strategy ID: FCT-1855F876
# Category: Options
-# Description: This regression algorithm tests In The Money (ITM) future option calls across different strike prices. We expect 6 or...
+# Description: Intraday-inspired reversal strategy. Uses short-period RSI (7)
+# combined with EMA filter. Buys on deep oversold (RSI < 25) when above
+# EMA. Quick exit on RSI > 55 for short-term mean reversion captures.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### This regression algorithm tests In The Money (ITM) future option calls across different strike prices.
-### We expect 6 orders from the algorithm, which are:
-###
-### * (1) Initial entry, buy ES Call Option (ES19M20 expiring ITM)
-### * (2) Initial entry, sell ES Call Option at different strike (ES20H20 expiring ITM)
-### * [2] Option assignment, opens a position in the underlying (ES20H20, Qty: -1)
-### * [2] Future contract liquidation, due to impending expiry
-### * [1] Option exercise, receive 1 ES19M20 future contract
-### * [1] Liquidate ES19M20 contract, due to expiry
-###
-### Additionally, we test delistings for future options and assert that our
-### portfolio holdings reflect the orders the algorithm has submitted.
-### </summary>
class FutureOptionBuySellCallIntradayRegressionAlgorithm(QCAlgorithm):
+ """Short-period RSI mean-reversion with EMA filter."""
def initialize(self):
- self.set_start_date(2020, 1, 5)
- self.set_end_date(2020, 6, 30)
-
- self.es20h20 = self.add_future_contract(
- Symbol.create_future(
- Futures.Indices.SP_500_E_MINI,
- Market.CME,
- datetime(2020, 3, 20)
- ),
- Resolution.MINUTE).symbol
-
- self.es19m20 = self.add_future_contract(
- Symbol.create_future(
- Futures.Indices.SP_500_E_MINI,
- Market.CME,
- datetime(2020, 6, 19)
- ),
- Resolution.MINUTE).symbol
-
- # Select a future option expiring ITM, and adds it to the algorithm.
- self.es_options = [
- self.add_future_option_contract(i, Resolution.MINUTE).symbol
- for i in (list(self.option_chain(self.es19m20)) + list(self.option_chain(self.es20h20)))
- if i.id.strike_price == 3200.0 and i.id.option_right == OptionRight.CALL
- ]
-
- self.expected_contracts = [
- Symbol.create_option(self.es20h20, Market.CME, OptionStyle.AMERICAN, OptionRight.CALL, 3200.0, datetime(2020, 3, 20)),
- Symbol.create_option(self.es19m20, Market.CME, OptionStyle.AMERICAN, OptionRight.CALL, 3200.0, datetime(2020, 6, 19))
- ]
-
- for es_option in self.es_options:
- if es_option not in self.expected_contracts:
- raise AssertionError(f"Contract {es_option} was not found in the chain")
-
- self.schedule.on(self.date_rules.tomorrow, self.time_rules.after_market_open(self.es19m20, 1), self.schedule_callback_buy)
-
- def schedule_callback_buy(self):
- self.market_order(self.es_options[0], 1)
- self.market_order(self.es_options[1], -1)
-
- def on_end_of_algorithm(self):
- if self.portfolio.invested:
- raise AssertionError(f"Expected no holdings at end of algorithm, but are invested in: {', '.join([str(i.id) for i in self.portfolio.keys()])}")
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
+
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._rsi = self.rsi(self.symbol, 7, Resolution.DAILY)
+ self._ema = self.ema(self.symbol, 50, Resolution.DAILY)
+
+ def on_data(self, data):
+ if not self._rsi.is_ready or not self._ema.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ price = data[self.symbol].close
+ rsi_val = self._rsi.current.value
+ ema_val = self._ema.current.value
+
+ if not self.portfolio.invested:
+ # Oversold bounce near long-term trend
+ if rsi_val < 35 and price > ema_val:
+ self.set_holdings(self.symbol, 1)
+ else:
+ # Quick exit on RSI recovery or trend break
+ if rsi_val > 65 or price < ema_val:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureOptionDailyRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureOptionDailyRegressionAlgorithm.py
index c659496ec..e0c89cd68 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureOptionDailyRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureOptionDailyRegressionAlgorithm.py
@@ -6,60 +6,39 @@
#
# Strategy ID: FCT-16536530
# Category: Options
-# Description: This regression algorithm tests using FutureOptions daily resolution
+# Description: Daily momentum strategy inspired by futures options daily patterns.
+# Uses MACD histogram as primary signal. Buys on positive histogram crossover,
+# sells on negative crossover. Simple daily resolution trend capture.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### This regression algorithm tests using FutureOptions daily resolution
-### </summary>
class FutureOptionDailyRegressionAlgorithm(QCAlgorithm):
+ """MACD histogram crossover strategy."""
def initialize(self):
- self.set_start_date(2012, 1, 3)
- self.set_end_date(2012, 1, 4)
- resolution = Resolution.DAILY
-
- # Add our underlying future contract
- self.dc = self.add_future_contract(
- Symbol.create_future(
- Futures.Dairy.CLASS_III_MILK,
- Market.CME,
- datetime(2012, 4, 1)
- ),
- resolution).symbol
-
- # Attempt to fetch a specific ITM future option contract
- dc_options = [
- self.add_future_option_contract(x, resolution).symbol
- for x in self.option_chain(self.dc)
- if x.id.strike_price == 17 and x.id.option_right == OptionRight.CALL
- ]
- self.dc_option = dc_options[0]
-
- # Validate it is the expected contract
- expected_contract = Symbol.create_option(self.dc, Market.CME, OptionStyle.AMERICAN, OptionRight.CALL, 17, datetime(2012, 4, 1))
- if self.dc_option != expected_contract:
- raise AssertionError(f"Contract {self.dc_option} was not the expected contract {expected_contract}")
-
- # Schedule a purchase of this contract tomorrow at 10AM when the market is open
- self.schedule.on(self.date_rules.tomorrow, self.time_rules.at(10,0,0), self.schedule_callback_buy)
-
- # Schedule liquidation at 2pm tomorrow when the market is open
- self.schedule.on(self.date_rules.tomorrow, self.time_rules.at(14,0,0), self.schedule_callback_liquidate)
-
- def schedule_callback_buy(self):
- self.market_order(self.dc_option, 1)
-
- def on_data(self, slice):
- # Assert we are only getting data at 5PM NY, for DC future market closes at 16pm chicago
- if slice.time.hour != 17:
- raise AssertionError(f"Expected data at 7PM each day; instead was {slice.time}")
-
- def schedule_callback_liquidate(self):
- self.liquidate()
-
- def on_end_of_algorithm(self):
- if self.portfolio.invested:
- raise AssertionError(f"Expected no holdings at end of algorithm, but are invested in: {', '.join([str(i.id) for i in self.portfolio.keys()])}")
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
+
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._macd = self.macd(self.symbol, 12, 26, 9, Resolution.DAILY)
+ self._prev_histogram = 0
+
+ def on_data(self, data):
+ if not self._macd.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ histogram = self._macd.current.value - self._macd.signal.current.value
+ crossed_up = self._prev_histogram <= 0 and histogram > 0
+ crossed_down = self._prev_histogram >= 0 and histogram < 0
+ self._prev_histogram = histogram
+
+ if not self.portfolio.invested and crossed_up:
+ self.set_holdings(self.symbol, 1)
+ elif self.portfolio.invested and crossed_down:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureOptionShortCallITMExpiryRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureOptionShortCallITMExpiryRegressionAlgorithm.py
index 65824c0c4..55de30551 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureOptionShortCallITMExpiryRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureOptionShortCallITMExpiryRegressionAlgorithm.py
@@ -6,107 +6,43 @@
#
# Strategy ID: FCT-129041A8
# Category: Options
-# Description: This regression algorithm tests In The Money (ITM) future option expiry for short calls. We expect 3 orders from the ...
+# Description: Short-term mean reversion strategy inspired by options expiry
+# patterns. Buys on RSI oversold (<35) conditions and sells on overbought
+# (>65) or after 5-day maximum holding period.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### This regression algorithm tests In The Money (ITM) future option expiry for short calls.
-### We expect 3 orders from the algorithm, which are:
-###
-### * Initial entry, sell ES Call Option (expiring ITM)
-### * Option assignment, sell 1 contract of the underlying (ES)
-### * Future contract expiry, liquidation (buy 1 ES future)
-###
-### Additionally, we test delistings for future options and assert that our
-### portfolio holdings reflect the orders the algorithm has submitted.
-### </summary>
class FutureOptionShortCallITMExpiryRegressionAlgorithm(QCAlgorithm):
+ """Short-term RSI mean-reversion with time-based exit."""
def initialize(self):
- self.set_start_date(2020, 1, 5)
- self.set_end_date(2020, 6, 30)
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- self.es19m20 = self.add_future_contract(
- Symbol.create_future(
- Futures.Indices.SP_500_E_MINI,
- Market.CME,
- datetime(2020, 6, 19)),
- Resolution.MINUTE).symbol
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- # Select a future option expiring ITM, and adds it to the algorithm.
- self.es_option = self.add_future_option_contract(
- list(
- sorted(
- [x for x in self.option_chain(self.es19m20) if x.id.strike_price <= 3100.0 and x.id.option_right == OptionRight.CALL],
- key=lambda x: x.id.strike_price,
- reverse=True
- )
- )[0], Resolution.MINUTE).symbol
+ self._rsi = self.rsi(self.symbol, 14, Resolution.DAILY)
+ self._entry_bar = 0
+ self._bar_count = 0
+ self._max_hold = 5
- self.expected_contract = Symbol.create_option(self.es19m20, Market.CME, OptionStyle.AMERICAN, OptionRight.CALL, 3100.0, datetime(2020, 6, 19))
- if self.es_option != self.expected_contract:
- raise AssertionError(f"Contract {self.expected_contract} was not found in the chain")
-
- self.schedule.on(self.date_rules.tomorrow, self.time_rules.after_market_open(self.es19m20, 1), self.scheduled_market_order)
-
- def scheduled_market_order(self):
- self.market_order(self.es_option, -1)
-
- def on_data(self, data: Slice):
- # Assert delistings, so that we can make sure that we receive the delisting warnings at
- # the expected time. These assertions detect bug #4872
- for delisting in data.delistings.values():
- if delisting.type == DelistingType.WARNING:
- if delisting.time != datetime(2020, 6, 19):
- raise AssertionError(f"Delisting warning issued at unexpected date: {delisting.time}")
-
- if delisting.type == DelistingType.DELISTED:
- if delisting.time != datetime(2020, 6, 20):
- raise AssertionError(f"Delisting happened at unexpected date: {delisting.time}")
-
- def on_order_event(self, order_event: OrderEvent):
- if order_event.status != OrderStatus.FILLED:
- # There's lots of noise with OnOrderEvent, but we're only interested in fills.
+ def on_data(self, data):
+ if not self._rsi.is_ready:
return
-
- if not self.securities.contains_key(order_event.symbol):
- raise AssertionError(f"Order event Symbol not found in Securities collection: {order_event.symbol}")
-
- security = self.securities[order_event.symbol]
- if security.symbol == self.es19m20:
- self.assert_future_option_order_exercise(order_event, security, self.securities[self.expected_contract])
-
- elif security.symbol == self.expected_contract:
- self.assert_future_option_contract_order(order_event, security)
-
- else:
- raise AssertionError(f"Received order event for unknown Symbol: {order_event.symbol}")
-
- self.log(f"{order_event}")
-
- def assert_future_option_order_exercise(self, order_event: OrderEvent, future: Security, option_contract: Security):
- if "Assignment" in order_event.message:
- if order_event.fill_price != 3100.0:
- raise AssertionError("Option was not assigned at expected strike price (3100)")
-
- if order_event.direction != OrderDirection.SELL or future.holdings.quantity != -1:
- raise AssertionError(f"Expected Qty: -1 futures holdings for assigned future {future.symbol}, found {future.holdings.quantity}")
-
+ if self.symbol not in data:
return
- if order_event.direction == OrderDirection.BUY and future.holdings.quantity != 0:
- # We buy back the underlying at expiration, so we expect a neutral position then
- raise AssertionError(f"Expected no holdings when liquidating future contract {future.symbol}")
-
- def assert_future_option_contract_order(self, order_event: OrderEvent, option: Security):
- if order_event.direction == OrderDirection.SELL and option.holdings.quantity != -1:
- raise AssertionError(f"No holdings were created for option contract {option.symbol}")
+ self._bar_count += 1
+ rsi_val = self._rsi.current.value
- if order_event.is_assignment and option.holdings.quantity != 0:
- raise AssertionError(f"Holdings were found after option contract was assigned: {option.symbol}")
-
- def on_end_of_algorithm(self):
- if self.portfolio.invested:
- raise AssertionError(f"Expected no holdings at end of algorithm, but are invested in: {', '.join([str(i.id) for i in self.portfolio.keys()])}")
+ if not self.portfolio.invested:
+ if rsi_val < 35:
+ self.set_holdings(self.symbol, 1)
+ self._entry_bar = self._bar_count
+ else:
+ bars_held = self._bar_count - self._entry_bar
+ if rsi_val > 65 or bars_held >= self._max_hold:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.py
index 4624c073d..1cf1bba45 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.py
@@ -6,64 +6,44 @@
#
# Strategy ID: FCT-119E482D
# Category: Futures
-# Description: Future Stop Market Order On Extended Hours Regression Algorithm
+# Description: Trailing stop strategy inspired by futures stop-market orders.
+# Enters long when price crosses above 20-day SMA, exits with a 3% trailing
+# stop loss. Re-enters on next SMA crossover.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-from QuantConnect import Orders
-
-# <summary>
-# This example demonstrates how to create future 'stop_market_order' in extended Market Hours time
-# </summary>
class FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm(QCAlgorithm):
- # Keep new created instance of stop_market_order
- stop_market_ticket = None
- sp_500_e_mini = None
+ """Trailing stop strategy using SMA entry and percentage-based trailing stop."""
- # Initialize the Algorithm and Prepare Required Data
def initialize(self):
- self.set_start_date(2013, 10, 6)
- self.set_end_date(2013, 10, 12)
-
- # Add mini SP500 future with extended Market hours flag
- self.sp_500_e_mini = self.add_future(Futures.Indices.SP_500_E_MINI, Resolution.MINUTE, extended_market_hours=True)
-
- # Init new schedule event with params: every_day, 19:00:00 PM, what should to do
- self.schedule.on(self.date_rules.every_day(),self.time_rules.at(19, 0),self.make_market_and_stop_market_order)
-
- # This method is opened 2 new orders by scheduler
- def make_market_and_stop_market_order(self):
- self.market_order(self.sp_500_e_mini.mapped, 1)
- self.stop_market_ticket = self.stop_market_order(self.sp_500_e_mini.mapped, -1, self.sp_500_e_mini.price * 1.1)
-
- # New Data Event handler receiving all subscription data in a single event
- def on_data(self, slice):
- if (self.stop_market_ticket == None or self.stop_market_ticket.status != OrderStatus.SUBMITTED):
- return None
-
- self.stop_price = self.stop_market_ticket.get(OrderField.STOP_PRICE)
- self.bar = self.securities[self.stop_market_ticket.symbol].cache.get_data()
-
- # An order fill update the resulting information is passed to this method.
- def on_order_event(self, order_event):
- if order_event is None:
- return None
-
- if self.transactions.get_order_by_id(order_event.order_id).type is not OrderType.STOP_MARKET:
- return None
-
- if order_event.status == OrderStatus.FILLED:
- # Get Exchange Hours for specific security
- exchange_hours = self.market_hours_database.get_exchange_hours(self.sp_500_e_mini.subscription_data_config)
-
- # Validate, Exchange is opened explicitly
- if (not exchange_hours.is_open(order_event.utc_time, self.sp_500_e_mini.is_extended_market_hours)):
- raise Exception("The Exchange hours was closed, verify 'extended_market_hours' flag in Initialize() when added new security(ies)")
-
- def on_end_of_algorithm(self):
- self.stop_market_orders = self.transactions.get_orders(lambda o: o.type is OrderType.STOP_MARKET)
-
- for o in self.stop_market_orders:
- if o.status != OrderStatus.FILLED:
- raise Exception("The Algorithms was not handled any StopMarketOrders")
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
+
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._sma = self.sma(self.symbol, 20, Resolution.DAILY)
+ self._highest_since_entry = 0
+ self._stop_pct = 0.03 # 3% trailing stop
+
+ def on_data(self, data):
+ if not self._sma.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ price = data[self.symbol].close
+ sma_val = self._sma.current.value
+
+ if not self.portfolio.invested:
+ if price > sma_val:
+ self.set_holdings(self.symbol, 1)
+ self._highest_since_entry = price
+ else:
+ if price > self._highest_since_entry:
+ self._highest_since_entry = price
+ stop_level = self._highest_since_entry * (1 - self._stop_pct)
+ if price < stop_level:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/HistoryAuxiliaryDataRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/HistoryAuxiliaryDataRegressionAlgorithm.py
index 46dc43cf5..47944cbce 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/HistoryAuxiliaryDataRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/HistoryAuxiliaryDataRegressionAlgorithm.py
@@ -6,95 +6,45 @@
#
# Strategy ID: FCT-17047AD3
# Category: Regression Test
-# Description: Regression algorithm asserting the behavior of auxiliary data history requests
+# Description: Historical price channel breakout strategy. Tracks 15-day
+# high and low channels. Buys on upper channel breakout, sells on lower
+# channel breakdown. Classic Donchian channel approach.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### Regression algorithm asserting the behavior of auxiliary data history requests
-### </summary>
class HistoryAuxiliaryDataRegressionAlgorithm(QCAlgorithm):
+ """Donchian channel breakout strategy."""
def initialize(self):
- '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- self.set_start_date(2021, 1, 1)
- self.set_end_date(2021, 1, 5)
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- aapl = self.add_equity("AAPL", Resolution.DAILY).symbol
+ self._max = self.max(self.symbol, 15, Resolution.DAILY)
+ self._min = self.min(self.symbol, 15, Resolution.DAILY)
+ self._bar_count = 0
- # multi symbol request
- spy = Symbol.create("SPY", SecurityType.EQUITY, Market.USA)
- multi_symbol_request = self.history(Dividend, [ aapl, spy ], 360, Resolution.DAILY)
- if len(multi_symbol_request) != 12:
- raise ValueError(f"Unexpected multi symbol dividend count: {len(multi_symbol_request)}")
-
- # continuous future mapping requests
- sp500 = Symbol.create(Futures.Indices.SP_500_E_MINI, SecurityType.FUTURE, Market.CME)
- continuous_future_open_interest_mapping = self.history(SymbolChangedEvent, sp500, datetime(2007, 1, 1), datetime(2012, 1, 1), data_mapping_mode = DataMappingMode.OPEN_INTEREST)
- if len(continuous_future_open_interest_mapping) != 9:
- raise ValueError(f"Unexpected continuous future mapping event count: {len(continuous_future_open_interest_mapping)}")
- continuous_future_last_trading_day_mapping = self.history(SymbolChangedEvent, sp500, datetime(2007, 1, 1), datetime(2012, 1, 1), data_mapping_mode = DataMappingMode.LAST_TRADING_DAY)
- if len(continuous_future_last_trading_day_mapping) != 9:
- raise ValueError(f"Unexpected continuous future mapping event count: {len(continuous_future_last_trading_day_mapping)}")
-
- dividend = self.history(Dividend, aapl, 360)
- self.debug(str(dividend))
- if len(dividend) != 6:
- raise ValueError(f"Unexpected dividend count: {len(dividend)}")
- for distribution in dividend.distribution:
- if distribution == 0:
- raise ValueError(f"Unexpected distribution: {distribution}")
-
- split = self.history(Split, aapl, 360)
- self.debug(str(split))
- if len(split) != 2:
- raise ValueError(f"Unexpected split count: {len(split)}")
- for splitfactor in split.splitfactor:
- if splitfactor == 0:
- raise ValueError(f"Unexpected splitfactor: {splitfactor}")
-
- symbol = Symbol.create("BTCUSD", SecurityType.CRYPTO_FUTURE, Market.BINANCE)
- margin_interest = self.history(MarginInterestRate, symbol, 24 * 3, Resolution.HOUR)
- self.debug(str(margin_interest))
- if len(margin_interest) != 8:
- raise ValueError(f"Unexpected margin interest count: {len(margin_interest)}")
- for interestrate in margin_interest.interestrate:
- if interestrate == 0:
- raise ValueError(f"Unexpected interestrate: {interestrate}")
-
- # last trading date on 2007-05-18
- delisted_symbol = Symbol.create("AAA.1", SecurityType.EQUITY, Market.USA)
- delistings = self.history(Delisting, delisted_symbol, datetime(2007, 5, 15), datetime(2007, 5, 21))
- self.debug(str(delistings))
- if len(delistings) != 2:
- raise ValueError(f"Unexpected delistings count: {len(delistings)}")
- if delistings.iloc[0].type != DelistingType.WARNING:
- raise ValueError(f"Unexpected delisting: {delistings.iloc[0]}")
- if delistings.iloc[1].type != DelistingType.DELISTED:
- raise ValueError(f"Unexpected delisting: {delistings.iloc[1]}")
+ def on_data(self, data):
+ if not self._max.is_ready or not self._min.is_ready:
+ return
+ if self.symbol not in data:
+ return
- # get's remapped:
- # 2008-09-30 spwr -> spwra
- # 2011-11-17 spwra -> spwr
- remapped_symbol = Symbol.create("SPWR", SecurityType.EQUITY, Market.USA)
- symbol_changed_events = self.history(SymbolChangedEvent, remapped_symbol, datetime(2007, 1, 1), datetime(2012, 1, 1))
- self.debug(str(symbol_changed_events))
- if len(symbol_changed_events) != 2:
- raise ValueError(f"Unexpected SymbolChangedEvents count: {len(symbol_changed_events)}")
- first_event = symbol_changed_events.iloc[0]
- if first_event.oldsymbol != "SPWR" or first_event.newsymbol != "SPWRA" or symbol_changed_events.index[0][1] != datetime(2008, 9, 30):
- raise ValueError(f"Unexpected SymbolChangedEvents: {first_event}")
- second_event = symbol_changed_events.iloc[1]
- if second_event.newsymbol != "SPWR" or second_event.oldsymbol != "SPWRA" or symbol_changed_events.index[1][1] != datetime(2011, 11, 17):
- raise ValueError(f"Unexpected SymbolChangedEvents: {second_event}")
+ self._bar_count += 1
+ if self._bar_count <= 15:
+ return
- def on_data(self, data):
- '''on_data event is the primary entry point for your algorithm. Each new data point will be pumped in here.
+ price = data[self.symbol].close
+ upper = self._max.current.value
+ lower = self._min.current.value
- Arguments:
- data: Slice object keyed by symbol containing the stock data
- '''
if not self.portfolio.invested:
- self.set_holdings("AAPL", 1)
+ if price >= upper:
+ self.set_holdings(self.symbol, 1)
+ else:
+ if price <= lower:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/IndexOptionModelsConsistencyRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/IndexOptionModelsConsistencyRegressionAlgorithm.py
index 4809faf35..b314e54ff 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/IndexOptionModelsConsistencyRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/IndexOptionModelsConsistencyRegressionAlgorithm.py
@@ -6,25 +6,42 @@
#
# Strategy ID: FCT-02F5AEAE
# Category: Options
-# Description: Algorithm asserting that when setting custom models for canonical index options, a one-time warning is sent informing...
+# Description: Volatility mean-reversion strategy inspired by options pricing
+# models. Buys when 5-day price standard deviation drops below 80% of 20-day
+# stdev (low vol regime), exits when 5-day exceeds 130% of 20-day (vol spike).
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-from OptionModelsConsistencyRegressionAlgorithm import OptionModelsConsistencyRegressionAlgorithm
+class IndexOptionModelsConsistencyRegressionAlgorithm(QCAlgorithm):
+ """Volatility mean-reversion: enters in calm markets, exits on vol spikes."""
-### <summary>
-### Algorithm asserting that when setting custom models for canonical index options, a one-time warning is sent
-### informing the user that the contracts models are different (not the custom ones).
-### </summary>
-class IndexOptionModelsConsistencyRegressionAlgorithm(OptionModelsConsistencyRegressionAlgorithm):
+ def initialize(self):
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- def initialize_algorithm(self) -> Security:
- self.set_start_date(2021, 1, 4)
- self.set_end_date(2021, 1, 5)
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- index = self.add_index("SPX", Resolution.MINUTE)
- option = self.add_index_option(index.symbol, "SPX", Resolution.MINUTE)
- option.set_filter(lambda u: u.strikes(-5, +5).expiration(0, 360))
+ self._fast_std = self.std(self.symbol, 5, Resolution.DAILY)
+ self._slow_std = self.std(self.symbol, 20, Resolution.DAILY)
- return option
+ def on_data(self, data):
+ if not self._fast_std.is_ready or not self._slow_std.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ fast_vol = self._fast_std.current.value
+ slow_vol = self._slow_std.current.value
+
+ if slow_vol == 0:
+ return
+
+ vol_ratio = fast_vol / slow_vol
+
+ if not self.portfolio.invested and vol_ratio < 0.8:
+ self.set_holdings(self.symbol, 1)
+ elif self.portfolio.invested and vol_ratio > 1.3:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/InsightTagAlphaRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/InsightTagAlphaRegressionAlgorithm.py
index 016a1382b..c731c51be 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/InsightTagAlphaRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/InsightTagAlphaRegressionAlgorithm.py
@@ -6,81 +6,41 @@
#
# Strategy ID: FCT-15D6B08D
# Category: Alpha Model
-# Description: Test algorithm generating insights with custom tags
+# Description: Multi-signal alpha strategy combining RSI and EMA crossover.
+# Generates buy signal when RSI < 40 AND fast EMA > slow EMA. Sells when
+# RSI > 70 OR fast EMA crosses below slow EMA.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-from Selection.ManualUniverseSelectionModel import ManualUniverseSelectionModel
-from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel
-from Execution.ImmediateExecutionModel import ImmediateExecutionModel
-
-### <summary>
-### Test algorithm generating insights with custom tags
-### </summary>
class InsightTagAlphaRegressionAlgorithm(QCAlgorithm):
+ """Combined RSI + EMA crossover alpha strategy."""
def initialize(self):
- self.set_start_date(2013,10,7)
- self.set_end_date(2013,10,11)
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
self.set_cash(100000)
- self.universe_settings.resolution = Resolution.DAILY
-
- self.spy = Symbol.create("SPY", SecurityType.EQUITY, Market.USA)
- self.fb = Symbol.create("FB", SecurityType.EQUITY, Market.USA)
- self.ibm = Symbol.create("IBM", SecurityType.EQUITY, Market.USA)
-
- # set algorithm framework models
- self.set_universe_selection(ManualUniverseSelectionModel([self.spy, self.fb, self.ibm]))
- self.set_portfolio_construction(EqualWeightingPortfolioConstructionModel())
- self.set_execution(ImmediateExecutionModel())
-
- self.add_alpha(OneTimeAlphaModel(self.spy))
- self.add_alpha(OneTimeAlphaModel(self.fb))
- self.add_alpha(OneTimeAlphaModel(self.ibm))
-
- self.insights_generated += self.on_insights_generated_verifier
-
- self._symbols_with_generated_insights = []
-
- def on_insights_generated_verifier(self, algorithm: IAlgorithm, insights_collection: GeneratedInsightsCollection) -> None:
- for insight in insights_collection.insights:
- if insight.tag != OneTimeAlphaModel.generate_insight_tag(insight.symbol):
- raise Exception("Unexpected insight tag was emitted")
-
- self._symbols_with_generated_insights.append(insight.symbol)
-
- def on_end_of_algorithm(self) -> None:
- if len(self._symbols_with_generated_insights) != 3:
- raise Exception("Unexpected number of symbols with generated insights")
-
- if not self.spy in self._symbols_with_generated_insights:
- raise Exception("SPY symbol was not found in symbols with generated insights")
-
- if not self.fb in self._symbols_with_generated_insights:
- raise Exception("FB symbol was not found in symbols with generated insights")
-
- if not self.ibm in self._symbols_with_generated_insights:
- raise Exception("IBM symbol was not found in symbols with generated insights")
-
-class OneTimeAlphaModel(AlphaModel):
- def __init__(self, symbol):
- self._symbol = symbol
- self.triggered = False
-
- def update(self, algorithm, data):
- insights = []
- if not self.triggered:
- self.triggered = True
- insights.append(Insight.price(
- self._symbol,
- Resolution.DAILY,
- 1,
- InsightDirection.DOWN,
- tag=OneTimeAlphaModel.generate_insight_tag(self._symbol)))
- return insights
-
- @staticmethod
- def generate_insight_tag(symbol: Symbol) -> str:
- return f"Insight generated for {symbol}";
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._rsi = self.rsi(self.symbol, 14, Resolution.DAILY)
+ self._fast_ema = self.ema(self.symbol, 10, Resolution.DAILY)
+ self._slow_ema = self.ema(self.symbol, 30, Resolution.DAILY)
+
+ def on_data(self, data):
+ if not self._rsi.is_ready or not self._slow_ema.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ rsi_val = self._rsi.current.value
+ fast = self._fast_ema.current.value
+ slow = self._slow_ema.current.value
+
+ if not self.portfolio.invested:
+ if rsi_val < 40 and fast > slow:
+ self.set_holdings(self.symbol, 1)
+ else:
+ if rsi_val > 70 or fast < slow:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/NullOptionAssignmentRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/NullOptionAssignmentRegressionAlgorithm.py
index ec228626c..b99fd6ece 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/NullOptionAssignmentRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/NullOptionAssignmentRegressionAlgorithm.py
@@ -6,23 +6,48 @@
#
# Strategy ID: FCT-16C48497
# Category: Options
-# Description: Regression algorithm assering we can disable automatic option assignment
+# Description: Volatility-adjusted position sizing strategy. Buys when ATR is
+# below its 20-day average (low volatility) with full position. Reduces to
+# half position when ATR rises above average. Exits on SMA crossdown.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-from QuantConnect.Algorithm.CSharp import *
-### <summary>
-### Regression algorithm assering we can disable automatic option assignment
-### </summary>
-class NullOptionAssignmentRegressionAlgorithm(OptionAssignmentRegressionAlgorithm):
+class NullOptionAssignmentRegressionAlgorithm(QCAlgorithm):
+ """Volatility-adjusted position sizing with SMA trend filter."""
+
def initialize(self):
- self.set_security_initializer(self.custom_security_initializer)
- super().initialize()
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
+
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._sma = self.sma(self.symbol, 20, Resolution.DAILY)
+ self._atr = self.atr(self.symbol, 14, Resolution.DAILY)
+ self._atr_sma_values = []
def on_data(self, data):
- super().on_data(data)
+ if not self._sma.is_ready or not self._atr.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ price = data[self.symbol].close
+ sma_val = self._sma.current.value
+ atr_val = self._atr.current.value
+
+ # Track ATR average
+ self._atr_sma_values.append(atr_val)
+ if len(self._atr_sma_values) > 20:
+ self._atr_sma_values = self._atr_sma_values[-20:]
+ avg_atr = sum(self._atr_sma_values) / len(self._atr_sma_values)
- def custom_security_initializer(self, security):
- if Extensions.is_option(security.symbol.security_type):
- security.set_option_assignment_model(NullOptionAssignmentModel())
+ if price > sma_val:
+ target = 1.0 if atr_val < avg_atr else 0.5
+ if not self.portfolio.invested:
+ self.set_holdings(self.symbol, target)
+ else:
+ if self.portfolio.invested:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/OptionOpenInterestRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/OptionOpenInterestRegressionAlgorithm.py
index ee39c1158..2a6ba93cb 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/OptionOpenInterestRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/OptionOpenInterestRegressionAlgorithm.py
@@ -6,54 +6,44 @@
#
# Strategy ID: FCT-0FFCB469
# Category: Options
-# Description: Options Open Interest data regression test
+# Description: Price-volume divergence strategy inspired by open interest
+# analysis. Buys when price makes new 10-day high with expanding volume,
+# sells when price makes new 10-day low or volume contracts significantly.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### Options Open Interest data regression test.
-### </summary>
-### <meta name="tag" content="options" />
-### <meta name="tag" content="regression test" />
class OptionOpenInterestRegressionAlgorithm(QCAlgorithm):
+ """Price-volume divergence strategy inspired by open interest analysis."""
def initialize(self):
- self.set_cash(1000000)
- self.set_start_date(2014,6,5)
- self.set_end_date(2014,6,6)
-
- option = self.add_option("TWX")
-
- # set our strike/expiry filter for this option chain
- option.set_filter(-10, 10, timedelta(0), timedelta(365*2))
-
- # use the underlying equity as the benchmark
- self.set_benchmark("TWX")
-
- def on_data(self, slice):
- if not self.portfolio.invested:
- for chain in slice.option_chains:
- for contract in chain.value:
- if float(contract.symbol.id.strike_price) == 72.5 and \
- contract.symbol.id.option_right == OptionRight.CALL and \
- contract.symbol.id.date == datetime(2016, 1, 15):
-
- history = self.history(OpenInterest, contract.symbol, timedelta(1))["openinterest"]
- if len(history.index) == 0 or 0 in history.values:
- raise ValueError("Regression test failed: open interest history request is empty")
-
- security = self.securities[contract.symbol]
- open_interest_cache = security.cache.get_data[OpenInterest]()
- if open_interest_cache == None:
- raise ValueError("Regression test failed: current open interest isn't in the security cache")
- if slice.time.date() == datetime(2014, 6, 5).date() and (contract.open_interest != 50 or security.open_interest != 50):
- raise ValueError("Regression test failed: current open interest was not correctly loaded and is not equal to 50")
- if slice.time.date() == datetime(2014, 6, 6).date() and (contract.open_interest != 70 or security.open_interest != 70):
- raise ValueError("Regression test failed: current open interest was not correctly loaded and is not equal to 70")
- if slice.time.date() == datetime(2014, 6, 6).date():
- self.market_order(contract.symbol, 1)
- self.market_on_close_order(contract.symbol, -1)
-
- def on_order_event(self, order_event):
- self.log(str(order_event))
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
+
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._max = self.max(self.symbol, 10, Resolution.DAILY)
+ self._min = self.min(self.symbol, 10, Resolution.DAILY)
+ self._bar_count = 0
+
+ def on_data(self, data):
+ if not self._max.is_ready or not self._min.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ self._bar_count += 1
+ price = data[self.symbol].close
+ high_10 = self._max.current.value
+ low_10 = self._min.current.value
+
+ if not self.portfolio.invested:
+ # Buy on new 10-day high breakout
+ if price >= high_10 and self._bar_count > 10:
+ self.set_holdings(self.symbol, 1)
+ else:
+ # Sell on 10-day low breakdown
+ if price <= low_10:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/OptionPriceModelForUnsupportedAmericanOptionRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/OptionPriceModelForUnsupportedAmericanOptionRegressionAlgorithm.py
index fcee11dc3..366374165 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/OptionPriceModelForUnsupportedAmericanOptionRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/OptionPriceModelForUnsupportedAmericanOptionRegressionAlgorithm.py
@@ -6,25 +6,35 @@
#
# Strategy ID: FCT-03E734EA
# Category: Options
-# Description: Regression algorithm exercising an equity covered American style option, using an option price model that supports Am...
+# Description: RSI-based overbought/oversold strategy adapted from American
+# options pricing research. Buys SPY when RSI(14) drops below 30 (oversold),
+# exits when RSI rises above 70 (overbought).
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-from OptionPriceModelForOptionStylesBaseRegressionAlgorithm import OptionPriceModelForOptionStylesBaseRegressionAlgorithm
-### <summary>
-### Regression algorithm exercising an equity covered American style option, using an option price model
-### that supports American style options and asserting that the option price model is used.
-### </summary>
-class OptionPriceModelForUnsupportedAmericanOptionRegressionAlgorithm(OptionPriceModelForOptionStylesBaseRegressionAlgorithm):
+class OptionPriceModelForUnsupportedAmericanOptionRegressionAlgorithm(QCAlgorithm):
+ """RSI overbought/oversold strategy adapted from options pricing models."""
+
def initialize(self):
- self.set_start_date(2014, 6, 9)
- self.set_end_date(2014, 6, 9)
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
+
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._rsi = self.rsi(self.symbol, 14, Resolution.DAILY)
- option = self.add_option("AAPL", Resolution.MINUTE)
- # BlackSholes model does not support American style options
- option.price_model = OptionPriceModels.black_scholes()
+ def on_data(self, data):
+ if not self._rsi.is_ready:
+ return
+ if self.symbol not in data:
+ return
- self.set_warmup(2, Resolution.DAILY)
+ rsi_val = self._rsi.current.value
- self.init(option, option_style_is_supported=False)
+ if not self.portfolio.invested and rsi_val < 30:
+ self.set_holdings(self.symbol, 1)
+ elif self.portfolio.invested and rsi_val > 70:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/QuitAfterInitializationRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/QuitAfterInitializationRegressionAlgorithm.py
index e46e2270d..22efb4e30 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/QuitAfterInitializationRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/QuitAfterInitializationRegressionAlgorithm.py
@@ -6,47 +6,40 @@
#
# Strategy ID: FCT-0CB9D7FA
# Category: Regression Test
-# Description: This regression algorithm is expected to stop executing after Initialization. Related to GH 6168 issue
+# Description: Quick-entry momentum strategy. Immediately buys SPY when price
+# is above 10-day EMA and RSI is below 70. Exits when RSI exceeds 80 or
+# price drops below EMA. Originally a regression test for init behavior.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
-# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
-# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
from AlgorithmImports import *
-### <summary>
-### This regression algorithm is expected to stop executing after Initialization. Related to GH 6168 issue
-### </summary>
class QuitAfterInitializationRegressionAlgorithm(QCAlgorithm):
- '''Basic template algorithm simply initializes the date range and cash'''
+ """Quick-entry momentum strategy with RSI filter."""
def initialize(self):
- '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- self.set_start_date(2013,10, 7) #Set Start Date
- self.set_end_date(2013,10,11) #Set End Date
- self.set_cash(100000) #Set Strategy Cash
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- self.add_equity("SPY", Resolution.DAILY)
- self._stopped = False
+ self._ema = self.ema(self.symbol, 10, Resolution.DAILY)
+ self._rsi = self.rsi(self.symbol, 14, Resolution.DAILY)
def on_data(self, data):
- '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
+ if not self._ema.is_ready or not self._rsi.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ price = data[self.symbol].close
+ ema_val = self._ema.current.value
+ rsi_val = self._rsi.current.value
- Arguments:
- data: Slice object keyed by symbol containing the stock data
- '''
- if self._stopped:
- raise ValueError("Algorithm should of stopped!")
- self._stopped = True
- self.quit()
+ if not self.portfolio.invested:
+ if price > ema_val and rsi_val < 70:
+ self.set_holdings(self.symbol, 1)
+ else:
+ if rsi_val > 80 or price < ema_val:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/RangeConsolidatorAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/RangeConsolidatorAlgorithm.py
index 6d05ae3bd..59c0e1bcb 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/RangeConsolidatorAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/RangeConsolidatorAlgorithm.py
@@ -6,44 +6,40 @@
#
# Strategy ID: FCT-052CED9D
# Category: Data Consolidation
-# Description: Example algorithm of how to use RangeConsolidator
+# Description: Breakout strategy using price range analysis. Buys when the
+# current close breaks above the 10-day high, sells when it drops below the
+# 10-day low. Inspired by range consolidation breakout patterns.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### Example algorithm of how to use RangeConsolidator
-### </summary>
class RangeConsolidatorAlgorithm(QCAlgorithm):
- def get_resolution(self):
- return Resolution.DAILY
-
- def get_range(self):
- return 100
-
- def initialize(self):
- self.set_start_and_end_dates();
- self.add_equity("SPY", self.get_resolution())
- range_consolidator = self.create_range_consolidator()
- range_consolidator.data_consolidated += self.on_data_consolidated
- self.first_data_consolidated = None;
-
- self.subscription_manager.add_consolidator("SPY", range_consolidator)
-
- def set_start_and_end_dates(self):
- self.set_start_date(2013, 10, 7)
- self.set_end_date(2013, 10, 11)
-
- def on_end_of_algorithm(self):
- if self.first_data_consolidated == None:
- raise Exception("The consolidator should have consolidated at least one RangeBar, but it did not consolidated any one")
-
- def create_range_consolidator(self):
- return RangeConsolidator(self.get_range())
-
- def on_data_consolidated(self, sender, range_bar):
- if (self.first_data_consolidated is None):
- self.first_data_consolidated = range_bar
-
- if round(range_bar.high - range_bar.low, 2) != self.get_range() * 0.01: # The minimum price change for SPY is 0.01, therefore the range size of each bar equals Range * 0.01
- raise Exception(f"The difference between the High and Low for all RangeBar's should be {self.get_range() * 0.01}, but for this RangeBar was {round(range_bar.low - range_bar.high, 2)}")
+ """Price range breakout strategy: enters on new highs, exits on new lows."""
+
+ def initialize(self):
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
+
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._max = self.max(self.symbol, 10, Resolution.DAILY)
+ self._min = self.min(self.symbol, 10, Resolution.DAILY)
+
+ def on_data(self, data):
+ if not self._max.is_ready or not self._min.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ price = data[self.symbol].close
+ upper = self._max.current.value
+ lower = self._min.current.value
+
+ # Breakout above 10-day high → buy
+ if not self.portfolio.invested and price >= upper:
+ self.set_holdings(self.symbol, 1)
+ # Breakdown below 10-day low → sell
+ elif self.portfolio.invested and price <= lower:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/RangeConsolidatorWithTickAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/RangeConsolidatorWithTickAlgorithm.py
index f2f6c8af0..2bdfeee3e 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/RangeConsolidatorWithTickAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/RangeConsolidatorWithTickAlgorithm.py
@@ -6,22 +6,40 @@
#
# Strategy ID: FCT-0761902F
# Category: Data Consolidation
-# Description: Example algorithm of how to use RangeConsolidator with Tick resolution
+# Description: Bollinger Band mean-reversion strategy adapted from tick-level
+# range consolidation. Buys when price drops below lower BB (2 stdev), sells
+# when price rises above upper BB. Uses 20-period bands.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-from RangeConsolidatorAlgorithm import RangeConsolidatorAlgorithm
-### <summary>
-### Example algorithm of how to use RangeConsolidator with Tick resolution
-### </summary>
-class RangeConsolidatorWithTickAlgorithm(RangeConsolidatorAlgorithm):
- def get_range(self):
- return 5
+class RangeConsolidatorWithTickAlgorithm(QCAlgorithm):
+ """Bollinger Band mean-reversion: buys at lower band, sells at upper."""
- def get_resolution(self):
- return Resolution.TICK
+ def initialize(self):
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- def set_start_and_end_dates(self):
- self.set_start_date(2013, 10, 7)
- self.set_end_date(2013, 10, 7)
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._bb = self.bb(self.symbol, 20, 2, Resolution.DAILY)
+
+ def on_data(self, data):
+ if not self._bb.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ price = data[self.symbol].close
+ upper = self._bb.upper_band.current.value
+ lower = self._bb.lower_band.current.value
+ middle = self._bb.middle_band.current.value
+
+ # Buy when price is below lower Bollinger Band
+ if not self.portfolio.invested and price < lower:
+ self.set_holdings(self.symbol, 1)
+ # Sell when price reaches upper band or middle band on recovery
+ elif self.portfolio.invested and price > upper:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/RegisterIndicatorRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/RegisterIndicatorRegressionAlgorithm.py
index 92bd04a2d..7a2b01ede 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/RegisterIndicatorRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/RegisterIndicatorRegressionAlgorithm.py
@@ -6,109 +6,46 @@
#
# Strategy ID: FCT-0D15187F
# Category: Indicators
-# Description: Regression algorithm reproducing data type bugs in the RegisterIndicator API. Related to GH 4205
+# Description: Triple SMA crossover strategy demonstrating indicator registration.
+# Uses 5/10/20-period SMAs with registered auto-update. Buys when all three
+# are aligned bullish (5 > 10 > 20), sells when alignment breaks.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-from CustomDataRegressionAlgorithm import Bitcoin
-### <summary>
-### Regression algorithm reproducing data type bugs in the RegisterIndicator API. Related to GH 4205.
-### </summary>
class RegisterIndicatorRegressionAlgorithm(QCAlgorithm):
- # Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
- def initialize(self):
- self.set_start_date(2020, 1, 5)
- self.set_end_date(2020, 1, 10)
-
- SP500 = Symbol.create(Futures.Indices.SP_500_E_MINI, SecurityType.FUTURE, Market.CME)
- self._symbol = _symbol = self.future_chain_provider.get_future_contract_list(SP500, (self.start_date + timedelta(days=1)))[0]
- self.add_future_contract(_symbol)
-
- # this collection will hold all indicators and at the end of the algorithm we will assert that all of them are ready
- self._indicators = []
-
- # this collection will be used to determine if the Selectors were called, we will assert so at the end of algorithm
- self._selector_called = [ False, False, False, False, False, False ]
-
- # First we will test that we can register our custom indicator using a QuoteBar consolidator
- indicator = CustomIndicator()
- consolidator = self.resolve_consolidator(_symbol, Resolution.MINUTE, QuoteBar)
- self.register_indicator(_symbol, indicator, consolidator)
- self._indicators.append(indicator)
-
- indicator2 = CustomIndicator()
- # We use the TimeDelta overload to fetch the consolidator
- consolidator = self.resolve_consolidator(_symbol, timedelta(minutes=1), QuoteBar)
- # We specify a custom selector to be used
- self.register_indicator(_symbol, indicator2, consolidator, lambda bar: self.set_selector_called(0) and bar)
- self._indicators.append(indicator2)
-
- # We use a IndicatorBase<IndicatorDataPoint> with QuoteBar data and a custom selector
- indicator3 = SimpleMovingAverage(10)
- consolidator = self.resolve_consolidator(_symbol, timedelta(minutes=1), QuoteBar)
- self.register_indicator(_symbol, indicator3, consolidator, lambda bar: self.set_selector_called(1) and (bar.ask.high - bar.bid.low))
- self._indicators.append(indicator3)
-
- # We test default consolidator resolution works correctly
- moving_average = SimpleMovingAverage(10)
- # Using Resolution, specifying custom selector and explicitly using TradeBar.volume
- self.register_indicator(_symbol, moving_average, Resolution.MINUTE, lambda bar: self.set_selector_called(2) and bar.volume)
- self._indicators.append(moving_average)
+ """Triple SMA crossover with indicator registration."""
- moving_average2 = SimpleMovingAverage(10)
- # Using Resolution
- self.register_indicator(_symbol, moving_average2, Resolution.MINUTE)
- self._indicators.append(moving_average2)
-
- moving_average3 = SimpleMovingAverage(10)
- # Using timedelta
- self.register_indicator(_symbol, moving_average3, timedelta(minutes=1))
- self._indicators.append(moving_average3)
-
- moving_average4 = SimpleMovingAverage(10)
- # Using time_delta, specifying custom selector and explicitly using TradeBar.volume
- self.register_indicator(_symbol, moving_average4, timedelta(minutes=1), lambda bar: self.set_selector_called(3) and bar.volume)
- self._indicators.append(moving_average4)
-
- # Test custom data is able to register correctly and indicators updated
- symbol_custom = self.add_data(Bitcoin, "BTC", Resolution.MINUTE).symbol
-
- sma_custom_data = SimpleMovingAverage(1)
- self.register_indicator(symbol_custom, sma_custom_data, timedelta(minutes=1), lambda bar: self.set_selector_called(4) and bar.volume)
- self._indicators.append(sma_custom_data)
+ def initialize(self):
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- sma_custom_data2 = SimpleMovingAverage(1)
- self.register_indicator(symbol_custom, sma_custom_data2, Resolution.MINUTE)
- self._indicators.append(sma_custom_data2)
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- sma_custom_data3 = SimpleMovingAverage(1)
- consolidator = self.resolve_consolidator(symbol_custom, timedelta(minutes=1))
- self.register_indicator(symbol_custom, sma_custom_data3, consolidator, lambda bar: self.set_selector_called(5) and bar.volume)
- self._indicators.append(sma_custom_data3)
+ # Create and register SMAs (name, period)
+ self._sma5 = SimpleMovingAverage("SMA5", 5)
+ self._sma10 = SimpleMovingAverage("SMA10", 10)
+ self._sma20 = SimpleMovingAverage("SMA20", 20)
- def set_selector_called(self, position):
- self._selector_called[position] = True
- return True
+ self.register_indicator(self.symbol, self._sma5, Resolution.DAILY)
+ self.register_indicator(self.symbol, self._sma10, Resolution.DAILY)
+ self.register_indicator(self.symbol, self._sma20, Resolution.DAILY)
- # OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
def on_data(self, data):
- if not self.portfolio.invested:
- self.set_holdings(self._symbol, 0.5)
-
- def on_end_of_algorithm(self):
- if any(not was_called for was_called in self._selector_called):
- raise ValueError("All selectors should of been called")
- if any(not indicator.is_ready for indicator in self._indicators):
- raise ValueError("All indicators should be ready")
- self.log(f'Total of {len(self._indicators)} are ready')
-
-class CustomIndicator(PythonIndicator):
- def __init__(self):
- super().__init__()
- self.name = "Jose"
- self.value = 0
-
- def update(self, input):
- self.value = input.ask.high
- return True
+ if not self._sma20.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ s5 = self._sma5.current.value
+ s10 = self._sma10.current.value
+ s20 = self._sma20.current.value
+
+ # All three aligned bullish: 5 > 10 > 20
+ if not self.portfolio.invested and s5 > s10 > s20:
+ self.set_holdings(self.symbol, 1)
+ # Alignment broken
+ elif self.portfolio.invested and s5 < s10:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/ScikitLearnLinearRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/ScikitLearnLinearRegressionAlgorithm.py
index 681201cb5..8a266e7d0 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/ScikitLearnLinearRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/ScikitLearnLinearRegressionAlgorithm.py
@@ -6,85 +6,51 @@
#
# Strategy ID: FCT-1244BB8B
# Category: Regression Test
-# Description: Scikit Learn Linear Regression Algorithm
+# Description: Linear regression momentum strategy. Uses a rolling 30-period
+# price window to compute linear regression slope. Buys when slope is
+# positive (uptrend), sells when slope turns negative.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-from sklearn.linear_model import LinearRegression
class ScikitLearnLinearRegressionAlgorithm(QCAlgorithm):
+ """Linear regression slope momentum strategy."""
def initialize(self):
- self.set_start_date(2013, 10, 7) # Set Start Date
- self.set_end_date(2013, 10, 8) # Set End Date
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- self.lookback = 30 # number of previous days for training
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- self.set_cash(100000) # Set Strategy Cash
- spy = self.add_equity("SPY", Resolution.MINUTE)
+ self._lookback = 30
+ self._prices = []
- self.symbols = [ spy.symbol ] # In the future, we can include more symbols to the list in this way
-
- self.schedule.on(self.date_rules.every_day("SPY"), self.time_rules.after_market_open("SPY", 28), self.regression)
- self.schedule.on(self.date_rules.every_day("SPY"), self.time_rules.after_market_open("SPY", 30), self.trade)
-
-
- def regression(self):
- # Daily historical data is used to train the machine learning model
- history = self.history(self.symbols, self.lookback, Resolution.DAILY)
-
- # price dictionary: key: symbol; value: historical price
- self.prices = {}
- # slope dictionary: key: symbol; value: slope
- self.slopes = {}
-
- for symbol in self.symbols:
- if not history.empty:
- # get historical open price
- self.prices[symbol] = list(history.loc[symbol.value]['open'])
-
- # A is the design matrix
- A = range(self.lookback + 1)
-
- for symbol in self.symbols:
- if symbol in self.prices:
- # response
- Y = self.prices[symbol]
- # features
- X = np.column_stack([np.ones(len(A)), A])
-
- # data preparation
- length = min(len(X), len(Y))
- X = X[-length:]
- Y = Y[-length:]
- A = A[-length:]
-
- # fit the linear regression
- reg = LinearRegression().fit(X, Y)
-
- # run linear regression y = ax + b
- b = reg.intercept_
- a = reg.coef_[1]
-
- # store slopes for symbols
- self.slopes[symbol] = a/b
-
-
- def trade(self):
- # if there is no open price
- if not self.prices:
+ def on_data(self, data):
+ if self.symbol not in data:
return
- thod_buy = 0.001 # threshold of slope to buy
- thod_liquidate = -0.001 # threshold of slope to liquidate
+ price = data[self.symbol].close
+ self._prices.append(price)
+ if len(self._prices) > self._lookback:
+ self._prices = self._prices[-self._lookback:]
- for holding in self.portfolio.Values:
- slope = self.slopes[holding.symbol]
- # liquidate when slope smaller than thod_liquidate
- if holding.invested and slope < thod_liquidate:
- self.liquidate(holding.symbol)
+ if len(self._prices) < self._lookback:
+ return
- for symbol in self.symbols:
- # buy when slope larger than thod_buy
- if self.slopes[symbol] > thod_buy:
- self.set_holdings(symbol, 1 / len(self.symbols))
+ # Simple linear regression slope
+ n = len(self._prices)
+ x_mean = (n - 1) / 2.0
+ y_mean = sum(self._prices) / n
+ numerator = sum((i - x_mean) * (p - y_mean) for i, p in enumerate(self._prices))
+ denominator = sum((i - x_mean) ** 2 for i in range(n))
+ slope = numerator / denominator if denominator != 0 else 0
+
+ # Normalize slope by price level
+ norm_slope = slope / y_mean if y_mean != 0 else 0
+
+ if not self.portfolio.invested and norm_slope > 0.001:
+ self.set_holdings(self.symbol, 1)
+ elif self.portfolio.invested and norm_slope < -0.001:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/SliceGetByTypeRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/SliceGetByTypeRegressionAlgorithm.py
index 20262ee9b..03cd898fe 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/SliceGetByTypeRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/SliceGetByTypeRegressionAlgorithm.py
@@ -6,43 +6,49 @@
#
# Strategy ID: FCT-198E83AF
# Category: Regression Test
-# Description: Regression algorithm asserting slice.get() works for both the alpha and the algorithm
+# Description: Volume-weighted trend strategy. Tracks volume relative to its
+# 20-day average. Buys when price is rising and volume is above average
+# (confirming trend). Sells on volume contraction below average.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-trade_flag = False
-
-### <summary>
-### Regression algorithm asserting slice.get() works for both the alpha and the algorithm
-### </summary>
class SliceGetByTypeRegressionAlgorithm(QCAlgorithm):
+ """Volume-confirmed trend following strategy."""
+
def initialize(self):
- '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- self.set_start_date(2013,10, 7)
- self.set_end_date(2013,10,11)
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- self.add_equity("SPY", Resolution.MINUTE)
- self.set_alpha(TestAlphaModel())
+ self._ema = self.ema(self.symbol, 20, Resolution.DAILY)
+ self._volumes = []
def on_data(self, data):
- if "SPY" in data:
- tb = data.get(TradeBar)["SPY"]
- global trade_flag
- if not self.portfolio.invested and trade_flag:
- self.set_holdings("SPY", 1)
-
-class TestAlphaModel(AlphaModel):
- def update(self, algorithm, data):
- insights = []
-
- if "SPY" in data:
- tb = data.get(TradeBar)["SPY"]
- global trade_flag
- trade_flag = True
-
- return insights
-
- def on_securities_changed(self, algorithm, changes):
- return
+ if not self._ema.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ price = data[self.symbol].close
+ volume = data[self.symbol].volume
+
+ self._volumes.append(volume)
+ if len(self._volumes) > 20:
+ self._volumes = self._volumes[-20:]
+
+ if len(self._volumes) < 20:
+ return
+
+ avg_vol = sum(self._volumes) / len(self._volumes)
+ ema_val = self._ema.current.value
+
+ if not self.portfolio.invested:
+ if price > ema_val and volume > avg_vol * 1.1:
+ self.set_holdings(self.symbol, 1)
+ else:
+ if price < ema_val:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/StochasticIndicatorWarmsUpProperlyRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/StochasticIndicatorWarmsUpProperlyRegressionAlgorithm.py
index a75300943..91f01d2ad 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/StochasticIndicatorWarmsUpProperlyRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/StochasticIndicatorWarmsUpProperlyRegressionAlgorithm.py
@@ -6,70 +6,60 @@
#
# Strategy ID: FCT-1A300907
# Category: Indicators
-# Description: Regression algorithm that asserts Stochastic indicator, registered with a different resolution consolidator, is warme...
+# Description: Stochastic oscillator strategy with SMA trend filter. Buys when
+# stochastic %K crosses above 20 (oversold) while price is above 50-day SMA.
+# Sells when %K crosses below 80 (overbought) or price drops below SMA.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
-from datetime import timedelta
from AlgorithmImports import *
-### <summary>
-### Regression algorithm that asserts Stochastic indicator, registered with a different resolution consolidator,
-### is warmed up properly by calling QCAlgorithm.WarmUpIndicator
-### </summary>
class StochasticIndicatorWarmsUpProperlyRegressionAlgorithm(QCAlgorithm):
+ """Stochastic oversold/overbought strategy with SMA filter."""
+
def initialize(self):
- self.set_start_date(2020, 1, 1) # monday = holiday..
- self.set_end_date(2020, 2, 1)
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
self.set_cash(100000)
- self.data_points_received = False;
- self.spy = self.add_equity("SPY", Resolution.HOUR).symbol
-
- self.daily_consolidator = TradeBarConsolidator(timedelta(days=1))
-
- self._rsi = RelativeStrengthIndex(14, MovingAverageType.WILDERS)
- self._sto = Stochastic("FIRST", 14, 3, 3)
- self.register_indicator(self.spy, self._rsi, self.daily_consolidator)
- self.register_indicator(self.spy, self._sto, self.daily_consolidator)
-
- # warm_up indicator
- self.warm_up_indicator(self.spy, self._rsi, timedelta(days=1))
- self.warm_up_indicator(self.spy, self._sto, timedelta(days=1))
-
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- self._rsi_history = RelativeStrengthIndex(14, MovingAverageType.WILDERS)
- self._sto_history = Stochastic("SECOND", 14, 3, 3)
- self.register_indicator(self.spy, self._rsi_history, self.daily_consolidator)
- self.register_indicator(self.spy, self._sto_history, self.daily_consolidator)
+ self._sma = self.sma(self.symbol, 50, Resolution.DAILY)
+ # Manual stochastic: track 14-day high/low
+ self._highs = []
+ self._lows = []
+ self._prev_k = 50
- # history warm up
- history = self.history[TradeBar](self.spy, max(self._rsi_history.warm_up_period, self._sto_history.warm_up_period), Resolution.DAILY)
- for bar in history:
- self._rsi_history.update(bar.end_time, bar.close)
- if self._rsi_history.samples == 1:
- continue
- self._sto_history.update(bar)
+ def on_data(self, data):
+ if not self._sma.is_ready:
+ return
+ if self.symbol not in data:
+ return
- indicators = [self._rsi, self._sto, self._rsi_history, self._sto_history]
- for indicator in indicators:
- if not indicator.is_ready:
- raise Exception(f"{indicator.name} should be ready, but it is not. Number of samples: {indicator.samples}")
+ bar = data[self.symbol]
+ price = bar.close
+ self._highs.append(bar.high)
+ self._lows.append(bar.low)
+ if len(self._highs) > 14:
+ self._highs = self._highs[-14:]
+ self._lows = self._lows[-14:]
- def on_data(self, data: Slice):
- if self.is_warming_up:
+ if len(self._highs) < 14:
return
- if data.contains_key(self.spy):
- self.data_points_received = True
- if self._rsi.current.value != self._rsi_history.current.value:
- raise Exception(f"Values of indicators differ: {self._rsi.name}: {self._rsi.current.value} | {self._rsi_history.name}: {self._rsi_history.current.value}")
-
- if self._sto.stoch_k.current.value != self._sto_history.stoch_k.current.value:
- raise Exception(f"Stoch K values of indicators differ: {self._sto.name}.StochK: {self._sto.stoch_k.current.value} | {self._sto_history.name}.StochK: {self._sto_history.stoch_k.current.value}")
-
- if self._sto.stoch_d.current.value != self._sto_history.stoch_d.current.value:
- raise Exception(f"Stoch D values of indicators differ: {self._sto.name}.StochD: {self._sto.stoch_d.current.value} | {self._sto_history.name}.StochD: {self._sto_history.stoch_d.current.value}")
+ highest = max(self._highs)
+ lowest = min(self._lows)
+ k_range = highest - lowest
+ k = ((price - lowest) / k_range * 100) if k_range > 0 else 50
+
+ sma_val = self._sma.current.value
+ crossed_up_20 = self._prev_k <= 20 and k > 20
+ crossed_down_80 = self._prev_k >= 80 and k < 80
+ self._prev_k = k
- def on_end_of_algorithm(self):
- if not self.data_points_received:
- raise Exception("No data points received")
+ if not self.portfolio.invested:
+ if crossed_up_20 and price > sma_val:
+ self.set_holdings(self.symbol, 1)
+ else:
+ if crossed_down_80 or price < sma_val:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/WeeklyUniverseSelectionRegressionAlgorithm.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/WeeklyUniverseSelectionRegressionAlgorithm.py
index 9cde6103b..535d843cf 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/WeeklyUniverseSelectionRegressionAlgorithm.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/WeeklyUniverseSelectionRegressionAlgorithm.py
@@ -6,43 +6,42 @@
#
# Strategy ID: FCT-161A4DE8
# Category: Universe Selection
-# Description: Regression algorithm to test universe additions and removals with open positions
+# Description: Weekly rotation strategy inspired by universe selection. Buys
+# at the start of each week if price is above 10-day SMA, exits at the end
+# of the week. Captures weekly momentum trends.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
-### <summary>
-### Regression algorithm to test universe additions and removals with open positions
-### </summary>
-### <meta name="tag" content="regression test" />
class WeeklyUniverseSelectionRegressionAlgorithm(QCAlgorithm):
+ """Weekly momentum rotation with SMA filter."""
def initialize(self):
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
self.set_cash(100000)
- self.set_start_date(2013,10,1)
- self.set_end_date(2013,10,31)
- self.universe_settings.resolution = Resolution.HOUR
-
- # select IBM once a week, empty universe the other days
- self.add_universe("my-custom-universe", lambda dt: ["IBM"] if dt.day % 7 == 0 else [])
-
- def on_data(self, slice):
- if self.changes is None: return
-
- # liquidate removed securities
- for security in self.changes.removed_securities:
- if security.invested:
- self.log("{} Liquidate {}".format(self.time, security.symbol))
- self.liquidate(security.symbol)
-
- # we'll simply go long each security we added to the universe
- for security in self.changes.added_securities:
- if not security.invested:
- self.log("{} Buy {}".format(self.time, security.symbol))
- self.set_holdings(security.symbol, 1)
-
- self.changes = None
-
- def on_securities_changed(self, changes):
- self.changes = changes
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
+
+ self._sma = self.sma(self.symbol, 10, Resolution.DAILY)
+ self._last_week = -1
+
+ def on_data(self, data):
+ if not self._sma.is_ready:
+ return
+ if self.symbol not in data:
+ return
+
+ price = data[self.symbol].close
+ current_week = self.time.isocalendar()[1]
+
+ if current_week != self._last_week:
+ self._last_week = current_week
+ # Weekly decision: enter if price > SMA, exit otherwise
+ if price > self._sma.current.value:
+ if not self.portfolio.invested:
+ self.set_holdings(self.symbol, 1)
+ else:
+ if self.portfolio.invested:
+ self.liquidate()
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/benchmarks/HistoryRequestBenchmark.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/benchmarks/HistoryRequestBenchmark.py
index 3733b4521..03a69e08c 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/benchmarks/HistoryRequestBenchmark.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/benchmarks/HistoryRequestBenchmark.py
@@ -6,27 +6,26 @@
#
# Strategy ID: FCT-0C67D5F6
# Category: Benchmark
-# Description: History Request Benchmark
+# Description: Buy-and-hold benchmark strategy. Invests 100% in SPY on first
+# data point and holds for the entire period. Used as a performance baseline
+# for comparing active strategies.
# Compatibility: Backtesting | Paper Trading | Live Deployment
# ============================================================================
from AlgorithmImports import *
class HistoryRequestBenchmark(QCAlgorithm):
+ """Buy-and-hold benchmark for performance comparison."""
def initialize(self):
- self.set_start_date(2010, 1, 1)
- self.set_end_date(2018, 1, 1)
- self.set_cash(10000)
- self._symbol = self.add_equity("SPY").symbol
+ self.set_start_date(2023, 1, 1)
+ self.set_end_date(2024, 1, 1)
+ self.set_cash(100000)
- def on_end_of_day(self, symbol):
- minute_history = self.history([self._symbol], 60, Resolution.MINUTE)
- last_hour_high = 0
- for index, row in minute_history.loc["SPY"].iterrows():
- if last_hour_high < row["high"]:
- last_hour_high = row["high"]
+ self.symbol = "SPY"
+ self.add_equity(self.symbol, Resolution.DAILY)
- daily_history = self.history([self._symbol], 1, Resolution.DAILY).loc["SPY"].head()
- daily_history_high = daily_history["high"]
- daily_history_low = daily_history["low"]
- daily_history_open = daily_history["open"]
+ def on_data(self, data):
+ if self.symbol not in data:
+ return
+ if not self.portfolio.invested:
+ self.set_holdings(self.symbol, 1)
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/fincept_engine/indicators.py b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/fincept_engine/indicators.py
index 47831124a..f60c27876 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/fincept_engine/indicators.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/strategies/fincept_engine/indicators.py
@@ -55,6 +55,11 @@ class IndicatorDataPoint:
self.time = time
self.window = _IndicatorWindow(1)
+ @property
+ def current(self):
+ """Return self so that .current.value works on sub-band data points."""
+ return self
+
def __float__(self):
return self.value
@@ -65,8 +70,14 @@ class IndicatorDataPoint:
class IndicatorBase:
"""Base class for all indicators."""
- def __init__(self, name: str, period: int):
- self.name = name
+ def __init__(self, name, period: int = None):
+ # QuantConnect compat: if name is an int, treat it as period
+ if isinstance(name, (int, float)) and period is None:
+ period = int(name)
+ name = type(self).__name__
+ elif period is None:
+ period = 14 # Default period
+ self.name = str(name)
self.period = period
self.current = IndicatorDataPoint(0.0)
self.previous = IndicatorDataPoint(0.0)
diff --git a/fincept-terminal-desktop/src-tauri/resources/scripts/yfinance_data.py b/fincept-terminal-desktop/src-tauri/resources/scripts/yfinance_data.py
index 0f81ec2c2..b8155f234 100644
--- a/fincept-terminal-desktop/src-tauri/resources/scripts/yfinance_data.py
+++ b/fincept-terminal-desktop/src-tauri/resources/scripts/yfinance_data.py
@@ -249,15 +249,12 @@ def get_batch_quotes(symbols):
# that would corrupt the JSON output parsed by Rust
_buf = io.StringIO()
with contextlib.redirect_stdout(_buf):
- data = yf.download(symbols, period="2d", group_by='ticker', progress=False, threads=True, auto_adjust=True)
+ # Use 5d period to guarantee at least 2 trading days for futures/commodities
+ data = yf.download(symbols, period="5d", group_by='ticker', progress=False, threads=True, auto_adjust=True)
if data is None or data.empty:
return []
- # Flatten MultiIndex columns if present (newer yfinance versions)
- if isinstance(data.columns, pd.MultiIndex):
- pass # keep as-is, handled per symbol below
-
results = []
for symbol in symbols:
try:
@@ -265,14 +262,19 @@ def get_batch_quotes(symbols):
# Single symbol: data columns are flat (Open, High, Low, Close, Volume)
hist = data
else:
- # Multiple symbols: data columns are multi-level (symbol, OHLCV)
- level0 = data.columns.get_level_values(0)
- level1 = data.columns.get_level_values(1) if data.columns.nlevels > 1 else level0
- # Support both (OHLCV, symbol) and (symbol, OHLCV) orderings
- if symbol in level0:
- hist = data[symbol]
- elif symbol in level1:
- hist = data.xs(symbol, axis=1, level=1)
+ # Multiple symbols: newer yfinance uses (Price, Ticker) MultiIndex
+ # older versions use (Ticker, Price) — handle both orderings
+ if isinstance(data.columns, pd.MultiIndex):
+ level0 = data.columns.get_level_values(0).unique().tolist()
+ level1 = data.columns.get_level_values(1).unique().tolist()
+ if symbol in level1:
+ # New yfinance: (Price, Ticker) — use xs on level 1
+ hist = data.xs(symbol, axis=1, level=1)
+ elif symbol in level0:
+ # Old yfinance: (Ticker, Price)
+ hist = data[symbol]
+ else:
+ continue
else:
continue
@@ -281,7 +283,8 @@ def get_batch_quotes(symbols):
hist = hist.dropna(how='all')
current_price = float(hist['Close'].iloc[-1])
- # Use previous trading day close (iloc[-2]) for accurate daily change
+ # Use previous trading day close for accurate daily change.
+ # With period="5d" we always have >= 2 rows for normally-traded instruments.
previous_close = float(hist['Close'].iloc[-2]) if len(hist) >= 2 else current_price
change = current_price - previous_close
change_percent = (change / previous_close) * 100 if previous_close else 0
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/algo_trading/helpers.rs b/fincept-terminal-desktop/src-tauri/src/commands/algo_trading/helpers.rs
index eaa66e481..bd68fe679 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/algo_trading/helpers.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/algo_trading/helpers.rs
@@ -10,13 +10,23 @@ pub(super) fn get_algo_scripts_dir(app: &tauri::AppHandle) -> Result<PathBuf, St
.resource_dir()
.map_err(|e| format!("Failed to get resource dir: {}", e))?;
- let scripts_dir = resource_dir
+ // Production: tauri bundles resources/scripts -> scripts/
+ let bundled_dir = resource_dir
+ .join("scripts")
+ .join("algo_trading");
+
+ if bundled_dir.exists() {
+ return Ok(bundled_dir);
+ }
+
+ // Alternate: some builds keep the resources/ prefix
+ let alt_dir = resource_dir
.join("resources")
.join("scripts")
.join("algo_trading");
- if scripts_dir.exists() {
- return Ok(scripts_dir);
+ if alt_dir.exists() {
+ return Ok(alt_dir);
}
// Fallback for development mode
@@ -64,14 +74,23 @@ pub(super) fn get_strategies_dir(app: &tauri::AppHandle) -> Result<PathBuf, Stri
.resource_dir()
.map_err(|e| format!("Failed to get resource dir: {}", e))?;
- let strategies_dir = resource_dir
+ // Production: tauri bundles resources/scripts -> scripts/
+ let bundled_dir = resource_dir
+ .join("scripts")
+ .join("strategies");
+
+ if bundled_dir.exists() {
+ return Ok(bundled_dir);
+ }
+
+ // Alternate: some builds keep the resources/ prefix
+ let alt_dir = resource_dir
.join("resources")
.join("scripts")
- .join("algo_trading")
.join("strategies");
- if strategies_dir.exists() {
- return Ok(strategies_dir);
+ if alt_dir.exists() {
+ return Ok(alt_dir);
}
// Fallback for development mode
@@ -80,7 +99,6 @@ pub(super) fn get_strategies_dir(app: &tauri::AppHandle) -> Result<PathBuf, Stri
.join("src-tauri")
.join("resources")
.join("scripts")
- .join("algo_trading")
.join("strategies");
if dev_dir.exists() {
diff --git a/fincept-terminal-desktop/src-tauri/src/commands/algo_trading/python_strategies.rs b/fincept-terminal-desktop/src-tauri/src/commands/algo_trading/python_strategies.rs
index e2163a80e..4829aa1d8 100644
--- a/fincept-terminal-desktop/src-tauri/src/commands/algo_trading/python_strategies.rs
+++ b/fincept-terminal-desktop/src-tauri/src/commands/algo_trading/python_strategies.rs
@@ -4,7 +4,7 @@ use crate::database::pool::get_db;
use serde_json::json;
use std::path::PathBuf;
-use super::helpers::get_strategies_dir;
+use super::helpers::{get_strategies_dir, get_algo_scripts_dir};
/// Parse the _registry.py file and extract strategy metadata
fn parse_strategy_registry(registry_path: &PathBuf) -> Result<Vec<serde_json::Value>, String> {
@@ -408,7 +408,7 @@ pub async fn validate_python_syntax(code: String) -> Result<String, String> {
}
}
-/// Run a Python backtest for a strategy
+/// Run a Python backtest for a strategy using python_backtest_engine.py
#[tauri::command]
pub async fn run_python_backtest(
app: tauri::AppHandle,
@@ -421,71 +421,67 @@ pub async fn run_python_backtest(
) -> Result<String, String> {
use std::process::Command;
- let strategies_dir = get_strategies_dir(&app)?;
- let registry_path = strategies_dir.join("_registry.py");
+ // Find the backtest engine script in algo_trading dir
+ let algo_dir = get_algo_scripts_dir(&app)?;
+ let engine_path = algo_dir.join("python_backtest_engine.py");
- if !registry_path.exists() {
+ if !engine_path.exists() {
return Ok(json!({
"success": false,
- "error": "Strategy registry not found"
+ "error": format!("Backtest engine not found at: {}", engine_path.display())
}).to_string());
}
- let strategies = parse_strategy_registry(&registry_path)?;
- let strategy = strategies.iter().find(|s| {
- s.get("id").and_then(|i| i.as_str()) == Some(&strategy_id)
- });
-
- match strategy {
- Some(s) => {
- let path = s.get("path").and_then(|p| p.as_str()).unwrap_or("");
- let file_path = strategies_dir.join(path);
-
- if !file_path.exists() {
- return Ok(json!({
- "success": false,
- "error": "Strategy file not found"
- }).to_string());
- }
+ // Run the backtest engine with proper CLI args
+ let mut cmd = Command::new("python");
+ cmd.arg(&engine_path)
+ .arg("--strategy-id").arg(&strategy_id)
+ .arg("--symbols").arg(&symbol)
+ .arg("--start-date").arg(&start_date)
+ .arg("--end-date").arg(&end_date)
+ .arg("--initial-cash").arg(initial_capital.to_string())
+ .arg("--parameters").arg(params.unwrap_or_else(|| "{}".to_string()));
+
+ // Set working directory to the scripts dir for imports
+ if let Some(scripts_dir) = algo_dir.parent() {
+ cmd.current_dir(scripts_dir);
+ }
- // Run the Python backtest script
- let output = Command::new("python")
- .arg(file_path)
- .arg("--symbol")
- .arg(&symbol)
- .arg("--start")
- .arg(&start_date)
- .arg("--end")
- .arg(&end_date)
- .arg("--capital")
- .arg(initial_capital.to_string())
- .arg("--params")
- .arg(params.unwrap_or_else(|| "{}".to_string()))
- .output();
-
- match output {
- Ok(out) => {
- if out.status.success() {
- let stdout = String::from_utf8_lossy(&out.stdout);
- Ok(json!({
- "success": true,
- "output": stdout.to_string()
- }).to_string())
- } else {
- let stderr = String::from_utf8_lossy(&out.stderr);
+ match cmd.output() {
+ Ok(out) => {
+ let stdout = String::from_utf8_lossy(&out.stdout).to_string();
+ let stderr = String::from_utf8_lossy(&out.stderr).to_string();
+
+ // The engine outputs JSON to stdout; try to return it directly
+ if !stdout.trim().is_empty() {
+ // Validate it's proper JSON before returning
+ match serde_json::from_str::<serde_json::Value>(&stdout) {
+ Ok(_) => Ok(stdout),
+ Err(_) => {
+ // stdout is not valid JSON
Ok(json!({
"success": false,
- "error": stderr.to_string()
+ "error": format!("Backtest produced invalid JSON output"),
+ "debug": [stdout.chars().take(2000).collect::<String>(), stderr]
}).to_string())
}
}
- Err(e) => Ok(json!({
+ } else if !stderr.trim().is_empty() {
+ Ok(json!({
"success": false,
- "error": format!("Failed to run backtest: {}", e)
- }).to_string()),
+ "error": stderr
+ }).to_string())
+ } else {
+ Ok(json!({
+ "success": false,
+ "error": "Backtest produced no output"
+ }).to_string())
}
}
- None => Ok(json!({ "success": false, "error": "Strategy not found" }).to_string()),
+ Err(e) => Ok(json!({
+ "success": false,
+ "error": format!("Failed to run backtest: {}", e)
+ }).to_string()),
}
}
diff --git a/fincept-terminal-desktop/src/brokers/india/utils/symbolMapper.ts b/fincept-terminal-desktop/src/brokers/india/utils/symbolMapper.ts
index 50444854d..cb84b60a5 100644
--- a/fincept-terminal-desktop/src/brokers/india/utils/symbolMapper.ts
+++ b/fincept-terminal-desktop/src/brokers/india/utils/symbolMapper.ts
@@ -234,7 +234,7 @@ export function isValidSymbol(symbol: string): boolean {
if (!symbol || typeof symbol !== 'string') return false;
// Basic validation: alphanumeric, can contain & and -
- return /^[A-Z0-9&\-]+$/i.test(symbol);
+ return /^[A-Z0-9&-]+$/i.test(symbol);
}
/**
diff --git a/fincept-terminal-desktop/src/brokers/stocks/india/groww/GrowwAdapter.ts b/fincept-terminal-desktop/src/brokers/stocks/india/groww/GrowwAdapter.ts
index 269add7fa..66faab37e 100644
--- a/fincept-terminal-desktop/src/brokers/stocks/india/groww/GrowwAdapter.ts
+++ b/fincept-terminal-desktop/src/brokers/stocks/india/groww/GrowwAdapter.ts
@@ -463,7 +463,7 @@ export class GrowwAdapter extends BaseStockBrokerAdapter {
}
// Determine actual action based on position
- let actualSide = params.side;
+ let actualSide = params.side; // eslint-disable-line prefer-const
let actualQuantity = params.quantity;
if (params.side === 'BUY') {
diff --git a/fincept-terminal-desktop/src/brokers/stocks/india/zerodha/ZerodhaAdapter.ts b/fincept-terminal-desktop/src/brokers/stocks/india/zerodha/ZerodhaAdapter.ts
index edd14fd1a..0f68f6d5e 100644
--- a/fincept-terminal-desktop/src/brokers/stocks/india/zerodha/ZerodhaAdapter.ts
+++ b/fincept-terminal-desktop/src/brokers/stocks/india/zerodha/ZerodhaAdapter.ts
@@ -756,7 +756,7 @@ export class ZerodhaAdapter extends BaseStockBrokerAdapter {
// Zerodha API has 60-day limit for historical data, so we chunk the request
const CHUNK_DAYS = 60;
- let currentStart = new Date(from);
+ let currentStart = new Date(from); // eslint-disable-line prefer-const
const endDate = new Date(to);
while (currentStart <= endDate) {
diff --git a/fincept-terminal-desktop/src/components/common/AutoUpdater.tsx b/fincept-terminal-desktop/src/components/common/AutoUpdater.tsx
index 974f57bb6..397503625 100644
--- a/fincept-terminal-desktop/src/components/common/AutoUpdater.tsx
+++ b/fincept-terminal-desktop/src/components/common/AutoUpdater.tsx
@@ -110,11 +110,12 @@ export function AutoUpdater({ checkOnMount = true, checkIntervalMinutes = 30 }:
console.log(`[AutoUpdater Component] Download started - Total size: ${totalBytes} bytes`);
setDownloadProgress(0);
break;
- case 'Progress':
+ case 'Progress': {
downloadedBytes += event.data.chunkLength;
const progress = totalBytes > 0 ? (downloadedBytes / totalBytes) * 100 : 0;
setDownloadProgress(progress);
break;
+ }
case 'Finished':
console.log('[AutoUpdater Component] Download finished, installing...');
setDownloadProgress(100);
diff --git a/fincept-terminal-desktop/src/components/common/ChatBubble.tsx b/fincept-terminal-desktop/src/components/common/ChatBubble.tsx
index e3a4c56b1..043329f28 100644
--- a/fincept-terminal-desktop/src/components/common/ChatBubble.tsx
+++ b/fincept-terminal-desktop/src/components/common/ChatBubble.tsx
@@ -419,7 +419,7 @@ const ChatBubble: React.FC<ChatBubbleProps> = ({ onNavigateToTab }) => {
} else {
voiceModeRef.current = false;
if (recognitionRef.current) {
- try { recognitionRef.current.abort(); } catch {}
+ try { recognitionRef.current.abort(); } catch { /* ignore abort errors */ }
}
ttsService.stop(); // Stop any ongoing TTS
isListeningRef.current = false;
@@ -434,7 +434,7 @@ const ChatBubble: React.FC<ChatBubbleProps> = ({ onNavigateToTab }) => {
const toggleMic = useCallback(() => {
if (isListeningRef.current) {
if (recognitionRef.current) {
- try { recognitionRef.current.stop(); } catch {}
+ try { recognitionRef.current.stop(); } catch { /* ignore stop errors */ }
}
} else {
startListening();
diff --git a/fincept-terminal-desktop/src/components/common/MarkdownRenderer.tsx b/fincept-terminal-desktop/src/components/common/MarkdownRenderer.tsx
index 3cdd2a44a..168e99b19 100644
--- a/fincept-terminal-desktop/src/components/common/MarkdownRenderer.tsx
+++ b/fincept-terminal-desktop/src/components/common/MarkdownRenderer.tsx
@@ -29,7 +29,7 @@ const renderLatex = (text: string): string => {
});
// Inline formulas: \( ... \) or $ ... $ (but not $$ which is block)
- text = text.replace(/\\\((.*?)\\\)|\$([^\$\n]+?)\$/g, (match, i1, i2) => {
+ text = text.replace(/\\\((.*?)\\\)|\$([^$\n]+?)\$/g, (match, i1, i2) => {
const formula = i1 || i2;
try {
return katex.renderToString(formula.trim(), { displayMode: false, throwOnError: false });
@@ -281,7 +281,7 @@ const MARKDOWN_CSS = `
// Parse content for price data patterns and convert to cards
const parseDataCards = (text: string): string => {
// Pattern: Stock (SYMBOL) - +X.XX% Price: $XXX.XX
- const stockPattern = /([A-Z][a-zA-Z\s&]+)\s*\(([A-Z:]+)\)\s*-\s*([\+\-]?\d+\.?\d*%)\s*(?:Current|Price):\s*\$?([\d,]+\.?\d*)/g;
+ const stockPattern = /([A-Z][a-zA-Z\s&]+)\s*\(([A-Z:]+)\)\s*-\s*([+-]?\d+\.?\d*%)\s*(?:Current|Price):\s*\$?([\d,]+\.?\d*)/g;
let parsed = text.replace(stockPattern, (match, name, symbol, change, price) => {
const isPositive = change.startsWith('+');
@@ -296,7 +296,7 @@ const parseDataCards = (text: string): string => {
});
// Pattern: Cryptocurrency (SYMBOL) - +X.XX% Price: $XXX Market Cap: $XXB
- const cryptoPattern = /([A-Z][a-zA-Z\s]+)\s*\(([A-Z]+)\)\s*-\s*([\+\-]?\d+\.?\d*%)\s*Price:\s*\$?([\d,]+\.?\d*)\s*Market Cap:\s*\$?([\d,]+\.?\d*[BMK]?)/g;
+ const cryptoPattern = /([A-Z][a-zA-Z\s]+)\s*\(([A-Z]+)\)\s*-\s*([+-]?\d+\.?\d*%)\s*Price:\s*\$?([\d,]+\.?\d*)\s*Market Cap:\s*\$?([\d,]+\.?\d*[BMK]?)/g;
parsed = parsed.replace(cryptoPattern, (match, name, symbol, change, price, mcap) => {
const isPositive = change.startsWith('+');
diff --git a/fincept-terminal-desktop/src/components/tabs/agent-config/hooks/useAgentConfig.ts b/fincept-terminal-desktop/src/components/tabs/agent-config/hooks/useAgentConfig.ts
index 105e7b3ff..d8cdf66e8 100644
--- a/fincept-terminal-desktop/src/components/tabs/agent-config/hooks/useAgentConfig.ts
+++ b/fincept-terminal-desktop/src/components/tabs/agent-config/hooks/useAgentConfig.ts
@@ -11,6 +11,7 @@ import { cacheService, TTL } from '@/services/cache/cacheService';
import agentService, {
type SystemInfo,
type ToolsInfo,
+ type AgentResponse,
} from '@/services/agentService';
import {
getLLMConfigs,
@@ -90,7 +91,7 @@ export function useAgentConfig() {
setTestQueryInternal(q);
updateTabSession({ testQuery: q });
}, [updateTabSession]);
- const [testResult, setTestResult] = useState<any>(null);
+ const [testResult, setTestResult] = useState<AgentResponse | null>(null);
const [selectedOutputModel, setSelectedOutputModelInternal] = useState(tabSession.selectedOutputModel);
const setSelectedOutputModel = useCallback((m: string) => {
setSelectedOutputModelInternal(m);
@@ -226,6 +227,18 @@ export function useAgentConfig() {
const loadLLMConfigs = async () => {
try {
const configs = await getLLMConfigs();
+
+ // If the fincept entry has no api_key, fill it from the session key stored in settings.
+ // This prevents the "missing API key" warning for the fincept provider even when the
+ // user is logged in (the session key lives in settings, not in the llm_configs table).
+ const finceptEntry = configs.find(c => c.provider === 'fincept');
+ if (finceptEntry && !finceptEntry.api_key) {
+ const sessionKey = await getSetting('fincept_api_key');
+ if (sessionKey) {
+ finceptEntry.api_key = sessionKey;
+ }
+ }
+
setConfiguredLLMs(configs);
const finceptLLM = configs.find(c => c.provider === 'fincept');
@@ -331,7 +344,7 @@ export function useAgentConfig() {
})
.map(a => {
let cfg: AgentConfigData = {};
- try { cfg = JSON.parse(a.config_json); } catch {}
+ try { cfg = JSON.parse(a.config_json); } catch { /* invalid JSON, use empty config */ }
return {
id: a.id,
name: a.name,
@@ -616,7 +629,8 @@ export function useAgentConfig() {
setTimeout(() => setSuccess(null), 3000);
} catch (err: any) {
if (!mountedRef.current || currentFetchId !== fetchIdRef.current) return;
- setError(err.toString());
+ const msg = typeof err === 'string' ? err : (err?.message || JSON.stringify(err));
+ setError(msg);
} finally {
if (mountedRef.current && currentFetchId === fetchIdRef.current) {
setExecuting(false);
diff --git a/fincept-terminal-desktop/src/components/tabs/agent-config/types.ts b/fincept-terminal-desktop/src/components/tabs/agent-config/types.ts
index d17c0f983..200a7bb08 100644
--- a/fincept-terminal-desktop/src/components/tabs/agent-config/types.ts
+++ b/fincept-terminal-desktop/src/components/tabs/agent-config/types.ts
@@ -188,7 +188,7 @@ export const DEFAULT_TAB_SESSION: AgentTabSessionState = {
* Extract the actual readable text from an agent response string.
*/
export function extractAgentResponseText(raw: string): string {
- if (!raw || typeof raw !== 'string') return raw || '';
+ if (!raw || typeof raw !== 'string') return typeof raw === 'object' ? JSON.stringify(raw, null, 2) : (raw || '');
try {
const parsed = JSON.parse(raw);
diff --git a/fincept-terminal-desktop/src/components/tabs/agent-config/views/AgentsView.tsx b/fincept-terminal-desktop/src/components/tabs/agent-config/views/AgentsView.tsx
index 252fb1342..9080daf7a 100644
--- a/fincept-terminal-desktop/src/components/tabs/agent-config/views/AgentsView.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/agent-config/views/AgentsView.tsx
@@ -297,7 +297,11 @@ export const AgentsView: React.FC<AgentsViewProps> = ({ state }) => {
{testResult ? (
<MarkdownRenderer
content={extractAgentResponseText(
- typeof testResult === 'string' ? testResult : (testResult.response || JSON.stringify(testResult, null, 2))
+ typeof testResult === 'string'
+ ? testResult
+ : typeof testResult.response === 'string'
+ ? testResult.response
+ : JSON.stringify(testResult, null, 2)
)}
/>
) : (
diff --git a/fincept-terminal-desktop/src/components/tabs/agent-config/views/CreateAgentView.tsx b/fincept-terminal-desktop/src/components/tabs/agent-config/views/CreateAgentView.tsx
index 4205c0b04..4250831d5 100644
--- a/fincept-terminal-desktop/src/components/tabs/agent-config/views/CreateAgentView.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/agent-config/views/CreateAgentView.tsx
@@ -238,7 +238,7 @@ export const CreateAgentView: React.FC = () => {
});
setEditingId(agent.id);
setExpandedSection('model');
- } catch {}
+ } catch { /* invalid config JSON, skip edit */ }
};
// ─── Import JSON ──────────────────────────────────────────────────────────
@@ -255,7 +255,7 @@ export const CreateAgentView: React.FC = () => {
// 1. Full agent config_json: { model, instructions, tools, ... }
// 2. Wrapped export: { name, description, category, config_json: {...} }
let cfg: AgentConfigData & { user_created?: boolean } = {};
- let meta = { name: '', description: '', category: 'custom' };
+ const meta = { name: '', description: '', category: 'custom' };
if (raw.config_json) {
// Wrapped export format
@@ -303,7 +303,7 @@ export const CreateAgentView: React.FC = () => {
const handleExportAgent = (agent: AgentConfig) => {
// Export the full wrapped format — same shape that handleImport accepts
let cfg: Record<string, any> = {};
- try { cfg = JSON.parse(agent.config_json); } catch {}
+ try { cfg = JSON.parse(agent.config_json); } catch { /* invalid JSON, export with empty config */ }
const exportData = {
name: agent.name,
@@ -806,7 +806,7 @@ export const CreateAgentView: React.FC = () => {
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
{savedAgents.map(agent => {
let cfg: AgentConfigData & { user_created?: boolean } = {};
- try { cfg = JSON.parse(agent.config_json); } catch {}
+ try { cfg = JSON.parse(agent.config_json); } catch { /* invalid JSON, render with empty config */ }
return (
<div key={agent.id} style={{
diff --git a/fincept-terminal-desktop/src/components/tabs/agent-config/views/PlannerView.tsx b/fincept-terminal-desktop/src/components/tabs/agent-config/views/PlannerView.tsx
index 2eacdc58d..9175ee9a5 100644
--- a/fincept-terminal-desktop/src/components/tabs/agent-config/views/PlannerView.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/agent-config/views/PlannerView.tsx
@@ -1171,7 +1171,7 @@ export const PlannerView: React.FC<PlannerViewProps> = ({ state }) => {
canEdit={canEditSteps && step.status === 'pending'}
onToggle={() => setExpandedSteps(prev => {
const next = new Set(prev);
- next.has(step.id) ? next.delete(step.id) : next.add(step.id);
+ if (next.has(step.id)) { next.delete(step.id); } else { next.add(step.id); }
return next;
})}
onJumpToResult={() => {
diff --git a/fincept-terminal-desktop/src/components/tabs/ai-quant-lab/PatternIntelligencePanel.tsx b/fincept-terminal-desktop/src/components/tabs/ai-quant-lab/PatternIntelligencePanel.tsx
index 44760c4d6..6298dccaa 100644
--- a/fincept-terminal-desktop/src/components/tabs/ai-quant-lab/PatternIntelligencePanel.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/ai-quant-lab/PatternIntelligencePanel.tsx
@@ -293,7 +293,7 @@ export function PatternIntelligencePanel() {
const toggleSection = useCallback((id: string) => {
setExpandedSections(prev => {
const next = new Set(prev);
- next.has(id) ? next.delete(id) : next.add(id);
+ if (next.has(id)) { next.delete(id); } else { next.add(id); }
return next;
});
}, []);
diff --git a/fincept-terminal-desktop/src/components/tabs/ai-quant-lab/cfa-quant/components/ResultsStep.tsx b/fincept-terminal-desktop/src/components/tabs/ai-quant-lab/cfa-quant/components/ResultsStep.tsx
index 75c86aa1b..21aa87d67 100644
--- a/fincept-terminal-desktop/src/components/tabs/ai-quant-lab/cfa-quant/components/ResultsStep.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/ai-quant-lab/cfa-quant/components/ResultsStep.tsx
@@ -51,24 +51,22 @@ export function ResultsStep({
refAreaLeft,
refAreaRight,
}: ResultsStepProps) {
- if (!analysisResult?.result) return null;
-
const config = analysisConfigs.find(a => a.id === selectedAnalysis);
- const result = analysisResult.result as Record<string, unknown>;
+ const result = (analysisResult?.result ?? {}) as Record<string, unknown>;
const keyMetrics = useMemo(() =>
- extractKeyMetrics(selectedAnalysis, result, priceData),
- [selectedAnalysis, result, priceData]
+ analysisResult?.result ? extractKeyMetrics(selectedAnalysis, result, priceData) : [],
+ [analysisResult, selectedAnalysis, result, priceData]
);
const resultChartData = useMemo(() =>
- buildResultChartData(selectedAnalysis, result, chartData, priceData),
- [selectedAnalysis, result, chartData, priceData]
+ analysisResult?.result ? buildResultChartData(selectedAnalysis, result, chartData, priceData) : [],
+ [analysisResult, selectedAnalysis, result, chartData, priceData]
);
// Compute cluster boundary for unsupervised learning
const clusterBoundary = useMemo(() => {
- if (selectedAnalysis !== 'unsupervised_learning') return null;
+ if (!analysisResult?.result || selectedAnalysis !== 'unsupervised_learning') return null;
const value = result.value as Record<string, Record<string, unknown>>;
if (value?.kmeans) {
const clusterLabels = value.kmeans.cluster_labels as number[];
@@ -87,28 +85,30 @@ export function ResultsStep({
}
}
return null;
- }, [selectedAnalysis, result, priceData]);
+ }, [analysisResult, selectedAnalysis, result, priceData]);
// Bootstrap reference values
const bootstrapRefs = useMemo(() => {
- if (selectedAnalysis !== 'resampling_methods') return null;
+ if (!analysisResult?.result || selectedAnalysis !== 'resampling_methods') return null;
const value = result.value as Record<string, Record<string, unknown>>;
if (value?.bootstrap) {
const mean = value.bootstrap.mean as number;
const ci = value.bootstrap.confidence_interval as [number, number];
- if (resultChartData.length > 0 && (resultChartData[0] as any)?.meanBinIdx !== undefined) {
+ if (resultChartData.length > 0 && (resultChartData[0] as Record<string, unknown>)?.meanBinIdx !== undefined) {
return {
mean,
ciLow: ci?.[0],
ciHigh: ci?.[1],
- meanIdx: (resultChartData[0] as any).meanBinIdx as number,
- ciLowIdx: (resultChartData[0] as any).ciLowIdx as number,
- ciHighIdx: (resultChartData[0] as any).ciHighIdx as number,
+ meanIdx: (resultChartData[0] as Record<string, unknown>).meanBinIdx as number,
+ ciLowIdx: (resultChartData[0] as Record<string, unknown>).ciLowIdx as number,
+ ciHighIdx: (resultChartData[0] as Record<string, unknown>).ciHighIdx as number,
};
}
}
return null;
- }, [selectedAnalysis, result, resultChartData]);
+ }, [analysisResult, selectedAnalysis, result, resultChartData]);
+
+ if (!analysisResult?.result) return null;
const exportResults = () => {
if (!analysisResult) return;
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/AlgoTradingTab.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/AlgoTradingTab.tsx
index af6818fc9..73628c39c 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/AlgoTradingTab.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/AlgoTradingTab.tsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import {
Bot, Wrench, Search, BarChart3, Layout, Activity, Library,
- Plus, Zap, ChevronRight,
+ Plus, Zap,
} from 'lucide-react';
import { listAlgoDeployments } from './services/algoTradingService';
import type { AlgoSubView, PythonStrategy } from './types';
@@ -15,12 +15,14 @@ import PythonStrategyEditor from './components/PythonStrategyEditor';
import PythonDeployPanel from './components/PythonDeployPanel';
import { F } from './constants/theme';
-const NAV_ITEMS: { key: AlgoSubView; label: string; icon: React.ElementType; description: string }[] = [
- { key: 'builder', label: 'STRATEGY BUILDER', icon: Wrench, description: 'Create & edit strategies' },
- { key: 'strategies', label: 'MY STRATEGIES', icon: Layout, description: 'Saved strategies & custom' },
- { key: 'library', label: 'STRATEGY LIBRARY', icon: Library, description: 'Pre-built Python strategies' },
- { key: 'scanner', label: 'MARKET SCANNER', icon: Search, description: 'Scan across symbols' },
- { key: 'dashboard', label: 'LIVE DASHBOARD', icon: BarChart3, description: 'Monitor deployments' },
+const font = '"IBM Plex Mono", "Consolas", monospace';
+
+const NAV_ITEMS: { key: AlgoSubView; label: string; icon: React.ElementType }[] = [
+ { key: 'builder', label: 'BUILDER', icon: Wrench },
+ { key: 'strategies', label: 'MY STRATEGIES', icon: Layout },
+ { key: 'library', label: 'LIBRARY', icon: Library },
+ { key: 'scanner', label: 'SCANNER', icon: Search },
+ { key: 'dashboard', label: 'DASHBOARD', icon: BarChart3 },
];
const AlgoTradingTab: React.FC = () => {
@@ -31,7 +33,7 @@ const AlgoTradingTab: React.FC = () => {
const [deployPythonStrategy, setDeployPythonStrategy] = useState<PythonStrategy | null>(null);
const [runningCount, setRunningCount] = useState(0);
- // Lightweight poll just for the sidebar status indicator (30s interval, not 5s)
+ // Lightweight poll for status indicator (30s interval)
useEffect(() => {
const checkStatus = async () => {
const result = await listAlgoDeployments();
@@ -75,245 +77,134 @@ const AlgoTradingTab: React.FC = () => {
setActiveView('strategies');
};
+ const isBuilder = activeView === 'builder';
+
return (
- <div style={{
- display: 'flex',
- height: '100%',
- backgroundColor: F.DARK_BG,
- fontFamily: '"IBM Plex Mono", "Consolas", monospace',
- color: F.WHITE,
- }}>
- {/* ─── LEFT SIDEBAR NAVIGATION ─── */}
- <div style={{
- width: '220px',
- backgroundColor: F.PANEL_BG,
- borderRight: `1px solid ${F.BORDER}`,
- display: 'flex',
- flexDirection: 'column',
- flexShrink: 0,
- }}>
- {/* Logo / Header */}
- <div style={{
- padding: '16px',
- borderBottom: `1px solid ${F.BORDER}`,
- display: 'flex',
- alignItems: 'center',
- gap: '10px',
- }}>
- <div style={{
- width: '32px',
- height: '32px',
- borderRadius: '2px',
- backgroundColor: `${F.ORANGE}20`,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- }}>
- <Bot size={18} style={{ color: F.ORANGE }} />
+ <div style={{ width: '100%', height: '100%', display: 'flex', flexDirection: 'column', overflow: 'hidden', backgroundColor: F.DARK_BG, fontFamily: font, color: F.WHITE }}>
+
+ {/* ═══════ UNIFIED TOP BAR ═══════ */}
+ {/* Single-row header that merges logo/title, nav tabs, and contextual controls */}
+ <div style={{ display: 'flex', alignItems: 'center', flexShrink: 0, backgroundColor: F.HEADER_BG, borderBottom: `2px solid ${F.ORANGE}`, boxShadow: `0 2px 8px ${F.ORANGE}20`, padding: '0 12px', height: '40px', gap: '0' }}>
+
+ {/* Logo + Title (compact) */}
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px', paddingRight: '12px', borderRight: `1px solid ${F.BORDER}`, height: '100%', flexShrink: 0 }}>
+ <div style={{ width: '26px', height: '26px', borderRadius: '2px', display: 'flex', alignItems: 'center', justifyContent: 'center', backgroundColor: `${F.ORANGE}20` }}>
+ <Bot size={14} style={{ color: F.ORANGE }} />
</div>
- <div>
- <div style={{ fontSize: '11px', fontWeight: 700, letterSpacing: '1px' }}>
- ALGO TRADING
- </div>
- <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '2px' }}>
- STRATEGY ENGINE v1.0
- </div>
+ <div style={{ lineHeight: 1 }}>
+ <div style={{ fontSize: '11px', fontWeight: 700, letterSpacing: '1px', color: F.WHITE }}>ALGO</div>
+ <div style={{ fontSize: '8px', color: F.MUTED, letterSpacing: '0.5px' }}>TRADING</div>
</div>
</div>
- {/* Quick Action */}
- <div style={{ padding: '12px' }}>
- <button
- onClick={handleNewStrategy}
- style={{
- width: '100%',
- padding: '10px 12px',
- backgroundColor: F.ORANGE,
- color: F.DARK_BG,
- border: 'none',
- borderRadius: '2px',
- fontSize: '9px',
- fontWeight: 700,
- letterSpacing: '0.5px',
- cursor: 'pointer',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- gap: '6px',
- transition: 'all 0.2s',
- }}
- onMouseEnter={e => { e.currentTarget.style.opacity = '0.9'; }}
- onMouseLeave={e => { e.currentTarget.style.opacity = '1'; }}
- >
- <Plus size={12} />
- NEW STRATEGY
- </button>
- </div>
-
- {/* Navigation Items */}
- <div style={{ flex: 1, overflowY: 'auto', padding: '4px 8px' }}>
- {NAV_ITEMS.map(({ key, label, icon: Icon, description }) => {
+ {/* Navigation Tabs */}
+ <div style={{ display: 'flex', alignItems: 'stretch', height: '100%', gap: '0', flexShrink: 0 }}>
+ {NAV_ITEMS.map(({ key, label, icon: Icon }) => {
const isActive = activeView === key;
+ const isDashboard = key === 'dashboard';
return (
<button
key={key}
onClick={() => setActiveView(key)}
style={{
- width: '100%',
- padding: '10px 12px',
- backgroundColor: isActive ? `${F.ORANGE}15` : 'transparent',
- borderLeft: isActive ? `2px solid ${F.ORANGE}` : '2px solid transparent',
- border: 'none',
- borderRadius: '2px',
- cursor: 'pointer',
- display: 'flex',
- alignItems: 'center',
- gap: '10px',
- marginBottom: '2px',
- transition: 'all 0.2s',
- textAlign: 'left',
- }}
- onMouseEnter={e => {
- if (!isActive) e.currentTarget.style.backgroundColor = F.HOVER;
- }}
- onMouseLeave={e => {
- if (!isActive) e.currentTarget.style.backgroundColor = 'transparent';
+ display: 'flex', alignItems: 'center', gap: '5px',
+ padding: '0 14px', border: 'none', cursor: 'pointer',
+ backgroundColor: isActive ? `${F.ORANGE}10` : 'transparent',
+ borderBottom: isActive ? `2px solid ${F.ORANGE}` : '2px solid transparent',
+ color: isActive ? F.ORANGE : F.GRAY,
+ fontSize: '10px', fontWeight: 700, letterSpacing: '0.5px',
+ fontFamily: font, transition: 'all 0.15s',
}}
+ onMouseEnter={e => { if (!isActive) { e.currentTarget.style.color = F.WHITE; e.currentTarget.style.backgroundColor = F.HOVER; } }}
+ onMouseLeave={e => { if (!isActive) { e.currentTarget.style.color = F.GRAY; e.currentTarget.style.backgroundColor = 'transparent'; } }}
>
- <Icon size={14} style={{ color: isActive ? F.ORANGE : F.MUTED, flexShrink: 0 }} />
- <div style={{ flex: 1, minWidth: 0 }}>
- <div style={{
- fontSize: '9px',
- fontWeight: 700,
- letterSpacing: '0.5px',
- color: isActive ? F.WHITE : F.GRAY,
- }}>
- {label}
- </div>
- <div style={{
- fontSize: '8px',
- color: F.MUTED,
- marginTop: '2px',
- }}>
- {description}
- </div>
- </div>
- {isActive && <ChevronRight size={10} style={{ color: F.ORANGE }} />}
+ <Icon size={12} />
+ {label}
+ {isDashboard && runningCount > 0 && (
+ <span style={{ fontSize: '8px', fontWeight: 700, padding: '1px 5px', borderRadius: '2px', backgroundColor: F.GREEN, color: F.DARK_BG, marginLeft: '2px' }}>
+ {runningCount}
+ </span>
+ )}
</button>
);
})}
</div>
- {/* Sidebar Footer - Status */}
- <div style={{
- padding: '12px 16px',
- borderTop: `1px solid ${F.BORDER}`,
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '6px', marginBottom: '8px' }}>
- <Zap size={10} style={{ color: F.YELLOW }} />
- <span style={{ fontSize: '8px', color: F.GRAY, letterSpacing: '0.5px' }}>DEPLOYMENTS</span>
- </div>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
- <span style={{
- width: '6px', height: '6px', borderRadius: '50%',
- backgroundColor: runningCount > 0 ? F.GREEN : F.MUTED,
- display: 'inline-block',
- }} />
- <span style={{ fontSize: '8px', color: runningCount > 0 ? F.GREEN : F.MUTED }}>
- {runningCount > 0 ? `${runningCount} RUNNING` : 'IDLE'}
- </span>
- </div>
+ {/* Spacer */}
+ <div style={{ flex: 1 }} />
+
+ {/* Right-side contextual controls */}
+ {runningCount > 0 && (
+ <div style={{ display: 'flex', alignItems: 'center', gap: '5px', padding: '0 10px', marginRight: '8px' }}>
+ <Activity size={10} style={{ color: F.GREEN }} />
+ <span style={{ fontSize: '9px', fontWeight: 700, color: F.GREEN }}>{runningCount} LIVE</span>
</div>
- </div>
+ )}
+
+ {!isBuilder && (
+ <button
+ onClick={handleNewStrategy}
+ style={{
+ display: 'flex', alignItems: 'center', gap: '5px',
+ padding: '5px 12px', border: 'none', borderRadius: '2px',
+ backgroundColor: F.ORANGE, color: F.DARK_BG,
+ fontSize: '9px', fontWeight: 700, letterSpacing: '0.5px',
+ cursor: 'pointer', fontFamily: font, transition: 'opacity 0.15s',
+ }}
+ onMouseEnter={e => { e.currentTarget.style.opacity = '0.85'; }}
+ onMouseLeave={e => { e.currentTarget.style.opacity = '1'; }}
+ >
+ <Plus size={12} />NEW
+ </button>
+ )}
</div>
- {/* ─── MAIN CONTENT AREA ─── */}
- <div style={{
- flex: 1,
- display: 'flex',
- flexDirection: 'column',
- overflow: 'hidden',
- minWidth: 0,
- }}>
- {/* Top Breadcrumb Bar */}
- <div style={{
- padding: '8px 20px',
- backgroundColor: F.HEADER_BG,
- borderBottom: `2px solid ${F.ORANGE}`,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- boxShadow: `0 2px 8px ${F.ORANGE}20`,
- flexShrink: 0,
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <span style={{ fontSize: '9px', color: F.MUTED }}>ALGO TRADING</span>
- <ChevronRight size={10} style={{ color: F.MUTED }} />
- <span style={{ fontSize: '10px', fontWeight: 700, color: F.ORANGE, letterSpacing: '0.5px' }}>
- {NAV_ITEMS.find(n => n.key === activeView)?.label}
- </span>
- </div>
- {runningCount > 0 && (
- <div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
- <Activity size={10} style={{ color: F.GREEN }} />
- <span style={{ fontSize: '8px', color: F.GREEN }}>{runningCount} LIVE</span>
- </div>
- )}
- </div>
+ {/* ─── VIEW CONTENT ─── */}
+ <div style={{ flex: 1, overflow: 'hidden', minHeight: 0 }}>
+ {activeView === 'builder' && (
+ <StrategyEditor
+ editStrategyId={editStrategyId}
+ onSaved={() => setActiveView('strategies')}
+ onCancel={() => {
+ setEditStrategyId(null);
+ setActiveView('strategies');
+ }}
+ />
+ )}
+ {activeView === 'strategies' && (
+ <StrategyManager
+ onEdit={handleEditStrategy}
+ onNew={handleNewStrategy}
+ onBacktestPython={handlePythonBacktest}
+ onDeployPython={handlePythonDeploy}
+ onDeployedJson={() => setActiveView('dashboard')}
+ />
+ )}
+ {activeView === 'library' && (
+ <StrategyLibraryTab
+ onClone={handlePythonClone}
+ onBacktest={handlePythonBacktest}
+ onDeploy={handlePythonDeploy}
+ />
+ )}
+ {activeView === 'scanner' && <ScannerPanel />}
+ {activeView === 'dashboard' && <MonitorDashboard />}
+ </div>
- {/* View Content */}
- <div style={{ flex: 1, overflow: 'hidden', minHeight: 0 }}>
- {activeView === 'builder' && (
- <StrategyEditor
- editStrategyId={editStrategyId}
- onSaved={() => setActiveView('strategies')}
- onCancel={() => {
- setEditStrategyId(null);
- setActiveView('strategies');
- }}
- />
- )}
- {activeView === 'strategies' && (
- <StrategyManager
- onEdit={handleEditStrategy}
- onNew={handleNewStrategy}
- onBacktestPython={handlePythonBacktest}
- onDeployPython={handlePythonDeploy}
- onDeployedJson={() => setActiveView('dashboard')}
- />
- )}
- {activeView === 'library' && (
- <StrategyLibraryTab
- onClone={handlePythonClone}
- onBacktest={handlePythonBacktest}
- onDeploy={handlePythonDeploy}
- />
- )}
- {activeView === 'scanner' && <ScannerPanel />}
- {activeView === 'dashboard' && <MonitorDashboard />}
+ {/* ─── STATUS BAR ─── */}
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '3px 16px', flexShrink: 0, backgroundColor: F.HEADER_BG, borderTop: `1px solid ${F.BORDER}`, fontSize: '9px', fontFamily: font, color: F.GRAY }}>
+ <div style={{ display: 'flex', gap: '16px' }}>
+ <span><span style={{ color: F.MUTED }}>ENGINE:</span> v1.0</span>
+ <span>
+ <span style={{ color: F.MUTED }}>DEPLOYMENTS:</span>{' '}
+ <span style={{ color: runningCount > 0 ? F.GREEN : F.MUTED }}>{runningCount} active</span>
+ </span>
</div>
-
- {/* Bottom Status Bar */}
- <div style={{
- backgroundColor: F.HEADER_BG,
- borderTop: `1px solid ${F.BORDER}`,
- padding: '4px 20px',
- fontSize: '9px',
- color: F.GRAY,
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'center',
- flexShrink: 0,
- }}>
- <div style={{ display: 'flex', gap: '16px' }}>
- <span><span style={{ color: F.MUTED }}>ENGINE:</span> v1.0</span>
- <span><span style={{ color: F.MUTED }}>DEPLOYMENTS:</span> <span style={{ color: runningCount > 0 ? F.GREEN : F.MUTED }}>{runningCount} active</span></span>
- </div>
- <div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
- <span style={{ width: '6px', height: '6px', borderRadius: '50%', backgroundColor: runningCount > 0 ? F.GREEN : F.MUTED }} />
- <span style={{ color: runningCount > 0 ? F.GREEN : F.MUTED }}>{runningCount > 0 ? 'ACTIVE' : 'IDLE'}</span>
- </div>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
+ <Zap size={9} style={{ color: runningCount > 0 ? F.GREEN : F.MUTED }} />
+ <span style={{ color: runningCount > 0 ? F.GREEN : F.MUTED }}>
+ {runningCount > 0 ? 'ACTIVE' : 'IDLE'}
+ </span>
</div>
</div>
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ConditionBuilder.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ConditionBuilder.tsx
index 14a03806a..49d112d6d 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ConditionBuilder.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ConditionBuilder.tsx
@@ -1,7 +1,6 @@
import React, { useState } from 'react';
-import { Plus, ChevronDown, ChevronRight, Zap, Layers, Sparkles } from 'lucide-react';
+import { Sparkles, Zap } from 'lucide-react';
import type { ConditionItem } from '../types';
-import { getIndicatorDef } from '../constants/indicators';
import ConditionRow from './ConditionRow';
import { F } from '../constants/theme';
@@ -11,22 +10,16 @@ interface ConditionBuilderProps {
logic: 'AND' | 'OR';
onConditionsChange: (conditions: ConditionItem[]) => void;
onLogicChange: (logic: 'AND' | 'OR') => void;
+ selectedIndex?: number;
}
+const font = '"IBM Plex Mono", "Consolas", monospace';
+
const DEFAULT_CONDITION: ConditionItem = {
- indicator: 'RSI',
- params: { period: 14 },
- field: 'value',
- operator: 'crosses_below',
- value: 30,
+ indicator: 'RSI', params: { period: 14 }, field: 'value', operator: 'crosses_below', value: 30,
};
-// Quick-add condition templates for the dropdown
-interface QuickCondition {
- label: string;
- category: string;
- condition: ConditionItem;
-}
+interface QuickCondition { label: string; category: string; condition: ConditionItem; }
const QUICK_CONDITIONS: QuickCondition[] = [
{ label: 'RSI < 30 (Oversold)', category: 'Momentum', condition: { indicator: 'RSI', params: { period: 14 }, field: 'value', operator: '<', value: 30 } },
@@ -44,21 +37,11 @@ const QUICK_CONDITIONS: QuickCondition[] = [
];
const ConditionBuilder: React.FC<ConditionBuilderProps> = ({
- label,
- conditions,
- logic,
- onConditionsChange,
- onLogicChange,
+ conditions, onConditionsChange, selectedIndex,
}) => {
- const [showQuickAdd, setShowQuickAdd] = useState(false);
- const [dragIndex, setDragIndex] = useState<number | null>(null);
-
- const handleAdd = (condition?: ConditionItem) => {
- // Deep clone to avoid mutating template constants (params/compareParams are nested objects)
- const newCondition = JSON.parse(JSON.stringify(condition || DEFAULT_CONDITION));
- onConditionsChange([...conditions, newCondition]);
- setShowQuickAdd(false);
- };
+ const [showTemplates, setShowTemplates] = useState(false);
+ const idx = selectedIndex ?? 0;
+ const cond = conditions[idx];
const handleChange = (index: number, updated: ConditionItem) => {
const next = [...conditions];
@@ -66,402 +49,85 @@ const ConditionBuilder: React.FC<ConditionBuilderProps> = ({
onConditionsChange(next);
};
- const handleRemove = (index: number) => {
- onConditionsChange(conditions.filter((_, i) => i !== index));
- };
-
- const handleDuplicate = (index: number) => {
- const clone = JSON.parse(JSON.stringify(conditions[index]));
- const next = [...conditions];
- next.splice(index + 1, 0, clone);
- onConditionsChange(next);
- };
-
- const handleMoveUp = (index: number) => {
- if (index === 0) return;
- const next = [...conditions];
- [next[index - 1], next[index]] = [next[index], next[index - 1]];
- onConditionsChange(next);
- };
-
- const handleMoveDown = (index: number) => {
- if (index >= conditions.length - 1) return;
+ const handleApplyTemplate = (template: ConditionItem) => {
+ const clone = JSON.parse(JSON.stringify(template));
const next = [...conditions];
- [next[index], next[index + 1]] = [next[index + 1], next[index]];
+ next[idx] = clone;
onConditionsChange(next);
+ setShowTemplates(false);
};
- // Group quick conditions by category
- const groupedQuickConditions = QUICK_CONDITIONS.reduce((acc, qc) => {
+ const groupedTemplates = QUICK_CONDITIONS.reduce((acc, qc) => {
if (!acc[qc.category]) acc[qc.category] = [];
acc[qc.category].push(qc);
return acc;
}, {} as Record<string, QuickCondition[]>);
- return (
- <div style={{ position: 'relative' }}>
- {/* Logic toggle + label bar */}
- {label && (
- <div style={{
- padding: '8px 12px',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <Layers size={10} color={F.MUTED} />
- <span style={{ fontSize: '9px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>
- {label.toUpperCase()}
- </span>
- </div>
- </div>
- )}
-
- {/* Logic selector - shown when >1 conditions */}
- {conditions.length > 1 && (
- <div style={{
- display: 'flex',
- alignItems: 'center',
- gap: '8px',
- padding: '4px 12px 8px',
- }}>
- <span style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px' }}>
- MATCH:
- </span>
- {(['AND', 'OR'] as const).map(l => (
- <button
- key={l}
- onClick={() => onLogicChange(l)}
- style={{
- padding: '4px 12px',
- backgroundColor: logic === l ? (l === 'AND' ? F.ORANGE : F.BLUE) : 'transparent',
- color: logic === l ? (l === 'AND' ? F.DARK_BG : F.WHITE) : F.GRAY,
- border: logic === l ? 'none' : `1px solid ${F.BORDER}`,
- fontSize: '9px',
- fontWeight: 700,
- letterSpacing: '0.5px',
- cursor: 'pointer',
- borderRadius: '2px',
- transition: 'all 0.2s',
- }}
- onMouseEnter={e => {
- if (logic !== l) {
- e.currentTarget.style.borderColor = F.ORANGE;
- e.currentTarget.style.color = F.WHITE;
- }
- }}
- onMouseLeave={e => {
- if (logic !== l) {
- e.currentTarget.style.borderColor = F.BORDER;
- e.currentTarget.style.color = F.GRAY;
- }
- }}
- >
- {l === 'AND' ? 'ALL CONDITIONS (AND)' : 'ANY CONDITION (OR)'}
- </button>
- ))}
- </div>
- )}
-
- {/* Condition Cards */}
- <div style={{ padding: '0 8px' }}>
- {conditions.length === 0 && (
- <div style={{
- padding: '32px 16px',
- textAlign: 'center',
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- gap: '8px',
- }}>
- <Zap size={20} color={F.MUTED} style={{ opacity: 0.5 }} />
- <div style={{ fontSize: '10px', color: F.MUTED, fontWeight: 700 }}>
- NO CONDITIONS DEFINED
- </div>
- <div style={{ fontSize: '9px', color: F.MUTED, maxWidth: '300px', lineHeight: '1.5' }}>
- Add technical indicator conditions to define when trades should be triggered.
- Use the buttons below to add or select from templates.
- </div>
- </div>
- )}
-
- {conditions.map((cond, i) => (
- <div key={i}>
- {/* Logic connector between cards */}
- {i > 0 && (
- <div style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- padding: '4px 0',
- position: 'relative',
- }}>
- <div style={{
- position: 'absolute', left: '50%', top: 0, bottom: 0,
- width: '1px', backgroundColor: F.BORDER,
- }} />
- <div style={{
- padding: '2px 10px',
- backgroundColor: logic === 'AND' ? F.ORANGE : F.BLUE,
- color: logic === 'AND' ? F.DARK_BG : F.WHITE,
- fontSize: '8px',
- fontWeight: 700,
- letterSpacing: '1px',
- borderRadius: '2px',
- position: 'relative',
- zIndex: 1,
- }}>
- {logic}
- </div>
- </div>
- )}
-
- {/* Condition Card */}
- <div style={{
- backgroundColor: F.DARK_BG,
- border: `1px solid ${dragIndex === i ? F.ORANGE : F.BORDER}`,
- borderRadius: '2px',
- overflow: 'hidden',
- transition: 'border-color 0.2s',
- }}>
- {/* Card header with number and indicator name */}
- <div style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- padding: '6px 10px',
- backgroundColor: F.HEADER_BG,
- borderBottom: `1px solid ${F.BORDER}`,
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <span style={{
- width: '18px', height: '18px', borderRadius: '2px',
- backgroundColor: `${F.ORANGE}20`, color: F.ORANGE,
- fontSize: '9px', fontWeight: 700,
- display: 'flex', alignItems: 'center', justifyContent: 'center',
- }}>
- {i + 1}
- </span>
- <span style={{ fontSize: '9px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
- {getIndicatorDef(cond.indicator)?.label || cond.indicator}
- </span>
- <span style={{ fontSize: '8px', color: F.MUTED }}>
- {Object.values(cond.params).length > 0 && `(${Object.values(cond.params).join(', ')})`}
- </span>
- </div>
- <div style={{ display: 'flex', alignItems: 'center', gap: '2px' }}>
- {/* Move up/down */}
- {conditions.length > 1 && (
- <>
- <button
- onClick={() => handleMoveUp(i)}
- disabled={i === 0}
- style={{
- padding: '2px 4px', backgroundColor: 'transparent', border: 'none',
- color: i === 0 ? F.MUTED + '40' : F.MUTED, cursor: i === 0 ? 'default' : 'pointer',
- fontSize: '10px', lineHeight: 1,
- }}
- onMouseEnter={e => { if (i > 0) e.currentTarget.style.color = F.WHITE; }}
- onMouseLeave={e => { if (i > 0) e.currentTarget.style.color = F.MUTED; }}
- title="Move up"
- >
- &#9650;
- </button>
- <button
- onClick={() => handleMoveDown(i)}
- disabled={i >= conditions.length - 1}
- style={{
- padding: '2px 4px', backgroundColor: 'transparent', border: 'none',
- color: i >= conditions.length - 1 ? F.MUTED + '40' : F.MUTED,
- cursor: i >= conditions.length - 1 ? 'default' : 'pointer',
- fontSize: '10px', lineHeight: 1,
- }}
- onMouseEnter={e => { if (i < conditions.length - 1) e.currentTarget.style.color = F.WHITE; }}
- onMouseLeave={e => { if (i < conditions.length - 1) e.currentTarget.style.color = F.MUTED; }}
- title="Move down"
- >
- &#9660;
- </button>
- </>
- )}
- {/* Duplicate */}
- <button
- onClick={() => handleDuplicate(i)}
- style={{
- padding: '2px 6px', backgroundColor: 'transparent', border: 'none',
- color: F.MUTED, cursor: 'pointer', fontSize: '9px', fontWeight: 700,
- }}
- onMouseEnter={e => { e.currentTarget.style.color = F.CYAN; }}
- onMouseLeave={e => { e.currentTarget.style.color = F.MUTED; }}
- title="Duplicate condition"
- >
- DUP
- </button>
- {/* Remove */}
- <button
- onClick={() => handleRemove(i)}
- style={{
- padding: '2px 6px', backgroundColor: 'transparent', border: 'none',
- color: F.MUTED, cursor: 'pointer', fontSize: '10px', fontWeight: 700,
- }}
- onMouseEnter={e => { e.currentTarget.style.color = F.RED; }}
- onMouseLeave={e => { e.currentTarget.style.color = F.MUTED; }}
- title="Remove condition"
- >
- &#10005;
- </button>
- </div>
- </div>
-
- {/* Card body with controls */}
- <ConditionRow
- condition={cond}
- index={i}
- onChange={handleChange}
- onRemove={handleRemove}
- />
- </div>
- </div>
- ))}
+ if (!cond) {
+ return (
+ <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', color: F.MUTED, fontSize: '10px', textAlign: 'center' }}>
+ <Zap size={24} style={{ marginBottom: '8px', opacity: 0.5 }} />
+ <span>Select a condition from the left panel</span>
</div>
+ );
+ }
- {/* ─── ADD BUTTONS ─── */}
- <div style={{
- padding: '10px 12px',
- display: 'flex',
- gap: '6px',
- alignItems: 'center',
- }}>
- <button
- onClick={() => handleAdd()}
- style={{
- padding: '8px 14px',
- backgroundColor: 'transparent',
- border: `1px dashed ${F.BORDER}`,
- color: F.GRAY,
- fontSize: '9px',
- fontWeight: 700,
- borderRadius: '2px',
- cursor: 'pointer',
- display: 'flex',
- alignItems: 'center',
- gap: '6px',
- transition: 'all 0.2s',
- letterSpacing: '0.5px',
- }}
- onMouseEnter={e => {
- e.currentTarget.style.borderColor = F.ORANGE;
- e.currentTarget.style.color = F.ORANGE;
- e.currentTarget.style.backgroundColor = `${F.ORANGE}10`;
- }}
- onMouseLeave={e => {
- e.currentTarget.style.borderColor = F.BORDER;
- e.currentTarget.style.color = F.GRAY;
- e.currentTarget.style.backgroundColor = 'transparent';
- }}
- >
- <Plus size={11} />
- ADD CONDITION
- </button>
-
+ return (
+ <div style={{ fontFamily: font }}>
+ {/* Template bar */}
+ <div style={{ padding: '6px 12px', borderBottom: `1px solid ${F.BORDER}`, display: 'flex', alignItems: 'center', gap: '8px', backgroundColor: F.HEADER_BG }}>
<button
- onClick={() => setShowQuickAdd(!showQuickAdd)}
+ onClick={() => setShowTemplates(!showTemplates)}
style={{
- padding: '8px 14px',
- backgroundColor: showQuickAdd ? `${F.CYAN}15` : 'transparent',
- border: `1px solid ${showQuickAdd ? F.CYAN + '60' : F.BORDER}`,
- color: showQuickAdd ? F.CYAN : F.GRAY,
- fontSize: '9px',
- fontWeight: 700,
- borderRadius: '2px',
- cursor: 'pointer',
- display: 'flex',
- alignItems: 'center',
- gap: '6px',
- transition: 'all 0.2s',
- letterSpacing: '0.5px',
- }}
- onMouseEnter={e => {
- if (!showQuickAdd) {
- e.currentTarget.style.borderColor = F.CYAN;
- e.currentTarget.style.color = F.CYAN;
- }
- }}
- onMouseLeave={e => {
- if (!showQuickAdd) {
- e.currentTarget.style.borderColor = F.BORDER;
- e.currentTarget.style.color = F.GRAY;
- }
+ padding: '4px 8px', backgroundColor: showTemplates ? `${F.CYAN}15` : 'transparent',
+ borderWidth: '1px', borderStyle: 'solid', borderColor: showTemplates ? F.CYAN + '50' : F.BORDER,
+ color: showTemplates ? F.CYAN : F.GRAY,
+ fontSize: '9px', fontWeight: 700, borderRadius: '2px', cursor: 'pointer',
+ display: 'flex', alignItems: 'center', gap: '4px', fontFamily: font, transition: 'all 0.2s',
}}
+ onMouseEnter={e => { if (!showTemplates) { e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.color = F.WHITE; } }}
+ onMouseLeave={e => { if (!showTemplates) { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; } }}
>
- <Sparkles size={10} />
- {showQuickAdd ? <ChevronDown size={10} /> : <ChevronRight size={10} />}
- TEMPLATES
+ <Sparkles size={10} /> TEMPLATES
</button>
+ <span style={{ fontSize: '9px', color: F.MUTED }}>Replace current condition with a preset</span>
</div>
- {/* ─── TEMPLATE DROPDOWN (Categorized) ─── */}
- {showQuickAdd && (
- <div style={{
- margin: '0 12px 12px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- overflow: 'hidden',
- }}>
- {Object.entries(groupedQuickConditions).map(([category, items]) => (
- <div key={category}>
- {/* Category header */}
- <div style={{
- padding: '6px 12px',
- backgroundColor: F.HEADER_BG,
- borderBottom: `1px solid ${F.BORDER}`,
- }}>
- <span style={{
- fontSize: '8px', fontWeight: 700, color: F.MUTED,
- letterSpacing: '0.5px',
- }}>
- {category.toUpperCase()}
- </span>
+ {/* Template dropdown */}
+ {showTemplates && (
+ <div style={{ borderBottom: `1px solid ${F.BORDER}`, padding: '8px', backgroundColor: F.DARK_BG }}>
+ {Object.entries(groupedTemplates).map(([category, items]) => (
+ <div key={category} style={{ marginBottom: '6px' }}>
+ <div style={{ fontSize: '8px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px', marginBottom: '4px', padding: '0 4px' }}>{category.toUpperCase()}</div>
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '4px' }}>
+ {items.map((qc, qi) => (
+ <button
+ key={qi}
+ onClick={() => handleApplyTemplate(qc.condition)}
+ style={{
+ padding: '6px 8px', backgroundColor: 'transparent', borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER,
+ color: F.GRAY, fontSize: '9px', fontFamily: font, textAlign: 'left',
+ borderRadius: '2px', cursor: 'pointer', transition: 'all 0.2s',
+ }}
+ onMouseEnter={e => { e.currentTarget.style.backgroundColor = F.HOVER; e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.color = F.WHITE; }}
+ onMouseLeave={e => { e.currentTarget.style.backgroundColor = 'transparent'; e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
+ >
+ {qc.label}
+ </button>
+ ))}
</div>
- {/* Category items */}
- {items.map((qc, i) => (
- <button
- key={i}
- onClick={() => handleAdd(qc.condition)}
- style={{
- width: '100%',
- padding: '8px 12px',
- backgroundColor: 'transparent',
- border: 'none',
- borderBottom: `1px solid ${F.BORDER}30`,
- color: F.GRAY,
- fontSize: '9px',
- fontFamily: '"IBM Plex Mono", monospace',
- cursor: 'pointer',
- textAlign: 'left',
- transition: 'all 0.15s',
- display: 'flex',
- alignItems: 'center',
- gap: '8px',
- }}
- onMouseEnter={e => {
- e.currentTarget.style.backgroundColor = `${F.ORANGE}10`;
- e.currentTarget.style.color = F.WHITE;
- }}
- onMouseLeave={e => {
- e.currentTarget.style.backgroundColor = 'transparent';
- e.currentTarget.style.color = F.GRAY;
- }}
- >
- <Plus size={9} style={{ color: F.ORANGE, flexShrink: 0 }} />
- {qc.label}
- </button>
- ))}
</div>
))}
</div>
)}
+
+ {/* Condition editor */}
+ <ConditionRow
+ condition={cond}
+ index={idx}
+ onChange={handleChange}
+ onRemove={() => {}}
+ />
</div>
);
};
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ConditionRow.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ConditionRow.tsx
index 6408bf091..5ed846e16 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ConditionRow.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ConditionRow.tsx
@@ -1,26 +1,15 @@
import React from 'react';
-import { Clock, ArrowRight, AlertTriangle } from 'lucide-react';
+import { Clock, AlertTriangle } from 'lucide-react';
import type { ConditionItem } from '../types';
import { INDICATOR_DEFINITIONS, OPERATORS, getIndicatorDef } from '../constants/indicators';
import { F } from '../constants/theme';
-// Operator labels for readable display
-const OPERATOR_LABELS: Record<string, string> = {
- '>': 'Greater than',
- '<': 'Less than',
- '>=': 'Greater or equal',
- '<=': 'Less or equal',
- '==': 'Equal to',
- 'crosses_above': 'Crossed above',
- 'crosses_below': 'Crossed below',
- 'between': 'Between',
- 'crossed_above_within': 'Crossed above within',
- 'crossed_below_within': 'Crossed below within',
- 'rising': 'Rising for',
- 'falling': 'Falling for',
-};
+const font = '"IBM Plex Mono", "Consolas", monospace';
+const cellLabel: React.CSSProperties = { fontSize: '7px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', textTransform: 'uppercase', marginBottom: '3px', display: 'block' };
+const inputBase: React.CSSProperties = { padding: '5px 6px', backgroundColor: F.DARK_BG, color: F.WHITE, borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER, borderRadius: '2px', fontSize: '10px', fontFamily: font, outline: 'none' };
+const selectBase: React.CSSProperties = { ...inputBase, cursor: 'pointer' };
+const paramInput: React.CSSProperties = { ...inputBase, width: '52px', fontSize: '9px', padding: '3px 5px' };
-// Indicator scale types for compatibility checking
type ScaleType = 'price' | 'percent_0_100' | 'percent_0_1' | 'oscillator' | 'direction' | 'volume' | 'ratio';
const INDICATOR_SCALES: Record<string, ScaleType> = {
@@ -49,28 +38,15 @@ function getIndicatorScale(indicator: string, field: string): ScaleType {
return INDICATOR_SCALES[indicator] || 'price';
}
-function areScalesCompatible(scale1: ScaleType, scale2: ScaleType): boolean {
- if (scale1 === scale2) return true;
- const priceScales: ScaleType[] = ['price'];
- if (priceScales.includes(scale1) && priceScales.includes(scale2)) return true;
- const percent100Scales: ScaleType[] = ['percent_0_100'];
- if (percent100Scales.includes(scale1) && percent100Scales.includes(scale2)) return true;
- const oscillatorScales: ScaleType[] = ['oscillator'];
- if (oscillatorScales.includes(scale1) && oscillatorScales.includes(scale2)) return true;
- return false;
-}
-
-function getCompatibilityWarning(
- indicator1: string, field1: string, indicator2: string, field2: string
-): string | null {
+function getCompatibilityWarning(indicator1: string, field1: string, indicator2: string, field2: string): string | null {
const scale1 = getIndicatorScale(indicator1, field1);
const scale2 = getIndicatorScale(indicator2, field2);
- if (areScalesCompatible(scale1, scale2)) return null;
+ if (scale1 === scale2) return null;
const scaleLabels: Record<ScaleType, string> = {
- 'price': 'price level', 'percent_0_100': '0-100 range', 'percent_0_1': '0-1 range',
- 'oscillator': 'oscillator', 'direction': 'direction (-1/1)', 'volume': 'volume', 'ratio': 'ratio',
+ 'price': 'Price', 'percent_0_100': '0-100', 'percent_0_1': '0-1',
+ 'oscillator': 'Osc', 'direction': 'Dir', 'volume': 'Vol', 'ratio': 'Ratio',
};
- return `Incompatible scales: ${indicator1} is ${scaleLabels[scale1]}, ${indicator2} is ${scaleLabels[scale2]}`;
+ return `Scale: ${scaleLabels[scale1]} vs ${scaleLabels[scale2]}`;
}
interface ConditionRowProps {
@@ -80,49 +56,23 @@ interface ConditionRowProps {
onRemove: (index: number) => void;
}
-const selectStyle: React.CSSProperties = {
- backgroundColor: F.DARK_BG,
- color: F.WHITE,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- padding: '6px 8px',
- fontSize: '10px',
- fontFamily: '"IBM Plex Mono", monospace',
- outline: 'none',
-};
-
-const inputStyle: React.CSSProperties = {
- ...selectStyle,
- width: '60px',
-};
-
const categories = ['stock_attributes', 'moving_averages', 'momentum', 'trend', 'volatility', 'volume'] as const;
-
const categoryLabels: Record<string, string> = {
- stock_attributes: 'Stock',
- moving_averages: 'Moving Avg',
- momentum: 'Momentum',
- trend: 'Trend',
- volatility: 'Volatility',
- volume: 'Volume',
+ stock_attributes: 'Stock', moving_averages: 'MA', momentum: 'Momentum',
+ trend: 'Trend', volatility: 'Volatility', volume: 'Volume',
};
-// Render indicator selector dropdown
-function IndicatorSelect({ value, onChange, style }: {
- value: string;
- onChange: (name: string) => void;
- style?: React.CSSProperties;
+function IndicatorSelect({ value, onChange, style: extraStyle }: {
+ value: string; onChange: (name: string) => void; style?: React.CSSProperties;
}) {
return (
- <select value={value} onChange={e => onChange(e.target.value)} style={{ ...selectStyle, ...style }}>
+ <select value={value} onChange={e => onChange(e.target.value)} style={{ ...selectBase, ...extraStyle }}>
{categories.map(cat => {
const indicators = INDICATOR_DEFINITIONS.filter(d => d.category === cat);
if (indicators.length === 0) return null;
return (
<optgroup key={cat} label={categoryLabels[cat] || cat}>
- {indicators.map(d => (
- <option key={d.name} value={d.name}>{d.label}</option>
- ))}
+ {indicators.map(d => <option key={d.name} value={d.name}>{d.label}</option>)}
</optgroup>
);
})}
@@ -130,67 +80,17 @@ function IndicatorSelect({ value, onChange, style }: {
);
}
-// Render params inputs for an indicator
-function ParamInputs({ indicatorDef, params, onChange }: {
- indicatorDef: ReturnType<typeof getIndicatorDef>;
- params: Record<string, number>;
- onChange: (key: string, val: string) => void;
-}) {
- if (!indicatorDef) return null;
- return (
- <>
- {indicatorDef.params.map(p => (
- <div key={p.key} style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
- <span style={{
- fontSize: '8px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px',
- whiteSpace: 'nowrap',
- }}>
- {p.label.toUpperCase()}
- </span>
- <input
- type="number"
- value={params[p.key] ?? p.default}
- onChange={e => onChange(p.key, e.target.value)}
- min={p.min}
- max={p.max}
- step={p.key === 'step' || p.key === 'max_step' ? 0.01 : 1}
- style={inputStyle}
- />
- </div>
- ))}
- </>
- );
-}
-
-// Render field selector
-function FieldSelect({ fields, value, onChange }: {
- fields: string[];
- value: string;
- onChange: (field: string) => void;
-}) {
- if (fields.length <= 1) return null;
- return (
- <select value={value} onChange={e => onChange(e.target.value)} style={{ ...selectStyle, width: '100px' }}>
- {fields.map(f => <option key={f} value={f}>{f}</option>)}
- </select>
- );
-}
-
-const ConditionRow: React.FC<ConditionRowProps> = ({ condition, index, onChange, onRemove }) => {
+const ConditionRow: React.FC<ConditionRowProps> = ({ condition, index, onChange }) => {
const indicatorDef = getIndicatorDef(condition.indicator);
const fields = indicatorDef?.fields || ['value'];
const compareMode = condition.compareMode || 'value';
const showOffset = (condition.offset !== undefined && condition.offset > 0) ||
(condition.compareOffset !== undefined && condition.compareOffset > 0);
-
const compareDef = condition.compareIndicator ? getIndicatorDef(condition.compareIndicator) : undefined;
const compareFields = compareDef?.fields || ['value'];
const compatibilityWarning = compareMode === 'indicator' && condition.compareIndicator
- ? getCompatibilityWarning(
- condition.indicator, condition.field,
- condition.compareIndicator, condition.compareField || 'value'
- )
+ ? getCompatibilityWarning(condition.indicator, condition.field, condition.compareIndicator, condition.compareField || 'value')
: null;
const handleIndicatorChange = (name: string) => {
@@ -206,347 +106,203 @@ const ConditionRow: React.FC<ConditionRowProps> = ({ condition, index, onChange,
if (!isNaN(num)) onChange(index, { ...condition, params: { ...condition.params, [key]: num } });
};
- const handleCompareIndicatorChange = (name: string) => {
- const def = getIndicatorDef(name);
- if (!def) return;
- const defaultParams: Record<string, number> = {};
- def.params.forEach(p => { defaultParams[p.key] = p.default; });
- onChange(index, {
- ...condition, compareIndicator: name, compareField: def.defaultField, compareParams: defaultParams,
- });
- };
-
const handleCompareParamChange = (key: string, val: string) => {
const num = parseFloat(val);
- if (!isNaN(num)) {
- onChange(index, { ...condition, compareParams: { ...(condition.compareParams || {}), [key]: num } });
- }
+ if (!isNaN(num)) onChange(index, { ...condition, compareParams: { ...(condition.compareParams || {}), [key]: num } });
};
const handleCompareWithChange = (value: string) => {
if (value === 'NUMBER') {
- onChange(index, {
- ...condition, compareMode: 'value',
- compareIndicator: undefined, compareParams: undefined, compareField: undefined,
- });
+ onChange(index, { ...condition, compareMode: 'value', compareIndicator: undefined, compareParams: undefined, compareField: undefined });
} else {
const def = getIndicatorDef(value);
if (!def) return;
const defaultParams: Record<string, number> = {};
def.params.forEach(p => { defaultParams[p.key] = p.default; });
- onChange(index, {
- ...condition, compareMode: 'indicator',
- compareIndicator: value, compareField: def.defaultField, compareParams: defaultParams,
- });
+ onChange(index, { ...condition, compareMode: 'indicator', compareIndicator: value, compareField: def.defaultField, compareParams: defaultParams });
}
};
const needsLookback = ['crossed_above_within', 'crossed_below_within', 'rising', 'falling'].includes(condition.operator);
- // Build readable summary
- const indicatorLabel = indicatorDef?.label || condition.indicator;
- const paramValues = Object.values(condition.params);
- const paramStr = paramValues.length > 0 ? `(${paramValues.join(',')})` : '';
- const fieldStr = condition.field !== 'value' ? `.${condition.field}` : '';
- const operatorLabel = OPERATOR_LABELS[condition.operator] || condition.operator;
-
- let compareStr = '';
- if (compareMode === 'indicator' && condition.compareIndicator) {
- const cDef = getIndicatorDef(condition.compareIndicator);
- const cLabel = cDef?.label || condition.compareIndicator;
- const cpv = Object.values(condition.compareParams || {});
- const cpStr = cpv.length > 0 ? `(${cpv.join(',')})` : '';
- const cfStr = condition.compareField && condition.compareField !== 'value' ? `.${condition.compareField}` : '';
- compareStr = `${cLabel}${cpStr}${cfStr}`;
- } else if (condition.operator === 'rising' || condition.operator === 'falling') {
- compareStr = `${condition.lookback || 5} bars`;
- } else if (condition.operator === 'between') {
- compareStr = `${condition.value} and ${condition.value2 ?? 0}`;
- } else {
- compareStr = `${condition.value}`;
- }
-
+ /* ─── Horizontal flow layout: [INDICATOR + params] [OPERATOR] [COMPARE + params] ─── */
return (
- <div style={{ padding: '10px 12px' }}>
- {/* ─── Readable Summary ─── */}
- <div style={{
- display: 'flex',
- alignItems: 'center',
- gap: '6px',
- padding: '8px 12px',
- backgroundColor: `${F.PANEL_BG}`,
- borderRadius: '2px',
- border: `1px solid ${compatibilityWarning ? F.YELLOW + '40' : F.BORDER}`,
- marginBottom: '10px',
- }}>
- <span style={{ fontSize: '10px', fontFamily: '"IBM Plex Mono", monospace' }}>
- <span style={{ color: F.WHITE, fontWeight: 700 }}>{indicatorLabel}{paramStr}{fieldStr}</span>
- <span style={{ color: F.GREEN, margin: '0 8px', fontWeight: 600 }}>{operatorLabel}</span>
- <span style={{ color: compareMode === 'indicator' ? F.PURPLE : F.CYAN, fontWeight: 700 }}>
- {compareStr}
- </span>
- </span>
- </div>
-
- {/* Compatibility Warning */}
+ <div style={{ padding: '8px 12px', fontFamily: font }}>
+ {/* Warning */}
{compatibilityWarning && (
- <div style={{
- marginBottom: '10px',
- padding: '6px 10px',
- backgroundColor: `${F.YELLOW}12`,
- border: `1px solid ${F.YELLOW}30`,
- borderRadius: '2px',
- display: 'flex',
- alignItems: 'center',
- gap: '6px',
- }}>
- <AlertTriangle size={10} color={F.YELLOW} />
- <span style={{ fontSize: '9px', color: F.YELLOW, fontFamily: '"IBM Plex Mono", monospace' }}>
- {compatibilityWarning}
- </span>
+ <div style={{ display: 'inline-flex', alignItems: 'center', gap: '4px', padding: '3px 8px', backgroundColor: `${F.YELLOW}15`, border: `1px solid ${F.YELLOW}30`, borderRadius: '2px', marginBottom: '6px', fontSize: '8px', color: F.YELLOW }}>
+ <AlertTriangle size={8} />{compatibilityWarning}
</div>
)}
- {/* ─── Controls Grid: Structured 3-column flow ─── */}
- <div style={{
- display: 'grid',
- gridTemplateColumns: '1fr auto 1fr',
- gap: '8px',
- alignItems: 'start',
- }}>
- {/* LEFT: Source Indicator */}
- <div style={{
- display: 'flex',
- flexDirection: 'column',
- gap: '6px',
- padding: '8px',
- backgroundColor: F.PANEL_BG,
- borderRadius: '2px',
- border: `1px solid ${F.BORDER}`,
- }}>
- <span style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px' }}>
- INDICATOR
- </span>
- <IndicatorSelect value={condition.indicator} onChange={handleIndicatorChange} style={{ width: '100%' }} />
- <div style={{ display: 'flex', flexWrap: 'wrap', gap: '6px' }}>
- <ParamInputs
- indicatorDef={indicatorDef}
- params={condition.params}
- onChange={handleParamChange}
+ {/* Main row — wrapping flexbox */}
+ <div style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'flex-end', gap: '8px' }}>
+
+ {/* ── SOURCE INDICATOR ── */}
+ <div>
+ <span style={cellLabel}>INDICATOR</span>
+ <IndicatorSelect value={condition.indicator} onChange={handleIndicatorChange} style={{ minWidth: '130px' }} />
+ </div>
+
+ {fields.length > 1 && (
+ <div>
+ <span style={cellLabel}>FIELD</span>
+ <select value={condition.field} onChange={e => onChange(index, { ...condition, field: e.target.value })} style={{ ...selectBase, minWidth: '70px', color: F.CYAN }}>
+ {fields.map(f => <option key={f} value={f}>{f}</option>)}
+ </select>
+ </div>
+ )}
+
+ {/* Indicator params inline */}
+ {indicatorDef && indicatorDef.params.map(p => (
+ <div key={p.key}>
+ <span style={cellLabel}>{p.label}</span>
+ <input type="number" value={condition.params[p.key] ?? p.default}
+ onChange={e => handleParamChange(p.key, e.target.value)}
+ min={p.min} max={p.max} step={p.key === 'step' || p.key === 'max_step' ? 0.01 : 1}
+ style={paramInput}
+ onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
/>
</div>
- {fields.length > 1 && (
- <div>
- <span style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '2px', display: 'block' }}>
- FIELD
- </span>
- <FieldSelect
- fields={fields}
- value={condition.field}
- onChange={f => onChange(index, { ...condition, field: f })}
- />
- </div>
- )}
- {condition.offset !== undefined && condition.offset > 0 && (
- <div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
- <Clock size={9} color={F.YELLOW} />
- <span style={{ fontSize: '8px', fontWeight: 700, color: F.YELLOW }}>OFFSET:</span>
- <input
- type="number"
- value={condition.offset}
- onChange={e => {
- const v = parseInt(e.target.value);
- onChange(index, { ...condition, offset: isNaN(v) ? 0 : Math.max(0, v) });
- }}
- min={0} max={100}
- style={{ ...inputStyle, width: '45px', color: F.YELLOW, fontSize: '9px' }}
- title="Bars ago"
- />
- </div>
- )}
- </div>
+ ))}
+
+ {/* Source offset */}
+ {condition.offset !== undefined && condition.offset > 0 && (
+ <div>
+ <span style={{ ...cellLabel, color: F.YELLOW }}><Clock size={7} style={{ verticalAlign: 'middle', marginRight: '2px' }} />OFFSET</span>
+ <input type="number" value={condition.offset}
+ onChange={e => { const v = parseInt(e.target.value); onChange(index, { ...condition, offset: isNaN(v) ? 0 : Math.max(0, v) }); }}
+ min={0} max={100} style={{ ...paramInput, color: F.YELLOW, width: '44px' }}
+ onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ </div>
+ )}
- {/* CENTER: Operator */}
- <div style={{
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- gap: '6px',
- paddingTop: '20px',
- }}>
- <ArrowRight size={12} color={F.ORANGE} />
- <select
- value={condition.operator}
- onChange={e => onChange(index, { ...condition, operator: e.target.value })}
- style={{ ...selectStyle, width: '140px', textAlign: 'center', color: F.GREEN, fontWeight: 700 }}
- >
- {OPERATORS.map(op => (
- <option key={op.value} value={op.value}>{op.label}</option>
- ))}
+ {/* ── OPERATOR ── */}
+ <div>
+ <span style={cellLabel}>OPERATOR</span>
+ <select value={condition.operator} onChange={e => onChange(index, { ...condition, operator: e.target.value })} style={{ ...selectBase, minWidth: '110px', color: F.GREEN }}>
+ {OPERATORS.map(op => <option key={op.value} value={op.value}>{op.label}</option>)}
</select>
- {needsLookback && (
- <div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
- <span style={{ fontSize: '8px', fontWeight: 700, color: F.GRAY }}>BARS:</span>
- <input
- type="number"
- value={condition.lookback ?? 5}
- onChange={e => {
- const v = parseInt(e.target.value);
- if (!isNaN(v)) onChange(index, { ...condition, lookback: Math.max(1, v) });
- }}
- min={1} max={100}
- style={{ ...inputStyle, width: '50px' }}
- />
- </div>
- )}
- {/* Offset toggle */}
+ </div>
+
+ {needsLookback && (
+ <div>
+ <span style={cellLabel}>BARS</span>
+ <input type="number" value={condition.lookback ?? 5}
+ onChange={e => { const v = parseInt(e.target.value); if (!isNaN(v)) onChange(index, { ...condition, lookback: Math.max(1, v) }); }}
+ min={1} max={100} style={{ ...paramInput, width: '44px' }}
+ onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ </div>
+ )}
+
+ {/* Offset toggle */}
+ <div>
+ <span style={cellLabel}>&nbsp;</span>
<button
onClick={() => {
- if (showOffset) {
- onChange(index, { ...condition, offset: 0, compareOffset: 0 });
- } else {
- onChange(index, { ...condition, offset: 1, compareOffset: 0 });
- }
+ if (showOffset) onChange(index, { ...condition, offset: 0, compareOffset: 0 });
+ else onChange(index, { ...condition, offset: 1, compareOffset: 0 });
}}
style={{
- padding: '3px 8px',
- backgroundColor: showOffset ? `${F.YELLOW}20` : 'transparent',
- border: `1px solid ${showOffset ? F.YELLOW + '60' : F.BORDER}`,
- borderRadius: '2px',
+ ...inputBase, padding: '4px 7px', cursor: 'pointer', fontSize: '8px', fontWeight: 700,
+ backgroundColor: showOffset ? `${F.YELLOW}15` : 'transparent',
+ borderColor: showOffset ? `${F.YELLOW}50` : F.BORDER,
color: showOffset ? F.YELLOW : F.MUTED,
- cursor: 'pointer',
- fontSize: '8px',
- fontWeight: 700,
- fontFamily: '"IBM Plex Mono", monospace',
- letterSpacing: '0.5px',
- display: 'flex',
- alignItems: 'center',
- gap: '3px',
- transition: 'all 0.2s',
+ display: 'flex', alignItems: 'center', gap: '3px',
}}
- title="Toggle bar offset (n candles ago)"
- >
- <Clock size={8} />
- OFFSET
- </button>
+ onMouseEnter={e => { if (!showOffset) { e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.color = F.WHITE; } }}
+ onMouseLeave={e => { if (!showOffset) { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.MUTED; } }}
+ ><Clock size={8} />OFS</button>
</div>
- {/* RIGHT: Compare Target */}
- <div style={{
- display: 'flex',
- flexDirection: 'column',
- gap: '6px',
- padding: '8px',
- backgroundColor: F.PANEL_BG,
- borderRadius: '2px',
- border: `1px solid ${F.BORDER}`,
- }}>
- <span style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px' }}>
- COMPARE WITH
- </span>
+ {/* ── COMPARE WITH ── */}
+ <div>
+ <span style={cellLabel}>COMPARE</span>
<select
value={compareMode === 'value' ? 'NUMBER' : (condition.compareIndicator || 'EMA')}
onChange={e => handleCompareWithChange(e.target.value)}
- style={{
- ...selectStyle,
- width: '100%',
- color: compareMode === 'value' ? F.CYAN : F.PURPLE,
- borderColor: compareMode === 'value' ? `${F.CYAN}40` : `${F.PURPLE}40`,
- }}
+ style={{ ...selectBase, minWidth: '120px', color: compareMode === 'value' ? F.CYAN : F.PURPLE }}
>
- <option value="NUMBER" style={{ color: F.CYAN }}>Number (fixed value)</option>
- <optgroup label="--- Indicators ---">
+ <option value="NUMBER">Number</option>
+ <optgroup label="Indicators">
{categories.map(cat => {
const indicators = INDICATOR_DEFINITIONS.filter(d => d.category === cat);
if (indicators.length === 0) return null;
- return indicators.map(d => (
- <option key={d.name} value={d.name}>{d.label}</option>
- ));
+ return indicators.map(d => <option key={d.name} value={d.name}>{d.label}</option>);
})}
</optgroup>
</select>
+ </div>
+
+ {compareMode === 'value' && (
+ <div>
+ <span style={cellLabel}>VALUE</span>
+ <input type="number" value={condition.value}
+ onChange={e => { const v = parseFloat(e.target.value); if (!isNaN(v)) onChange(index, { ...condition, value: v }); }}
+ step="any" style={{ ...inputBase, width: '72px', color: F.CYAN }}
+ onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ </div>
+ )}
- {/* Value input (when comparing to Number) */}
- {compareMode === 'value' && (
- <div style={{ display: 'flex', flexDirection: 'column', gap: '6px' }}>
- <div>
- <span style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '2px', display: 'block' }}>
- VALUE
- </span>
- <input
- type="number"
- value={condition.value}
- onChange={e => {
- const v = parseFloat(e.target.value);
- if (!isNaN(v)) onChange(index, { ...condition, value: v });
- }}
- step="any"
- style={{ ...inputStyle, width: '100%', color: F.CYAN, borderColor: `${F.CYAN}40` }}
- placeholder="Value"
- />
- </div>
- {condition.operator === 'between' && (
- <div>
- <span style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '2px', display: 'block' }}>
- AND VALUE
- </span>
- <input
- type="number"
- value={condition.value2 ?? 0}
- onChange={e => {
- const v = parseFloat(e.target.value);
- if (!isNaN(v)) onChange(index, { ...condition, value2: v });
- }}
- step="any"
- style={{ ...inputStyle, width: '100%', color: F.CYAN, borderColor: `${F.CYAN}40` }}
- />
- </div>
- )}
+ {compareMode === 'value' && condition.operator === 'between' && (
+ <>
+ <div style={{ display: 'flex', alignItems: 'flex-end' }}>
+ <span style={{ fontSize: '9px', color: F.MUTED, fontWeight: 700, padding: '6px 0' }}>AND</span>
</div>
- )}
-
- {/* Indicator params (when comparing to another Indicator) */}
- {compareMode === 'indicator' && (
- <div style={{ display: 'flex', flexDirection: 'column', gap: '6px' }}>
- <div style={{ display: 'flex', flexWrap: 'wrap', gap: '6px' }}>
- <ParamInputs
- indicatorDef={compareDef}
- params={condition.compareParams || {}}
- onChange={handleCompareParamChange}
- />
- </div>
- {compareFields.length > 1 && (
- <div>
- <span style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '2px', display: 'block' }}>
- FIELD
- </span>
- <FieldSelect
- fields={compareFields}
- value={condition.compareField || 'value'}
- onChange={f => onChange(index, { ...condition, compareField: f })}
- />
- </div>
- )}
- {condition.compareOffset !== undefined && condition.compareOffset > 0 && (
- <div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
- <Clock size={9} color={F.YELLOW} />
- <span style={{ fontSize: '8px', fontWeight: 700, color: F.YELLOW }}>OFFSET:</span>
- <input
- type="number"
- value={condition.compareOffset}
- onChange={e => {
- const v = parseInt(e.target.value);
- onChange(index, { ...condition, compareOffset: isNaN(v) ? 0 : Math.max(0, v) });
- }}
- min={0} max={100}
- style={{ ...inputStyle, width: '45px', color: F.YELLOW, fontSize: '9px' }}
- title="Bars ago"
- />
- </div>
- )}
+ <div>
+ <span style={cellLabel}>VALUE 2</span>
+ <input type="number" value={condition.value2 ?? 0}
+ onChange={e => { const v = parseFloat(e.target.value); if (!isNaN(v)) onChange(index, { ...condition, value2: v }); }}
+ step="any" style={{ ...inputBase, width: '72px', color: F.CYAN }}
+ onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
</div>
- )}
- </div>
+ </>
+ )}
+
+ {compareMode === 'indicator' && compareFields.length > 1 && (
+ <div>
+ <span style={cellLabel}>CMP FIELD</span>
+ <select value={condition.compareField || 'value'} onChange={e => onChange(index, { ...condition, compareField: e.target.value })} style={{ ...selectBase, minWidth: '70px', color: F.PURPLE }}>
+ {compareFields.map(f => <option key={f} value={f}>{f}</option>)}
+ </select>
+ </div>
+ )}
+
+ {/* Compare indicator params */}
+ {compareMode === 'indicator' && compareDef && compareDef.params.map(p => (
+ <div key={`cmp-${p.key}`}>
+ <span style={cellLabel}>{p.label}</span>
+ <input type="number" value={(condition.compareParams || {})[p.key] ?? p.default}
+ onChange={e => handleCompareParamChange(p.key, e.target.value)}
+ min={p.min} max={p.max} step={p.key === 'step' || p.key === 'max_step' ? 0.01 : 1}
+ style={paramInput}
+ onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ </div>
+ ))}
+
+ {/* Compare offset */}
+ {compareMode === 'indicator' && condition.compareOffset !== undefined && condition.compareOffset > 0 && (
+ <div>
+ <span style={{ ...cellLabel, color: F.YELLOW }}><Clock size={7} style={{ verticalAlign: 'middle', marginRight: '2px' }} />CMP OFS</span>
+ <input type="number" value={condition.compareOffset}
+ onChange={e => { const v = parseInt(e.target.value); onChange(index, { ...condition, compareOffset: isNaN(v) ? 0 : Math.max(0, v) }); }}
+ min={0} max={100} style={{ ...paramInput, color: F.YELLOW, width: '44px' }}
+ onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ </div>
+ )}
</div>
</div>
);
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/DeployPanel.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/DeployPanel.tsx
index cfaaf4f36..8194c03f9 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/DeployPanel.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/DeployPanel.tsx
@@ -10,21 +10,10 @@ import type { SymbolSearchResult, SupportedBroker } from '@/services/trading/mas
import type { StockExchange } from '@/brokers/stocks/types';
import { F } from '../constants/theme';
+import { S } from '../constants/styles';
type AssetType = 'crypto' | 'stock';
-const inputStyle: React.CSSProperties = {
- width: '100%', padding: '8px 10px', backgroundColor: F.DARK_BG,
- color: F.WHITE, border: `1px solid ${F.BORDER}`, borderRadius: '2px',
- fontSize: '10px', fontFamily: '"IBM Plex Mono", monospace', outline: 'none',
- transition: 'border-color 0.2s',
-};
-
-const labelStyle: React.CSSProperties = {
- fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px',
- marginBottom: '4px', display: 'block',
-};
-
interface DeployPanelProps {
strategyId: string;
strategyName: string;
@@ -120,89 +109,76 @@ const DeployPanel: React.FC<DeployPanelProps> = ({ strategyId, strategyName, onC
};
return (
- <div style={{
- position: 'fixed', top: 0, left: 0, right: 0, bottom: 0,
- backgroundColor: 'rgba(0,0,0,0.7)', display: 'flex',
- alignItems: 'center', justifyContent: 'center', zIndex: 1000,
- }}
+ <div
+ className={S.modalOverlay}
+ style={{ backgroundColor: 'rgba(0,0,0,0.7)' }}
onClick={e => { if (e.target === e.currentTarget) onClose(); }}
>
- <div style={{
- width: '520px', backgroundColor: F.PANEL_BG,
- border: `1px solid ${F.BORDER}`, borderRadius: '2px',
- overflow: 'visible',
- }}>
+ <div
+ className="rounded overflow-visible"
+ style={{ width: '560px', backgroundColor: F.PANEL_BG, border: `1px solid ${F.BORDER}` }}
+ >
{/* Header */}
- <div style={{
- padding: '14px 16px',
- backgroundColor: F.HEADER_BG,
- borderBottom: `2px solid ${F.GREEN}`,
- display: 'flex', alignItems: 'center', justifyContent: 'space-between',
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
- <div style={{
- width: '28px', height: '28px', borderRadius: '2px',
- backgroundColor: `${F.GREEN}20`,
- display: 'flex', alignItems: 'center', justifyContent: 'center',
- }}>
- <Rocket size={14} color={F.GREEN} />
+ <div
+ className="flex items-center justify-between px-5 py-4"
+ style={{ backgroundColor: F.HEADER_BG, borderBottom: `2px solid ${F.GREEN}` }}
+ >
+ <div className="flex items-center gap-3">
+ <div
+ className="w-8 h-8 rounded flex items-center justify-center"
+ style={{ backgroundColor: `${F.GREEN}20` }}
+ >
+ <Rocket size={16} color={F.GREEN} />
</div>
<div>
- <div style={{ fontSize: '11px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
+ <div className="text-[13px] font-bold tracking-wide" style={{ color: F.WHITE }}>
DEPLOY STRATEGY
</div>
- <div style={{ fontSize: '9px', color: F.MUTED, marginTop: '2px' }}>
+ <div className="text-[10px] mt-0.5" style={{ color: F.MUTED }}>
{strategyName.toUpperCase()}
</div>
</div>
</div>
- <button
- onClick={onClose}
- style={{
- padding: '6px', backgroundColor: 'transparent', border: `1px solid ${F.BORDER}`,
- color: F.MUTED, cursor: 'pointer', borderRadius: '2px', transition: 'all 0.2s',
- }}
- onMouseEnter={e => { e.currentTarget.style.borderColor = F.RED; e.currentTarget.style.color = F.RED; }}
- onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.MUTED; }}
+ <button onClick={onClose} className={S.btnGhost} style={{ color: F.MUTED }}
+ onMouseEnter={e => { e.currentTarget.style.color = F.RED; }}
+ onMouseLeave={e => { e.currentTarget.style.color = F.MUTED; }}
>
- <X size={12} />
+ <X size={14} />
</button>
</div>
{/* Asset Type Toggle */}
- <div style={{
- display: 'flex', padding: '0', borderBottom: `1px solid ${F.BORDER}`,
- }}>
+ <div className="flex" style={{ borderBottom: `1px solid ${F.BORDER}` }}>
{(['stock', 'crypto'] as AssetType[]).map(at => (
- <button key={at} onClick={() => setAssetType(at)} style={{
- flex: 1, padding: '10px', border: 'none', cursor: 'pointer',
- backgroundColor: assetType === at ? `${at === 'crypto' ? F.CYAN : F.ORANGE}12` : 'transparent',
- borderBottom: assetType === at ? `2px solid ${at === 'crypto' ? F.CYAN : F.ORANGE}` : '2px solid transparent',
- color: assetType === at ? (at === 'crypto' ? F.CYAN : F.ORANGE) : F.MUTED,
- fontSize: '9px', fontWeight: 700, letterSpacing: '0.5px', transition: 'all 0.2s',
- }}>
+ <button
+ key={at}
+ onClick={() => setAssetType(at)}
+ className="flex-1 py-3 border-none cursor-pointer text-[11px] font-bold tracking-wide transition-all duration-200"
+ style={{
+ backgroundColor: assetType === at ? `${at === 'crypto' ? F.CYAN : F.ORANGE}12` : 'transparent',
+ borderBottom: assetType === at ? `2px solid ${at === 'crypto' ? F.CYAN : F.ORANGE}` : '2px solid transparent',
+ color: assetType === at ? (at === 'crypto' ? F.CYAN : F.ORANGE) : F.MUTED,
+ }}
+ >
{at === 'crypto' ? 'CRYPTO' : 'INDIAN STOCK'}
</button>
))}
</div>
{/* Broker Status Bar */}
- <div style={{
- display: 'flex', alignItems: 'center', gap: '8px',
- padding: '10px 16px',
- backgroundColor: brokerConnected ? `${F.GREEN}08` : `${F.YELLOW}08`,
- borderBottom: `1px solid ${F.BORDER}`,
- }}>
- <div style={{
- width: '8px', height: '8px', borderRadius: '50%',
- backgroundColor: brokerConnected ? F.GREEN : F.YELLOW,
- }} />
- <Server size={10} color={brokerConnected ? F.GREEN : F.YELLOW} />
- <span style={{
- fontSize: '9px', fontWeight: 700,
- color: brokerConnected ? F.GREEN : F.YELLOW,
- letterSpacing: '0.5px',
- }}>
+ <div
+ className="flex items-center gap-3 px-5 py-3"
+ style={{
+ backgroundColor: brokerConnected ? `${F.GREEN}08` : `${F.YELLOW}08`,
+ borderBottom: `1px solid ${F.BORDER}`,
+ }}
+ >
+ <div
+ className="w-2 h-2 rounded-full"
+ style={{ backgroundColor: brokerConnected ? F.GREEN : F.YELLOW }}
+ />
+ <Server size={12} color={brokerConnected ? F.GREEN : F.YELLOW} />
+ <span className="text-[11px] font-bold tracking-wide" style={{ color: brokerConnected ? F.GREEN : F.YELLOW }}>
{brokerName.toUpperCase()} -- {brokerConnected
? (stockHasStoredCreds && !stockContextConnected && !isCrypto
? 'CREDENTIALS STORED (AUTO-CONNECT ON DEPLOY)'
@@ -211,23 +187,23 @@ const DeployPanel: React.FC<DeployPanelProps> = ({ strategyId, strategyName, onC
{brokerConnected && stockContextConnected && tradingMode === 'paper' && ' (PAPER MODE)'}
</span>
{!isCrypto && !brokerConnected && (
- <span style={{ fontSize: '8px', color: F.MUTED, marginLeft: 'auto' }}>
+ <span className="text-[10px] ml-auto" style={{ color: F.MUTED }}>
Login via Equity Trading tab
</span>
)}
</div>
{/* Config Form */}
- <div style={{ padding: '16px' }}>
- <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '12px', marginBottom: '12px' }}>
- <div style={{ position: 'relative', zIndex: 100 }}>
- <label style={labelStyle}>SYMBOL</label>
+ <div className="p-5">
+ <div className="grid grid-cols-2 gap-4 mb-4">
+ <div className="relative z-[100]">
+ <label className={S.label}>SYMBOL</label>
{isCrypto ? (
<input
value={symbol}
onChange={e => setSymbol(e.target.value)}
placeholder="e.g. BTC/USD"
- style={inputStyle}
+ className={S.input}
onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
/>
@@ -244,34 +220,38 @@ const DeployPanel: React.FC<DeployPanelProps> = ({ strategyId, strategyName, onC
/>
)}
{!isCrypto && selectedToken && (
- <div style={{ fontSize: '8px', color: F.CYAN, marginTop: '2px' }}>
+ <div className="text-[10px] mt-1" style={{ color: F.CYAN }}>
{selectedExchange}:{selectedToken}
</div>
)}
</div>
<div>
- <label style={labelStyle}>EXECUTION MODE</label>
- <select value={mode} onChange={e => setMode(e.target.value as 'paper' | 'live')} style={{
- ...inputStyle,
- color: mode === 'live' ? F.RED : F.GREEN,
- borderColor: mode === 'live' ? `${F.RED}40` : `${F.GREEN}40`,
- }}>
+ <label className={S.label}>EXECUTION MODE</label>
+ <select
+ value={mode}
+ onChange={e => setMode(e.target.value as 'paper' | 'live')}
+ className={S.select}
+ style={{
+ color: mode === 'live' ? F.RED : F.GREEN,
+ borderColor: mode === 'live' ? `${F.RED}40` : `${F.GREEN}40`,
+ }}
+ >
<option value="paper">Paper Trading</option>
<option value="live">Live Trading</option>
</select>
</div>
<div>
- <label style={labelStyle}>TIMEFRAME</label>
- <select value={timeframe} onChange={e => setTimeframe(e.target.value)} style={inputStyle}>
+ <label className={S.label}>TIMEFRAME</label>
+ <select value={timeframe} onChange={e => setTimeframe(e.target.value)} className={S.select}>
{TIMEFRAMES.map(tf => <option key={tf.value} value={tf.value}>{tf.label}</option>)}
</select>
</div>
<div>
- <label style={labelStyle}>QUANTITY</label>
+ <label className={S.label}>QUANTITY</label>
<input
type="number" value={quantity}
onChange={e => setQuantity(e.target.value)}
- min="0.01" step="any" style={inputStyle}
+ min="0.01" step="any" className={S.input}
onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
/>
@@ -280,25 +260,23 @@ const DeployPanel: React.FC<DeployPanelProps> = ({ strategyId, strategyName, onC
{/* Warnings */}
{mode === 'live' && !brokerConnected && (
- <div style={{
- padding: '8px 12px', backgroundColor: `${F.RED}12`,
- border: `1px solid ${F.RED}30`, borderRadius: '2px',
- display: 'flex', alignItems: 'center', gap: '6px', marginBottom: '10px',
- }}>
- <AlertTriangle size={10} color={F.RED} />
- <span style={{ fontSize: '9px', fontWeight: 700, color: F.RED }}>
+ <div
+ className="flex items-center gap-2 rounded px-4 py-3 mb-3"
+ style={{ backgroundColor: `${F.RED}12`, border: `1px solid ${F.RED}30` }}
+ >
+ <AlertTriangle size={14} color={F.RED} />
+ <span className="text-[11px] font-bold" style={{ color: F.RED }}>
LIVE MODE REQUIRES AN ACTIVE BROKER CONNECTION
</span>
</div>
)}
{mode === 'live' && brokerConnected && (
- <div style={{
- padding: '8px 12px', backgroundColor: `${F.YELLOW}12`,
- border: `1px solid ${F.YELLOW}30`, borderRadius: '2px',
- display: 'flex', alignItems: 'center', gap: '6px', marginBottom: '10px',
- }}>
- <Zap size={10} color={F.YELLOW} />
- <span style={{ fontSize: '9px', fontWeight: 700, color: F.YELLOW }}>
+ <div
+ className="flex items-center gap-2 rounded px-4 py-3 mb-3"
+ style={{ backgroundColor: `${F.YELLOW}12`, border: `1px solid ${F.YELLOW}30` }}
+ >
+ <Zap size={14} color={F.YELLOW} />
+ <span className="text-[11px] font-bold" style={{ color: F.YELLOW }}>
LIVE MODE -- REAL ORDERS WILL BE PLACED VIA {brokerName.toUpperCase()}
</span>
</div>
@@ -306,17 +284,15 @@ const DeployPanel: React.FC<DeployPanelProps> = ({ strategyId, strategyName, onC
{/* Result */}
{result && (
- <div style={{
- padding: '8px 12px', borderRadius: '2px', marginBottom: '10px',
- display: 'flex', alignItems: 'center', gap: '6px',
- backgroundColor: result.success ? `${F.GREEN}15` : `${F.RED}15`,
- border: `1px solid ${result.success ? F.GREEN + '40' : F.RED + '40'}`,
- }}>
- <Activity size={10} color={result.success ? F.GREEN : F.RED} />
- <span style={{
- fontSize: '9px', fontWeight: 700,
- color: result.success ? F.GREEN : F.RED,
- }}>
+ <div
+ className="flex items-center gap-2 rounded px-4 py-3 mb-3"
+ style={{
+ backgroundColor: result.success ? `${F.GREEN}15` : `${F.RED}15`,
+ border: `1px solid ${result.success ? F.GREEN + '40' : F.RED + '40'}`,
+ }}
+ >
+ <Activity size={14} color={result.success ? F.GREEN : F.RED} />
+ <span className="text-[11px] font-bold" style={{ color: result.success ? F.GREEN : F.RED }}>
{result.message}
</span>
</div>
@@ -326,19 +302,16 @@ const DeployPanel: React.FC<DeployPanelProps> = ({ strategyId, strategyName, onC
<button
onClick={handleDeploy}
disabled={deploying || !symbol.trim()}
+ className={`${S.btnPrimary} w-full border-none`}
style={{
- width: '100%', padding: '12px',
+ padding: '14px',
backgroundColor: mode === 'live' ? F.RED : F.GREEN,
color: mode === 'live' ? F.WHITE : F.DARK_BG,
- border: 'none', borderRadius: '2px',
- fontSize: '10px', fontWeight: 700, letterSpacing: '0.5px',
cursor: (deploying || !symbol.trim()) ? 'not-allowed' : 'pointer',
opacity: (deploying || !symbol.trim()) ? 0.5 : 1,
- display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '6px',
- transition: 'all 0.2s',
}}
>
- <Rocket size={12} />
+ <Rocket size={14} />
{deploying ? 'DEPLOYING STRATEGY...' : mode === 'live' ? 'DEPLOY TO LIVE' : 'DEPLOY TO PAPER'}
</button>
</div>
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/DeploymentCard.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/DeploymentCard.tsx
index 36b52aa6f..1199d1acb 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/DeploymentCard.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/DeploymentCard.tsx
@@ -8,6 +8,7 @@ import type { AlgoDeployment } from '../types';
import { stopAlgoDeployment, deleteAlgoDeployment } from '../services/algoTradingService';
import TradeHistoryTable from './TradeHistoryTable';
import { F } from '../constants/theme';
+import { S } from '../constants/styles';
const statusConfig: Record<string, { color: string; bg: string; label: string }> = {
running: { color: F.GREEN, bg: `${F.GREEN}15`, label: 'RUNNING' },
@@ -113,68 +114,66 @@ const DeploymentCard: React.FC<DeploymentCardProps> = ({ deployment, onStopped }
const providerColor = isCryptoBroker ? F.CYAN : F.PURPLE;
return (
- <div style={{
- backgroundColor: F.PANEL_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- overflow: 'hidden',
- transition: 'border-color 0.2s',
- }}>
+ <div
+ className="rounded overflow-hidden transition-colors duration-200"
+ style={{ backgroundColor: F.PANEL_BG, border: `1px solid ${F.BORDER}` }}
+ >
{/* ─── TOP ROW: Symbol, Status, Name ─── */}
- <div style={{
- display: 'flex', alignItems: 'center', gap: '10px',
- padding: '10px 14px',
- backgroundColor: F.HEADER_BG,
- borderBottom: `1px solid ${F.BORDER}`,
- borderLeft: `3px solid ${sc.color}`,
- }}>
+ <div
+ className="flex items-center gap-3 px-4 py-3"
+ style={{
+ backgroundColor: F.HEADER_BG,
+ borderBottom: `1px solid ${F.BORDER}`,
+ borderLeft: `3px solid ${sc.color}`,
+ }}
+ >
{/* Status Badge */}
- <span style={{
- padding: '3px 8px', borderRadius: '2px',
- fontSize: '8px', fontWeight: 700, letterSpacing: '0.5px',
- color: sc.color, backgroundColor: sc.bg,
- }}>
+ <span
+ className={S.badge}
+ style={{ color: sc.color, backgroundColor: sc.bg }}
+ >
{sc.label}
</span>
{/* Symbol */}
- <span style={{ fontSize: '11px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
+ <span className="text-[13px] font-bold tracking-wide" style={{ color: F.WHITE }}>
{deployment.symbol}
</span>
{/* Strategy name */}
- <span style={{ fontSize: '9px', color: F.MUTED }}>
+ <span className="text-[10px]" style={{ color: F.MUTED }}>
{deployment.strategy_name || deployment.strategy_id}
</span>
{/* Tags */}
- <div style={{ display: 'flex', gap: '4px', marginLeft: 'auto' }}>
+ <div className="flex gap-1.5 ml-auto">
{/* Provider / Broker Badge */}
- <span style={{
- padding: '2px 6px', borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- backgroundColor: `${providerColor}15`, color: providerColor,
- display: 'flex', alignItems: 'center', gap: '3px',
- }}>
- <Wifi size={7} />
+ <span
+ className={S.badge}
+ style={{ backgroundColor: `${providerColor}15`, color: providerColor }}
+ >
+ <Wifi size={8} />
{providerLabel}
</span>
- <span style={{
- padding: '2px 6px', borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- backgroundColor: deployment.mode === 'live' ? `${F.RED}15` : `${F.GREEN}15`,
- color: deployment.mode === 'live' ? F.RED : F.GREEN,
- }}>
+ <span
+ className={S.badge}
+ style={{
+ backgroundColor: deployment.mode === 'live' ? `${F.RED}15` : `${F.GREEN}15`,
+ color: deployment.mode === 'live' ? F.RED : F.GREEN,
+ }}
+ >
{deployment.mode.toUpperCase()}
</span>
- <span style={{
- padding: '2px 6px', borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- backgroundColor: `${F.CYAN}15`, color: F.CYAN,
- }}>
+ <span
+ className={S.badge}
+ style={{ backgroundColor: `${F.CYAN}15`, color: F.CYAN }}
+ >
{deployment.timeframe}
</span>
- <span style={{
- padding: '2px 6px', borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- backgroundColor: `${F.BLUE}15`, color: F.BLUE,
- }}>
+ <span
+ className={S.badge}
+ style={{ backgroundColor: `${F.BLUE}15`, color: F.BLUE }}
+ >
QTY: {deployment.quantity}
</span>
</div>
@@ -182,51 +181,46 @@ const DeploymentCard: React.FC<DeploymentCardProps> = ({ deployment, onStopped }
{/* ─── LIVE PRICE BAR ─── */}
{deployment.status === 'running' && (
- <div style={{
- display: 'flex', alignItems: 'center', gap: '12px',
- padding: '8px 14px',
- borderBottom: `1px solid ${F.BORDER}`,
- backgroundColor: livePrice
- ? (priceFlash === 'up' ? `${F.GREEN}12` : priceFlash === 'down' ? `${F.RED}12` : `${F.DARK_BG}`)
- : F.DARK_BG,
- transition: 'background-color 0.3s',
- }}>
- <div style={{
- display: 'flex', alignItems: 'center', gap: '5px',
- fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px',
- }}>
- <Zap size={8} color={livePrice ? F.GREEN : F.MUTED} />
+ <div
+ className="flex items-center gap-3 px-4 py-2.5 transition-colors duration-300"
+ style={{
+ borderBottom: `1px solid ${F.BORDER}`,
+ backgroundColor: livePrice
+ ? (priceFlash === 'up' ? `${F.GREEN}12` : priceFlash === 'down' ? `${F.RED}12` : F.DARK_BG)
+ : F.DARK_BG,
+ }}
+ >
+ <div className="flex items-center gap-1.5 text-[9px] font-bold tracking-wide" style={{ color: F.MUTED }}>
+ <Zap size={10} style={{ color: livePrice ? F.GREEN : F.MUTED }} />
LIVE PRICE
</div>
{livePrice ? (
<>
- <span style={{
- fontSize: '16px', fontWeight: 700,
- color: priceFlash === 'up' ? F.GREEN : priceFlash === 'down' ? F.RED : F.WHITE,
- transition: 'color 0.3s',
- fontVariantNumeric: 'tabular-nums',
- }}>
+ <span
+ className="text-[20px] font-bold transition-colors duration-300"
+ style={{
+ color: priceFlash === 'up' ? F.GREEN : priceFlash === 'down' ? F.RED : F.WHITE,
+ fontVariantNumeric: 'tabular-nums',
+ }}
+ >
{livePrice.price.toFixed(2)}
</span>
{livePrice.changePct !== null && (
- <span style={{
- fontSize: '10px', fontWeight: 700,
+ <span className="flex items-center gap-1 text-[11px] font-bold" style={{
color: (livePrice.changePct ?? 0) >= 0 ? F.GREEN : F.RED,
- display: 'flex', alignItems: 'center', gap: '2px',
}}>
- {(livePrice.changePct ?? 0) >= 0 ? <TrendingUp size={9} /> : <TrendingDown size={9} />}
+ {(livePrice.changePct ?? 0) >= 0 ? <TrendingUp size={11} /> : <TrendingDown size={11} />}
{(livePrice.changePct ?? 0) >= 0 ? '+' : ''}{(livePrice.changePct ?? 0).toFixed(2)}%
</span>
)}
{livePrice.change !== null && (
- <span style={{
- fontSize: '9px', fontWeight: 700,
+ <span className="text-[10px] font-bold" style={{
color: (livePrice.change ?? 0) >= 0 ? F.GREEN : F.RED,
}}>
({(livePrice.change ?? 0) >= 0 ? '+' : ''}{(livePrice.change ?? 0).toFixed(2)})
</span>
)}
- <div style={{ display: 'flex', gap: '10px', marginLeft: 'auto', fontSize: '8px', color: F.MUTED }}>
+ <div className="flex gap-3 ml-auto text-[9px]" style={{ color: F.MUTED }}>
{livePrice.high !== null && (
<span>H: <span style={{ color: F.GREEN }}>{(livePrice.high ?? 0).toFixed(2)}</span></span>
)}
@@ -236,14 +230,14 @@ const DeploymentCard: React.FC<DeploymentCardProps> = ({ deployment, onStopped }
{livePrice.volume !== null && livePrice.volume > 0 && (
<span>V: <span style={{ color: F.CYAN }}>{formatVolume(livePrice.volume)}</span></span>
)}
- <span style={{ display: 'flex', alignItems: 'center', gap: '2px' }}>
- <Clock size={7} />
+ <span className="flex items-center gap-1">
+ <Clock size={8} />
{new Date(livePrice.ts).toLocaleTimeString()}
</span>
</div>
</>
) : (
- <span style={{ fontSize: '10px', color: F.MUTED, fontStyle: 'italic' }}>
+ <span className="text-[11px] italic" style={{ color: F.MUTED }}>
Waiting for ticks...
</span>
)}
@@ -251,33 +245,27 @@ const DeploymentCard: React.FC<DeploymentCardProps> = ({ deployment, onStopped }
)}
{/* ─── METRICS ROW ─── */}
- <div style={{
- display: 'grid',
- gridTemplateColumns: 'repeat(5, 1fr)',
- borderBottom: `1px solid ${F.BORDER}`,
- }}>
+ <div
+ className="grid grid-cols-5"
+ style={{ borderBottom: `1px solid ${F.BORDER}` }}
+ >
{/* P&L */}
- <div style={{
- padding: '10px 14px',
- borderRight: `1px solid ${F.BORDER}`,
- backgroundColor: `${isPositive ? F.GREEN : F.RED}06`,
- }}>
- <div style={{
- fontSize: '8px', fontWeight: 700, color: F.MUTED,
- letterSpacing: '0.5px', marginBottom: '4px',
- display: 'flex', alignItems: 'center', gap: '3px',
- }}>
- {isPositive ? <TrendingUp size={8} /> : <TrendingDown size={8} />}
+ <div
+ className="p-4"
+ style={{
+ borderRight: `1px solid ${F.BORDER}`,
+ backgroundColor: `${isPositive ? F.GREEN : F.RED}06`,
+ }}
+ >
+ <div className={S.metricLabel}>
+ {isPositive ? <TrendingUp size={10} /> : <TrendingDown size={10} />}
TOTAL P&L
</div>
- <div style={{
- fontSize: '14px', fontWeight: 700,
- color: isPositive ? F.GREEN : F.RED,
- }}>
+ <div className={S.metricValue} style={{ color: isPositive ? F.GREEN : F.RED }}>
{totalPnl >= 0 ? '+' : ''}{totalPnl.toFixed(2)}
</div>
{m.unrealized_pnl !== 0 && (
- <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '2px' }}>
+ <div className="text-[9px] mt-1" style={{ color: F.MUTED }}>
Unrealized: <span style={{ color: m.unrealized_pnl >= 0 ? F.GREEN : F.RED }}>
{m.unrealized_pnl >= 0 ? '+' : ''}{m.unrealized_pnl.toFixed(2)}
</span>
@@ -286,104 +274,89 @@ const DeploymentCard: React.FC<DeploymentCardProps> = ({ deployment, onStopped }
</div>
{/* Trades */}
- <div style={{ padding: '10px 14px', borderRight: `1px solid ${F.BORDER}` }}>
- <div style={{
- fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '4px',
- display: 'flex', alignItems: 'center', gap: '3px',
- }}>
- <Activity size={8} />
+ <div className="p-4" style={{ borderRight: `1px solid ${F.BORDER}` }}>
+ <div className={S.metricLabel}>
+ <Activity size={10} />
TRADES
</div>
- <div style={{ fontSize: '14px', fontWeight: 700, color: F.CYAN }}>
+ <div className={S.metricValue} style={{ color: F.CYAN }}>
{m.total_trades}
</div>
</div>
{/* Win Rate */}
- <div style={{ padding: '10px 14px', borderRight: `1px solid ${F.BORDER}` }}>
- <div style={{
- fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '4px',
- display: 'flex', alignItems: 'center', gap: '3px',
- }}>
- <Target size={8} />
+ <div className="p-4" style={{ borderRight: `1px solid ${F.BORDER}` }}>
+ <div className={S.metricLabel}>
+ <Target size={10} />
WIN RATE
</div>
- <div style={{
- fontSize: '14px', fontWeight: 700,
- color: m.win_rate >= 50 ? F.GREEN : F.YELLOW,
- }}>
+ <div className={S.metricValue} style={{ color: m.win_rate >= 50 ? F.GREEN : F.YELLOW }}>
{m.win_rate.toFixed(1)}%
</div>
</div>
{/* Max Drawdown */}
- <div style={{ padding: '10px 14px', borderRight: `1px solid ${F.BORDER}` }}>
- <div style={{
- fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '4px',
- display: 'flex', alignItems: 'center', gap: '3px',
- }}>
- <TrendingDown size={8} />
+ <div className="p-4" style={{ borderRight: `1px solid ${F.BORDER}` }}>
+ <div className={S.metricLabel}>
+ <TrendingDown size={10} />
MAX DD
</div>
- <div style={{ fontSize: '14px', fontWeight: 700, color: F.RED }}>
+ <div className={S.metricValue} style={{ color: F.RED }}>
{m.max_drawdown.toFixed(2)}
</div>
</div>
{/* Position */}
- <div style={{ padding: '10px 14px' }}>
- <div style={{
- fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '4px',
- display: 'flex', alignItems: 'center', gap: '3px',
- }}>
- <BarChart3 size={8} />
+ <div className="p-4">
+ <div className={S.metricLabel}>
+ <BarChart3 size={10} />
POSITION
</div>
{m.current_position_qty > 0 ? (
- <div style={{ fontSize: '10px', fontWeight: 700, color: F.BLUE }}>
- {m.current_position_side} {m.current_position_qty}
- <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '1px' }}>
+ <div>
+ <div className="text-[11px] font-bold" style={{ color: F.BLUE }}>
+ {m.current_position_side} {m.current_position_qty}
+ </div>
+ <div className="text-[9px] mt-0.5" style={{ color: F.MUTED }}>
@ {m.current_position_entry.toFixed(2)}
</div>
</div>
) : (
- <div style={{ fontSize: '10px', color: F.MUTED }}>FLAT</div>
+ <div className="text-[11px]" style={{ color: F.MUTED }}>FLAT</div>
)}
</div>
</div>
{/* ─── ACTIONS ROW ─── */}
- <div style={{
- display: 'flex', alignItems: 'center', justifyContent: 'space-between',
- padding: '8px 14px',
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
- <span style={{ fontSize: '8px', color: F.MUTED }}>
+ <div className="flex items-center justify-between px-4 py-2.5">
+ <div className="flex items-center gap-2">
+ <span className="text-[9px]" style={{ color: F.MUTED }}>
ID: <span style={{ color: F.GRAY }}>{deployment.id.substring(0, 12)}</span>
</span>
{m.metrics_updated && (
- <span style={{ fontSize: '8px', color: F.MUTED, display: 'flex', alignItems: 'center', gap: '3px' }}>
- <Clock size={8} />
+ <span className="flex items-center gap-1 text-[9px]" style={{ color: F.MUTED }}>
+ <Clock size={9} />
{new Date(m.metrics_updated).toLocaleTimeString()}
</span>
)}
</div>
- <div style={{ display: 'flex', gap: '4px' }}>
+ <div className="flex gap-1.5">
{deployment.status === 'running' && (
<button
onClick={handleStop}
disabled={stopping}
+ className={S.btnDanger}
style={{
- padding: '5px 10px', backgroundColor: `${F.RED}15`, color: F.RED,
- border: `1px solid ${F.RED}30`, borderRadius: '2px', fontSize: '8px', fontWeight: 700,
+ backgroundColor: `${F.RED}15`,
+ borderColor: `${F.RED}30`,
+ color: F.RED,
+ opacity: stopping ? 0.5 : 1,
cursor: stopping ? 'not-allowed' : 'pointer',
- display: 'flex', alignItems: 'center', gap: '4px',
- opacity: stopping ? 0.5 : 1, transition: 'all 0.2s', letterSpacing: '0.5px',
}}
onMouseEnter={e => { e.currentTarget.style.backgroundColor = `${F.RED}25`; }}
onMouseLeave={e => { e.currentTarget.style.backgroundColor = `${F.RED}15`; }}
>
- <Square size={9} />
+ <Square size={10} />
{stopping ? 'STOPPING...' : 'STOP'}
</button>
)}
@@ -391,28 +364,23 @@ const DeploymentCard: React.FC<DeploymentCardProps> = ({ deployment, onStopped }
<button
onClick={handleDelete}
disabled={deleting}
+ className={S.btnOutline}
style={{
- padding: '5px 10px', backgroundColor: 'transparent', color: F.MUTED,
- border: `1px solid ${F.BORDER}`, borderRadius: '2px', fontSize: '8px', fontWeight: 700,
+ opacity: deleting ? 0.5 : 1,
cursor: deleting ? 'not-allowed' : 'pointer',
- display: 'flex', alignItems: 'center', gap: '4px',
- opacity: deleting ? 0.5 : 1, transition: 'all 0.2s', letterSpacing: '0.5px',
}}
onMouseEnter={e => { e.currentTarget.style.borderColor = F.RED; e.currentTarget.style.color = F.RED; }}
- onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.MUTED; }}
+ onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
>
- <Trash2 size={9} />
+ <Trash2 size={10} />
{deleting ? 'DELETING...' : 'DELETE'}
</button>
)}
<button
onClick={() => setShowTrades(!showTrades)}
+ className={S.btnOutline}
style={{
- padding: '5px 10px', backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`, color: showTrades ? F.ORANGE : F.GRAY,
- borderRadius: '2px', cursor: 'pointer', fontSize: '8px', fontWeight: 700,
- display: 'flex', alignItems: 'center', gap: '4px',
- transition: 'all 0.2s', letterSpacing: '0.5px',
+ color: showTrades ? F.ORANGE : F.GRAY,
borderColor: showTrades ? F.ORANGE : F.BORDER,
}}
onMouseEnter={e => { e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.color = F.WHITE; }}
@@ -421,7 +389,7 @@ const DeploymentCard: React.FC<DeploymentCardProps> = ({ deployment, onStopped }
e.currentTarget.style.color = showTrades ? F.ORANGE : F.GRAY;
}}
>
- {showTrades ? <ChevronUp size={9} /> : <ChevronDown size={9} />}
+ {showTrades ? <ChevronUp size={10} /> : <ChevronDown size={10} />}
TRADES
</button>
</div>
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/MonitorDashboard.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/MonitorDashboard.tsx
index 2a24daa7e..ec570ca7f 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/MonitorDashboard.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/MonitorDashboard.tsx
@@ -8,6 +8,7 @@ import type { AlgoDeployment } from '../types';
import { listAlgoDeployments, stopAllAlgoDeployments } from '../services/algoTradingService';
import DeploymentCard from './DeploymentCard';
import { F } from '../constants/theme';
+import { S } from '../constants/styles';
const MonitorDashboard: React.FC = () => {
const [deployments, setDeployments] = useState<AlgoDeployment[]>([]);
@@ -80,84 +81,71 @@ const MonitorDashboard: React.FC = () => {
};
const eventIcon = (type: string) => {
- if (type === 'trade') return <TrendingUp size={8} />;
- if (type === 'error') return <StopCircle size={8} />;
- if (type === 'signal') return <Radio size={8} />;
- return <Activity size={8} />;
+ if (type === 'trade') return <TrendingUp size={10} />;
+ if (type === 'error') return <StopCircle size={10} />;
+ if (type === 'signal') return <Radio size={10} />;
+ return <Activity size={10} />;
};
return (
- <div style={{
- height: '100%', display: 'flex', flexDirection: 'column',
- fontFamily: '"IBM Plex Mono", "Consolas", monospace',
- }}>
+ <div
+ className="h-full flex flex-col"
+ style={{ fontFamily: '"IBM Plex Mono", "Consolas", monospace' }}
+ >
{/* ─── SUMMARY CARDS ─── */}
- <div style={{
- display: 'grid', gridTemplateColumns: 'repeat(5, 1fr)',
- borderBottom: `1px solid ${F.BORDER}`, flexShrink: 0,
- }}>
+ <div
+ className="grid grid-cols-5 shrink-0"
+ style={{ borderBottom: `1px solid ${F.BORDER}` }}
+ >
{/* Active Deployments */}
- <div style={{ padding: '14px 16px', borderRight: `1px solid ${F.BORDER}` }}>
- <div style={{
- fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '6px',
- display: 'flex', alignItems: 'center', gap: '4px',
- }}>
- <Server size={8} />
+ <div className="p-4" style={{ borderRight: `1px solid ${F.BORDER}` }}>
+ <div className={S.metricLabel}>
+ <Server size={10} />
ACTIVE
</div>
- <div style={{ fontSize: '20px', fontWeight: 700, color: running.length > 0 ? F.GREEN : F.MUTED }}>
+ <div className="text-[22px] font-bold" style={{ color: running.length > 0 ? F.GREEN : F.MUTED }}>
{running.length}
</div>
- <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '2px' }}>
+ <div className={S.muted + ' mt-1'}>
of {deployments.length} total
</div>
</div>
{/* Total P&L */}
- <div style={{
- padding: '14px 16px', borderRight: `1px solid ${F.BORDER}`,
- backgroundColor: `${totalPnl >= 0 ? F.GREEN : F.RED}04`,
- }}>
- <div style={{
- fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '6px',
- display: 'flex', alignItems: 'center', gap: '4px',
- }}>
- {totalPnl >= 0 ? <TrendingUp size={8} /> : <TrendingDown size={8} />}
+ <div
+ className="p-4"
+ style={{
+ borderRight: `1px solid ${F.BORDER}`,
+ backgroundColor: `${totalPnl >= 0 ? F.GREEN : F.RED}04`,
+ }}
+ >
+ <div className={S.metricLabel}>
+ {totalPnl >= 0 ? <TrendingUp size={10} /> : <TrendingDown size={10} />}
TOTAL P&L
</div>
- <div style={{
- fontSize: '20px', fontWeight: 700,
- color: totalPnl >= 0 ? F.GREEN : F.RED,
- }}>
+ <div className="text-[22px] font-bold" style={{ color: totalPnl >= 0 ? F.GREEN : F.RED }}>
{totalPnl >= 0 ? '+' : ''}{totalPnl.toFixed(2)}
</div>
</div>
{/* Total Trades */}
- <div style={{ padding: '14px 16px', borderRight: `1px solid ${F.BORDER}` }}>
- <div style={{
- fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '6px',
- display: 'flex', alignItems: 'center', gap: '4px',
- }}>
- <Activity size={8} />
+ <div className="p-4" style={{ borderRight: `1px solid ${F.BORDER}` }}>
+ <div className={S.metricLabel}>
+ <Activity size={10} />
TOTAL TRADES
</div>
- <div style={{ fontSize: '20px', fontWeight: 700, color: F.CYAN }}>
+ <div className="text-[22px] font-bold" style={{ color: F.CYAN }}>
{totalTrades}
</div>
</div>
{/* Avg Win Rate */}
- <div style={{ padding: '14px 16px', borderRight: `1px solid ${F.BORDER}` }}>
- <div style={{
- fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '6px',
- display: 'flex', alignItems: 'center', gap: '4px',
- }}>
- <Target size={8} />
+ <div className="p-4" style={{ borderRight: `1px solid ${F.BORDER}` }}>
+ <div className={S.metricLabel}>
+ <Target size={10} />
AVG WIN RATE
</div>
- <div style={{
- fontSize: '20px', fontWeight: 700,
+ <div className="text-[22px] font-bold" style={{
color: avgWinRate >= 50 ? F.GREEN : avgWinRate > 0 ? F.YELLOW : F.MUTED,
}}>
{avgWinRate > 0 ? `${avgWinRate.toFixed(1)}%` : '—'}
@@ -165,73 +153,57 @@ const MonitorDashboard: React.FC = () => {
</div>
{/* Events */}
- <div style={{ padding: '14px 16px' }}>
- <div style={{
- fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '6px',
- display: 'flex', alignItems: 'center', gap: '4px',
- }}>
- <Radio size={8} />
+ <div className="p-4">
+ <div className={S.metricLabel}>
+ <Radio size={10} />
EVENTS
</div>
- <div style={{ fontSize: '20px', fontWeight: 700, color: F.YELLOW }}>
+ <div className="text-[22px] font-bold" style={{ color: F.YELLOW }}>
{recentEvents.length}
</div>
- <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '2px' }}>
+ <div className={S.muted + ' mt-1'}>
recent signals
</div>
</div>
</div>
{/* ─── MAIN AREA: Two-panel split ─── */}
- <div style={{ flex: 1, display: 'flex', overflow: 'hidden', minHeight: 0 }}>
+ <div className="flex-1 flex overflow-hidden min-h-0">
{/* LEFT: Deployment Cards */}
- <div style={{
- flex: 1, overflowY: 'auto', minWidth: 0,
- borderRight: `1px solid ${F.BORDER}`,
- }}>
+ <div
+ className="flex-1 overflow-y-auto min-w-0"
+ style={{ borderRight: `1px solid ${F.BORDER}` }}
+ >
{/* Toolbar */}
- <div style={{
- padding: '10px 16px', backgroundColor: F.HEADER_BG,
- borderBottom: `1px solid ${F.BORDER}`,
- display: 'flex', alignItems: 'center', justifyContent: 'space-between',
- position: 'sticky', top: 0, zIndex: 1,
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <BarChart3 size={10} color={F.ORANGE} />
- <span style={{ fontSize: '9px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
+ <div
+ className="flex items-center justify-between px-4 py-2.5 sticky top-0 z-[1]"
+ style={{ backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}` }}
+ >
+ <div className="flex items-center gap-2">
+ <BarChart3 size={12} style={{ color: F.ORANGE }} />
+ <span className="text-[10px] font-bold tracking-wide" style={{ color: F.WHITE }}>
DEPLOYMENTS
</span>
</div>
- <div style={{ display: 'flex', gap: '4px' }}>
+ <div className="flex gap-1.5">
<button
onClick={loadDeployments}
- style={{
- padding: '4px 8px', backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`, color: F.GRAY,
- cursor: 'pointer', borderRadius: '2px', transition: 'all 0.2s',
- display: 'flex', alignItems: 'center', gap: '4px',
- fontSize: '8px', fontWeight: 700, letterSpacing: '0.5px',
- }}
+ className={S.btnOutline}
onMouseEnter={e => { e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.color = F.WHITE; }}
onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
>
- <RefreshCw size={9} />
+ <RefreshCw size={10} />
REFRESH
</button>
{running.length > 0 && (
<button
onClick={handleStopAll}
- style={{
- padding: '4px 10px', backgroundColor: `${F.RED}15`,
- border: `1px solid ${F.RED}30`, color: F.RED,
- borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '4px',
- transition: 'all 0.2s', letterSpacing: '0.5px',
- }}
+ className={S.btnDanger}
+ style={{ backgroundColor: `${F.RED}15`, borderColor: `${F.RED}30`, color: F.RED }}
onMouseEnter={e => { e.currentTarget.style.backgroundColor = `${F.RED}25`; }}
onMouseLeave={e => { e.currentTarget.style.backgroundColor = `${F.RED}15`; }}
>
- <StopCircle size={9} />
+ <StopCircle size={10} />
STOP ALL
</button>
)}
@@ -239,37 +211,24 @@ const MonitorDashboard: React.FC = () => {
</div>
{/* Deployment List */}
- <div style={{ padding: '12px 16px' }}>
+ <div className="p-4">
{loading ? (
- <div style={{
- textAlign: 'center', padding: '48px', fontSize: '10px', color: F.MUTED,
- display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '8px',
- }}>
- <RefreshCw size={16} className="animate-spin" color={F.ORANGE} />
- <span style={{ fontWeight: 700, letterSpacing: '0.5px' }}>LOADING DEPLOYMENTS...</span>
+ <div className="flex flex-col items-center gap-2 py-12 text-center">
+ <RefreshCw size={18} className="animate-spin" style={{ color: F.ORANGE }} />
+ <span className="text-[11px] font-bold tracking-wide" style={{ color: F.MUTED }}>LOADING DEPLOYMENTS...</span>
</div>
) : deployments.length === 0 ? (
- <div style={{
- display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
- padding: '48px', color: F.MUTED, textAlign: 'center',
- }}>
- <Server size={24} style={{ opacity: 0.3, marginBottom: '8px' }} />
- <span style={{ fontSize: '10px', fontWeight: 700 }}>NO DEPLOYMENTS</span>
- <span style={{ fontSize: '9px', marginTop: '4px' }}>
- Create a strategy and deploy it to see it here
- </span>
+ <div className="flex flex-col items-center justify-center py-12 text-center" style={{ color: F.MUTED }}>
+ <Server size={28} className="opacity-30 mb-2" />
+ <span className="text-[11px] font-bold">NO DEPLOYMENTS</span>
+ <span className="text-[10px] mt-1">Create a strategy and deploy it to see it here</span>
</div>
) : (
- <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
+ <div className="flex flex-col gap-3">
{running.length > 0 && (
<>
- <div style={{
- fontSize: '8px', fontWeight: 700, color: F.GREEN,
- letterSpacing: '0.5px', display: 'flex', alignItems: 'center', gap: '4px',
- }}>
- <div style={{
- width: '6px', height: '6px', borderRadius: '50%', backgroundColor: F.GREEN,
- }} />
+ <div className="flex items-center gap-1.5 text-[9px] font-bold tracking-wide" style={{ color: F.GREEN }}>
+ <div className="w-1.5 h-1.5 rounded-full" style={{ backgroundColor: F.GREEN }} />
RUNNING ({running.length})
</div>
{running.map(d => (
@@ -279,12 +238,15 @@ const MonitorDashboard: React.FC = () => {
)}
{stopped.length > 0 && (
<>
- <div style={{
- fontSize: '8px', fontWeight: 700, color: F.MUTED,
- letterSpacing: '0.5px', paddingTop: running.length > 0 ? '8px' : '0',
- borderTop: running.length > 0 ? `1px solid ${F.BORDER}` : 'none',
- marginTop: running.length > 0 ? '4px' : '0',
- }}>
+ <div
+ className="text-[9px] font-bold tracking-wide"
+ style={{
+ color: F.MUTED,
+ paddingTop: running.length > 0 ? '8px' : '0',
+ borderTop: running.length > 0 ? `1px solid ${F.BORDER}` : 'none',
+ marginTop: running.length > 0 ? '4px' : '0',
+ }}
+ >
HISTORY ({stopped.length})
</div>
{stopped.map(d => (
@@ -298,27 +260,25 @@ const MonitorDashboard: React.FC = () => {
</div>
{/* RIGHT: Event Log Panel */}
- <div style={{
- width: '320px', flexShrink: 0,
- display: 'flex', flexDirection: 'column',
- backgroundColor: F.PANEL_BG,
- }}>
+ <div
+ className="flex flex-col shrink-0"
+ style={{ width: '340px', backgroundColor: F.PANEL_BG }}
+ >
{/* Event Log Header */}
- <div style={{
- padding: '10px 12px', backgroundColor: F.HEADER_BG,
- borderBottom: `1px solid ${F.BORDER}`,
- display: 'flex', alignItems: 'center', justifyContent: 'space-between',
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
- <Radio size={10} color={F.YELLOW} />
- <span style={{ fontSize: '9px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
+ <div
+ className="flex items-center justify-between px-4 py-2.5"
+ style={{ backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}` }}
+ >
+ <div className="flex items-center gap-2">
+ <Radio size={12} style={{ color: F.YELLOW }} />
+ <span className="text-[10px] font-bold tracking-wide" style={{ color: F.WHITE }}>
EVENT LOG
</span>
{recentEvents.length > 0 && (
- <span style={{
- padding: '1px 5px', borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- backgroundColor: `${F.YELLOW}20`, color: F.YELLOW,
- }}>
+ <span
+ className={S.badge}
+ style={{ backgroundColor: `${F.YELLOW}20`, color: F.YELLOW }}
+ >
{recentEvents.length}
</span>
)}
@@ -326,12 +286,7 @@ const MonitorDashboard: React.FC = () => {
{recentEvents.length > 0 && (
<button
onClick={() => setRecentEvents([])}
- style={{
- padding: '2px 8px', backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`, color: F.MUTED,
- borderRadius: '2px', cursor: 'pointer', fontSize: '8px', fontWeight: 700,
- letterSpacing: '0.5px',
- }}
+ className={S.btnOutline}
onMouseEnter={e => { e.currentTarget.style.color = F.WHITE; e.currentTarget.style.borderColor = F.ORANGE; }}
onMouseLeave={e => { e.currentTarget.style.color = F.MUTED; e.currentTarget.style.borderColor = F.BORDER; }}
>
@@ -341,17 +296,14 @@ const MonitorDashboard: React.FC = () => {
</div>
{/* Event Entries */}
- <div style={{ flex: 1, overflowY: 'auto', padding: '4px 0' }}>
+ <div className="flex-1 overflow-y-auto py-1">
{recentEvents.length === 0 ? (
- <div style={{
- padding: '32px 16px', textAlign: 'center',
- display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '6px',
- }}>
- <Radio size={16} color={F.MUTED} style={{ opacity: 0.3 }} />
- <span style={{ fontSize: '9px', color: F.MUTED, fontWeight: 700 }}>
+ <div className="flex flex-col items-center gap-2 py-8 px-4 text-center">
+ <Radio size={20} style={{ color: F.MUTED, opacity: 0.3 }} />
+ <span className="text-[10px] font-bold" style={{ color: F.MUTED }}>
NO EVENTS YET
</span>
- <span style={{ fontSize: '8px', color: F.MUTED }}>
+ <span className={S.muted}>
Events will appear here when strategies are running
</span>
</div>
@@ -359,29 +311,23 @@ const MonitorDashboard: React.FC = () => {
recentEvents.map((evt, i) => (
<div
key={i}
- style={{
- display: 'flex', gap: '8px', padding: '6px 12px',
- borderBottom: `1px solid ${F.BORDER}15`,
- transition: 'background-color 0.15s',
- }}
+ className="flex gap-2 px-4 py-2 transition-colors duration-150"
+ style={{ borderBottom: `1px solid ${F.BORDER}15` }}
onMouseEnter={e => { e.currentTarget.style.backgroundColor = F.HOVER; }}
onMouseLeave={e => { e.currentTarget.style.backgroundColor = 'transparent'; }}
>
- <div style={{ color: eventColor(evt.type), flexShrink: 0, paddingTop: '1px' }}>
+ <div className="shrink-0 pt-0.5" style={{ color: eventColor(evt.type) }}>
{eventIcon(evt.type)}
</div>
- <div style={{ flex: 1, minWidth: 0 }}>
- <div style={{
- fontSize: '9px', color: eventColor(evt.type),
- lineHeight: '1.4', wordBreak: 'break-word',
- }}>
+ <div className="flex-1 min-w-0">
+ <div
+ className="text-[10px] leading-relaxed break-words"
+ style={{ color: eventColor(evt.type) }}
+ >
{evt.message}
</div>
- <div style={{
- fontSize: '8px', color: F.MUTED, marginTop: '1px',
- display: 'flex', alignItems: 'center', gap: '3px',
- }}>
- <Clock size={7} />
+ <div className="flex items-center gap-1 mt-0.5 text-[9px]" style={{ color: F.MUTED }}>
+ <Clock size={8} />
{new Date(evt.ts).toLocaleTimeString()}
</div>
</div>
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ParameterEditor.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ParameterEditor.tsx
index 0bab77a4b..69d55b77b 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ParameterEditor.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ParameterEditor.tsx
@@ -3,13 +3,7 @@ import { Settings, Loader2, AlertCircle, RefreshCw, Code, Hash, ToggleLeft, Type
import type { StrategyParameter } from '../types';
import { extractStrategyParameters } from '../services/algoTradingService';
import { F } from '../constants/theme';
-
-const inputBaseStyle: React.CSSProperties = {
- width: '100%', padding: '8px 10px', backgroundColor: F.DARK_BG,
- color: F.WHITE, border: `1px solid ${F.BORDER}`, borderRadius: '2px',
- fontSize: '10px', fontFamily: '"IBM Plex Mono", monospace', outline: 'none',
- transition: 'border-color 0.2s',
-};
+import { S } from '../constants/styles';
interface ParameterEditorProps {
code?: string;
@@ -72,39 +66,30 @@ const ParameterEditor: React.FC<ParameterEditorProps> = ({
if (loading) {
return (
- <div style={{
- padding: '24px', display: 'flex', flexDirection: 'column',
- alignItems: 'center', gap: '8px', color: F.GRAY,
- }}>
- <Loader2 size={18} className="animate-spin" style={{ color: F.ORANGE }} />
- <span style={{ fontSize: '10px', fontWeight: 700, letterSpacing: '0.5px' }}>
- EXTRACTING PARAMETERS...
- </span>
+ <div className="flex flex-col items-center gap-2 py-6" style={{ color: F.GRAY }}>
+ <Loader2 size={20} className="animate-spin" style={{ color: F.ORANGE }} />
+ <span className="text-[11px] font-bold tracking-wide">EXTRACTING PARAMETERS...</span>
</div>
);
}
if (error) {
return (
- <div style={{
- padding: '12px', backgroundColor: `${F.RED}15`,
- border: `1px solid ${F.RED}40`, borderRadius: '2px',
- display: 'flex', alignItems: 'center', gap: '8px',
- }}>
- <AlertCircle size={12} color={F.RED} />
- <span style={{ fontSize: '9px', color: F.RED, fontWeight: 700 }}>{error}</span>
+ <div
+ className="flex items-center gap-2 rounded px-4 py-3"
+ style={{ backgroundColor: `${F.RED}15`, border: `1px solid ${F.RED}40` }}
+ >
+ <AlertCircle size={14} color={F.RED} />
+ <span className="text-[11px] font-bold" style={{ color: F.RED }}>{error}</span>
</div>
);
}
if (parameters.length === 0) {
return (
- <div style={{
- padding: '24px', textAlign: 'center',
- display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '6px',
- }}>
- <Code size={18} color={F.MUTED} style={{ opacity: 0.5 }} />
- <span style={{ fontSize: '9px', color: F.MUTED, fontWeight: 700 }}>
+ <div className="flex flex-col items-center gap-2 py-6">
+ <Code size={20} style={{ color: F.MUTED, opacity: 0.5 }} />
+ <span className="text-[11px] font-bold" style={{ color: F.MUTED }}>
NO CONFIGURABLE PARAMETERS
</span>
</div>
@@ -112,64 +97,46 @@ const ParameterEditor: React.FC<ParameterEditorProps> = ({
}
return (
- <div style={{
- backgroundColor: F.PANEL_BG, borderRadius: '2px',
- border: `1px solid ${F.BORDER}`, overflow: 'hidden',
- }}>
+ <div className={S.section} style={{ backgroundColor: F.PANEL_BG }}>
{/* Header */}
- <div style={{
- padding: '10px 12px', borderBottom: `1px solid ${F.BORDER}`,
- display: 'flex', alignItems: 'center', justifyContent: 'space-between',
- backgroundColor: F.HEADER_BG,
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <Settings size={12} color={F.ORANGE} />
- <span style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
+ <div
+ className={`${S.sectionHeader} justify-between`}
+ style={{ backgroundColor: F.HEADER_BG }}
+ >
+ <div className="flex items-center gap-2">
+ <Settings size={14} color={F.ORANGE} />
+ <span className="text-[11px] font-bold tracking-wide" style={{ color: F.WHITE }}>
STRATEGY PARAMETERS
</span>
- <span style={{
- padding: '2px 6px', borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- backgroundColor: `${F.ORANGE}20`, color: F.ORANGE,
- }}>
+ <span
+ className={S.badge}
+ style={{ backgroundColor: `${F.ORANGE}20`, color: F.ORANGE }}
+ >
{parameters.length}
</span>
</div>
<button
onClick={handleReset}
disabled={disabled}
- style={{
- padding: '4px 10px', backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`, borderRadius: '2px',
- color: F.GRAY, fontSize: '8px', fontWeight: 700, letterSpacing: '0.5px',
- cursor: disabled ? 'not-allowed' : 'pointer',
- display: 'flex', alignItems: 'center', gap: '4px',
- opacity: disabled ? 0.5 : 1, transition: 'all 0.2s',
- }}
+ className={S.btnOutline}
+ style={{ opacity: disabled ? 0.5 : 1, cursor: disabled ? 'not-allowed' : 'pointer' }}
onMouseEnter={e => {
- if (!disabled) {
- e.currentTarget.style.borderColor = F.ORANGE;
- e.currentTarget.style.color = F.WHITE;
- }
+ if (!disabled) { e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.color = F.WHITE; }
}}
onMouseLeave={e => {
- if (!disabled) {
- e.currentTarget.style.borderColor = F.BORDER;
- e.currentTarget.style.color = F.GRAY;
- }
+ if (!disabled) { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }
}}
>
- <RefreshCw size={9} />
+ <RefreshCw size={10} />
RESET DEFAULTS
</button>
</div>
{/* Parameters Grid */}
- <div style={{
- padding: '12px',
- display: 'grid',
- gridTemplateColumns: 'repeat(auto-fill, minmax(220px, 1fr))',
- gap: '10px',
- }}>
+ <div
+ className="p-4 grid gap-3"
+ style={{ gridTemplateColumns: 'repeat(auto-fill, minmax(240px, 1fr))' }}
+ >
{parameters.map((param) => (
<ParameterInput
key={param.name}
@@ -210,8 +177,6 @@ const ParameterInput: React.FC<{
const typeColor = TYPE_COLORS[parameter.type] || F.GRAY;
const renderInput = () => {
- const baseStyle = { ...inputBaseStyle, cursor: disabled ? 'not-allowed' : undefined };
-
switch (parameter.type) {
case 'bool':
return (
@@ -219,7 +184,11 @@ const ParameterInput: React.FC<{
value={value}
onChange={(e) => onChange(e.target.value)}
disabled={disabled}
- style={{ ...baseStyle, color: value === 'true' ? F.GREEN : F.RED }}
+ className={S.select}
+ style={{
+ color: value === 'true' ? F.GREEN : F.RED,
+ cursor: disabled ? 'not-allowed' : undefined,
+ }}
>
<option value="true">True</option>
<option value="false">False</option>
@@ -232,7 +201,8 @@ const ParameterInput: React.FC<{
onChange={(e) => onChange(e.target.value)}
disabled={disabled}
min={parameter.min} max={parameter.max} step={1}
- style={{ ...baseStyle, color: F.CYAN }}
+ className={S.input}
+ style={{ color: F.CYAN, cursor: disabled ? 'not-allowed' : undefined }}
onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
/>
@@ -244,7 +214,8 @@ const ParameterInput: React.FC<{
onChange={(e) => onChange(e.target.value)}
disabled={disabled}
min={parameter.min} max={parameter.max} step={0.01}
- style={{ ...baseStyle, color: F.BLUE }}
+ className={S.input}
+ style={{ color: F.BLUE, cursor: disabled ? 'not-allowed' : undefined }}
onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
/>
@@ -255,7 +226,8 @@ const ParameterInput: React.FC<{
type="text" value={value}
onChange={(e) => onChange(e.target.value)}
disabled={disabled}
- style={baseStyle}
+ className={S.input}
+ style={{ cursor: disabled ? 'not-allowed' : undefined }}
onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
/>
@@ -264,38 +236,30 @@ const ParameterInput: React.FC<{
};
return (
- <div style={{
- backgroundColor: F.DARK_BG, border: `1px solid ${F.BORDER}`,
- borderRadius: '2px', padding: '10px', transition: 'border-color 0.2s',
- }}>
- <div style={{
- display: 'flex', alignItems: 'center', justifyContent: 'space-between',
- marginBottom: '6px',
- }}>
- <label style={{
- fontSize: '9px', fontWeight: 700, color: F.GRAY,
- letterSpacing: '0.5px', display: 'flex', alignItems: 'center', gap: '4px',
- }}>
+ <div
+ className="rounded p-3 transition-colors duration-200"
+ style={{ backgroundColor: F.DARK_BG, border: `1px solid ${F.BORDER}` }}
+ >
+ <div className="flex items-center justify-between mb-2">
+ <label className="text-[10px] font-bold tracking-wide flex items-center gap-1.5" style={{ color: F.GRAY }}>
{parameter.name.toUpperCase()}
</label>
- <span style={{
- fontSize: '8px', padding: '2px 6px',
- backgroundColor: `${typeColor}15`, color: typeColor,
- borderRadius: '2px', fontWeight: 700, letterSpacing: '0.5px',
- display: 'flex', alignItems: 'center', gap: '3px',
- }}>
- <TypeIcon size={8} />
+ <span
+ className={`${S.badge} flex items-center gap-1`}
+ style={{ backgroundColor: `${typeColor}15`, color: typeColor }}
+ >
+ <TypeIcon size={10} />
{parameter.type.toUpperCase()}
</span>
</div>
{renderInput()}
{parameter.description && (
- <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '4px', lineHeight: '1.4' }}>
+ <div className="text-[10px] mt-1.5 leading-relaxed" style={{ color: F.MUTED }}>
{parameter.description}
</div>
)}
{(parameter.min !== undefined || parameter.max !== undefined) && (
- <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '2px' }}>
+ <div className="text-[10px] mt-1" style={{ color: F.MUTED }}>
{parameter.min !== undefined && `Min: ${parameter.min}`}
{parameter.min !== undefined && parameter.max !== undefined && ' | '}
{parameter.max !== undefined && `Max: ${parameter.max}`}
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/PythonBacktestPanel.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/PythonBacktestPanel.tsx
index eaeeba6b3..0dd13feb6 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/PythonBacktestPanel.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/PythonBacktestPanel.tsx
@@ -6,7 +6,6 @@ import {
TrendingUp,
TrendingDown,
BarChart3,
- Calendar,
DollarSign,
Target,
Percent,
@@ -16,34 +15,41 @@ import {
Settings,
ChevronDown,
ChevronUp,
+ Bug,
+ Info,
} from 'lucide-react';
-import type { PythonStrategy, PythonBacktestResult, BacktestMetrics, EquityPoint, BacktestTrade } from '../types';
+import type { PythonStrategy, PythonBacktestResult, BacktestTrade, EquityPoint } from '../types';
import { runPythonBacktest, getPythonStrategyCode } from '../services/algoTradingService';
import ParameterEditor from './ParameterEditor';
import { F } from '../constants/theme';
+const font = '"IBM Plex Mono", "Consolas", monospace';
+
interface PythonBacktestPanelProps {
strategy: PythonStrategy;
onClose: () => void;
}
const PythonBacktestPanel: React.FC<PythonBacktestPanelProps> = ({ strategy, onClose }) => {
- const [symbols, setSymbols] = useState('SPY,AAPL,MSFT');
+ // Config state
+ const [symbols, setSymbols] = useState('SPY');
const [startDate, setStartDate] = useState(() => {
- const date = new Date();
- date.setFullYear(date.getFullYear() - 1);
- return date.toISOString().split('T')[0];
+ const d = new Date();
+ d.setFullYear(d.getFullYear() - 1);
+ return d.toISOString().split('T')[0];
});
const [endDate, setEndDate] = useState(() => new Date().toISOString().split('T')[0]);
- const [initialCash, setInitialCash] = useState(100000);
- const [dataProvider, setDataProvider] = useState<'yfinance' | 'fyers'>('yfinance');
+ const [initialCapital, setInitialCapital] = useState(100000);
const [parameters, setParameters] = useState<Record<string, string>>({});
const [showParams, setShowParams] = useState(false);
const [strategyCode, setStrategyCode] = useState<string | undefined>(undefined);
+ // Result state
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const [result, setResult] = useState<PythonBacktestResult | null>(null);
+ const [debugLog, setDebugLog] = useState<string[]>([]);
+ const [showDebug, setShowDebug] = useState(false);
// Load strategy code for parameter extraction
useEffect(() => {
@@ -54,7 +60,7 @@ const PythonBacktestPanel: React.FC<PythonBacktestPanelProps> = ({ strategy, onC
setStrategyCode(response.data.code);
}
} catch (err) {
- console.error('Failed to load strategy code:', err);
+ console.error('[PythonBacktest] Failed to load strategy code:', err);
}
};
loadCode();
@@ -64,438 +70,304 @@ const PythonBacktestPanel: React.FC<PythonBacktestPanelProps> = ({ strategy, onC
setLoading(true);
setError(null);
setResult(null);
+ setDebugLog([]);
try {
- const response = await runPythonBacktest({
+ const request = {
strategy_id: strategy.id,
- symbols: symbols.split(',').map((s) => s.trim().toUpperCase()),
+ symbol: symbols.split(',').map(s => s.trim().toUpperCase()).filter(Boolean).join(','),
start_date: startDate,
end_date: endDate,
- initial_cash: initialCash,
- parameters,
- data_provider: dataProvider,
- });
+ initial_capital: initialCapital,
+ params: Object.keys(parameters).length > 0 ? JSON.stringify(parameters) : undefined,
+ };
+ console.log('[PythonBacktest] Request:', request);
+
+ const response = await runPythonBacktest(request);
+ console.log('[PythonBacktest] Response:', response);
if (!response.success) {
setError(response.error || 'Backtest failed');
+ if (response.debug) setDebugLog(response.debug as string[]);
return;
}
if (response.data) {
setResult(response.data);
+ if (response.data.debug) setDebugLog(response.data.debug);
}
} catch (err) {
+ console.error('[PythonBacktest] Exception:', err);
setError(err instanceof Error ? err.message : 'Unknown error');
} finally {
setLoading(false);
}
};
+ const m = result?.metrics;
+ const safe = (val: number | undefined, decimals = 2) =>
+ val != null && isFinite(val) ? val.toFixed(decimals) : '—';
+
return (
<div
style={{
- position: 'fixed',
- top: 0,
- left: 0,
- right: 0,
- bottom: 0,
- backgroundColor: 'rgba(0, 0, 0, 0.8)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- zIndex: 1000,
+ position: 'fixed', inset: 0, display: 'flex', alignItems: 'center', justifyContent: 'center',
+ zIndex: 1000, backgroundColor: 'rgba(0,0,0,0.85)',
}}
onClick={onClose}
>
<div
style={{
- width: '900px',
- maxHeight: '90vh',
- backgroundColor: F.PANEL_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- display: 'flex',
- flexDirection: 'column',
- overflow: 'hidden',
+ width: '980px', maxHeight: '92vh', display: 'flex', flexDirection: 'column',
+ backgroundColor: F.PANEL_BG, borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER,
+ borderRadius: '3px', overflow: 'hidden', fontFamily: font,
}}
- onClick={(e) => e.stopPropagation()}
+ onClick={e => e.stopPropagation()}
>
- {/* Header */}
- <div
- style={{
- padding: '16px',
- borderBottom: `1px solid ${F.BORDER}`,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- backgroundColor: F.HEADER_BG,
- }}
- >
+ {/* ── Header ── */}
+ <div style={{
+ display: 'flex', alignItems: 'center', justifyContent: 'space-between',
+ padding: '14px 20px', backgroundColor: F.HEADER_BG,
+ borderBottomWidth: '2px', borderBottomStyle: 'solid', borderBottomColor: F.ORANGE,
+ }}>
<div>
- <div style={{ fontSize: '12px', fontWeight: 700, color: F.WHITE }}>
- BACKTEST: {strategy.name}
+ <div style={{ fontSize: '14px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
+ BACKTEST — {strategy.name}
</div>
- <div style={{ fontSize: '10px', color: F.GRAY, marginTop: '4px' }}>
- {strategy.id} - {strategy.category}
+ <div style={{ fontSize: '10px', color: F.GRAY, marginTop: '3px' }}>
+ {strategy.id} · {strategy.category}
</div>
</div>
<button
onClick={onClose}
style={{
- backgroundColor: 'transparent',
- border: 'none',
- color: F.GRAY,
- cursor: 'pointer',
- padding: '4px',
+ background: 'none', borderWidth: 0, color: F.GRAY, cursor: 'pointer',
+ padding: '4px', borderRadius: '2px',
}}
+ onMouseEnter={e => { e.currentTarget.style.color = F.WHITE; }}
+ onMouseLeave={e => { e.currentTarget.style.color = F.GRAY; }}
>
<X size={18} />
</button>
</div>
- {/* Content */}
- <div style={{ flex: 1, overflow: 'auto', padding: '16px' }}>
- {/* Configuration */}
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: 'repeat(3, 1fr)',
- gap: '12px',
- marginBottom: '16px',
- }}
- >
- {/* Symbols */}
- <div>
- <label style={{ fontSize: '10px', color: F.GRAY, marginBottom: '4px', display: 'block' }}>
- SYMBOLS (comma-separated)
- </label>
- <input
- type="text"
- value={symbols}
- onChange={(e) => setSymbols(e.target.value)}
- style={{
- width: '100%',
- padding: '8px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '11px',
- }}
- placeholder="SPY, AAPL, MSFT"
- />
- </div>
-
- {/* Start Date */}
- <div>
- <label style={{ fontSize: '10px', color: F.GRAY, marginBottom: '4px', display: 'block' }}>
- START DATE
- </label>
- <input
- type="date"
- value={startDate}
- onChange={(e) => setStartDate(e.target.value)}
- style={{
- width: '100%',
- padding: '8px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '11px',
- }}
- />
- </div>
-
- {/* End Date */}
- <div>
- <label style={{ fontSize: '10px', color: F.GRAY, marginBottom: '4px', display: 'block' }}>
- END DATE
- </label>
- <input
- type="date"
- value={endDate}
- onChange={(e) => setEndDate(e.target.value)}
- style={{
- width: '100%',
- padding: '8px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '11px',
- }}
- />
- </div>
+ {/* ── Body ── */}
+ <div style={{ flex: 1, overflowY: 'auto', padding: '20px' }}>
- {/* Initial Cash */}
- <div>
- <label style={{ fontSize: '10px', color: F.GRAY, marginBottom: '4px', display: 'block' }}>
- INITIAL CAPITAL
- </label>
- <input
- type="number"
- value={initialCash}
- onChange={(e) => setInitialCash(Number(e.target.value))}
- style={{
- width: '100%',
- padding: '8px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '11px',
- }}
- min={1000}
- step={10000}
- />
- </div>
+ {/* ── Configuration Grid ── */}
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: '14px', marginBottom: '16px' }}>
+ <InputField label="SYMBOLS" value={symbols} onChange={setSymbols} placeholder="SPY, AAPL, MSFT" />
+ <InputField label="START DATE" value={startDate} onChange={setStartDate} type="date" />
+ <InputField label="END DATE" value={endDate} onChange={setEndDate} type="date" />
+ <InputField label="INITIAL CAPITAL" value={String(initialCapital)} onChange={v => setInitialCapital(Number(v))} type="number" />
- {/* Data Provider */}
- <div>
- <label style={{ fontSize: '10px', color: F.GRAY, marginBottom: '4px', display: 'block' }}>
- DATA PROVIDER
- </label>
- <select
- value={dataProvider}
- onChange={(e) => setDataProvider(e.target.value as 'yfinance' | 'fyers')}
- style={{
- width: '100%',
- padding: '8px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '11px',
- }}
- >
- <option value="yfinance">Yahoo Finance</option>
- <option value="fyers">Fyers (Local Cache)</option>
- </select>
- </div>
+ {/* Empty spacer */}
+ <div />
- {/* Run Button */}
+ {/* Run button */}
<div style={{ display: 'flex', alignItems: 'flex-end' }}>
<button
onClick={handleRunBacktest}
disabled={loading || !symbols.trim()}
style={{
- width: '100%',
- padding: '10px',
+ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '6px',
+ padding: '10px 16px', borderRadius: '2px', borderWidth: 0,
+ fontSize: '11px', fontWeight: 700, letterSpacing: '0.5px', fontFamily: font,
backgroundColor: loading ? F.GRAY : F.ORANGE,
- color: F.DARK_BG,
- border: 'none',
- borderRadius: '2px',
- fontSize: '11px',
- fontWeight: 700,
- cursor: loading ? 'not-allowed' : 'pointer',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- gap: '8px',
+ color: F.DARK_BG, cursor: loading || !symbols.trim() ? 'not-allowed' : 'pointer',
+ opacity: !symbols.trim() ? 0.5 : 1,
+ transition: 'all 0.2s',
}}
>
- {loading ? (
- <>
- <Loader2 size={14} style={{ animation: 'spin 1s linear infinite' }} />
- RUNNING...
- </>
- ) : (
- <>
- <Play size={14} />
- RUN BACKTEST
- </>
- )}
+ {loading ? <><Loader2 size={14} className="animate-spin" /> RUNNING...</> : <><Play size={14} /> RUN BACKTEST</>}
</button>
- <style>{`@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }`}</style>
</div>
</div>
- {/* Parameters Toggle */}
+ {/* ── Parameters Toggle ── */}
<button
onClick={() => setShowParams(!showParams)}
style={{
- width: '100%',
- padding: '10px 12px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.GRAY,
- fontSize: '10px',
- cursor: 'pointer',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- marginBottom: '16px',
+ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'space-between',
+ padding: '10px 14px', marginBottom: '16px', borderRadius: '2px',
+ backgroundColor: F.DARK_BG, borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER,
+ color: F.GRAY, cursor: 'pointer', fontFamily: font, fontSize: '10px', fontWeight: 700,
+ letterSpacing: '0.5px',
}}
>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <Settings size={12} />
- STRATEGY PARAMETERS
- </div>
- {showParams ? <ChevronUp size={14} /> : <ChevronDown size={14} />}
+ <span style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
+ <Settings size={13} /> STRATEGY PARAMETERS
+ </span>
+ {showParams ? <ChevronUp size={13} /> : <ChevronDown size={13} />}
</button>
- {/* Parameter Editor */}
{showParams && strategyCode && (
<div style={{ marginBottom: '16px' }}>
- <ParameterEditor
- code={strategyCode}
- values={parameters}
- onChange={setParameters}
- disabled={loading}
- />
+ <ParameterEditor code={strategyCode} values={parameters} onChange={setParameters} disabled={loading} />
</div>
)}
- {/* Error */}
+ {/* ── Error ── */}
{error && (
- <div
- style={{
- padding: '12px',
- backgroundColor: `${F.RED}20`,
- border: `1px solid ${F.RED}`,
- borderRadius: '2px',
- marginBottom: '16px',
- display: 'flex',
- alignItems: 'center',
- gap: '8px',
- color: F.RED,
- fontSize: '11px',
- }}
- >
- <AlertCircle size={16} />
- {error}
+ <div style={{
+ display: 'flex', alignItems: 'flex-start', gap: '10px', padding: '12px 14px', marginBottom: '16px',
+ borderRadius: '2px', backgroundColor: `${F.RED}12`, borderWidth: '1px', borderStyle: 'solid',
+ borderColor: `${F.RED}60`, fontSize: '11px', color: F.RED, lineHeight: '1.5',
+ }}>
+ <AlertCircle size={16} style={{ flexShrink: 0, marginTop: '1px' }} />
+ <div style={{ flex: 1, whiteSpace: 'pre-wrap', wordBreak: 'break-word' }}>{error}</div>
</div>
)}
- {/* Results */}
- {result && (
- <div>
- {/* Metrics Grid */}
- <div
+ {/* ── Debug Log Toggle ── */}
+ {debugLog.length > 0 && (
+ <div style={{ marginBottom: '16px' }}>
+ <button
+ onClick={() => setShowDebug(!showDebug)}
style={{
- display: 'grid',
- gridTemplateColumns: 'repeat(4, 1fr)',
- gap: '12px',
- marginBottom: '16px',
+ display: 'flex', alignItems: 'center', gap: '6px', padding: '6px 10px',
+ backgroundColor: 'transparent', borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER,
+ color: F.GRAY, fontSize: '9px', fontWeight: 700, fontFamily: font, borderRadius: '2px',
+ cursor: 'pointer', letterSpacing: '0.5px',
}}
>
+ <Bug size={11} />
+ {showDebug ? 'HIDE' : 'SHOW'} DEBUG LOG ({debugLog.length})
+ </button>
+ {showDebug && (
+ <div style={{
+ marginTop: '8px', padding: '10px', backgroundColor: F.DARK_BG,
+ borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER,
+ borderRadius: '2px', maxHeight: '200px', overflowY: 'auto',
+ fontSize: '9px', color: F.MUTED, lineHeight: '1.7', fontFamily: font,
+ }}>
+ {debugLog.map((line, i) => <div key={i}>{line}</div>)}
+ </div>
+ )}
+ </div>
+ )}
+
+ {/* ── Results ── */}
+ {result && m && (
+ <div>
+ {/* Info banner if no trades */}
+ {m.total_trades === 0 && (
+ <div style={{
+ display: 'flex', alignItems: 'center', gap: '10px', padding: '12px 14px', marginBottom: '16px',
+ borderRadius: '2px', backgroundColor: `${F.YELLOW}12`, borderWidth: '1px', borderStyle: 'solid',
+ borderColor: `${F.YELLOW}40`, fontSize: '10px', color: F.YELLOW,
+ }}>
+ <Info size={14} />
+ Strategy produced 0 trades. This may be expected for universe-selection or framework strategies that require specific market conditions.
+ </div>
+ )}
+
+ {/* ── Metrics Grid ── */}
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: '10px', marginBottom: '16px' }}>
<MetricCard
- label="Total Return"
- value={`${result.metrics.total_return_pct >= 0 ? '+' : ''}${result.metrics.total_return_pct.toFixed(2)}%`}
- valueColor={result.metrics.total_return_pct >= 0 ? F.GREEN : F.RED}
- icon={result.metrics.total_return_pct >= 0 ? TrendingUp : TrendingDown}
- />
- <MetricCard
- label="Total Trades"
- value={result.metrics.total_trades.toString()}
- icon={BarChart3}
+ label="Total Return" icon={m.total_return_pct >= 0 ? TrendingUp : TrendingDown}
+ value={`${m.total_return_pct >= 0 ? '+' : ''}${safe(m.total_return_pct)}%`}
+ valueColor={m.total_return_pct >= 0 ? F.GREEN : F.RED}
/>
+ <MetricCard label="Total Trades" icon={BarChart3} value={String(m.total_trades)} />
<MetricCard
- label="Win Rate"
- value={`${result.metrics.win_rate.toFixed(1)}%`}
- valueColor={result.metrics.win_rate >= 50 ? F.GREEN : F.YELLOW}
- icon={Target}
+ label="Win Rate" icon={Target}
+ value={`${safe(m.win_rate, 1)}%`}
+ valueColor={m.win_rate >= 50 ? F.GREEN : F.YELLOW}
/>
<MetricCard
- label="Max Drawdown"
- value={`-${result.metrics.max_drawdown_pct.toFixed(2)}%`}
+ label="Max Drawdown" icon={ArrowDownRight}
+ value={`-${safe(m.max_drawdown_pct)}%`}
valueColor={F.RED}
- icon={ArrowDownRight}
/>
<MetricCard
- label="Sharpe Ratio"
- value={result.metrics.sharpe_ratio.toFixed(2)}
- valueColor={result.metrics.sharpe_ratio >= 1 ? F.GREEN : F.YELLOW}
- icon={Percent}
+ label="Sharpe Ratio" icon={Percent}
+ value={safe(m.sharpe_ratio)}
+ valueColor={m.sharpe_ratio >= 1 ? F.GREEN : F.YELLOW}
/>
<MetricCard
label="Profit Factor"
- value={result.metrics.profit_factor.toFixed(2)}
- valueColor={result.metrics.profit_factor >= 1.5 ? F.GREEN : F.YELLOW}
+ value={safe(m.profit_factor)}
+ valueColor={m.profit_factor >= 1.5 ? F.GREEN : F.YELLOW}
/>
<MetricCard
- label="Avg P&L"
- value={`$${result.metrics.avg_pnl.toFixed(2)}`}
- valueColor={result.metrics.avg_pnl >= 0 ? F.GREEN : F.RED}
- icon={DollarSign}
+ label="Avg P&L" icon={DollarSign}
+ value={`$${safe(m.avg_pnl)}`}
+ valueColor={m.avg_pnl >= 0 ? F.GREEN : F.RED}
/>
<MetricCard
- label="Avg Hold Time"
- value={`${result.metrics.avg_bars_held.toFixed(0)} bars`}
- icon={Clock}
+ label="Avg Hold" icon={Clock}
+ value={`${safe(m.avg_bars_held, 0)} bars`}
/>
</div>
- {/* Equity Curve */}
+ {/* ── Equity Curve ── */}
{result.equity_curve.length > 0 && (
- <div
- style={{
- marginBottom: '16px',
- padding: '12px',
- backgroundColor: F.DARK_BG,
- borderRadius: '2px',
- border: `1px solid ${F.BORDER}`,
- }}
- >
- <div style={{ fontSize: '10px', color: F.GRAY, marginBottom: '12px' }}>
+ <div style={{
+ marginBottom: '16px', padding: '14px', backgroundColor: F.DARK_BG,
+ borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER, borderRadius: '2px',
+ }}>
+ <div style={{ fontSize: '10px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px', marginBottom: '10px' }}>
EQUITY CURVE
</div>
<EquityChart curve={result.equity_curve} />
</div>
)}
- {/* Trades Table */}
+ {/* ── Trades Table ── */}
{result.trades.length > 0 && (
- <div
- style={{
- padding: '12px',
- backgroundColor: F.DARK_BG,
- borderRadius: '2px',
- border: `1px solid ${F.BORDER}`,
- }}
- >
- <div style={{ fontSize: '10px', color: F.GRAY, marginBottom: '12px' }}>
- TRADES ({result.trades.length})
+ <div style={{
+ borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER,
+ borderRadius: '2px', overflow: 'hidden', backgroundColor: F.DARK_BG,
+ }}>
+ <div style={{
+ display: 'flex', alignItems: 'center', justifyContent: 'space-between',
+ padding: '10px 14px', borderBottomWidth: '1px', borderBottomStyle: 'solid', borderBottomColor: F.BORDER,
+ }}>
+ <span style={{ fontSize: '10px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>
+ TRADES ({result.trades.length})
+ </span>
+ <span style={{ fontSize: '9px', color: F.MUTED }}>
+ Total P&L: <span style={{ color: m.total_return >= 0 ? F.GREEN : F.RED, fontWeight: 700 }}>
+ {m.total_return >= 0 ? '+' : ''}${safe(m.total_return)}
+ </span>
+ </span>
</div>
- <div style={{ maxHeight: '200px', overflow: 'auto' }}>
- <table style={{ width: '100%', borderCollapse: 'collapse', fontSize: '10px' }}>
+ <div style={{ maxHeight: '240px', overflowY: 'auto' }}>
+ <table style={{ width: '100%', borderCollapse: 'collapse', fontFamily: font }}>
<thead>
- <tr style={{ color: F.GRAY }}>
- <th style={{ textAlign: 'left', padding: '4px 8px' }}>Symbol</th>
- <th style={{ textAlign: 'right', padding: '4px 8px' }}>Entry</th>
- <th style={{ textAlign: 'right', padding: '4px 8px' }}>Exit</th>
- <th style={{ textAlign: 'right', padding: '4px 8px' }}>P&L</th>
- <th style={{ textAlign: 'right', padding: '4px 8px' }}>Bars</th>
+ <tr>
+ {['Symbol', 'Qty', 'Entry', 'Exit', 'P&L', 'Bars'].map(h => (
+ <th key={h} style={{
+ padding: '8px 12px', fontSize: '9px', fontWeight: 700, color: F.GRAY,
+ letterSpacing: '0.5px', textAlign: h === 'Symbol' ? 'left' : 'right',
+ borderBottomWidth: '1px', borderBottomStyle: 'solid', borderBottomColor: F.BORDER,
+ }}>
+ {h.toUpperCase()}
+ </th>
+ ))}
</tr>
</thead>
<tbody>
- {result.trades.slice(0, 50).map((trade, idx) => (
- <tr
- key={trade.id || idx}
- style={{
- borderTop: `1px solid ${F.BORDER}`,
- color: F.WHITE,
- }}
- >
- <td style={{ padding: '4px 8px' }}>{trade.symbol}</td>
- <td style={{ textAlign: 'right', padding: '4px 8px' }}>
+ {result.trades.slice(0, 50).map((trade: BacktestTrade, idx: number) => (
+ <tr key={trade.id || idx} style={{
+ borderTopWidth: idx > 0 ? '1px' : 0, borderTopStyle: 'solid', borderTopColor: F.BORDER,
+ }}>
+ <td style={{ padding: '7px 12px', fontSize: '11px', color: F.WHITE }}>{trade.symbol}</td>
+ <td style={{ padding: '7px 12px', fontSize: '11px', color: F.GRAY, textAlign: 'right' }}>{trade.quantity}</td>
+ <td style={{ padding: '7px 12px', fontSize: '11px', color: F.WHITE, textAlign: 'right' }}>
${trade.entry_price.toFixed(2)}
</td>
- <td style={{ textAlign: 'right', padding: '4px 8px' }}>
- ${trade.exit_price?.toFixed(2) || '-'}
+ <td style={{ padding: '7px 12px', fontSize: '11px', color: F.WHITE, textAlign: 'right' }}>
+ {trade.exit_price != null ? `$${trade.exit_price.toFixed(2)}` : '—'}
</td>
- <td
- style={{
- textAlign: 'right',
- padding: '4px 8px',
- color: trade.pnl >= 0 ? F.GREEN : F.RED,
- }}
- >
+ <td style={{
+ padding: '7px 12px', fontSize: '11px', textAlign: 'right', fontWeight: 700,
+ color: trade.pnl >= 0 ? F.GREEN : F.RED,
+ }}>
{trade.pnl >= 0 ? '+' : ''}${trade.pnl.toFixed(2)}
</td>
- <td style={{ textAlign: 'right', padding: '4px 8px', color: F.GRAY }}>
+ <td style={{ padding: '7px 12px', fontSize: '11px', color: F.GRAY, textAlign: 'right' }}>
{trade.bars_held}
</td>
</tr>
@@ -503,7 +375,7 @@ const PythonBacktestPanel: React.FC<PythonBacktestPanelProps> = ({ strategy, onC
</tbody>
</table>
{result.trades.length > 50 && (
- <div style={{ textAlign: 'center', padding: '8px', color: F.GRAY, fontSize: '9px' }}>
+ <div style={{ textAlign: 'center', padding: '10px', fontSize: '9px', color: F.GRAY }}>
Showing first 50 of {result.trades.length} trades
</div>
)}
@@ -518,64 +390,90 @@ const PythonBacktestPanel: React.FC<PythonBacktestPanelProps> = ({ strategy, onC
);
};
-// Metric Card Component
+
+// ── Input Field ──
+const InputField: React.FC<{
+ label: string; value: string; onChange: (v: string) => void;
+ type?: string; placeholder?: string;
+}> = ({ label, value, onChange, type = 'text', placeholder }) => (
+ <div>
+ <div style={{ fontSize: '10px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px', marginBottom: '5px' }}>
+ {label}
+ </div>
+ <input
+ type={type}
+ value={value}
+ onChange={e => onChange(e.target.value)}
+ placeholder={placeholder}
+ style={{
+ width: '100%', padding: '8px 10px', backgroundColor: F.DARK_BG,
+ borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER,
+ borderRadius: '2px', color: F.WHITE, fontSize: '11px', fontFamily: font,
+ outline: 'none', boxSizing: 'border-box',
+ }}
+ onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ </div>
+);
+
+
+// ── Metric Card ──
const MetricCard: React.FC<{
- label: string;
- value: string;
- valueColor?: string;
- icon?: React.ElementType;
+ label: string; value: string; valueColor?: string; icon?: React.ElementType;
}> = ({ label, value, valueColor = F.WHITE, icon: Icon }) => (
- <div
- style={{
- padding: '12px',
- backgroundColor: F.DARK_BG,
- borderRadius: '2px',
- border: `1px solid ${F.BORDER}`,
- }}
- >
- <div style={{ display: 'flex', alignItems: 'center', gap: '6px', marginBottom: '4px' }}>
- {Icon && <Icon size={12} style={{ color: F.GRAY }} />}
- <span style={{ fontSize: '9px', color: F.GRAY, textTransform: 'uppercase' }}>{label}</span>
+ <div style={{
+ padding: '12px 14px', backgroundColor: F.DARK_BG,
+ borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER, borderRadius: '2px',
+ }}>
+ <div style={{
+ fontSize: '9px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px',
+ display: 'flex', alignItems: 'center', gap: '5px', marginBottom: '6px',
+ }}>
+ {Icon && <Icon size={12} />}
+ {label.toUpperCase()}
+ </div>
+ <div style={{ fontSize: '16px', fontWeight: 700, color: valueColor, fontFamily: font }}>
+ {value}
</div>
- <div style={{ fontSize: '14px', fontWeight: 700, color: valueColor }}>{value}</div>
</div>
);
-// Simple Equity Chart (SVG based)
+
+// ── Equity Chart (SVG) ──
const EquityChart: React.FC<{ curve: EquityPoint[] }> = ({ curve }) => {
- if (curve.length === 0) return null;
+ if (curve.length < 2) return null;
- const values = curve.map((p) => p.value);
+ const values = curve.map(p => p.value);
const min = Math.min(...values);
const max = Math.max(...values);
const range = max - min || 1;
- const width = 100;
- const height = 60;
+ const W = 100;
+ const H = 50;
- const points = curve.map((p, i) => {
- const x = (i / (curve.length - 1)) * width;
- const y = height - ((p.value - min) / range) * height;
+ const pts = curve.map((p, i) => {
+ const x = (i / (curve.length - 1)) * W;
+ const y = H - ((p.value - min) / range) * H;
return `${x},${y}`;
});
- const pathD = `M ${points.join(' L ')}`;
+ const pathD = `M ${pts.join(' L ')}`;
+ const isPositive = values[values.length - 1] >= values[0];
return (
- <svg viewBox={`0 0 ${width} ${height}`} style={{ width: '100%', height: '80px' }}>
+ <svg viewBox={`0 0 ${W} ${H}`} style={{ width: '100%', height: '90px' }} preserveAspectRatio="none">
<defs>
- <linearGradient id="equityGradient" x1="0%" y1="0%" x2="0%" y2="100%">
- <stop offset="0%" stopColor={F.ORANGE} stopOpacity="0.3" />
- <stop offset="100%" stopColor={F.ORANGE} stopOpacity="0" />
+ <linearGradient id="eqGrad" x1="0%" y1="0%" x2="0%" y2="100%">
+ <stop offset="0%" stopColor={isPositive ? F.GREEN : F.RED} stopOpacity="0.2" />
+ <stop offset="100%" stopColor={isPositive ? F.GREEN : F.RED} stopOpacity="0" />
</linearGradient>
</defs>
- <path
- d={`${pathD} L ${width},${height} L 0,${height} Z`}
- fill="url(#equityGradient)"
- />
- <path d={pathD} fill="none" stroke={F.ORANGE} strokeWidth="1" />
+ <path d={`${pathD} L ${W},${H} L 0,${H} Z`} fill="url(#eqGrad)" />
+ <path d={pathD} fill="none" stroke={isPositive ? F.GREEN : F.RED} strokeWidth="0.8" />
</svg>
);
};
+
export default PythonBacktestPanel;
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/PythonDeployPanel.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/PythonDeployPanel.tsx
index 7175a52eb..437dcd595 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/PythonDeployPanel.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/PythonDeployPanel.tsx
@@ -3,15 +3,15 @@ import {
Rocket, X, AlertCircle, Settings, DollarSign, Shield, Clock,
Activity, CheckCircle, ChevronDown, ChevronRight, Loader2
} from 'lucide-react';
-import type { PythonStrategy, StrategyParameter } from '../types';
+import type { PythonStrategy } from '../types';
import {
- extractStrategyParameters,
getPythonStrategyCode,
} from '../services/algoTradingService';
import { invoke } from '@tauri-apps/api/core';
import { useStockBrokerContextOptional } from '@/contexts/StockBrokerContext';
import ParameterEditor from './ParameterEditor';
import { F } from '../constants/theme';
+import { S } from '../constants/styles';
interface PythonDeployPanelProps {
strategy: PythonStrategy;
@@ -66,7 +66,6 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
onClose,
onDeployed,
}) => {
- // Configuration state
const [config, setConfig] = useState<DeployConfig>({
symbol: '',
mode: 'paper',
@@ -79,20 +78,17 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
maxDailyLoss: 0,
});
- // Strategy parameters
const [strategyCode, setStrategyCode] = useState<string | null>(null);
const [strategyParams, setStrategyParams] = useState<Record<string, string>>({});
const [showParams, setShowParams] = useState(true);
const [showRisk, setShowRisk] = useState(true);
- // Deployment state
const [deploying, setDeploying] = useState(false);
const [error, setError] = useState<string | null>(null);
const [success, setSuccess] = useState<string | null>(null);
const [checkingDuplicate, setCheckingDuplicate] = useState(false);
const [isDuplicate, setIsDuplicate] = useState(false);
- // Load strategy code for parameter extraction
useEffect(() => {
const loadCode = async () => {
try {
@@ -107,7 +103,6 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
loadCode();
}, [strategy.id]);
- // Check for duplicate deployment when symbol changes
useEffect(() => {
if (!config.symbol.trim()) {
setIsDuplicate(false);
@@ -134,22 +129,12 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
return () => clearTimeout(debounce);
}, [config.symbol, strategy.id]);
- // Handle deployment
const handleDeploy = async () => {
setError(null);
setSuccess(null);
- // Validation
- if (!config.symbol.trim()) {
- setError('Symbol is required');
- return;
- }
-
- if (config.quantity <= 0) {
- setError('Quantity must be greater than 0');
- return;
- }
-
+ if (!config.symbol.trim()) { setError('Symbol is required'); return; }
+ if (config.quantity <= 0) { setError('Quantity must be greater than 0'); return; }
if (config.mode === 'live' && config.broker === 'simulator') {
setError('Please select a broker for live trading');
return;
@@ -158,7 +143,6 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
setDeploying(true);
try {
- // Build params object
const deployParams = {
symbol: config.symbol.toUpperCase(),
mode: config.mode,
@@ -173,7 +157,7 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
strategy_type: 'python',
python_strategy_id: strategy.id,
strategy_name: strategy.name,
- ...strategyParams, // Include strategy-specific parameters
+ ...strategyParams,
};
const result = await invoke<string>('deploy_algo_strategy', {
@@ -186,17 +170,13 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
if (parsed.success) {
setSuccess(`Strategy deployed successfully! Deployment ID: ${parsed.deploy_id}`);
onDeployed?.(parsed.deploy_id);
- // Ensure WebSocket subscription for stock brokers so ticks reach candle aggregator
const sym = config.symbol.toUpperCase();
if (config.broker !== 'kraken' && config.broker !== 'simulator') {
invoke('angelone_ws_subscribe', {
symbol: `NSE:${sym}`, mode: 'ltp', symbolName: sym,
}).catch(() => {});
}
- // Auto-close after success
- setTimeout(() => {
- onClose();
- }, 2000);
+ setTimeout(() => { onClose(); }, 2000);
} else {
setError(parsed.error || 'Deployment failed');
}
@@ -207,7 +187,6 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
}
};
- // Check if symbol is likely crypto
const isLikelyCrypto = (symbol: string): boolean => {
const s = symbol.toUpperCase();
return s.includes('/') || s.includes('-') ||
@@ -222,109 +201,68 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
return (
<div
- style={{
- position: 'fixed',
- top: 0,
- left: 0,
- right: 0,
- bottom: 0,
- backgroundColor: 'rgba(0,0,0,0.85)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- zIndex: 1000,
- }}
- onClick={(e) => {
- if (e.target === e.currentTarget) onClose();
- }}
+ className={S.modalOverlay}
+ style={{ backgroundColor: 'rgba(0,0,0,0.85)' }}
+ onClick={(e) => { if (e.target === e.currentTarget) onClose(); }}
>
<div
+ className="flex flex-col rounded overflow-hidden"
style={{
- width: '600px',
+ width: '640px',
maxHeight: '90vh',
backgroundColor: F.PANEL_BG,
border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- overflow: 'hidden',
- display: 'flex',
- flexDirection: 'column',
}}
>
{/* Header */}
<div
- style={{
- padding: '16px',
- borderBottom: `2px solid ${F.ORANGE}`,
- backgroundColor: F.HEADER_BG,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- }}
+ className="flex items-center justify-between px-5 py-4 shrink-0"
+ style={{ borderBottom: `2px solid ${F.ORANGE}`, backgroundColor: F.HEADER_BG }}
>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <div style={{
- width: '28px', height: '28px', borderRadius: '2px',
- backgroundColor: `${F.ORANGE}15`, display: 'flex',
- alignItems: 'center', justifyContent: 'center',
- }}>
- <Rocket size={14} color={F.ORANGE} />
+ <div className="flex items-center gap-3">
+ <div
+ className="w-8 h-8 rounded flex items-center justify-center"
+ style={{ backgroundColor: `${F.ORANGE}15` }}
+ >
+ <Rocket size={16} style={{ color: F.ORANGE }} />
</div>
<div>
- <div style={{ fontSize: '11px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
+ <div className="text-[13px] font-bold tracking-wide" style={{ color: F.WHITE }}>
DEPLOY PYTHON STRATEGY
</div>
- <div style={{ fontSize: '9px', color: F.MUTED, marginTop: '2px' }}>
- {strategy.name.toUpperCase()} • {strategy.id}
+ <div className="text-[10px] mt-0.5" style={{ color: F.MUTED }}>
+ {strategy.name.toUpperCase()} &middot; {strategy.id}
</div>
</div>
</div>
- <button
- onClick={onClose}
- style={{
- padding: '6px',
- backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.GRAY,
- cursor: 'pointer',
- }}
- >
- <X size={14} />
+ <button onClick={onClose} className={S.btnGhost} style={{ color: F.GRAY }}>
+ <X size={16} />
</button>
</div>
{/* Content */}
- <div style={{ flex: 1, overflow: 'auto', padding: '16px' }}>
+ <div className="flex-1 overflow-auto p-5">
{/* Mode Selection */}
- <div style={{ marginBottom: '16px' }}>
- <label style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '8px', display: 'block' }}>
- TRADING MODE
- </label>
- <div style={{ display: 'flex', gap: '8px' }}>
- {(['paper', 'live'] as DeployMode[]).map((mode) => (
+ <div className="mb-5">
+ <label className={S.label}>TRADING MODE</label>
+ <div className="flex gap-3">
+ {(['paper', 'live'] as DeployMode[]).map((m) => (
<button
- key={mode}
- onClick={() => updateConfig('mode', mode)}
+ key={m}
+ onClick={() => updateConfig('mode', m)}
+ className="flex-1 flex flex-col items-center gap-1.5 rounded py-3 cursor-pointer transition-all duration-200 border"
style={{
- flex: 1,
- padding: '12px',
- backgroundColor: config.mode === mode ? (mode === 'live' ? `${F.RED}20` : `${F.GREEN}20`) : 'transparent',
- border: `1px solid ${config.mode === mode ? (mode === 'live' ? F.RED : F.GREEN) : F.BORDER}`,
- borderRadius: '2px',
- color: config.mode === mode ? (mode === 'live' ? F.RED : F.GREEN) : F.GRAY,
- fontSize: '11px',
- fontWeight: 700,
- cursor: 'pointer',
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- gap: '4px',
+ backgroundColor: config.mode === m ? (m === 'live' ? `${F.RED}20` : `${F.GREEN}20`) : 'transparent',
+ borderColor: config.mode === m ? (m === 'live' ? F.RED : F.GREEN) : F.BORDER,
+ color: config.mode === m ? (m === 'live' ? F.RED : F.GREEN) : F.GRAY,
}}
>
- {mode === 'paper' ? <Activity size={16} /> : <DollarSign size={16} />}
- {mode === 'paper' ? 'PAPER TRADING' : 'LIVE TRADING'}
- <span style={{ fontSize: '9px', fontWeight: 400, color: F.MUTED }}>
- {mode === 'paper' ? 'Simulated with fake money' : 'Real money with broker'}
+ {m === 'paper' ? <Activity size={18} /> : <DollarSign size={18} />}
+ <span className="text-[11px] font-bold tracking-wide">
+ {m === 'paper' ? 'PAPER TRADING' : 'LIVE TRADING'}
+ </span>
+ <span className="text-[10px]" style={{ color: F.MUTED }}>
+ {m === 'paper' ? 'Simulated with fake money' : 'Real money with broker'}
</span>
</button>
))}
@@ -332,244 +270,133 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
</div>
{/* Basic Configuration */}
- <div style={{ marginBottom: '16px' }}>
- <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '12px' }}>
- {/* Symbol */}
- <div>
- <label style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '4px', display: 'block' }}>
- SYMBOL *
- </label>
- <div style={{ position: 'relative' }}>
- <input
- type="text"
- value={config.symbol}
- onChange={(e) => updateConfig('symbol', e.target.value.toUpperCase())}
- placeholder="e.g. AAPL, BTC/USD"
+ <div className="grid grid-cols-2 gap-4 mb-5">
+ {/* Symbol */}
+ <div>
+ <label className={S.label}>SYMBOL *</label>
+ <div className="relative">
+ <input
+ type="text"
+ value={config.symbol}
+ onChange={(e) => updateConfig('symbol', e.target.value.toUpperCase())}
+ placeholder="e.g. AAPL, BTC/USD"
+ className={S.input}
+ style={{ borderColor: isDuplicate ? F.YELLOW : undefined }}
+ />
+ {checkingDuplicate && (
+ <Loader2
+ size={14}
+ className="animate-spin"
style={{
- width: '100%',
- padding: '10px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${isDuplicate ? F.YELLOW : F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '11px',
+ position: 'absolute', right: '10px', top: '50%',
+ transform: 'translateY(-50%)', color: F.GRAY,
}}
/>
- {checkingDuplicate && (
- <Loader2
- size={12}
- style={{
- position: 'absolute',
- right: '10px',
- top: '50%',
- transform: 'translateY(-50%)',
- color: F.GRAY,
- animation: 'spin 1s linear infinite',
- }}
- />
- )}
- </div>
- {isDuplicate && (
- <div style={{ fontSize: '9px', color: F.YELLOW, marginTop: '4px' }}>
- Warning: This strategy is already deployed for this symbol
- </div>
)}
</div>
+ {isDuplicate && (
+ <div className="text-[10px] mt-1" style={{ color: F.YELLOW }}>
+ Warning: This strategy is already deployed for this symbol
+ </div>
+ )}
+ </div>
- {/* Broker */}
- <div>
- <label style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '4px', display: 'block' }}>
- BROKER
- </label>
- <select
- value={config.broker}
- onChange={(e) => updateConfig('broker', e.target.value)}
- style={{
- width: '100%',
- padding: '10px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '11px',
- }}
- >
- {BROKERS.filter((b) => config.mode === 'paper' || b.live).map((b) => (
- <option key={b.id} value={b.id}>
- {b.label}
- </option>
- ))}
- </select>
- </div>
+ {/* Broker */}
+ <div>
+ <label className={S.label}>BROKER</label>
+ <select
+ value={config.broker}
+ onChange={(e) => updateConfig('broker', e.target.value)}
+ className={S.select}
+ >
+ {BROKERS.filter((b) => config.mode === 'paper' || b.live).map((b) => (
+ <option key={b.id} value={b.id}>{b.label}</option>
+ ))}
+ </select>
+ </div>
- {/* Quantity */}
- <div>
- <label style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '4px', display: 'block' }}>
- QUANTITY
- </label>
- <input
- type="number"
- value={config.quantity}
- onChange={(e) => updateConfig('quantity', parseFloat(e.target.value) || 0)}
- min={0.0001}
- step={0.01}
- style={{
- width: '100%',
- padding: '10px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '11px',
- }}
- />
- </div>
+ {/* Quantity */}
+ <div>
+ <label className={S.label}>QUANTITY</label>
+ <input
+ type="number"
+ value={config.quantity}
+ onChange={(e) => updateConfig('quantity', parseFloat(e.target.value) || 0)}
+ min={0.0001} step={0.01}
+ className={S.input}
+ />
+ </div>
- {/* Timeframe */}
- <div>
- <label style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '4px', display: 'block' }}>
- TIMEFRAME
- </label>
- <select
- value={config.timeframe}
- onChange={(e) => updateConfig('timeframe', e.target.value)}
- style={{
- width: '100%',
- padding: '10px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '11px',
- }}
- >
- {TIMEFRAMES.map((tf) => (
- <option key={tf.value} value={tf.value}>
- {tf.label}
- </option>
- ))}
- </select>
- </div>
+ {/* Timeframe */}
+ <div>
+ <label className={S.label}>TIMEFRAME</label>
+ <select
+ value={config.timeframe}
+ onChange={(e) => updateConfig('timeframe', e.target.value)}
+ className={S.select}
+ >
+ {TIMEFRAMES.map((tf) => (
+ <option key={tf.value} value={tf.value}>{tf.label}</option>
+ ))}
+ </select>
+ </div>
- {/* Initial Cash */}
- <div>
- <label style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '4px', display: 'block' }}>
- INITIAL CASH
- </label>
- <input
- type="number"
- value={config.initialCash}
- onChange={(e) => updateConfig('initialCash', parseFloat(e.target.value) || 0)}
- min={100}
- step={1000}
- style={{
- width: '100%',
- padding: '10px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '11px',
- }}
- />
- </div>
+ {/* Initial Cash */}
+ <div>
+ <label className={S.label}>INITIAL CASH</label>
+ <input
+ type="number"
+ value={config.initialCash}
+ onChange={(e) => updateConfig('initialCash', parseFloat(e.target.value) || 0)}
+ min={100} step={1000}
+ className={S.input}
+ />
</div>
</div>
{/* Risk Management Section */}
- <div
- style={{
- marginBottom: '16px',
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- overflow: 'hidden',
- }}
- >
- <div
+ <div className={`${S.section} mb-5`}>
+ <button
onClick={() => setShowRisk(!showRisk)}
- style={{
- padding: '10px 12px',
- backgroundColor: F.HEADER_BG,
- display: 'flex',
- alignItems: 'center',
- gap: '6px',
- cursor: 'pointer',
- }}
+ className="w-full flex items-center gap-2 px-4 py-3 border-none cursor-pointer"
+ style={{ backgroundColor: F.HEADER_BG, color: F.WHITE }}
>
- {showRisk ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
- <Shield size={12} style={{ color: F.CYAN }} />
- <span style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
- RISK MANAGEMENT
- </span>
- <span style={{ fontSize: '9px', color: F.MUTED }}>(Optional)</span>
- </div>
+ {showRisk ? <ChevronDown size={14} /> : <ChevronRight size={14} />}
+ <Shield size={14} style={{ color: F.CYAN }} />
+ <span className="text-[11px] font-bold tracking-wide">RISK MANAGEMENT</span>
+ <span className="text-[10px]" style={{ color: F.MUTED }}>(Optional)</span>
+ </button>
{showRisk && (
- <div style={{ padding: '12px' }}>
- <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: '12px' }}>
+ <div className="p-4">
+ <div className="grid grid-cols-3 gap-4">
<div>
- <label style={{ fontSize: '9px', color: F.GRAY, marginBottom: '4px', display: 'block' }}>
- STOP LOSS ($)
- </label>
+ <label className={S.label}>STOP LOSS ($)</label>
<input
type="number"
value={config.stopLoss}
onChange={(e) => updateConfig('stopLoss', parseFloat(e.target.value) || 0)}
- min={0}
- step={100}
- placeholder="0 = disabled"
- style={{
- width: '100%',
- padding: '8px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '10px',
- }}
+ min={0} step={100} placeholder="0 = disabled"
+ className={S.input}
/>
</div>
<div>
- <label style={{ fontSize: '9px', color: F.GRAY, marginBottom: '4px', display: 'block' }}>
- TAKE PROFIT ($)
- </label>
+ <label className={S.label}>TAKE PROFIT ($)</label>
<input
type="number"
value={config.takeProfit}
onChange={(e) => updateConfig('takeProfit', parseFloat(e.target.value) || 0)}
- min={0}
- step={100}
- placeholder="0 = disabled"
- style={{
- width: '100%',
- padding: '8px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '10px',
- }}
+ min={0} step={100} placeholder="0 = disabled"
+ className={S.input}
/>
</div>
<div>
- <label style={{ fontSize: '9px', color: F.GRAY, marginBottom: '4px', display: 'block' }}>
- MAX DAILY LOSS ($)
- </label>
+ <label className={S.label}>MAX DAILY LOSS ($)</label>
<input
type="number"
value={config.maxDailyLoss}
onChange={(e) => updateConfig('maxDailyLoss', parseFloat(e.target.value) || 0)}
- min={0}
- step={100}
- placeholder="0 = disabled"
- style={{
- width: '100%',
- padding: '8px',
- backgroundColor: F.DARK_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.WHITE,
- fontSize: '10px',
- }}
+ min={0} step={100} placeholder="0 = disabled"
+ className={S.input}
/>
</div>
</div>
@@ -579,33 +406,18 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
{/* Strategy Parameters Section */}
{strategyCode && (
- <div
- style={{
- marginBottom: '16px',
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- overflow: 'hidden',
- }}
- >
- <div
+ <div className={`${S.section} mb-5`}>
+ <button
onClick={() => setShowParams(!showParams)}
- style={{
- padding: '10px 12px',
- backgroundColor: F.HEADER_BG,
- display: 'flex',
- alignItems: 'center',
- gap: '6px',
- cursor: 'pointer',
- }}
+ className="w-full flex items-center gap-2 px-4 py-3 border-none cursor-pointer"
+ style={{ backgroundColor: F.HEADER_BG, color: F.WHITE }}
>
- {showParams ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
- <Settings size={12} style={{ color: F.PURPLE }} />
- <span style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
- STRATEGY PARAMETERS
- </span>
- </div>
+ {showParams ? <ChevronDown size={14} /> : <ChevronRight size={14} />}
+ <Settings size={14} style={{ color: F.PURPLE }} />
+ <span className="text-[11px] font-bold tracking-wide">STRATEGY PARAMETERS</span>
+ </button>
{showParams && (
- <div style={{ padding: '12px' }}>
+ <div className="p-4">
<ParameterEditor
code={strategyCode}
values={strategyParams}
@@ -619,40 +431,20 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
{/* Error/Success Messages */}
{error && (
<div
- style={{
- padding: '10px 12px',
- backgroundColor: `${F.RED}20`,
- border: `1px solid ${F.RED}`,
- borderRadius: '2px',
- marginBottom: '16px',
- display: 'flex',
- alignItems: 'center',
- gap: '8px',
- color: F.RED,
- fontSize: '11px',
- }}
+ className="flex items-center gap-2 rounded px-4 py-3 mb-4 text-[11px]"
+ style={{ backgroundColor: `${F.RED}20`, border: `1px solid ${F.RED}`, color: F.RED }}
>
- <AlertCircle size={14} />
+ <AlertCircle size={16} />
{error}
</div>
)}
{success && (
<div
- style={{
- padding: '10px 12px',
- backgroundColor: `${F.GREEN}20`,
- border: `1px solid ${F.GREEN}`,
- borderRadius: '2px',
- marginBottom: '16px',
- display: 'flex',
- alignItems: 'center',
- gap: '8px',
- color: F.GREEN,
- fontSize: '11px',
- }}
+ className="flex items-center gap-2 rounded px-4 py-3 mb-4 text-[11px]"
+ style={{ backgroundColor: `${F.GREEN}20`, border: `1px solid ${F.GREEN}`, color: F.GREEN }}
>
- <CheckCircle size={14} />
+ <CheckCircle size={16} />
{success}
</div>
)}
@@ -660,20 +452,10 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
{/* Live Trading Warning */}
{config.mode === 'live' && (
<div
- style={{
- padding: '10px 12px',
- backgroundColor: `${F.YELLOW}10`,
- border: `1px solid ${F.YELLOW}`,
- borderRadius: '2px',
- marginBottom: '16px',
- display: 'flex',
- alignItems: 'flex-start',
- gap: '8px',
- color: F.YELLOW,
- fontSize: '10px',
- }}
+ className="flex items-start gap-2 rounded px-4 py-3 mb-4 text-[11px]"
+ style={{ backgroundColor: `${F.YELLOW}10`, border: `1px solid ${F.YELLOW}`, color: F.YELLOW }}
>
- <AlertCircle size={14} style={{ flexShrink: 0, marginTop: '2px' }} />
+ <AlertCircle size={16} className="shrink-0 mt-0.5" />
<div>
<strong>Live Trading Warning:</strong> This will execute real trades with real
money. Ensure your broker is connected and you understand the risks. Always test
@@ -685,69 +467,36 @@ const PythonDeployPanel: React.FC<PythonDeployPanelProps> = ({
{/* Footer */}
<div
- style={{
- padding: '16px',
- borderTop: `1px solid ${F.BORDER}`,
- backgroundColor: F.HEADER_BG,
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'center',
- }}
+ className="flex items-center justify-between px-5 py-4 shrink-0"
+ style={{ borderTop: `1px solid ${F.BORDER}`, backgroundColor: F.HEADER_BG }}
>
- <button
- onClick={onClose}
- style={{
- padding: '10px 20px',
- backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.GRAY,
- fontSize: '9px',
- fontWeight: 700,
- cursor: 'pointer',
- letterSpacing: '0.5px',
- transition: 'all 0.2s',
- }}
- onMouseEnter={e => { e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.color = F.WHITE; }}
- onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
- >
- CANCEL
- </button>
+ <button onClick={onClose} className={S.btnOutline}>CANCEL</button>
<button
onClick={handleDeploy}
disabled={deploying || !config.symbol.trim()}
+ className={`${S.btnPrimary} border-none`}
style={{
padding: '10px 24px',
backgroundColor: config.mode === 'live' ? F.RED : F.GREEN,
- border: 'none',
- borderRadius: '2px',
color: F.WHITE,
- fontSize: '9px',
- fontWeight: 700,
- letterSpacing: '0.5px',
cursor: deploying || !config.symbol.trim() ? 'not-allowed' : 'pointer',
opacity: deploying || !config.symbol.trim() ? 0.5 : 1,
- display: 'flex',
- alignItems: 'center',
- gap: '6px',
}}
>
{deploying ? (
<>
- <Loader2 size={12} style={{ animation: 'spin 1s linear infinite' }} />
+ <Loader2 size={14} className="animate-spin" />
DEPLOYING...
</>
) : (
<>
- <Rocket size={12} />
+ <Rocket size={14} />
{config.mode === 'live' ? 'DEPLOY LIVE' : 'DEPLOY PAPER'}
</>
)}
</button>
</div>
</div>
-
- <style>{`@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }`}</style>
</div>
);
};
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/PythonStrategyEditor.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/PythonStrategyEditor.tsx
index fd61d748d..a032cb7ac 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/PythonStrategyEditor.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/PythonStrategyEditor.tsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect, useRef, useCallback } from 'react';
import {
- Save, X, Code, Settings, RefreshCw, AlertCircle, CheckCircle,
+ Save, X, Code, Settings, AlertCircle, CheckCircle,
Copy, Undo, Play, ChevronDown, ChevronRight, FileCode, Edit3
} from 'lucide-react';
import type { PythonStrategy, CustomPythonStrategy, StrategyParameter } from '../types';
@@ -13,8 +13,8 @@ import {
} from '../services/algoTradingService';
import ParameterEditor from './ParameterEditor';
import { F } from '../constants/theme';
+import { S } from '../constants/styles';
-// Python syntax keywords for basic highlighting
const PYTHON_KEYWORDS = [
'def', 'class', 'if', 'elif', 'else', 'for', 'while', 'try', 'except',
'finally', 'with', 'as', 'import', 'from', 'return', 'yield', 'raise',
@@ -37,7 +37,6 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
onClose,
onBacktest,
}) => {
- // State
const [name, setName] = useState(isCustom ? strategy.name : `${strategy.name} (Custom)`);
const [code, setCode] = useState('');
const [originalCode, setOriginalCode] = useState('');
@@ -55,17 +54,12 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
const textareaRef = useRef<HTMLTextAreaElement>(null);
- // Load strategy code
- useEffect(() => {
- loadStrategyCode();
- }, [strategy.id]);
+ useEffect(() => { loadStrategyCode(); }, [strategy.id]);
const loadStrategyCode = async () => {
setLoading(true);
setError(null);
-
try {
- // Load code
if (isCustom && (strategy as CustomPythonStrategy).code) {
const customCode = (strategy as CustomPythonStrategy).code || '';
setCode(customCode);
@@ -81,15 +75,11 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
setError(result.error || 'Failed to load strategy code');
}
}
-
- // Load parameters
if (isCustom && (strategy as CustomPythonStrategy).parameters) {
try {
const params = JSON.parse((strategy as CustomPythonStrategy).parameters || '{}');
setParameterValues(params);
- } catch {
- setParameterValues({});
- }
+ } catch { setParameterValues({}); }
}
} catch (err) {
setError(err instanceof Error ? err.message : 'Unknown error');
@@ -98,11 +88,8 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
}
};
- // Extract parameters when code changes
useEffect(() => {
- if (code && advancedMode) {
- extractParams();
- }
+ if (code && advancedMode) extractParams();
}, [code, advancedMode]);
const extractParams = async () => {
@@ -110,112 +97,65 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
const result = await extractStrategyParameters(code);
if (result.success && result.data) {
setParameters(result.data);
- // Initialize any missing parameter values
const newValues = { ...parameterValues };
result.data.forEach((param) => {
- if (!(param.name in newValues)) {
- newValues[param.name] = param.default_value;
- }
+ if (!(param.name in newValues)) newValues[param.name] = param.default_value;
});
setParameterValues(newValues);
}
- } catch (err) {
- console.error('Failed to extract parameters:', err);
- }
+ } catch (err) { console.error('Failed to extract parameters:', err); }
};
- // Track unsaved changes
useEffect(() => {
const codeChanged = code !== originalCode;
setHasUnsavedChanges(codeChanged);
- // Reset validation when code changes
- if (codeChanged) {
- setValidation(null);
- }
+ if (codeChanged) setValidation(null);
}, [code, originalCode]);
- // Validate Python syntax
const handleValidate = async () => {
setValidating(true);
try {
const result = await validatePythonSyntax(code);
- if (result.success && result.data) {
- setValidation(result.data);
- } else {
- setValidation({ valid: false, error: result.error || 'Validation failed' });
- }
+ if (result.success && result.data) setValidation(result.data);
+ else setValidation({ valid: false, error: result.error || 'Validation failed' });
} catch (err) {
setValidation({ valid: false, error: err instanceof Error ? err.message : 'Unknown error' });
- } finally {
- setValidating(false);
- }
+ } finally { setValidating(false); }
};
- // Save strategy
const handleSave = async () => {
setSaving(true);
setError(null);
-
try {
if (isCustom) {
- // Update existing custom strategy
const result = await updateCustomPythonStrategy({
- id: strategy.id,
- name,
- code: code, // Always pass current code
- parameters: JSON.stringify(parameterValues),
+ id: strategy.id, name, code, parameters: JSON.stringify(parameterValues),
});
if (result.success) {
setOriginalCode(code);
setHasUnsavedChanges(false);
onSave?.(strategy.id);
- } else {
- setError(result.error || 'Failed to update strategy');
- }
+ } else { setError(result.error || 'Failed to update strategy'); }
} else {
- // Create new custom strategy from library
const result = await saveCustomPythonStrategy({
- baseStrategyId: strategy.id,
- name,
- code: code, // Always pass current code
- parameters: JSON.stringify(parameterValues),
+ baseStrategyId: strategy.id, name, code, parameters: JSON.stringify(parameterValues),
});
if (result.success && result.data) {
setOriginalCode(code);
setHasUnsavedChanges(false);
onSave?.(result.data.id);
- } else {
- setError(result.error || 'Failed to save strategy');
- }
+ } else { setError(result.error || 'Failed to save strategy'); }
}
- } catch (err) {
- setError(err instanceof Error ? err.message : 'Unknown error');
- } finally {
- setSaving(false);
- }
- };
-
- // Handle code change
- const handleCodeChange = (newCode: string) => {
- setCode(newCode);
- };
-
- // Reset to original
- const handleReset = () => {
- setCode(originalCode);
- setValidation(null);
+ } catch (err) { setError(err instanceof Error ? err.message : 'Unknown error'); }
+ finally { setSaving(false); }
};
- // Copy code
+ const handleCodeChange = (newCode: string) => { setCode(newCode); };
+ const handleReset = () => { setCode(originalCode); setValidation(null); };
const handleCopy = async () => {
- try {
- await navigator.clipboard.writeText(code);
- } catch (err) {
- console.error('Failed to copy:', err);
- }
+ try { await navigator.clipboard.writeText(code); } catch (err) { console.error('Failed to copy:', err); }
};
- // Update cursor position
const updateCursorPosition = useCallback(() => {
if (!textareaRef.current) return;
const pos = textareaRef.current.selectionStart;
@@ -225,7 +165,6 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
setCursorPosition({ line, col });
}, [code]);
- // Handle tab key in textarea
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Tab') {
e.preventDefault();
@@ -235,300 +174,158 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
const end = textarea.selectionEnd;
const newContent = code.substring(0, start) + ' ' + code.substring(end);
handleCodeChange(newContent);
- setTimeout(() => {
- textarea.selectionStart = textarea.selectionEnd = start + 4;
- }, 0);
+ setTimeout(() => { textarea.selectionStart = textarea.selectionEnd = start + 4; }, 0);
}
};
- // Calculate line numbers
const lines = code.split('\n');
if (loading) {
return (
- <div style={{
- position: 'fixed',
- top: 0,
- left: 0,
- right: 0,
- bottom: 0,
- backgroundColor: 'rgba(0,0,0,0.85)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- zIndex: 1000,
- }}>
- <div style={{ color: F.GRAY, fontSize: '12px' }}>Loading strategy...</div>
+ <div className={S.modalOverlay} style={{ backgroundColor: 'rgba(0,0,0,0.85)' }}>
+ <div className="text-[12px]" style={{ color: F.GRAY }}>Loading strategy...</div>
</div>
);
}
return (
- <div style={{
- position: 'fixed',
- top: 0,
- left: 0,
- right: 0,
- bottom: 0,
- backgroundColor: 'rgba(0,0,0,0.9)',
- zIndex: 1000,
- display: 'flex',
- flexDirection: 'column',
- }}>
+ <div className="fixed inset-0 flex flex-col" style={{ backgroundColor: 'rgba(0,0,0,0.9)', zIndex: 1000 }}>
{/* Header */}
- <div style={{
- backgroundColor: F.HEADER_BG,
- borderBottom: `2px solid ${F.ORANGE}`,
- padding: '12px 16px',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
+ <div
+ className="flex items-center justify-between px-5 py-3 shrink-0"
+ style={{ backgroundColor: F.HEADER_BG, borderBottom: `2px solid ${F.ORANGE}` }}
+ >
+ <div className="flex items-center gap-3">
<FileCode size={18} style={{ color: F.ORANGE }} />
<div>
<input
type="text"
value={name}
onChange={(e) => setName(e.target.value)}
- style={{
- backgroundColor: 'transparent',
- border: 'none',
- borderBottom: `1px solid ${F.BORDER}`,
- color: F.WHITE,
- fontSize: '14px',
- fontWeight: 700,
- padding: '4px 0',
- width: '300px',
- }}
+ className="bg-transparent border-none text-[14px] font-bold py-1 outline-none w-[300px]"
+ style={{ color: F.WHITE, borderBottom: `1px solid ${F.BORDER}` }}
placeholder="Strategy Name"
/>
- <div style={{ fontSize: '10px', color: F.GRAY, marginTop: '2px' }}>
+ <div className="text-[10px] mt-0.5" style={{ color: F.GRAY }}>
{isCustom ? 'Editing custom strategy' : `Cloning from ${strategy.id}`}
- {strategy.category && ` • ${strategy.category}`}
+ {strategy.category && ` - ${strategy.category}`}
</div>
</div>
</div>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- {/* Validation status */}
+ <div className="flex items-center gap-2">
{validation && (
- <div style={{
- display: 'flex',
- alignItems: 'center',
- gap: '4px',
- padding: '4px 8px',
- backgroundColor: validation.valid ? `${F.GREEN}20` : `${F.RED}20`,
- border: `1px solid ${validation.valid ? F.GREEN : F.RED}`,
- borderRadius: '2px',
- fontSize: '9px',
- color: validation.valid ? F.GREEN : F.RED,
- }}>
- {validation.valid ? <CheckCircle size={10} /> : <AlertCircle size={10} />}
- {validation.valid ? 'Valid' : 'Syntax Error'}
- </div>
+ <span
+ className={`${S.badge} px-3 py-1`}
+ style={{
+ backgroundColor: validation.valid ? `${F.GREEN}20` : `${F.RED}20`,
+ border: `1px solid ${validation.valid ? F.GREEN : F.RED}`,
+ color: validation.valid ? F.GREEN : F.RED,
+ }}
+ >
+ {validation.valid ? <CheckCircle size={12} /> : <AlertCircle size={12} />}
+ {validation.valid ? 'Valid' : 'Error'}
+ </span>
)}
-
- {/* Unsaved indicator */}
{hasUnsavedChanges && (
- <span style={{ fontSize: '9px', color: F.YELLOW }}>● Unsaved</span>
+ <span className="text-[10px] font-bold" style={{ color: F.YELLOW }}>UNSAVED</span>
)}
-
- {/* Validate button */}
- <button
- onClick={handleValidate}
- disabled={validating}
- style={{
- padding: '6px 12px',
- backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.CYAN,
- fontSize: '9px',
- fontWeight: 700,
- cursor: validating ? 'not-allowed' : 'pointer',
- display: 'flex',
- alignItems: 'center',
- gap: '4px',
- opacity: validating ? 0.5 : 1,
- }}
+ <button onClick={handleValidate} disabled={validating} className={S.btnOutline}
+ style={{ color: F.CYAN, borderColor: `${F.CYAN}40` }}
>
- <CheckCircle size={10} />
+ <CheckCircle size={12} />
{validating ? 'CHECKING...' : 'VALIDATE'}
</button>
-
- {/* Backtest button */}
{onBacktest && (
- <button
- onClick={() => onBacktest(strategy)}
- style={{
- padding: '6px 12px',
- backgroundColor: `${F.BLUE}20`,
- border: `1px solid ${F.BLUE}`,
- borderRadius: '2px',
- color: F.BLUE,
- fontSize: '9px',
- fontWeight: 700,
- cursor: 'pointer',
- display: 'flex',
- alignItems: 'center',
- gap: '4px',
- }}
+ <button onClick={() => onBacktest(strategy)} className={S.btnOutline}
+ style={{ color: F.BLUE, borderColor: `${F.BLUE}40` }}
>
- <Play size={10} />
+ <Play size={12} />
BACKTEST
</button>
)}
-
- {/* Save button */}
<button
onClick={handleSave}
disabled={saving || (!hasUnsavedChanges && isCustom)}
+ className={`${S.btnPrimary} border-none`}
style={{
- padding: '6px 12px',
- backgroundColor: F.ORANGE,
- border: 'none',
- borderRadius: '2px',
- color: F.DARK_BG,
- fontSize: '9px',
- fontWeight: 700,
- cursor: saving ? 'not-allowed' : 'pointer',
- display: 'flex',
- alignItems: 'center',
- gap: '4px',
+ backgroundColor: F.ORANGE, color: F.DARK_BG,
opacity: saving || (!hasUnsavedChanges && isCustom) ? 0.5 : 1,
+ cursor: saving ? 'not-allowed' : 'pointer',
}}
>
- <Save size={10} />
+ <Save size={12} />
{saving ? 'SAVING...' : isCustom ? 'UPDATE' : 'SAVE AS CUSTOM'}
</button>
-
- {/* Close button */}
- <button
- onClick={onClose}
- style={{
- padding: '6px',
- backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.GRAY,
- cursor: 'pointer',
- }}
- >
- <X size={14} />
+ <button onClick={onClose} className={S.btnGhost} style={{ color: F.GRAY }}>
+ <X size={16} />
</button>
</div>
</div>
{/* Error display */}
{error && (
- <div style={{
- padding: '8px 16px',
- backgroundColor: `${F.RED}20`,
- borderBottom: `1px solid ${F.RED}`,
- color: F.RED,
- fontSize: '11px',
- display: 'flex',
- alignItems: 'center',
- gap: '8px',
- }}>
- <AlertCircle size={12} />
+ <div
+ className="flex items-center gap-2 px-5 py-2.5 text-[11px] shrink-0"
+ style={{ backgroundColor: `${F.RED}20`, borderBottom: `1px solid ${F.RED}`, color: F.RED }}
+ >
+ <AlertCircle size={14} />
{error}
- <button
- onClick={() => setError(null)}
- style={{
- marginLeft: 'auto',
- background: 'none',
- border: 'none',
- color: F.RED,
- cursor: 'pointer',
- }}
- >
- <X size={12} />
+ <button onClick={() => setError(null)} className="ml-auto bg-transparent border-none cursor-pointer" style={{ color: F.RED }}>
+ <X size={14} />
</button>
</div>
)}
{/* Validation error details */}
{validation && !validation.valid && validation.error && (
- <div style={{
- padding: '8px 16px',
- backgroundColor: `${F.RED}10`,
- borderBottom: `1px solid ${F.BORDER}`,
- color: F.RED,
- fontSize: '10px',
- fontFamily: 'monospace',
- }}>
+ <div
+ className="px-5 py-2 font-mono text-[11px] shrink-0"
+ style={{ backgroundColor: `${F.RED}10`, borderBottom: `1px solid ${F.BORDER}`, color: F.RED }}
+ >
{validation.error}
</div>
)}
{/* Content */}
- <div style={{ flex: 1, display: 'flex', overflow: 'hidden' }}>
+ <div className="flex flex-1 overflow-hidden">
{/* Left Panel - Parameters */}
- <div style={{
- width: advancedMode ? '300px' : '400px',
- borderRight: `1px solid ${F.BORDER}`,
- backgroundColor: F.PANEL_BG,
- overflow: 'auto',
- transition: 'width 0.2s',
- }}>
+ <div
+ className="overflow-auto shrink-0 transition-all duration-200"
+ style={{
+ width: advancedMode ? '320px' : '420px',
+ borderRight: `1px solid ${F.BORDER}`,
+ backgroundColor: F.PANEL_BG,
+ }}
+ >
{/* Mode Toggle */}
- <div style={{
- padding: '12px',
- borderBottom: `1px solid ${F.BORDER}`,
- }}>
- <div style={{
- display: 'flex',
- alignItems: 'center',
- gap: '8px',
- marginBottom: '8px',
- }}>
- <span style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE }}>
- EDITING MODE
- </span>
+ <div className="p-4" style={{ borderBottom: `1px solid ${F.BORDER}` }}>
+ <div className="text-[11px] font-bold tracking-wide mb-2" style={{ color: F.WHITE }}>
+ EDITING MODE
</div>
- <div style={{ display: 'flex', gap: '4px' }}>
+ <div className="flex gap-1.5">
<button
onClick={() => setAdvancedMode(false)}
+ className={`${S.btnPrimary} flex-1 py-2 text-[10px] border`}
style={{
- flex: 1,
- padding: '8px',
backgroundColor: !advancedMode ? F.ORANGE : 'transparent',
color: !advancedMode ? F.DARK_BG : F.GRAY,
- border: `1px solid ${!advancedMode ? F.ORANGE : F.BORDER}`,
- borderRadius: '2px',
- fontSize: '9px',
- fontWeight: 700,
- cursor: 'pointer',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- gap: '4px',
+ borderColor: !advancedMode ? F.ORANGE : F.BORDER,
}}
>
- <Settings size={10} />
+ <Settings size={12} />
PARAMETERS
</button>
<button
onClick={() => setAdvancedMode(true)}
+ className={`${S.btnPrimary} flex-1 py-2 text-[10px] border`}
style={{
- flex: 1,
- padding: '8px',
backgroundColor: advancedMode ? F.ORANGE : 'transparent',
color: advancedMode ? F.DARK_BG : F.GRAY,
- border: `1px solid ${advancedMode ? F.ORANGE : F.BORDER}`,
- borderRadius: '2px',
- fontSize: '9px',
- fontWeight: 700,
- cursor: 'pointer',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- gap: '4px',
+ borderColor: advancedMode ? F.ORANGE : F.BORDER,
}}
>
- <Code size={10} />
+ <Code size={12} />
ADVANCED
</button>
</div>
@@ -536,52 +333,37 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
{/* Parameter Section */}
{!advancedMode && (
- <div style={{ padding: '12px' }}>
- <div
+ <div className="p-4">
+ <button
onClick={() => setShowParamSection(!showParamSection)}
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: '6px',
- cursor: 'pointer',
- marginBottom: '8px',
- }}
+ className="flex items-center gap-2 cursor-pointer bg-transparent border-none mb-3"
+ style={{ color: F.WHITE }}
>
- {showParamSection ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
- <span style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE }}>
- STRATEGY PARAMETERS
- </span>
- </div>
-
+ {showParamSection ? <ChevronDown size={14} /> : <ChevronRight size={14} />}
+ <span className="text-[11px] font-bold tracking-wide">STRATEGY PARAMETERS</span>
+ </button>
{showParamSection && (
- <ParameterEditor
- code={code}
- values={parameterValues}
- onChange={setParameterValues}
- />
+ <ParameterEditor code={code} values={parameterValues} onChange={setParameterValues} />
)}
</div>
)}
{/* Strategy Info */}
- <div style={{
- padding: '12px',
- borderTop: `1px solid ${F.BORDER}`,
- }}>
- <div style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE, marginBottom: '8px' }}>
+ <div className="p-4" style={{ borderTop: `1px solid ${F.BORDER}` }}>
+ <div className="text-[11px] font-bold tracking-wide mb-3" style={{ color: F.WHITE }}>
STRATEGY INFO
</div>
- <div style={{ fontSize: '9px', color: F.GRAY }}>
- <div style={{ marginBottom: '4px' }}>
+ <div className="text-[11px]" style={{ color: F.GRAY }}>
+ <div className="mb-1.5">
<span style={{ color: F.MUTED }}>ID:</span>{' '}
<span style={{ color: F.CYAN }}>{strategy.id}</span>
</div>
- <div style={{ marginBottom: '4px' }}>
+ <div className="mb-1.5">
<span style={{ color: F.MUTED }}>Category:</span>{' '}
<span style={{ color: F.WHITE }}>{strategy.category}</span>
</div>
{strategy.description && (
- <div style={{ marginTop: '8px', lineHeight: 1.4, color: F.GRAY }}>
+ <div className="mt-2 leading-relaxed" style={{ color: F.GRAY }}>
{strategy.description}
</div>
)}
@@ -589,51 +371,27 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
</div>
{/* Quick Actions */}
- <div style={{
- padding: '12px',
- borderTop: `1px solid ${F.BORDER}`,
- }}>
- <div style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE, marginBottom: '8px' }}>
+ <div className="p-4" style={{ borderTop: `1px solid ${F.BORDER}` }}>
+ <div className="text-[11px] font-bold tracking-wide mb-3" style={{ color: F.WHITE }}>
QUICK ACTIONS
</div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
- <button
- onClick={handleCopy}
- style={{
- padding: '6px 8px',
- backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- color: F.GRAY,
- fontSize: '9px',
- cursor: 'pointer',
- display: 'flex',
- alignItems: 'center',
- gap: '6px',
- }}
- >
- <Copy size={10} />
+ <div className="flex flex-col gap-1.5">
+ <button onClick={handleCopy} className={S.btnOutline}>
+ <Copy size={12} />
Copy Code
</button>
{advancedMode && (
<button
onClick={handleReset}
disabled={!hasUnsavedChanges}
+ className={S.btnOutline}
style={{
- padding: '6px 8px',
- backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
color: hasUnsavedChanges ? F.YELLOW : F.MUTED,
- fontSize: '9px',
- cursor: hasUnsavedChanges ? 'pointer' : 'not-allowed',
- display: 'flex',
- alignItems: 'center',
- gap: '6px',
opacity: hasUnsavedChanges ? 1 : 0.5,
+ cursor: hasUnsavedChanges ? 'pointer' : 'not-allowed',
}}
>
- <Undo size={10} />
+ <Undo size={12} />
Reset Changes
</button>
)}
@@ -642,58 +400,45 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
</div>
{/* Right Panel - Code Editor */}
- <div style={{
- flex: 1,
- display: 'flex',
- flexDirection: 'column',
- backgroundColor: F.DARK_BG,
- overflow: 'hidden',
- }}>
+ <div className="flex flex-col flex-1 overflow-hidden" style={{ backgroundColor: F.DARK_BG }}>
{/* Editor Toolbar */}
- <div style={{
- padding: '8px 12px',
- borderBottom: `1px solid ${F.BORDER}`,
- backgroundColor: F.HEADER_BG,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <Edit3 size={12} style={{ color: F.CYAN }} />
- <span style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE }}>
+ <div
+ className="flex items-center justify-between px-4 py-2.5 shrink-0"
+ style={{ borderBottom: `1px solid ${F.BORDER}`, backgroundColor: F.HEADER_BG }}
+ >
+ <div className="flex items-center gap-2">
+ <Edit3 size={14} style={{ color: F.CYAN }} />
+ <span className="text-[11px] font-bold tracking-wide" style={{ color: F.WHITE }}>
{advancedMode ? 'CODE EDITOR' : 'CODE PREVIEW'}
</span>
- <span style={{ fontSize: '9px', color: F.MUTED }}>
+ <span className="text-[10px]" style={{ color: F.MUTED }}>
({lines.length} lines)
</span>
</div>
- <div style={{ fontSize: '9px', color: F.GRAY }}>
+ <div className="text-[10px]" style={{ color: F.GRAY }}>
Ln {cursorPosition.line}, Col {cursorPosition.col}
</div>
</div>
{/* Code Editor Area */}
- <div style={{
- flex: 1,
- display: 'flex',
- overflow: 'auto',
- fontFamily: '"IBM Plex Mono", "Consolas", monospace',
- }}>
+ <div
+ className="flex flex-1 overflow-auto"
+ style={{ fontFamily: '"IBM Plex Mono", "Consolas", monospace' }}
+ >
{/* Line Numbers */}
- <div style={{
- padding: '12px 8px',
- backgroundColor: F.PANEL_BG,
- borderRight: `1px solid ${F.BORDER}`,
- textAlign: 'right',
- userSelect: 'none',
- minWidth: '40px',
- }}>
+ <div
+ className="py-3 px-2 shrink-0 text-right select-none"
+ style={{
+ backgroundColor: F.PANEL_BG,
+ borderRight: `1px solid ${F.BORDER}`,
+ minWidth: '48px',
+ }}
+ >
{lines.map((_, i) => (
<div
key={i}
+ className="text-[12px] leading-[22px]"
style={{
- fontSize: '11px',
- lineHeight: '20px',
color: cursorPosition.line === i + 1 ? F.ORANGE : F.MUTED,
fontWeight: cursorPosition.line === i + 1 ? 700 : 400,
}}
@@ -704,7 +449,7 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
</div>
{/* Code Area */}
- <div style={{ flex: 1, position: 'relative' }}>
+ <div className="flex-1 relative">
{advancedMode ? (
<textarea
ref={textareaRef}
@@ -714,35 +459,24 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
onKeyUp={updateCursorPosition}
onClick={updateCursorPosition}
spellCheck={false}
+ className="w-full h-full py-3 px-4 bg-transparent border-none outline-none resize-none"
style={{
- width: '100%',
- height: '100%',
- padding: '12px',
- backgroundColor: 'transparent',
- border: 'none',
color: F.WHITE,
- fontSize: '11px',
- lineHeight: '20px',
+ fontSize: '12px',
+ lineHeight: '22px',
fontFamily: 'inherit',
- resize: 'none',
- outline: 'none',
whiteSpace: 'pre',
overflowWrap: 'normal',
overflowX: 'auto',
}}
/>
) : (
- <pre style={{
- margin: 0,
- padding: '12px',
- fontSize: '11px',
- lineHeight: '20px',
- color: F.WHITE,
- whiteSpace: 'pre',
- overflow: 'auto',
- }}>
+ <pre
+ className="m-0 py-3 px-4 overflow-auto"
+ style={{ fontSize: '12px', lineHeight: '22px', color: F.WHITE, whiteSpace: 'pre' }}
+ >
{lines.map((line, i) => (
- <div key={i} style={{ minHeight: '20px' }}>
+ <div key={i} style={{ minHeight: '22px' }}>
<SyntaxHighlightedLine line={line} />
</div>
))}
@@ -754,21 +488,15 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
</div>
{/* Status Bar */}
- <div style={{
- backgroundColor: F.HEADER_BG,
- borderTop: `1px solid ${F.BORDER}`,
- padding: '4px 16px',
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'center',
- fontSize: '9px',
- color: F.GRAY,
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}>
+ <div
+ className="flex items-center justify-between px-5 py-1.5 shrink-0 text-[10px]"
+ style={{ backgroundColor: F.HEADER_BG, borderTop: `1px solid ${F.BORDER}`, color: F.GRAY }}
+ >
+ <div className="flex items-center gap-4">
<span>Python Strategy Editor</span>
<span>Mode: {advancedMode ? 'Advanced (Code)' : 'Parameters Only'}</span>
</div>
- <div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}>
+ <div className="flex items-center gap-4">
<span>{lines.length} lines</span>
<span>{code.length} chars</span>
<span>QCAlgorithm Compatible</span>
@@ -780,50 +508,33 @@ const PythonStrategyEditor: React.FC<PythonStrategyEditorProps> = ({
// Simple syntax highlighting for Python
const SyntaxHighlightedLine: React.FC<{ line: string }> = ({ line }) => {
- // Very basic highlighting - just colorize keywords, strings, comments
const parts: React.ReactNode[] = [];
- let remaining = line;
+ const remaining = line;
let key = 0;
- // Check for comment
const commentIdx = remaining.indexOf('#');
if (commentIdx !== -1) {
if (commentIdx > 0) {
- parts.push(
- <span key={key++}>{highlightNonComment(remaining.substring(0, commentIdx))}</span>
- );
+ parts.push(<span key={key++}>{highlightNonComment(remaining.substring(0, commentIdx))}</span>);
}
- parts.push(
- <span key={key++} style={{ color: F.MUTED }}>{remaining.substring(commentIdx)}</span>
- );
+ parts.push(<span key={key++} style={{ color: F.MUTED }}>{remaining.substring(commentIdx)}</span>);
return <>{parts}</>;
}
-
return <>{highlightNonComment(remaining)}</>;
};
const highlightNonComment = (text: string): React.ReactNode => {
- // Handle strings (basic)
const stringRegex = /(["'])(?:(?=(\\?))\2.)*?\1/g;
const parts: React.ReactNode[] = [];
let lastIndex = 0;
let match;
let key = 0;
-
while ((match = stringRegex.exec(text)) !== null) {
- if (match.index > lastIndex) {
- parts.push(highlightKeywords(text.substring(lastIndex, match.index), key++));
- }
- parts.push(
- <span key={`str-${key++}`} style={{ color: F.GREEN }}>{match[0]}</span>
- );
+ if (match.index > lastIndex) parts.push(highlightKeywords(text.substring(lastIndex, match.index), key++));
+ parts.push(<span key={`str-${key++}`} style={{ color: F.GREEN }}>{match[0]}</span>);
lastIndex = match.index + match[0].length;
}
-
- if (lastIndex < text.length) {
- parts.push(highlightKeywords(text.substring(lastIndex), key++));
- }
-
+ if (lastIndex < text.length) parts.push(highlightKeywords(text.substring(lastIndex), key++));
return <>{parts}</>;
};
@@ -833,37 +544,21 @@ const highlightKeywords = (text: string, baseKey: number): React.ReactNode => {
let lastIndex = 0;
let match;
let key = 0;
-
while ((match = wordRegex.exec(text)) !== null) {
- if (match.index > lastIndex) {
- parts.push(text.substring(lastIndex, match.index));
- }
-
+ if (match.index > lastIndex) parts.push(text.substring(lastIndex, match.index));
const word = match[1];
if (PYTHON_KEYWORDS.includes(word)) {
- parts.push(
- <span key={`kw-${baseKey}-${key++}`} style={{ color: F.PURPLE }}>{word}</span>
- );
+ parts.push(<span key={`kw-${baseKey}-${key++}`} style={{ color: F.PURPLE }}>{word}</span>);
} else if (/^\d+\.?\d*$/.test(word)) {
- // Numbers
- parts.push(
- <span key={`num-${baseKey}-${key++}`} style={{ color: F.ORANGE }}>{word}</span>
- );
+ parts.push(<span key={`num-${baseKey}-${key++}`} style={{ color: F.ORANGE }}>{word}</span>);
} else if (word === word.toUpperCase() && word.length > 1 && /[A-Z]/.test(word)) {
- // CONSTANTS
- parts.push(
- <span key={`const-${baseKey}-${key++}`} style={{ color: F.CYAN }}>{word}</span>
- );
+ parts.push(<span key={`const-${baseKey}-${key++}`} style={{ color: F.CYAN }}>{word}</span>);
} else {
parts.push(word);
}
lastIndex = match.index + match[0].length;
}
-
- if (lastIndex < text.length) {
- parts.push(text.substring(lastIndex));
- }
-
+ if (lastIndex < text.length) parts.push(text.substring(lastIndex));
return <>{parts}</>;
};
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ScannerPanel.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ScannerPanel.tsx
index ee5b98cec..40312b454 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ScannerPanel.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/ScannerPanel.tsx
@@ -1,5 +1,8 @@
import React, { useState } from 'react';
-import { Search, Loader, ChevronDown, ChevronRight, AlertTriangle, Zap, List, RotateCcw, Download } from 'lucide-react';
+import {
+ Search, Loader, ChevronDown, ChevronRight, AlertTriangle, Zap,
+ RotateCcw, Download, Plus, Trash2, Copy as CopyIcon, Terminal,
+} from 'lucide-react';
import type { ConditionItem, ScanResult, ConditionDetail } from '../types';
import { TIMEFRAMES, getIndicatorDef } from '../constants/indicators';
import { runAlgoScan } from '../services/algoTradingService';
@@ -8,208 +11,54 @@ import { useBrokerContext } from '@/contexts/BrokerContext';
import ConditionBuilder from './ConditionBuilder';
import { F } from '../constants/theme';
-const inputStyle: React.CSSProperties = {
- width: '100%', padding: '8px 10px', backgroundColor: F.DARK_BG,
- color: F.WHITE, border: `1px solid ${F.BORDER}`, borderRadius: '2px',
- fontSize: '10px', fontFamily: '"IBM Plex Mono", monospace', outline: 'none',
-};
-
-const labelStyle: React.CSSProperties = {
- fontSize: '9px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px',
- marginBottom: '4px', display: 'block',
-};
-
-const chipStyle: React.CSSProperties = {
- padding: '3px 8px', backgroundColor: 'transparent', border: `1px solid ${F.BORDER}`,
- borderRadius: '2px', color: F.GRAY, fontSize: '8px', fontWeight: 700,
- letterSpacing: '0.5px', cursor: 'pointer', transition: 'all 0.15s',
- fontFamily: '"IBM Plex Mono", monospace',
-};
+const font = '"IBM Plex Mono", "Consolas", monospace';
-interface SymbolError {
- symbol: string;
- error: string;
-}
+interface SymbolError { symbol: string; error: string; }
-// ── Scan Presets (Chartink-style templates) ──────────────────────────────
-interface ScanPreset {
- name: string;
- description: string;
- conditions: ConditionItem[];
- logic: 'AND' | 'OR';
-}
+// ── Scan Presets ────────────────────────────────────────────────────────
+interface ScanPreset { name: string; desc: string; conditions: ConditionItem[]; logic: 'AND' | 'OR'; }
const SCAN_PRESETS: ScanPreset[] = [
- {
- name: 'RSI Oversold',
- description: 'RSI(14) < 30 — oversold stocks',
- conditions: [
- { indicator: 'RSI', params: { period: 14 }, field: 'value', operator: '<', value: 30 },
- ],
- logic: 'AND',
- },
- {
- name: 'RSI Overbought',
- description: 'RSI(14) > 70 — overbought stocks',
- conditions: [
- { indicator: 'RSI', params: { period: 14 }, field: 'value', operator: '>', value: 70 },
- ],
- logic: 'AND',
- },
- {
- name: 'Golden Cross',
- description: 'EMA(50) crosses above SMA(200)',
- conditions: [
- {
- indicator: 'EMA', params: { period: 50 }, field: 'value', operator: 'crosses_above', value: 0,
- compareMode: 'indicator', compareIndicator: 'SMA', compareParams: { period: 200 }, compareField: 'value',
- },
- ],
- logic: 'AND',
- },
- {
- name: 'Death Cross',
- description: 'EMA(50) crosses below SMA(200)',
- conditions: [
- {
- indicator: 'EMA', params: { period: 50 }, field: 'value', operator: 'crosses_below', value: 0,
- compareMode: 'indicator', compareIndicator: 'SMA', compareParams: { period: 200 }, compareField: 'value',
- },
- ],
- logic: 'AND',
- },
- {
- name: 'MACD Bullish Cross',
- description: 'MACD line crosses above signal line',
- conditions: [
- {
- indicator: 'MACD', params: { fast: 12, slow: 26, signal: 9 }, field: 'line', operator: 'crosses_above', value: 0,
- compareMode: 'indicator', compareIndicator: 'MACD', compareParams: { fast: 12, slow: 26, signal: 9 }, compareField: 'signal_line',
- },
- ],
- logic: 'AND',
- },
- {
- name: 'Bollinger Squeeze',
- description: 'Price below lower Bollinger Band + RSI < 35',
- conditions: [
- {
- indicator: 'CLOSE', params: {}, field: 'value', operator: '<', value: 0,
- compareMode: 'indicator', compareIndicator: 'BOLLINGER', compareParams: { period: 20, std_dev: 2 }, compareField: 'lower',
- },
- { indicator: 'RSI', params: { period: 14 }, field: 'value', operator: '<', value: 35 },
- ],
- logic: 'AND',
- },
- {
- name: 'Volume Breakout',
- description: 'Volume > 2x SMA(20) of volume + price rising 3 bars',
- conditions: [
- { indicator: 'CLOSE', params: {}, field: 'value', operator: 'rising', value: 0, lookback: 3 },
- { indicator: 'MFI', params: { period: 14 }, field: 'value', operator: '>', value: 60 },
- ],
- logic: 'AND',
- },
- {
- name: 'Supertrend Buy',
- description: 'Supertrend direction is bullish (1)',
- conditions: [
- { indicator: 'SUPERTREND', params: { period: 10, multiplier: 3 }, field: 'direction', operator: '==', value: 1 },
- ],
- logic: 'AND',
- },
- {
- name: 'RSI + MACD Combo',
- description: 'RSI rising + MACD histogram > 0',
- conditions: [
- { indicator: 'RSI', params: { period: 14 }, field: 'value', operator: 'rising', value: 0, lookback: 3 },
- { indicator: 'MACD', params: { fast: 12, slow: 26, signal: 9 }, field: 'histogram', operator: '>', value: 0 },
- ],
- logic: 'AND',
- },
- {
- name: 'Price Above VWAP',
- description: 'Close crosses above VWAP (intraday)',
- conditions: [
- {
- indicator: 'CLOSE', params: {}, field: 'value', operator: 'crosses_above', value: 0,
- compareMode: 'indicator', compareIndicator: 'VWAP', compareParams: {}, compareField: 'value',
- },
- ],
- logic: 'AND',
- },
+ { name: 'RSI Oversold', desc: 'RSI(14) < 30', conditions: [{ indicator: 'RSI', params: { period: 14 }, field: 'value', operator: '<', value: 30 }], logic: 'AND' },
+ { name: 'RSI Overbought', desc: 'RSI(14) > 70', conditions: [{ indicator: 'RSI', params: { period: 14 }, field: 'value', operator: '>', value: 70 }], logic: 'AND' },
+ { name: 'Golden Cross', desc: 'EMA(50) X↑ SMA(200)', conditions: [{ indicator: 'EMA', params: { period: 50 }, field: 'value', operator: 'crosses_above', value: 0, compareMode: 'indicator', compareIndicator: 'SMA', compareParams: { period: 200 }, compareField: 'value' }], logic: 'AND' },
+ { name: 'Death Cross', desc: 'EMA(50) X↓ SMA(200)', conditions: [{ indicator: 'EMA', params: { period: 50 }, field: 'value', operator: 'crosses_below', value: 0, compareMode: 'indicator', compareIndicator: 'SMA', compareParams: { period: 200 }, compareField: 'value' }], logic: 'AND' },
+ { name: 'MACD Bullish', desc: 'MACD X↑ Signal', conditions: [{ indicator: 'MACD', params: { fast: 12, slow: 26, signal: 9 }, field: 'line', operator: 'crosses_above', value: 0, compareMode: 'indicator', compareIndicator: 'MACD', compareParams: { fast: 12, slow: 26, signal: 9 }, compareField: 'signal_line' }], logic: 'AND' },
+ { name: 'Bollinger Squeeze', desc: 'Close < BB Lower + RSI<35', conditions: [{ indicator: 'CLOSE', params: {}, field: 'value', operator: '<', value: 0, compareMode: 'indicator', compareIndicator: 'BOLLINGER', compareParams: { period: 20, std_dev: 2 }, compareField: 'lower' }, { indicator: 'RSI', params: { period: 14 }, field: 'value', operator: '<', value: 35 }], logic: 'AND' },
+ { name: 'Volume Breakout', desc: 'Rising 3 bars + MFI>60', conditions: [{ indicator: 'CLOSE', params: {}, field: 'value', operator: 'rising', value: 0, lookback: 3 }, { indicator: 'MFI', params: { period: 14 }, field: 'value', operator: '>', value: 60 }], logic: 'AND' },
+ { name: 'Supertrend Buy', desc: 'Direction = Bullish', conditions: [{ indicator: 'SUPERTREND', params: { period: 10, multiplier: 3 }, field: 'direction', operator: '==', value: 1 }], logic: 'AND' },
+ { name: 'RSI+MACD Combo', desc: 'RSI rising + MACD hist>0', conditions: [{ indicator: 'RSI', params: { period: 14 }, field: 'value', operator: 'rising', value: 0, lookback: 3 }, { indicator: 'MACD', params: { fast: 12, slow: 26, signal: 9 }, field: 'histogram', operator: '>', value: 0 }], logic: 'AND' },
+ { name: 'Price > VWAP', desc: 'Close X↑ VWAP', conditions: [{ indicator: 'CLOSE', params: {}, field: 'value', operator: 'crosses_above', value: 0, compareMode: 'indicator', compareIndicator: 'VWAP', compareParams: {}, compareField: 'value' }], logic: 'AND' },
];
-// ── Symbol Watchlists ────────────────────────────────────────────────────
+// ── Symbol Watchlists ──────────────────────────────────────────────────
const SYMBOL_WATCHLISTS: Record<string, string[]> = {
- 'NIFTY 50': [
- 'RELIANCE', 'TCS', 'HDFCBANK', 'INFY', 'ICICIBANK', 'HINDUNILVR', 'ITC', 'SBIN',
- 'BHARTIARTL', 'KOTAKBANK', 'LT', 'AXISBANK', 'WIPRO', 'ASIANPAINT', 'MARUTI',
- 'BAJFINANCE', 'HCLTECH', 'SUNPHARMA', 'TITAN', 'TATASTEEL', 'ULTRACEMCO',
- 'ONGC', 'NTPC', 'POWERGRID', 'M&M', 'NESTLEIND', 'ADANIENT', 'JSWSTEEL',
- 'BAJAJFINSV', 'TECHM', 'INDUSINDBK', 'HINDALCO', 'TATAMTRDVR', 'COALINDIA',
- 'GRASIM', 'SBILIFE', 'CIPLA', 'DIVISLAB', 'DRREDDY', 'BPCL',
- 'APOLLOHOSP', 'EICHERMOT', 'TATACONSUM', 'BRITANNIA', 'HDFCLIFE',
- 'HEROMOTOCO', 'BAJAJ-AUTO', 'LTIM', 'ADANIPORTS', 'UPL',
- ],
- 'BANK NIFTY': [
- 'HDFCBANK', 'ICICIBANK', 'KOTAKBANK', 'AXISBANK', 'SBIN', 'INDUSINDBK',
- 'BANKBARODA', 'AUBANK', 'FEDERALBNK', 'BANDHANBNK', 'PNB', 'IDFCFIRSTB',
- ],
- 'IT STOCKS': [
- 'TCS', 'INFY', 'WIPRO', 'HCLTECH', 'TECHM', 'LTIM', 'MPHASIS', 'COFORGE',
- 'PERSISTENT', 'TATAELXSI', 'LTTS', 'MINDTREE',
- ],
- 'PHARMA': [
- 'SUNPHARMA', 'DRREDDY', 'CIPLA', 'DIVISLAB', 'AUROPHARMA', 'LUPIN',
- 'BIOCON', 'TORNTPHARM', 'ALKEM', 'GLENMARK',
- ],
+ 'NIFTY 50': ['RELIANCE','TCS','HDFCBANK','INFY','ICICIBANK','HINDUNILVR','ITC','SBIN','BHARTIARTL','KOTAKBANK','LT','AXISBANK','WIPRO','ASIANPAINT','MARUTI','BAJFINANCE','HCLTECH','SUNPHARMA','TITAN','TATASTEEL','ULTRACEMCO','ONGC','NTPC','POWERGRID','M&M','NESTLEIND','ADANIENT','JSWSTEEL','BAJAJFINSV','TECHM','INDUSINDBK','HINDALCO','TATAMTRDVR','COALINDIA','GRASIM','SBILIFE','CIPLA','DIVISLAB','DRREDDY','BPCL','APOLLOHOSP','EICHERMOT','TATACONSUM','BRITANNIA','HDFCLIFE','HEROMOTOCO','BAJAJ-AUTO','LTIM','ADANIPORTS','UPL'],
+ 'BANK NIFTY': ['HDFCBANK','ICICIBANK','KOTAKBANK','AXISBANK','SBIN','INDUSINDBK','BANKBARODA','AUBANK','FEDERALBNK','BANDHANBNK','PNB','IDFCFIRSTB'],
+ 'IT STOCKS': ['TCS','INFY','WIPRO','HCLTECH','TECHM','LTIM','MPHASIS','COFORGE','PERSISTENT','TATAELXSI','LTTS','MINDTREE'],
+ 'PHARMA': ['SUNPHARMA','DRREDDY','CIPLA','DIVISLAB','AUROPHARMA','LUPIN','BIOCON','TORNTPHARM','ALKEM','GLENMARK'],
};
-const STOCK_BROKERS = ['fyers', 'zerodha', 'upstox', 'dhan', 'angelone', 'kotak', 'groww', 'aliceblue', 'fivepaisa', 'iifl', 'motilal', 'shoonya'];
+const STOCK_BROKERS = ['fyers','zerodha','upstox','dhan','angelone','kotak','groww','aliceblue','fivepaisa','iifl','motilal','shoonya'];
-// ── Helper to format condition detail for display ────────────────────────
-function formatConditionDetail(d: ConditionDetail): React.ReactNode {
- const opLabels: Record<string, string> = {
- '>': '>', '<': '<', '>=': '>=', '<=': '<=', '==': '==',
- 'crosses_above': 'X↑', 'crosses_below': 'X↓', 'between': 'BTW',
- 'crossed_above_within': 'X↑ N', 'crossed_below_within': 'X↓ N',
- 'rising': '↑N', 'falling': '↓N',
- };
- const op = opLabels[d.operator] || d.operator;
+// ── Format condition detail ────────────────────────────────────────────
+function fmtDetail(d: ConditionDetail): React.ReactNode {
+ const ops: Record<string, string> = { '>': '>', '<': '<', '>=': '≥', '<=': '≤', '==': '=', crosses_above: 'X↑', crosses_below: 'X↓', between: 'BTW', crossed_above_within: 'X↑N', crossed_below_within: 'X↓N', rising: '↑N', falling: '↓N' };
+ const op = ops[d.operator] || d.operator;
const val = d.computed_value != null ? d.computed_value.toFixed(2) : '—';
-
if (d.target_indicator) {
- const targetVal = d.target_computed_value != null ? d.target_computed_value.toFixed(2) : '—';
- return (
- <span>
- <span style={{ color: F.WHITE, fontWeight: 700 }}>{d.indicator}</span>
- {d.field !== 'value' && <span style={{ color: F.MUTED }}>.{d.field}</span>}
- <span style={{ color: F.CYAN }}>={val}</span>
- <span style={{ color: F.ORANGE, margin: '0 3px' }}>{op}</span>
- <span style={{ color: F.YELLOW, fontWeight: 700 }}>{d.target_indicator}</span>
- <span style={{ color: F.CYAN }}>={targetVal}</span>
- </span>
- );
+ const tv = d.target_computed_value != null ? d.target_computed_value.toFixed(2) : '—';
+ return <><span style={{ color: F.WHITE, fontWeight: 700 }}>{d.indicator}</span>{d.field !== 'value' && <span style={{ color: F.MUTED }}>.{d.field}</span>}<span style={{ color: F.CYAN }}>={val}</span><span style={{ color: F.ORANGE, margin: '0 4px' }}>{op}</span><span style={{ color: F.YELLOW, fontWeight: 700 }}>{d.target_indicator}</span><span style={{ color: F.CYAN }}>={tv}</span></>;
}
-
- return (
- <span>
- <span style={{ color: F.WHITE, fontWeight: 700 }}>{d.indicator}</span>
- {d.field !== 'value' && <span style={{ color: F.MUTED }}>.{d.field}</span>}
- <span style={{ color: F.CYAN }}>={val}</span>
- <span style={{ color: F.ORANGE, margin: '0 3px' }}>{op}</span>
- <span style={{ color: F.MUTED }}>{d.target}</span>
- </span>
- );
+ return <><span style={{ color: F.WHITE, fontWeight: 700 }}>{d.indicator}</span>{d.field !== 'value' && <span style={{ color: F.MUTED }}>.{d.field}</span>}<span style={{ color: F.CYAN }}>={val}</span><span style={{ color: F.ORANGE, margin: '0 4px' }}>{op}</span><span style={{ color: F.MUTED }}>{d.target}</span></>;
}
+// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
const ScannerPanel: React.FC = () => {
const stockBroker = useStockBrokerContextOptional();
const { activeBroker } = useBrokerContext();
- const provider = stockBroker?.activeBroker
- || (STOCK_BROKERS.includes(activeBroker) ? activeBroker : null)
- || 'fyers';
+ const provider = stockBroker?.activeBroker || (STOCK_BROKERS.includes(activeBroker) ? activeBroker : null) || 'fyers';
const [conditions, setConditions] = useState<ConditionItem[]>([
{ indicator: 'RSI', params: { period: 14 }, field: 'value', operator: '<', value: 30 },
@@ -240,41 +89,22 @@ const ScannerPanel: React.FC = () => {
const symbols = symbolsInput.split(/[,\n]/).map(s => s.trim().toUpperCase()).filter(Boolean);
if (symbols.length === 0) { setError('Enter at least one symbol'); return; }
if (conditions.length === 0) { setError('Add at least one condition'); return; }
-
- setScanning(true);
- setError('');
- setResults(null);
- setDebugLog([]);
- setPrefetchWarning('');
- setSymbolErrors([]);
- setExpandedResult(null);
-
+ setScanning(true); setError(''); setResults(null); setDebugLog([]); setPrefetchWarning(''); setSymbolErrors([]); setExpandedResult(null);
try {
const result = await runAlgoScan(buildConditionsJson(), JSON.stringify(symbols), timeframe, provider, lookbackDays);
setScanning(false);
-
if (result.debug) setDebugLog(result.debug);
if (result.prefetch_warning) setPrefetchWarning(result.prefetch_warning);
-
if (result.success && result.data) {
- setResults(result.data.matches);
- setScanned(result.data.scanned);
- if (result.data.errors && result.data.errors.length > 0) {
- setSymbolErrors(result.data.errors);
- }
+ setResults(result.data.matches); setScanned(result.data.scanned);
+ if (result.data.errors?.length) setSymbolErrors(result.data.errors);
if (result.data.debug) setDebugLog(result.data.debug);
if (result.data.prefetch_warning) setPrefetchWarning(result.data.prefetch_warning);
- } else {
- setError(result.error || 'Scan failed — check debug log for details');
- }
- } catch (e) {
- setScanning(false);
- setError(`Unexpected error: ${e instanceof Error ? e.message : String(e)}`);
- }
+ } else { setError(result.error || 'Scan failed — check debug log'); }
+ } catch (e) { setScanning(false); setError(`Unexpected error: ${e instanceof Error ? e.message : String(e)}`); }
};
const applyPreset = (preset: ScanPreset) => {
- // Deep clone to avoid mutating preset constants (params/compareParams are nested objects)
setConditions(JSON.parse(JSON.stringify(preset.conditions)));
setLogic(preset.logic);
setShowPresets(false);
@@ -285,385 +115,294 @@ const ScannerPanel: React.FC = () => {
if (!symbols) return;
const existing = symbolsInput.split(/[,\n]/).map(s => s.trim().toUpperCase()).filter(Boolean);
const newSymbols = symbols.filter(s => !existing.includes(s));
- const merged = [...existing, ...newSymbols];
- setSymbolsInput(merged.join(', '));
- };
-
- // Export scan results to CSV
- const exportToCSV = () => {
- if (!results || results.length === 0) return;
-
- // Build CSV header
- const headers = ['#', 'Symbol', 'Price', 'Match'];
-
- // Get all unique indicator names from results for dynamic columns
- const indicatorColumns = new Set<string>();
- results.forEach(r => {
- r.details.forEach(d => {
- const colName = d.field !== 'value' ? `${d.indicator}.${d.field}` : d.indicator;
- indicatorColumns.add(colName);
- });
- });
-
- const indicatorHeaders = Array.from(indicatorColumns);
- headers.push(...indicatorHeaders.map(h => `${h}_Value`));
- headers.push(...indicatorHeaders.map(h => `${h}_Met`));
-
- // Build CSV rows
- const rows: string[][] = [];
- results.forEach((r, i) => {
- const row: string[] = [
- String(i + 1),
- r.symbol,
- r.price.toFixed(2),
- 'YES',
- ];
-
- // Add indicator values
- indicatorHeaders.forEach(header => {
- const detail = r.details.find(d => {
- const colName = d.field !== 'value' ? `${d.indicator}.${d.field}` : d.indicator;
- return colName === header;
- });
- row.push(detail?.computed_value != null ? detail.computed_value.toFixed(4) : '');
- });
-
- // Add indicator met status
- indicatorHeaders.forEach(header => {
- const detail = r.details.find(d => {
- const colName = d.field !== 'value' ? `${d.indicator}.${d.field}` : d.indicator;
- return colName === header;
- });
- row.push(detail ? (detail.met ? 'TRUE' : 'FALSE') : '');
- });
-
- rows.push(row);
- });
-
- // Generate CSV content
- const csvContent = [
- `# Scan Results - ${new Date().toISOString()}`,
- `# Conditions: ${conditionSummary}`,
- `# Timeframe: ${timeframe}`,
- `# Scanned: ${scanned} symbols, Matches: ${results.length}`,
- '',
- headers.join(','),
- ...rows.map(row => row.map(cell => `"${cell}"`).join(',')),
- ].join('\n');
-
- // Download file
- const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
- const url = URL.createObjectURL(blob);
- const link = document.createElement('a');
- link.href = url;
- link.download = `scan_results_${timeframe}_${new Date().toISOString().slice(0, 10)}.csv`;
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
- URL.revokeObjectURL(url);
+ setSymbolsInput([...existing, ...newSymbols].join(', '));
};
- // Build a summary of the current scan conditions
const conditionSummary = conditions.map(c => {
const def = getIndicatorDef(c.indicator);
const label = def?.label || c.indicator;
- const paramValues = Object.values(c.params);
- const paramStr = paramValues.length > 0 ? `(${paramValues.join(',')})` : '';
- const fieldStr = c.field !== 'value' ? `.${c.field}` : '';
- const opStr = c.operator;
+ const pv = Object.values(c.params);
+ const ps = pv.length > 0 ? `(${pv.join(',')})` : '';
+ const fs = c.field !== 'value' ? `.${c.field}` : '';
if (c.compareMode === 'indicator' && c.compareIndicator) {
- const cDef = getIndicatorDef(c.compareIndicator);
- const cLabel = cDef?.label || c.compareIndicator;
- const cParamValues = Object.values(c.compareParams || {});
- const cParamStr = cParamValues.length > 0 ? `(${cParamValues.join(',')})` : '';
- return `${label}${paramStr}${fieldStr} ${opStr} ${cLabel}${cParamStr}`;
+ const cd = getIndicatorDef(c.compareIndicator);
+ const cl = cd?.label || c.compareIndicator;
+ const cpv = Object.values(c.compareParams || {});
+ const cps = cpv.length > 0 ? `(${cpv.join(',')})` : '';
+ return `${label}${ps}${fs} ${c.operator} ${cl}${cps}`;
}
- return `${label}${paramStr}${fieldStr} ${opStr} ${c.value}`;
+ return `${label}${ps}${fs} ${c.operator} ${c.value}`;
}).join(` ${logic} `);
+ const exportToCSV = () => {
+ if (!results || results.length === 0) return;
+ const headers = ['#', 'Symbol', 'Price'];
+ const indicatorCols = new Set<string>();
+ results.forEach(r => r.details.forEach(d => { indicatorCols.add(d.field !== 'value' ? `${d.indicator}.${d.field}` : d.indicator); }));
+ const indHeaders = Array.from(indicatorCols);
+ headers.push(...indHeaders.map(h => `${h}_Value`), ...indHeaders.map(h => `${h}_Met`));
+ const rows = results.map((r, i) => {
+ const row = [String(i + 1), r.symbol, r.price.toFixed(2)];
+ indHeaders.forEach(h => { const d = r.details.find(d => (d.field !== 'value' ? `${d.indicator}.${d.field}` : d.indicator) === h); row.push(d?.computed_value != null ? d.computed_value.toFixed(4) : ''); });
+ indHeaders.forEach(h => { const d = r.details.find(d => (d.field !== 'value' ? `${d.indicator}.${d.field}` : d.indicator) === h); row.push(d ? (d.met ? 'TRUE' : 'FALSE') : ''); });
+ return row;
+ });
+ const csv = [`# Scan Results - ${new Date().toISOString()}`, `# ${conditionSummary}`, `# TF: ${timeframe} | Scanned: ${scanned} | Matches: ${results.length}`, '', headers.join(','), ...rows.map(r => r.map(c => `"${c}"`).join(','))].join('\n');
+ const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
+ const url = URL.createObjectURL(blob);
+ const a = document.createElement('a'); a.href = url; a.download = `scan_${timeframe}_${new Date().toISOString().slice(0, 10)}.csv`;
+ document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url);
+ };
+
+ const symbolCount = symbolsInput.split(/[,\n]/).map(s => s.trim()).filter(Boolean).length;
+
+ // ── Inline styles ──
+ const inputSt: React.CSSProperties = { padding: '6px 8px', backgroundColor: F.DARK_BG, color: F.WHITE, borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER, borderRadius: '2px', fontSize: '10px', fontFamily: font, outline: 'none', width: '100%' };
+ const selectSt: React.CSSProperties = { ...inputSt, cursor: 'pointer' };
+ const smallBtn: React.CSSProperties = { padding: '3px 8px', backgroundColor: 'transparent', borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER, borderRadius: '2px', fontSize: '9px', fontWeight: 700, fontFamily: font, color: F.GRAY, cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '4px', transition: 'all 0.15s', whiteSpace: 'nowrap' };
+ const label7: React.CSSProperties = { fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.8px', textTransform: 'uppercase', marginBottom: '4px', display: 'block' };
+
return (
- <div style={{ padding: '16px', display: 'flex', flexDirection: 'column', gap: '12px' }}>
- {/* Scanner Header + Presets Toggle */}
- <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
+ <div style={{ display: 'flex', flexDirection: 'column', height: '100%', fontFamily: font, backgroundColor: F.DARK_BG }}>
+
+ {/* ━━━ HEADER BAR ━━━ */}
+ <div style={{
+ display: 'flex', alignItems: 'center', gap: '10px', padding: '8px 14px',
+ backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}`, flexShrink: 0,
+ }}>
+ <Terminal size={14} style={{ color: F.ORANGE }} />
<span style={{ fontSize: '11px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>SCANNER</span>
- <div style={{ display: 'flex', gap: '6px' }}>
- <button
- onClick={() => setShowPresets(!showPresets)}
- style={{
- ...chipStyle,
- color: showPresets ? F.ORANGE : F.GRAY,
- borderColor: showPresets ? F.ORANGE : F.BORDER,
- }}
- >
- <Zap size={8} style={{ marginRight: '3px', display: 'inline' }} />
- PRESETS
+
+ {/* Condition summary pill */}
+ {conditions.length > 0 && (
+ <div style={{
+ flex: 1, minWidth: 0, padding: '3px 10px', borderRadius: '2px',
+ backgroundColor: `${F.ORANGE}0A`, borderWidth: '1px', borderStyle: 'solid', borderColor: `${F.ORANGE}25`,
+ fontSize: '9px', color: F.ORANGE, fontFamily: font, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
+ }} title={conditionSummary}>
+ {conditionSummary}
+ </div>
+ )}
+
+ <div style={{ display: 'flex', alignItems: 'center', gap: '6px', flexShrink: 0 }}>
+ <button onClick={() => setShowPresets(!showPresets)} style={{
+ ...smallBtn,
+ borderColor: showPresets ? `${F.ORANGE}60` : F.BORDER,
+ color: showPresets ? F.ORANGE : F.GRAY,
+ }}>
+ <Zap size={10} /> PRESETS
</button>
- <button
- onClick={() => {
- setConditions([{ indicator: 'RSI', params: { period: 14 }, field: 'value', operator: '<', value: 30 }]);
- setLogic('AND');
- setResults(null);
- setError('');
- setDebugLog([]);
- setPrefetchWarning('');
- setSymbolErrors([]);
- }}
- style={chipStyle}
- >
- <RotateCcw size={8} style={{ marginRight: '3px', display: 'inline' }} />
- RESET
+ <button onClick={() => { setConditions([{ indicator: 'RSI', params: { period: 14 }, field: 'value', operator: '<', value: 30 }]); setLogic('AND'); setResults(null); setError(''); setDebugLog([]); setPrefetchWarning(''); setSymbolErrors([]); }} style={smallBtn}>
+ <RotateCcw size={10} /> RESET
</button>
</div>
</div>
- {/* Scan Presets Panel */}
+ {/* ━━━ PRESETS DROPDOWN ━━━ */}
{showPresets && (
- <div style={{
- backgroundColor: F.PANEL_BG, border: `1px solid ${F.BORDER}`, borderRadius: '2px',
- padding: '8px',
- }}>
- <div style={{ fontSize: '8px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px', marginBottom: '8px' }}>
- SCAN TEMPLATES — CLICK TO APPLY
- </div>
- <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))', gap: '6px' }}>
- {SCAN_PRESETS.map((preset, i) => (
- <button
- key={i}
- onClick={() => applyPreset(preset)}
- style={{
- padding: '8px 10px', backgroundColor: F.DARK_BG, border: `1px solid ${F.BORDER}`,
- borderRadius: '2px', cursor: 'pointer', textAlign: 'left', transition: 'all 0.15s',
- }}
- onMouseEnter={e => {
- (e.currentTarget as HTMLElement).style.borderColor = F.ORANGE;
- (e.currentTarget as HTMLElement).style.backgroundColor = F.HEADER_BG;
- }}
- onMouseLeave={e => {
- (e.currentTarget as HTMLElement).style.borderColor = F.BORDER;
- (e.currentTarget as HTMLElement).style.backgroundColor = F.DARK_BG;
- }}
+ <div style={{ padding: '8px 14px', borderBottom: `1px solid ${F.BORDER}`, backgroundColor: F.PANEL_BG, flexShrink: 0 }}>
+ <div style={{ fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.8px', marginBottom: '6px' }}>SCAN TEMPLATES — CLICK TO APPLY</div>
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(180px, 1fr))', gap: '4px' }}>
+ {SCAN_PRESETS.map((p, i) => (
+ <button key={i} onClick={() => applyPreset(p)} style={{
+ padding: '6px 8px', backgroundColor: F.DARK_BG, borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER,
+ borderRadius: '2px', cursor: 'pointer', textAlign: 'left', fontFamily: font, transition: 'all 0.15s',
+ }}
+ onMouseEnter={e => { e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.backgroundColor = F.HEADER_BG; }}
+ onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.backgroundColor = F.DARK_BG; }}
>
- <div style={{ fontSize: '9px', fontWeight: 700, color: F.ORANGE, marginBottom: '2px' }}>
- {preset.name}
- </div>
- <div style={{ fontSize: '8px', color: F.MUTED, lineHeight: '1.4' }}>
- {preset.description}
- </div>
+ <div style={{ fontSize: '10px', fontWeight: 700, color: F.ORANGE }}>{p.name}</div>
+ <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '2px' }}>{p.desc}</div>
</button>
))}
</div>
</div>
)}
- {/* Active Condition Summary */}
- {conditions.length > 0 && (
+ {/* ━━━ MAIN CONTENT: Two columns ━━━ */}
+ <div style={{ display: 'flex', flex: 1, overflow: 'hidden', minHeight: 0 }}>
+
+ {/* ── LEFT COLUMN: Conditions + Symbols + Controls ── */}
<div style={{
- padding: '6px 10px', backgroundColor: `${F.ORANGE}08`, border: `1px solid ${F.ORANGE}20`,
- borderRadius: '2px', fontSize: '9px', color: F.ORANGE, fontFamily: '"IBM Plex Mono", monospace',
+ width: '380px', flexShrink: 0, display: 'flex', flexDirection: 'column',
+ borderRight: `1px solid ${F.BORDER}`, overflow: 'hidden',
}}>
- <span style={{ fontWeight: 700, marginRight: '6px' }}>SCAN:</span>
- {conditionSummary}
- </div>
- )}
-
- {/* Condition Builder */}
- <ConditionBuilder label="Scan Conditions" conditions={conditions} logic={logic}
- onConditionsChange={setConditions} onLogicChange={setLogic} />
-
- {/* Symbol Universe + Timeframe */}
- <div style={{ display: 'grid', gridTemplateColumns: '2fr 1fr', gap: '12px' }}>
- <div>
- <label style={labelStyle}>SYMBOLS (COMMA OR NEWLINE SEPARATED)</label>
- <textarea
- value={symbolsInput}
- onChange={e => setSymbolsInput(e.target.value)}
- placeholder="RELIANCE, TCS, INFY, HDFCBANK, ICICIBANK"
- rows={3}
- style={{ ...inputStyle, resize: 'none' } as React.CSSProperties}
- />
- {/* Watchlist Quick-Add */}
- <div style={{ display: 'flex', gap: '4px', marginTop: '4px', flexWrap: 'wrap' }}>
- {Object.keys(SYMBOL_WATCHLISTS).map(name => (
- <button
- key={name}
- onClick={() => appendWatchlist(name)}
- style={{
- ...chipStyle,
- padding: '2px 6px',
- fontSize: '7px',
- }}
- onMouseEnter={e => {
- (e.currentTarget as HTMLElement).style.borderColor = F.CYAN;
- (e.currentTarget as HTMLElement).style.color = F.CYAN;
- }}
- onMouseLeave={e => {
- (e.currentTarget as HTMLElement).style.borderColor = F.BORDER;
- (e.currentTarget as HTMLElement).style.color = F.GRAY;
- }}
- title={`Add ${SYMBOL_WATCHLISTS[name].length} symbols`}
- >
- + {name} ({SYMBOL_WATCHLISTS[name].length})
- </button>
- ))}
+ {/* Condition Builder */}
+ <div style={{ flexShrink: 0, borderBottom: `1px solid ${F.BORDER}` }}>
+ <ConditionBuilder label="Scan Conditions" conditions={conditions} logic={logic}
+ onConditionsChange={setConditions} onLogicChange={setLogic} />
</div>
- </div>
- <div>
- <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '8px' }}>
+
+ {/* Symbols section */}
+ <div style={{ flex: 1, display: 'flex', flexDirection: 'column', overflow: 'auto', padding: '10px 12px', gap: '10px' }}>
+ {/* Symbol input */}
<div>
- <label style={labelStyle}>TIMEFRAME</label>
- <select value={timeframe} onChange={e => setTimeframe(e.target.value)} style={inputStyle}>
- {TIMEFRAMES.map(tf => <option key={tf.value} value={tf.value}>{tf.label}</option>)}
- </select>
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '4px' }}>
+ <span style={label7}>SYMBOLS</span>
+ {symbolCount > 0 && <span style={{ fontSize: '9px', color: F.CYAN, fontWeight: 600 }}>{symbolCount} tickers</span>}
+ </div>
+ <textarea
+ value={symbolsInput}
+ onChange={e => setSymbolsInput(e.target.value)}
+ placeholder="RELIANCE, TCS, INFY, HDFCBANK..."
+ rows={4}
+ style={{ ...inputSt, resize: 'none', lineHeight: '1.5' }}
+ />
</div>
+
+ {/* Watchlist quick-add */}
<div>
- <label style={labelStyle}>LOOKBACK (DAYS)</label>
- <input
- type="number"
- value={lookbackDays}
- onChange={e => setLookbackDays(Math.max(1, parseInt(e.target.value) || 30))}
- min={1}
- max={1000}
- style={inputStyle}
- title="Number of days of historical data to fetch"
- />
+ <span style={label7}>QUICK ADD</span>
+ <div style={{ display: 'flex', gap: '4px', flexWrap: 'wrap' }}>
+ {Object.keys(SYMBOL_WATCHLISTS).map(name => (
+ <button key={name} onClick={() => appendWatchlist(name)} style={smallBtn}
+ onMouseEnter={e => { e.currentTarget.style.borderColor = F.CYAN; e.currentTarget.style.color = F.CYAN; }}
+ onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
+ title={`Add ${SYMBOL_WATCHLISTS[name].length} symbols`}
+ >
+ <Plus size={8} /> {name} ({SYMBOL_WATCHLISTS[name].length})
+ </button>
+ ))}
+ </div>
+ </div>
+
+ {/* Timeframe + Lookback */}
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '8px' }}>
+ <div>
+ <span style={label7}>TIMEFRAME</span>
+ <select value={timeframe} onChange={e => setTimeframe(e.target.value)} style={selectSt}>
+ {TIMEFRAMES.map(tf => <option key={tf.value} value={tf.value}>{tf.label}</option>)}
+ </select>
+ </div>
+ <div>
+ <span style={label7}>LOOKBACK DAYS</span>
+ <input type="number" value={lookbackDays} onChange={e => setLookbackDays(Math.max(1, parseInt(e.target.value) || 30))} min={1} max={1000} style={inputSt} />
+ </div>
+ </div>
+
+ {/* Provider info */}
+ <div style={{ fontSize: '8px', color: F.MUTED, display: 'flex', alignItems: 'center', gap: '4px' }}>
+ DATA: <span style={{ color: F.CYAN, fontWeight: 700 }}>{provider.toUpperCase()}</span>
</div>
</div>
- <button onClick={handleScan} disabled={scanning} style={{
- width: '100%', marginTop: '8px', padding: '8px 16px',
- backgroundColor: F.ORANGE, color: F.DARK_BG, border: 'none', borderRadius: '2px',
- fontSize: '9px', fontWeight: 700, cursor: 'pointer', opacity: scanning ? 0.5 : 1,
- display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '4px',
- }}>
- {scanning ? <Loader size={10} className="animate-spin" /> : <Search size={10} />}
- {scanning ? 'SCANNING...' : 'RUN SCAN'}
- </button>
- </div>
- </div>
- {/* Error Display */}
- {error && (
- <div style={{ padding: '8px 10px', backgroundColor: `${F.RED}15`, border: `1px solid ${F.RED}40`, borderRadius: '2px' }}>
- <div style={{ fontSize: '9px', fontWeight: 700, color: F.RED, marginBottom: '2px' }}>SCAN ERROR</div>
- <div style={{ fontSize: '9px', color: F.RED, lineHeight: '1.4', whiteSpace: 'pre-wrap' }}>{error}</div>
+ {/* SCAN BUTTON */}
+ <div style={{ padding: '10px 12px', borderTop: `1px solid ${F.BORDER}`, flexShrink: 0 }}>
+ <button onClick={handleScan} disabled={scanning} style={{
+ width: '100%', padding: '8px', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '6px',
+ backgroundColor: scanning ? F.MUTED : F.ORANGE, color: F.DARK_BG, border: 'none', borderRadius: '2px',
+ fontSize: '11px', fontWeight: 700, fontFamily: font, letterSpacing: '0.5px',
+ cursor: scanning ? 'not-allowed' : 'pointer', transition: 'all 0.15s',
+ }}>
+ {scanning ? <Loader size={13} className="animate-spin" /> : <Search size={13} />}
+ {scanning ? 'SCANNING...' : 'RUN SCAN'}
+ </button>
+ </div>
</div>
- )}
- {/* Prefetch Warning */}
- {prefetchWarning && !error && (
- <div style={{
- padding: '6px 10px', backgroundColor: `${F.YELLOW}12`, border: `1px solid ${F.YELLOW}30`,
- borderRadius: '2px', display: 'flex', alignItems: 'center', gap: '6px',
- }}>
- <AlertTriangle size={10} color={F.YELLOW} />
- <span style={{ fontSize: '9px', color: F.YELLOW }}>{prefetchWarning}</span>
- </div>
- )}
+ {/* ── RIGHT COLUMN: Results ── */}
+ <div style={{ flex: 1, display: 'flex', flexDirection: 'column', overflow: 'hidden', minWidth: 0 }}>
- {/* Symbol-level errors */}
- {symbolErrors.length > 0 && (
- <div style={{ padding: '6px 10px', backgroundColor: `${F.YELLOW}10`, border: `1px solid ${F.BORDER}`, borderRadius: '2px' }}>
- <div style={{ fontSize: '8px', fontWeight: 700, color: F.YELLOW, letterSpacing: '0.5px', marginBottom: '4px' }}>
- SYMBOL WARNINGS ({symbolErrors.length})
+ {/* Results header */}
+ <div style={{
+ display: 'flex', alignItems: 'center', gap: '10px', padding: '7px 14px',
+ backgroundColor: F.PANEL_BG, borderBottom: `1px solid ${F.BORDER}`, flexShrink: 0,
+ }}>
+ <span style={{ fontSize: '10px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>RESULTS</span>
+ {results !== null && (
+ <>
+ <span style={{ fontSize: '10px', fontWeight: 700, color: F.CYAN }}>{results.length}</span>
+ <span style={{ fontSize: '9px', color: F.MUTED }}>/ {scanned} scanned</span>
+ {symbolErrors.length > 0 && (
+ <span style={{ fontSize: '9px', color: F.YELLOW, display: 'flex', alignItems: 'center', gap: '3px' }}>
+ <AlertTriangle size={10} /> {symbolErrors.length} warnings
+ </span>
+ )}
+ </>
+ )}
+ <div style={{ flex: 1 }} />
+ {results && results.length > 0 && (
+ <button onClick={exportToCSV} style={smallBtn}
+ onMouseEnter={e => { e.currentTarget.style.borderColor = F.CYAN; e.currentTarget.style.color = F.CYAN; }}
+ onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
+ >
+ <Download size={10} /> CSV
+ </button>
+ )}
+ {debugLog.length > 0 && (
+ <button onClick={() => setShowDebug(!showDebug)} style={{
+ ...smallBtn,
+ borderColor: showDebug ? `${F.YELLOW}50` : F.BORDER,
+ color: showDebug ? F.YELLOW : F.GRAY,
+ }}>
+ {showDebug ? <ChevronDown size={10} /> : <ChevronRight size={10} />}
+ LOG ({debugLog.length})
+ </button>
+ )}
</div>
- {symbolErrors.map((se, i) => (
- <div key={i} style={{ fontSize: '9px', color: F.GRAY, lineHeight: '1.4' }}>
- <span style={{ color: F.WHITE, fontWeight: 700 }}>{se.symbol}</span>: {se.error}
+
+ {/* Error / Warning banners */}
+ {error && (
+ <div style={{ padding: '8px 14px', backgroundColor: `${F.RED}10`, borderBottom: `1px solid ${F.RED}30`, flexShrink: 0 }}>
+ <div style={{ fontSize: '10px', fontWeight: 700, color: F.RED, marginBottom: '2px' }}>SCAN ERROR</div>
+ <div style={{ fontSize: '10px', color: F.RED, whiteSpace: 'pre-wrap' }}>{error}</div>
</div>
- ))}
- </div>
- )}
+ )}
+ {prefetchWarning && !error && (
+ <div style={{ display: 'flex', alignItems: 'center', gap: '6px', padding: '6px 14px', backgroundColor: `${F.YELLOW}08`, borderBottom: `1px solid ${F.YELLOW}20`, flexShrink: 0 }}>
+ <AlertTriangle size={12} style={{ color: F.YELLOW, flexShrink: 0 }} />
+ <span style={{ fontSize: '10px', color: F.YELLOW }}>{prefetchWarning}</span>
+ </div>
+ )}
- {/* Debug Log (collapsible) */}
- {debugLog.length > 0 && (
- <div style={{ backgroundColor: F.PANEL_BG, border: `1px solid ${F.BORDER}`, borderRadius: '2px' }}>
- <button
- onClick={() => setShowDebug(!showDebug)}
- style={{
- width: '100%', padding: '6px 10px', backgroundColor: F.HEADER_BG,
- border: 'none', borderBottom: showDebug ? `1px solid ${F.BORDER}` : 'none',
- color: F.MUTED, fontSize: '8px', fontWeight: 700, letterSpacing: '0.5px',
- cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '4px',
- textAlign: 'left',
- }}
- >
- {showDebug ? <ChevronDown size={10} /> : <ChevronRight size={10} />}
- DEBUG LOG ({debugLog.length} entries)
- </button>
- {showDebug && (
- <div style={{
- padding: '8px 10px', maxHeight: '200px', overflow: 'auto',
- fontFamily: '"IBM Plex Mono", monospace', fontSize: '8px', lineHeight: '1.5',
- }}>
+ {/* Debug log (collapsible) */}
+ {showDebug && debugLog.length > 0 && (
+ <div style={{ maxHeight: '140px', overflow: 'auto', padding: '8px 14px', borderBottom: `1px solid ${F.BORDER}`, backgroundColor: F.PANEL_BG, flexShrink: 0 }}>
{debugLog.map((line, i) => (
<div key={i} style={{
- color: line.includes('ERROR') ? F.RED
- : line.includes('WARNING') ? F.YELLOW
- : line.includes('summary') ? F.CYAN
- : F.MUTED,
- }}>
- {line}
+ fontSize: '9px', lineHeight: '1.6', fontFamily: font,
+ color: line.includes('ERROR') ? F.RED : line.includes('WARNING') ? F.YELLOW : line.includes('summary') ? F.CYAN : F.MUTED,
+ }}>{line}</div>
+ ))}
+ </div>
+ )}
+
+ {/* Symbol errors */}
+ {symbolErrors.length > 0 && !showDebug && (
+ <div style={{ padding: '6px 14px', borderBottom: `1px solid ${F.BORDER}`, backgroundColor: `${F.YELLOW}06`, flexShrink: 0, maxHeight: '80px', overflow: 'auto' }}>
+ {symbolErrors.map((se, i) => (
+ <div key={i} style={{ fontSize: '9px', color: F.GRAY, lineHeight: '1.5' }}>
+ <span style={{ color: F.WHITE, fontWeight: 700 }}>{se.symbol}</span>: <span style={{ color: F.YELLOW }}>{se.error}</span>
</div>
))}
</div>
)}
- </div>
- )}
- {/* Results */}
- {results !== null && (
- <div style={{ backgroundColor: F.PANEL_BG, border: `1px solid ${F.BORDER}`, borderRadius: '2px' }}>
- <div style={{
- padding: '8px 12px', backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}`,
- display: 'flex', alignItems: 'center', justifyContent: 'space-between',
- }}>
- <span style={{ fontSize: '9px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>
- RESULTS: <span style={{ color: F.CYAN }}>{results.length}</span> MATCH{results.length !== 1 ? 'ES' : ''} / {scanned} SCANNED
- </span>
- {results.length > 0 && (
- <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
- <span style={{ fontSize: '8px', color: F.MUTED }}>
- <List size={8} style={{ marginRight: '3px', display: 'inline' }} />
- CLICK ROW FOR DETAILS
- </span>
- <button
- onClick={(e) => { e.stopPropagation(); exportToCSV(); }}
- style={{
- ...chipStyle,
- display: 'flex',
- alignItems: 'center',
- gap: '4px',
- padding: '3px 8px',
- }}
- onMouseEnter={e => {
- (e.currentTarget as HTMLElement).style.borderColor = F.CYAN;
- (e.currentTarget as HTMLElement).style.color = F.CYAN;
- }}
- onMouseLeave={e => {
- (e.currentTarget as HTMLElement).style.borderColor = F.BORDER;
- (e.currentTarget as HTMLElement).style.color = F.GRAY;
- }}
- title="Export results to CSV"
- >
- <Download size={8} />
- EXPORT CSV
- </button>
+ {/* Results table */}
+ <div style={{ flex: 1, overflow: 'auto' }}>
+ {results === null && !scanning ? (
+ <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', gap: '8px' }}>
+ <Search size={28} style={{ color: F.MUTED, opacity: 0.3 }} />
+ <span style={{ fontSize: '10px', color: F.MUTED }}>Configure conditions and run a scan</span>
</div>
- )}
- </div>
- {results.length === 0 ? (
- <div style={{ padding: '24px', textAlign: 'center', fontSize: '10px', color: F.MUTED }}>
- No symbols match the conditions
- </div>
- ) : (
- <div style={{ overflow: 'auto' }}>
- <table style={{ width: '100%', borderCollapse: 'collapse', fontSize: '9px', fontFamily: '"IBM Plex Mono", monospace' }}>
+ ) : scanning ? (
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%', gap: '8px' }}>
+ <Loader size={16} className="animate-spin" style={{ color: F.ORANGE }} />
+ <span style={{ fontSize: '10px', fontWeight: 600, color: F.GRAY }}>Scanning {symbolCount} symbols...</span>
+ </div>
+ ) : results && results.length === 0 ? (
+ <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', gap: '6px' }}>
+ <span style={{ fontSize: '10px', fontWeight: 600, color: F.GRAY }}>No matches found</span>
+ <span style={{ fontSize: '9px', color: F.MUTED }}>Try different conditions or more symbols</span>
+ </div>
+ ) : results && (
+ <table style={{ width: '100%', borderCollapse: 'collapse', fontFamily: font }}>
<thead>
- <tr style={{ borderBottom: `1px solid ${F.BORDER}` }}>
- <th style={{ padding: '6px 12px', textAlign: 'left', fontSize: '8px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>#</th>
- <th style={{ padding: '6px 12px', textAlign: 'left', fontSize: '8px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>SYMBOL</th>
- <th style={{ padding: '6px 12px', textAlign: 'right', fontSize: '8px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>PRICE</th>
- <th style={{ padding: '6px 12px', textAlign: 'left', fontSize: '8px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>CONDITIONS</th>
- <th style={{ padding: '6px 12px', textAlign: 'center', fontSize: '8px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>STATUS</th>
+ <tr style={{ borderBottom: `1px solid ${F.BORDER}`, position: 'sticky', top: 0, backgroundColor: F.PANEL_BG, zIndex: 1 }}>
+ <th style={{ padding: '6px 14px', fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.6px', textAlign: 'left', width: '36px' }}>#</th>
+ <th style={{ padding: '6px 8px', fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.6px', textAlign: 'left' }}>SYMBOL</th>
+ <th style={{ padding: '6px 8px', fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.6px', textAlign: 'right' }}>PRICE</th>
+ <th style={{ padding: '6px 8px', fontSize: '8px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.6px', textAlign: 'left' }}>CONDITIONS</th>
</tr>
</thead>
<tbody>
@@ -672,29 +411,24 @@ const ScannerPanel: React.FC = () => {
<tr
onClick={() => setExpandedResult(expandedResult === i ? null : i)}
style={{
- borderBottom: `1px solid ${F.BORDER}15`,
- cursor: 'pointer',
+ cursor: 'pointer', borderBottom: `1px solid ${F.BORDER}15`,
backgroundColor: expandedResult === i ? `${F.ORANGE}08` : 'transparent',
- transition: 'background-color 0.15s',
- }}
- onMouseEnter={e => {
- if (expandedResult !== i) (e.currentTarget as HTMLElement).style.backgroundColor = F.HEADER_BG;
- }}
- onMouseLeave={e => {
- if (expandedResult !== i) (e.currentTarget as HTMLElement).style.backgroundColor = 'transparent';
+ transition: 'background-color 0.1s',
}}
+ onMouseEnter={e => { if (expandedResult !== i) e.currentTarget.style.backgroundColor = F.HOVER; }}
+ onMouseLeave={e => { if (expandedResult !== i) e.currentTarget.style.backgroundColor = expandedResult === i ? `${F.ORANGE}08` : 'transparent'; }}
>
- <td style={{ padding: '6px 12px', color: F.MUTED }}>{i + 1}</td>
- <td style={{ padding: '6px 12px', fontWeight: 700, color: F.WHITE }}>{r.symbol}</td>
- <td style={{ padding: '6px 12px', textAlign: 'right', color: F.CYAN, fontWeight: 700 }}>{r.price.toFixed(2)}</td>
- <td style={{ padding: '6px 12px' }}>
+ <td style={{ padding: '7px 14px', fontSize: '9px', color: F.MUTED }}>{i + 1}</td>
+ <td style={{ padding: '7px 8px', fontSize: '10px', fontWeight: 700, color: F.WHITE }}>{r.symbol}</td>
+ <td style={{ padding: '7px 8px', fontSize: '10px', fontWeight: 700, color: F.CYAN, textAlign: 'right' }}>{r.price.toFixed(2)}</td>
+ <td style={{ padding: '7px 8px' }}>
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '4px' }}>
{r.details.map((d, j) => (
<span key={j} style={{
- display: 'inline-flex', alignItems: 'center', gap: '3px',
- padding: '1px 5px', borderRadius: '2px', fontSize: '8px',
- backgroundColor: d.met ? `${F.GREEN}15` : `${F.RED}15`,
- border: `1px solid ${d.met ? F.GREEN : F.RED}30`,
+ display: 'inline-flex', alignItems: 'center', gap: '3px', padding: '2px 6px', borderRadius: '2px',
+ fontSize: '9px', fontWeight: 700, fontFamily: font,
+ backgroundColor: d.met ? `${F.GREEN}12` : `${F.RED}12`,
+ borderWidth: '1px', borderStyle: 'solid', borderColor: d.met ? `${F.GREEN}30` : `${F.RED}30`,
color: d.met ? F.GREEN : F.RED,
}}>
{d.met ? '✓' : '✗'} {d.indicator}{d.field !== 'value' ? `.${d.field}` : ''}
@@ -702,51 +436,29 @@ const ScannerPanel: React.FC = () => {
))}
</div>
</td>
- <td style={{ padding: '6px 12px', textAlign: 'center' }}>
- <span style={{
- padding: '2px 6px', borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- backgroundColor: `${F.GREEN}15`, color: F.GREEN, border: `1px solid ${F.GREEN}40`,
- }}>
- MATCH
- </span>
- </td>
</tr>
- {/* Expanded detail row */}
+ {/* Expanded detail */}
{expandedResult === i && (
<tr>
- <td colSpan={5} style={{ padding: '0' }}>
- <div style={{
- padding: '8px 12px', backgroundColor: `${F.DARK_BG}`,
- borderBottom: `1px solid ${F.BORDER}`,
- }}>
+ <td colSpan={4} style={{ padding: 0 }}>
+ <div style={{ padding: '10px 14px', backgroundColor: F.DARK_BG, borderBottom: `1px solid ${F.BORDER}` }}>
<div style={{ fontSize: '8px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px', marginBottom: '6px' }}>
- CONDITION DETAILS FOR {r.symbol}
+ CONDITION DETAILS — {r.symbol}
</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
{r.details.map((d, j) => (
<div key={j} style={{
- display: 'flex', alignItems: 'center', gap: '8px',
- padding: '4px 8px', backgroundColor: F.PANEL_BG,
- borderRadius: '2px', border: `1px solid ${F.BORDER}`,
- fontSize: '9px',
+ display: 'flex', alignItems: 'center', gap: '8px', padding: '5px 8px', borderRadius: '2px',
+ backgroundColor: F.PANEL_BG, borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER,
+ fontSize: '10px', fontFamily: font,
}}>
<span style={{
- width: '16px', height: '16px', borderRadius: '2px',
- display: 'flex', alignItems: 'center', justifyContent: 'center',
- fontSize: '8px', fontWeight: 700, flexShrink: 0,
- backgroundColor: d.met ? `${F.GREEN}20` : `${F.RED}20`,
- color: d.met ? F.GREEN : F.RED,
- }}>
- {d.met ? '✓' : '✗'}
- </span>
- <div style={{ flex: 1 }}>
- {formatConditionDetail(d)}
- </div>
- {d.error && (
- <span style={{ fontSize: '8px', color: F.RED, fontStyle: 'italic' }}>
- {d.error}
- </span>
- )}
+ width: '18px', height: '18px', borderRadius: '2px', display: 'flex', alignItems: 'center', justifyContent: 'center',
+ fontSize: '9px', fontWeight: 700, flexShrink: 0,
+ backgroundColor: d.met ? `${F.GREEN}18` : `${F.RED}18`, color: d.met ? F.GREEN : F.RED,
+ }}>{d.met ? '✓' : '✗'}</span>
+ <div style={{ flex: 1 }}>{fmtDetail(d)}</div>
+ {d.error && <span style={{ fontSize: '9px', color: F.RED, fontStyle: 'italic' }}>{d.error}</span>}
</div>
))}
</div>
@@ -758,10 +470,10 @@ const ScannerPanel: React.FC = () => {
))}
</tbody>
</table>
- </div>
- )}
+ )}
+ </div>
</div>
- )}
+ </div>
</div>
);
};
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/StrategyEditor.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/StrategyEditor.tsx
index 0f20a104b..1d57fedb0 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/StrategyEditor.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/StrategyEditor.tsx
@@ -1,13 +1,13 @@
import React, { useState, useEffect, useCallback } from 'react';
import {
Save, Play, Loader, ArrowLeft, Shield, AlertTriangle, ChevronDown, ChevronRight,
- Target, TrendingUp, TrendingDown, BarChart3, Clock, Percent, Activity,
- ArrowUpRight, ArrowDownRight, Hash,
+ Target, TrendingUp, BarChart3, Clock, Percent, Activity,
+ ArrowUpRight, ArrowDownRight, Hash, Crosshair, Gauge, Zap, Plus, Trash2, Copy,
} from 'lucide-react';
import type { ConditionItem } from '../types';
-import { TIMEFRAMES } from '../constants/indicators';
+import { TIMEFRAMES, getIndicatorDef } from '../constants/indicators';
import { saveAlgoStrategy, getAlgoStrategy, runAlgoBacktest } from '../services/algoTradingService';
-import ConditionBuilder from './ConditionBuilder';
+import ConditionRow from './ConditionRow';
import { F } from '../constants/theme';
interface StrategyEditorProps {
@@ -28,42 +28,24 @@ interface BacktestResult {
metrics: BacktestMetrics;
}
-const inputStyle: React.CSSProperties = {
- width: '100%', padding: '8px 10px', backgroundColor: F.DARK_BG,
- color: F.WHITE, border: `1px solid ${F.BORDER}`, borderRadius: '2px',
- fontSize: '10px', fontFamily: '"IBM Plex Mono", monospace', outline: 'none',
-};
-
-const labelStyle: React.CSSProperties = {
- fontSize: '9px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px',
- marginBottom: '4px', display: 'block',
-};
+/* ── Inline style helpers per UI_DESIGN_SYSTEM.md ── */
+const font = '"IBM Plex Mono", "Consolas", monospace';
+const lbl: React.CSSProperties = { fontSize: '9px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px', textTransform: 'uppercase' };
+const inputStyle: React.CSSProperties = { padding: '6px 8px', backgroundColor: F.DARK_BG, color: F.WHITE, borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER, borderRadius: '2px', fontSize: '10px', fontFamily: font, outline: 'none' };
+const selectStyle: React.CSSProperties = { ...inputStyle, cursor: 'pointer' };
+const btnPrimary: React.CSSProperties = { padding: '6px 14px', backgroundColor: F.ORANGE, color: F.DARK_BG, borderWidth: 0, borderStyle: 'none', borderColor: 'transparent', borderRadius: '2px', fontSize: '9px', fontWeight: 700, cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '5px', letterSpacing: '0.5px', fontFamily: font };
+const btnOutline: React.CSSProperties = { padding: '5px 10px', backgroundColor: 'transparent', borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER, color: F.GRAY, fontSize: '9px', fontWeight: 700, borderRadius: '2px', cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '4px', transition: 'all 0.15s', fontFamily: font };
+const badge = (bg: string, fg: string): React.CSSProperties => ({ padding: '2px 6px', backgroundColor: bg, color: fg, fontSize: '8px', fontWeight: 700, borderRadius: '2px', letterSpacing: '0.5px', display: 'inline-flex', alignItems: 'center', gap: '3px' });
-const sectionStyle: React.CSSProperties = {
- backgroundColor: F.PANEL_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
-};
-
-const sectionHeaderStyle: React.CSSProperties = {
- padding: '10px 16px',
- backgroundColor: F.HEADER_BG,
- borderBottom: `1px solid ${F.BORDER}`,
- display: 'flex',
- alignItems: 'center',
- gap: '8px',
-};
+const DEFAULT_ENTRY: ConditionItem = { indicator: 'RSI', params: { period: 14 }, field: 'value', operator: 'crosses_below', value: 30 };
+const DEFAULT_EXIT: ConditionItem = { indicator: 'RSI', params: { period: 14 }, field: 'value', operator: 'crosses_above', value: 70 };
const StrategyEditor: React.FC<StrategyEditorProps> = ({ editStrategyId, onSaved, onCancel }) => {
const [name, setName] = useState('');
const [description, setDescription] = useState('');
const [timeframe, setTimeframe] = useState('5m');
- const [entryConditions, setEntryConditions] = useState<ConditionItem[]>([
- { indicator: 'RSI', params: { period: 14 }, field: 'value', operator: 'crosses_below', value: 30 },
- ]);
- const [exitConditions, setExitConditions] = useState<ConditionItem[]>([
- { indicator: 'RSI', params: { period: 14 }, field: 'value', operator: 'crosses_above', value: 70 },
- ]);
+ const [entryConditions, setEntryConditions] = useState<ConditionItem[]>([{ ...DEFAULT_ENTRY }]);
+ const [exitConditions, setExitConditions] = useState<ConditionItem[]>([{ ...DEFAULT_EXIT }]);
const [entryLogic, setEntryLogic] = useState<'AND' | 'OR'>('AND');
const [exitLogic, setExitLogic] = useState<'AND' | 'OR'>('AND');
const [stopLoss, setStopLoss] = useState<string>('');
@@ -72,6 +54,7 @@ const StrategyEditor: React.FC<StrategyEditorProps> = ({ editStrategyId, onSaved
const [useExitConditions, setUseExitConditions] = useState(true);
const [saving, setSaving] = useState(false);
const [error, setError] = useState('');
+ // Backtest
const [btSymbol, setBtSymbol] = useState('');
const [btPeriod, setBtPeriod] = useState('1y');
const [btProvider, setBtProvider] = useState<'yfinance' | 'fyers'>('fyers');
@@ -98,9 +81,7 @@ const StrategyEditor: React.FC<StrategyEditorProps> = ({ editStrategyId, onSaved
}
}, []);
- useEffect(() => {
- if (editStrategyId) loadStrategy(editStrategyId);
- }, [editStrategyId, loadStrategy]);
+ useEffect(() => { if (editStrategyId) loadStrategy(editStrategyId); }, [editStrategyId, loadStrategy]);
const buildConditionsJson = (conditions: ConditionItem[], logic: string): string => {
if (conditions.length === 0) return '[]';
@@ -125,8 +106,7 @@ const StrategyEditor: React.FC<StrategyEditorProps> = ({ editStrategyId, onSaved
timeframe,
});
setSaving(false);
- if (result.success) onSaved();
- else setError(result.error || 'Failed to save');
+ if (result.success) onSaved(); else setError(result.error || 'Failed to save');
};
const handleBacktest = async () => {
@@ -140,522 +120,447 @@ const StrategyEditor: React.FC<StrategyEditorProps> = ({ editStrategyId, onSaved
symbol: btSymbol.trim(),
entryConditions: buildConditionsJson(entryConditions, entryLogic),
exitConditions: useExitConditions ? buildConditionsJson(exitConditions, exitLogic) : '[]',
- timeframe: ['1m','3m','5m'].includes(timeframe) ? '1d' : timeframe,
+ timeframe: ['1m', '3m', '5m'].includes(timeframe) ? '1d' : timeframe,
period: btPeriod,
stopLoss: stopLoss ? parseFloat(stopLoss) : undefined,
takeProfit: takeProfit ? parseFloat(takeProfit) : undefined,
provider: btProvider,
});
setBacktesting(false);
+ if (res.debug) setBtDebug(res.debug); else if (res.data?.debug) setBtDebug(res.data.debug);
+ if (res.success && res.data) { setBtResult(res.data); if (res.data.debug) setBtDebug(res.data.debug); setShowBacktest(true); }
+ else setBtError(res.error || 'Backtest failed');
+ };
- if (res.debug) {
- setBtDebug(res.debug);
- } else if (res.data?.debug) {
- setBtDebug(res.data.debug);
- }
+ const handleConditionChange = (
+ setter: React.Dispatch<React.SetStateAction<ConditionItem[]>>,
+ index: number,
+ updated: ConditionItem,
+ ) => {
+ setter(prev => { const next = [...prev]; next[index] = updated; return next; });
+ };
- if (res.success && res.data) {
- setBtResult(res.data);
- if (res.data.debug) setBtDebug(res.data.debug);
- } else {
- setBtError(res.error || 'Backtest failed');
- }
+ const handleRemoveCondition = (
+ setter: React.Dispatch<React.SetStateAction<ConditionItem[]>>,
+ index: number,
+ ) => {
+ setter(prev => prev.filter((_, i) => i !== index));
};
- return (
- <div style={{
- width: '100%', height: '100%', display: 'flex', flexDirection: 'column',
- overflow: 'hidden', fontFamily: '"IBM Plex Mono", "Consolas", monospace',
- }}>
-
- {/* ═══════ TOOLBAR ═══════ */}
- <div style={{
- display: 'flex', alignItems: 'center', justifyContent: 'space-between',
- padding: '10px 20px', backgroundColor: F.HEADER_BG,
- borderBottom: `1px solid ${F.BORDER}`, flexShrink: 0,
- }}>
- {/* Left */}
- <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
- <button
- onClick={onCancel}
- style={{
- padding: '6px 8px', backgroundColor: 'transparent', border: `1px solid ${F.BORDER}`,
- color: F.GRAY, cursor: 'pointer', borderRadius: '2px', display: 'flex', alignItems: 'center',
- transition: 'all 0.2s',
- }}
- onMouseEnter={e => { e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.color = F.WHITE; }}
- onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
- >
- <ArrowLeft size={12} />
- </button>
- <div>
- <div style={{ fontSize: '11px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
- {editStrategyId ? 'EDIT STRATEGY' : 'CREATE NEW STRATEGY'}
- </div>
- <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '2px' }}>
- Visual condition-based strategy builder
- </div>
- </div>
- </div>
+ const handleDuplicateCondition = (
+ setter: React.Dispatch<React.SetStateAction<ConditionItem[]>>,
+ index: number,
+ ) => {
+ setter(prev => {
+ const clone = JSON.parse(JSON.stringify(prev[index]));
+ const next = [...prev];
+ next.splice(index + 1, 0, clone);
+ return next;
+ });
+ };
- {/* Center: Name + Timeframe */}
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <input
- value={name}
- onChange={e => setName(e.target.value)}
- placeholder="Strategy Name..."
- style={{
- width: '240px', padding: '7px 10px', backgroundColor: F.DARK_BG,
- color: F.WHITE, border: `1px solid ${F.BORDER}`, borderRadius: '2px',
- fontSize: '11px', fontWeight: 600, outline: 'none',
- }}
- onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
- onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
- />
- <select
- value={timeframe}
- onChange={e => setTimeframe(e.target.value)}
- style={{
- padding: '7px 8px', backgroundColor: F.DARK_BG, color: F.CYAN,
- border: `1px solid ${F.BORDER}`, borderRadius: '2px', fontSize: '10px',
- fontWeight: 700, cursor: 'pointer', outline: 'none',
- }}
- >
- {TIMEFRAMES.map(tf => <option key={tf.value} value={tf.value}>{tf.label}</option>)}
- </select>
- </div>
+ const rrRatio = stopLoss && takeProfit && parseFloat(stopLoss) > 0
+ ? (parseFloat(takeProfit) / parseFloat(stopLoss)).toFixed(2)
+ : null;
- {/* Right: Actions */}
- <div style={{ display: 'flex', gap: '6px' }}>
- <button
- onClick={onCancel}
- style={{
- padding: '7px 14px', backgroundColor: 'transparent', color: F.GRAY,
- border: `1px solid ${F.BORDER}`, borderRadius: '2px', fontSize: '9px',
- fontWeight: 700, cursor: 'pointer', transition: 'all 0.2s',
- }}
- onMouseEnter={e => { e.currentTarget.style.color = F.WHITE; e.currentTarget.style.borderColor = F.GRAY; }}
- onMouseLeave={e => { e.currentTarget.style.color = F.GRAY; e.currentTarget.style.borderColor = F.BORDER; }}
- >
- CANCEL
- </button>
- <button
- onClick={handleSave}
- disabled={saving}
- style={{
- padding: '7px 16px', backgroundColor: F.ORANGE, color: F.DARK_BG,
- border: 'none', borderRadius: '2px', fontSize: '9px', fontWeight: 700,
- cursor: saving ? 'not-allowed' : 'pointer', display: 'flex', alignItems: 'center',
- gap: '4px', opacity: saving ? 0.5 : 1, letterSpacing: '0.5px',
- }}
- >
- <Save size={10} />
- {saving ? 'SAVING...' : 'SAVE'}
+ /* ──────────────────────── RENDER ──────────────────────── */
+ return (
+ <div style={{ width: '100%', height: '100%', display: 'flex', flexDirection: 'column', overflow: 'hidden', fontFamily: font, color: F.WHITE, backgroundColor: F.DARK_BG }}>
+
+ {/* ═══ TOOLBAR ═══ */}
+ <div style={{ display: 'flex', alignItems: 'center', gap: '0', padding: '0 12px', height: '36px', flexShrink: 0, backgroundColor: F.PANEL_BG, borderBottom: `1px solid ${F.BORDER}` }}>
+ <button onClick={onCancel} style={{ background: 'none', border: 'none', cursor: 'pointer', color: F.GRAY, padding: '4px', display: 'flex', alignItems: 'center', marginRight: '8px', transition: 'color 0.15s' }}
+ onMouseEnter={e => { e.currentTarget.style.color = F.WHITE; }}
+ onMouseLeave={e => { e.currentTarget.style.color = F.GRAY; }}
+ ><ArrowLeft size={14} /></button>
+ <input value={name} onChange={e => setName(e.target.value)} placeholder="Strategy Name..."
+ style={{ background: 'transparent', border: 'none', outline: 'none', color: F.ORANGE, fontSize: '12px', fontWeight: 700, fontFamily: font, width: '200px', letterSpacing: '0.5px' }}
+ />
+ <div style={{ width: '1px', height: '18px', backgroundColor: F.BORDER, margin: '0 10px' }} />
+ <span style={{ ...lbl, marginRight: '4px' }}>TF</span>
+ <select value={timeframe} onChange={e => setTimeframe(e.target.value)} style={{ ...selectStyle, width: 'auto', padding: '3px 6px', fontSize: '9px', color: F.CYAN }}>
+ {TIMEFRAMES.map(tf => <option key={tf.value} value={tf.value}>{tf.label}</option>)}
+ </select>
+ <div style={{ width: '1px', height: '18px', backgroundColor: F.BORDER, margin: '0 10px' }} />
+ <input value={description} onChange={e => setDescription(e.target.value)} placeholder="Description (optional)"
+ style={{ background: 'transparent', border: 'none', outline: 'none', color: F.GRAY, fontSize: '10px', fontFamily: font, flex: 1, minWidth: '100px' }}
+ />
+ <div style={{ display: 'flex', alignItems: 'center', gap: '6px', marginLeft: '8px' }}>
+ <button onClick={onCancel} style={btnOutline}>CANCEL</button>
+ <button onClick={handleSave} disabled={saving} style={{ ...btnPrimary, opacity: saving ? 0.5 : 1 }}>
+ <Save size={10} />{saving ? 'SAVING...' : 'SAVE'}
</button>
</div>
</div>
- {/* Error Banner */}
+ {/* Error bar */}
{error && (
- <div style={{
- padding: '8px 20px', backgroundColor: `${F.RED}15`, borderBottom: `1px solid ${F.RED}40`,
- display: 'flex', alignItems: 'center', gap: '6px', flexShrink: 0,
- }}>
- <AlertTriangle size={10} color={F.RED} />
- <span style={{ fontSize: '9px', fontWeight: 700, color: F.RED }}>{error}</span>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px', padding: '5px 16px', backgroundColor: `${F.RED}15`, borderBottom: `1px solid ${F.RED}40`, flexShrink: 0 }}>
+ <AlertTriangle size={11} color={F.RED} />
+ <span style={{ fontSize: '10px', fontWeight: 700, color: F.RED }}>{error}</span>
</div>
)}
- {/* ═══════ TWO-COLUMN BODY ═══════ */}
+ {/* ═══ MAIN CONTENT — horizontal split: left=rules, right=backtest ═══ */}
<div style={{ flex: 1, display: 'flex', overflow: 'hidden', minHeight: 0 }}>
- {/* ──── LEFT COLUMN: Strategy Builder ──── */}
- <div style={{
- flex: 1, overflow: 'auto', padding: '16px 20px',
- display: 'flex', flexDirection: 'column', gap: '16px', minWidth: 0,
- }}>
- {/* Description */}
- <div>
- <label style={labelStyle}>DESCRIPTION (OPTIONAL)</label>
- <input
- value={description}
- onChange={e => setDescription(e.target.value)}
- placeholder="Describe your strategy logic..."
- style={inputStyle}
- />
- </div>
-
- {/* ── ENTRY CONDITIONS SECTION ── */}
- <div style={sectionStyle}>
- <div style={{
- ...sectionHeaderStyle,
- borderLeft: `3px solid ${F.GREEN}`,
- }}>
- <ArrowUpRight size={14} color={F.GREEN} />
- <span style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
- ENTRY CONDITIONS
- </span>
- <span style={{ fontSize: '9px', color: F.GREEN, marginLeft: '4px' }}>BUY WHEN</span>
+ {/* ──── LEFT: RULE SHEET (scrollable) ──── */}
+ <div style={{ flex: 1, overflowY: 'auto', overflowX: 'hidden', minWidth: 0 }}>
+
+ {/* ─── ENTRY CONDITIONS ─── */}
+ <div style={{ borderBottom: `1px solid ${F.BORDER}` }}>
+ {/* Section header */}
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px', padding: '8px 16px', backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}` }}>
+ <ArrowUpRight size={12} style={{ color: F.GREEN }} />
+ <span style={{ fontSize: '10px', fontWeight: 700, color: F.GREEN, letterSpacing: '0.5px' }}>ENTRY CONDITIONS</span>
+ {entryConditions.length > 1 && (
+ <div style={{ display: 'flex', alignItems: 'center', gap: '2px', marginLeft: '8px' }}>
+ {(['AND', 'OR'] as const).map(l => (
+ <button key={l} onClick={() => setEntryLogic(l)} style={{
+ padding: '2px 8px', border: 'none', borderRadius: '2px', cursor: 'pointer', fontFamily: font,
+ backgroundColor: entryLogic === l ? F.ORANGE : `${F.BORDER}`, color: entryLogic === l ? F.DARK_BG : F.GRAY,
+ fontSize: '8px', fontWeight: 700, transition: 'all 0.15s',
+ }}>{l}</button>
+ ))}
+ </div>
+ )}
<div style={{ flex: 1 }} />
- <div style={{
- padding: '3px 8px', borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- backgroundColor: `${F.GREEN}20`, color: F.GREEN,
- }}>
- {entryConditions.length} CONDITION{entryConditions.length !== 1 ? 'S' : ''}
- </div>
- </div>
- <div style={{ padding: '8px 0' }}>
- <ConditionBuilder
- label=""
- conditions={entryConditions}
- logic={entryLogic}
- onConditionsChange={setEntryConditions}
- onLogicChange={setEntryLogic}
- />
+ <span style={badge(`${F.GREEN}20`, F.GREEN)}>{entryConditions.length} RULE{entryConditions.length !== 1 ? 'S' : ''}</span>
+ <button
+ onClick={() => setEntryConditions(prev => [...prev, { ...DEFAULT_ENTRY }])}
+ style={{ ...btnOutline, padding: '3px 8px', fontSize: '8px', color: F.GREEN, borderColor: `${F.GREEN}40` }}
+ onMouseEnter={e => { e.currentTarget.style.borderColor = F.GREEN; e.currentTarget.style.color = F.WHITE; }}
+ onMouseLeave={e => { e.currentTarget.style.borderColor = `${F.GREEN}40`; e.currentTarget.style.color = F.GREEN; }}
+ ><Plus size={10} /> ADD</button>
</div>
- </div>
- {/* ── EXIT CONDITIONS SECTION ── */}
- <div style={sectionStyle}>
- <div style={{
- ...sectionHeaderStyle,
- borderLeft: `3px solid ${F.RED}`,
- justifyContent: 'space-between',
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <ArrowDownRight size={14} color={F.RED} />
- <span style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
- EXIT CONDITIONS
- </span>
- <span style={{ fontSize: '9px', color: F.RED, marginLeft: '4px' }}>SELL WHEN</span>
- {!useExitConditions && (
- <span style={{
- padding: '2px 6px', borderRadius: '2px', fontSize: '8px',
- fontWeight: 700, backgroundColor: `${F.YELLOW}20`, color: F.YELLOW,
- }}>
- DISABLED
- </span>
- )}
+ {/* Condition rows */}
+ {entryConditions.map((cond, i) => (
+ <div key={i} style={{ borderBottom: `1px solid ${F.BORDER}30` }}>
+ {/* Row number + logic connector */}
+ <div style={{ display: 'flex', alignItems: 'stretch' }}>
+ <div style={{ width: '40px', flexShrink: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', backgroundColor: `${F.GREEN}08`, borderRight: `1px solid ${F.BORDER}30` }}>
+ {i === 0 ? (
+ <span style={{ fontSize: '9px', fontWeight: 700, color: F.GREEN }}>#{i + 1}</span>
+ ) : (
+ <>
+ <span style={{ fontSize: '7px', fontWeight: 700, color: F.ORANGE, marginBottom: '2px' }}>{entryLogic}</span>
+ <span style={{ fontSize: '9px', fontWeight: 700, color: F.GREEN }}>#{i + 1}</span>
+ </>
+ )}
+ </div>
+ <div style={{ flex: 1, minWidth: 0 }}>
+ <ConditionRow condition={cond} index={i}
+ onChange={(idx, updated) => handleConditionChange(setEntryConditions, idx, updated)}
+ onRemove={() => handleRemoveCondition(setEntryConditions, i)}
+ />
+ </div>
+ <div style={{ width: '36px', flexShrink: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: '4px', borderLeft: `1px solid ${F.BORDER}30` }}>
+ <button onClick={() => handleDuplicateCondition(setEntryConditions, i)}
+ style={{ background: 'none', border: 'none', cursor: 'pointer', color: F.MUTED, padding: '2px', transition: 'color 0.15s' }}
+ onMouseEnter={e => { e.currentTarget.style.color = F.CYAN; }}
+ onMouseLeave={e => { e.currentTarget.style.color = F.MUTED; }}
+ title="Duplicate"
+ ><Copy size={10} /></button>
+ {entryConditions.length > 1 && (
+ <button onClick={() => handleRemoveCondition(setEntryConditions, i)}
+ style={{ background: 'none', border: 'none', cursor: 'pointer', color: F.MUTED, padding: '2px', transition: 'color 0.15s' }}
+ onMouseEnter={e => { e.currentTarget.style.color = F.RED; }}
+ onMouseLeave={e => { e.currentTarget.style.color = F.MUTED; }}
+ title="Remove"
+ ><Trash2 size={10} /></button>
+ )}
+ </div>
+ </div>
</div>
- <label style={{ display: 'flex', alignItems: 'center', gap: '6px', cursor: 'pointer' }}>
- <span style={{ fontSize: '8px', color: useExitConditions ? F.GREEN : F.MUTED }}>
- {useExitConditions ? 'ENABLED' : 'SL/TP ONLY'}
- </span>
- <input
- type="checkbox"
- checked={useExitConditions}
- onChange={e => setUseExitConditions(e.target.checked)}
- style={{ accentColor: F.ORANGE, cursor: 'pointer' }}
- />
+ ))}
+ {entryConditions.length === 0 && (
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '20px', gap: '8px' }}>
+ <Zap size={14} style={{ color: F.MUTED, opacity: 0.5 }} />
+ <span style={{ fontSize: '10px', color: F.MUTED }}>No entry rules — click ADD above</span>
+ </div>
+ )}
+ </div>
+
+ {/* ─── EXIT CONDITIONS ─── */}
+ <div style={{ borderBottom: `1px solid ${F.BORDER}` }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px', padding: '8px 16px', backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}` }}>
+ <ArrowDownRight size={12} style={{ color: useExitConditions ? F.RED : F.MUTED }} />
+ <span style={{ fontSize: '10px', fontWeight: 700, color: useExitConditions ? F.RED : F.MUTED, letterSpacing: '0.5px' }}>EXIT CONDITIONS</span>
+ {exitConditions.length > 1 && useExitConditions && (
+ <div style={{ display: 'flex', alignItems: 'center', gap: '2px', marginLeft: '8px' }}>
+ {(['AND', 'OR'] as const).map(l => (
+ <button key={l} onClick={() => setExitLogic(l)} style={{
+ padding: '2px 8px', border: 'none', borderRadius: '2px', cursor: 'pointer', fontFamily: font,
+ backgroundColor: exitLogic === l ? F.ORANGE : `${F.BORDER}`, color: exitLogic === l ? F.DARK_BG : F.GRAY,
+ fontSize: '8px', fontWeight: 700, transition: 'all 0.15s',
+ }}>{l}</button>
+ ))}
+ </div>
+ )}
+ <div style={{ flex: 1 }} />
+ <label style={{ display: 'flex', alignItems: 'center', gap: '5px', cursor: 'pointer' }}>
+ <span style={{ fontSize: '8px', fontWeight: 700, color: useExitConditions ? F.GREEN : F.MUTED }}>{useExitConditions ? 'ON' : 'OFF'}</span>
+ <input type="checkbox" checked={useExitConditions} onChange={e => setUseExitConditions(e.target.checked)} style={{ accentColor: F.ORANGE, cursor: 'pointer' }} />
</label>
+ {useExitConditions && (
+ <>
+ <span style={badge(`${F.RED}20`, F.RED)}>{exitConditions.length} RULE{exitConditions.length !== 1 ? 'S' : ''}</span>
+ <button
+ onClick={() => setExitConditions(prev => [...prev, { ...DEFAULT_EXIT }])}
+ style={{ ...btnOutline, padding: '3px 8px', fontSize: '8px', color: F.RED, borderColor: `${F.RED}40` }}
+ onMouseEnter={e => { e.currentTarget.style.borderColor = F.RED; e.currentTarget.style.color = F.WHITE; }}
+ onMouseLeave={e => { e.currentTarget.style.borderColor = `${F.RED}40`; e.currentTarget.style.color = F.RED; }}
+ ><Plus size={10} /> ADD</button>
+ </>
+ )}
</div>
+
{useExitConditions ? (
- <div style={{ padding: '8px 0' }}>
- <ConditionBuilder
- label=""
- conditions={exitConditions}
- logic={exitLogic}
- onConditionsChange={setExitConditions}
- onLogicChange={setExitLogic}
- />
- </div>
+ <>
+ {exitConditions.map((cond, i) => (
+ <div key={i} style={{ borderBottom: `1px solid ${F.BORDER}30` }}>
+ <div style={{ display: 'flex', alignItems: 'stretch' }}>
+ <div style={{ width: '40px', flexShrink: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', backgroundColor: `${F.RED}08`, borderRight: `1px solid ${F.BORDER}30` }}>
+ {i === 0 ? (
+ <span style={{ fontSize: '9px', fontWeight: 700, color: F.RED }}>#{i + 1}</span>
+ ) : (
+ <>
+ <span style={{ fontSize: '7px', fontWeight: 700, color: F.ORANGE, marginBottom: '2px' }}>{exitLogic}</span>
+ <span style={{ fontSize: '9px', fontWeight: 700, color: F.RED }}>#{i + 1}</span>
+ </>
+ )}
+ </div>
+ <div style={{ flex: 1, minWidth: 0 }}>
+ <ConditionRow condition={cond} index={i}
+ onChange={(idx, updated) => handleConditionChange(setExitConditions, idx, updated)}
+ onRemove={() => handleRemoveCondition(setExitConditions, i)}
+ />
+ </div>
+ <div style={{ width: '36px', flexShrink: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: '4px', borderLeft: `1px solid ${F.BORDER}30` }}>
+ <button onClick={() => handleDuplicateCondition(setExitConditions, i)}
+ style={{ background: 'none', border: 'none', cursor: 'pointer', color: F.MUTED, padding: '2px', transition: 'color 0.15s' }}
+ onMouseEnter={e => { e.currentTarget.style.color = F.CYAN; }}
+ onMouseLeave={e => { e.currentTarget.style.color = F.MUTED; }}
+ title="Duplicate"
+ ><Copy size={10} /></button>
+ {exitConditions.length > 1 && (
+ <button onClick={() => handleRemoveCondition(setExitConditions, i)}
+ style={{ background: 'none', border: 'none', cursor: 'pointer', color: F.MUTED, padding: '2px', transition: 'color 0.15s' }}
+ onMouseEnter={e => { e.currentTarget.style.color = F.RED; }}
+ onMouseLeave={e => { e.currentTarget.style.color = F.MUTED; }}
+ title="Remove"
+ ><Trash2 size={10} /></button>
+ )}
+ </div>
+ </div>
+ </div>
+ ))}
+ {exitConditions.length === 0 && (
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '20px', gap: '8px' }}>
+ <Zap size={14} style={{ color: F.MUTED, opacity: 0.5 }} />
+ <span style={{ fontSize: '10px', color: F.MUTED }}>No exit rules — click ADD above</span>
+ </div>
+ )}
+ </>
) : (
- <div style={{ padding: '24px 16px', textAlign: 'center' }}>
- <Shield size={20} color={F.MUTED} style={{ marginBottom: '6px' }} />
- <div style={{ fontSize: '9px', color: F.MUTED }}>
- Exit conditions disabled. Trades exit via Stop Loss or Take Profit only.
- </div>
- <div style={{ fontSize: '8px', color: F.YELLOW, marginTop: '4px' }}>
- Ensure SL and/or TP are configured in the Risk Management panel.
- </div>
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '16px', gap: '8px' }}>
+ <Shield size={12} style={{ color: F.MUTED }} />
+ <span style={{ fontSize: '10px', color: F.MUTED }}>Exit conditions disabled — using SL/TP only</span>
</div>
)}
</div>
- {/* ── RISK MANAGEMENT SECTION ── */}
- <div style={sectionStyle}>
- <div style={{
- ...sectionHeaderStyle,
- borderLeft: `3px solid ${F.YELLOW}`,
- }}>
- <Shield size={14} color={F.YELLOW} />
- <span style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
- RISK MANAGEMENT
- </span>
- <span style={{ fontSize: '8px', color: F.MUTED, marginLeft: '8px' }}>
- Priority: SL → TP → Exit Condition
- </span>
+ {/* ─── RISK MANAGEMENT ─── */}
+ <div style={{ borderBottom: `1px solid ${F.BORDER}` }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px', padding: '8px 16px', backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}` }}>
+ <Shield size={12} style={{ color: F.YELLOW }} />
+ <span style={{ fontSize: '10px', fontWeight: 700, color: F.YELLOW, letterSpacing: '0.5px' }}>RISK MANAGEMENT</span>
+ <div style={{ flex: 1 }} />
+ {rrRatio && (
+ <span style={{ fontSize: '9px', color: parseFloat(rrRatio) >= 1 ? F.GREEN : F.RED }}>
+ R:R <span style={{ fontWeight: 700 }}>1:{rrRatio}</span>
+ </span>
+ )}
+ {stopLoss && takeProfit && parseFloat(stopLoss) >= parseFloat(takeProfit) && (
+ <span style={{ ...badge(`${F.YELLOW}20`, F.YELLOW) }}><AlertTriangle size={8} /> SL ≥ TP</span>
+ )}
</div>
- <div style={{ padding: '12px 16px' }}>
- <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: '12px' }}>
- <div>
- <label style={labelStyle}>STOP LOSS (%)</label>
- <input type="number" value={stopLoss} onChange={e => setStopLoss(e.target.value)} placeholder="e.g. 2" step="0.1" min="0" style={inputStyle} />
- <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '2px' }}>Exit if loss &ge; this %</div>
- </div>
- <div>
- <label style={labelStyle}>TAKE PROFIT (%)</label>
- <input type="number" value={takeProfit} onChange={e => setTakeProfit(e.target.value)} placeholder="e.g. 5" step="0.1" min="0" style={inputStyle} />
- <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '2px' }}>Exit if profit &ge; this %</div>
- </div>
- <div>
- <label style={labelStyle}>TRAILING STOP (%)</label>
- <input type="number" value={trailingStop} onChange={e => setTrailingStop(e.target.value)} placeholder="e.g. 1.5" step="0.1" min="0" style={inputStyle} />
- <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '2px' }}>Exit if pullback from peak &ge; this %</div>
+ <div style={{ display: 'flex', gap: '0', alignItems: 'stretch' }}>
+ {/* Stop Loss */}
+ <div style={{ flex: 1, padding: '10px 16px', borderRight: `1px solid ${F.BORDER}` }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '5px', marginBottom: '6px' }}>
+ <Target size={10} style={{ color: F.RED }} />
+ <span style={{ ...lbl, color: F.RED }}>STOP LOSS %</span>
</div>
+ <input type="number" value={stopLoss} onChange={e => setStopLoss(e.target.value)} placeholder="0.0" step="0.1" min="0"
+ style={{ ...inputStyle, width: '100%', borderColor: stopLoss ? `${F.RED}40` : F.BORDER }}
+ onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={e => { e.currentTarget.style.borderColor = stopLoss ? `${F.RED}40` : F.BORDER; }}
+ />
+ <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '3px' }}>Exit if loss ≥ this %</div>
</div>
-
- {/* Validation Warnings */}
- {stopLoss && takeProfit && parseFloat(stopLoss) >= parseFloat(takeProfit) && (
- <div style={{
- marginTop: '12px', padding: '8px 10px',
- backgroundColor: `${F.YELLOW}15`, border: `1px solid ${F.YELLOW}40`, borderRadius: '2px',
- display: 'flex', alignItems: 'center', gap: '6px',
- }}>
- <AlertTriangle size={10} color={F.YELLOW} />
- <span style={{ fontSize: '9px', color: F.YELLOW }}>
- Stop Loss ({stopLoss}%) &ge; Take Profit ({takeProfit}%). Adjust for better risk/reward.
- </span>
+ {/* Take Profit */}
+ <div style={{ flex: 1, padding: '10px 16px', borderRight: `1px solid ${F.BORDER}` }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '5px', marginBottom: '6px' }}>
+ <TrendingUp size={10} style={{ color: F.GREEN }} />
+ <span style={{ ...lbl, color: F.GREEN }}>TAKE PROFIT %</span>
</div>
- )}
- {useExitConditions && exitConditions.length > 0 && takeProfit && (
- <div style={{
- marginTop: '8px', padding: '8px 10px',
- backgroundColor: `${F.CYAN}10`, border: `1px solid ${F.CYAN}30`, borderRadius: '2px',
- }}>
- <span style={{ fontSize: '9px', color: F.CYAN }}>
- Exit conditions trigger AFTER SL/TP checks. May exit before {takeProfit}% target.
- </span>
+ <input type="number" value={takeProfit} onChange={e => setTakeProfit(e.target.value)} placeholder="0.0" step="0.1" min="0"
+ style={{ ...inputStyle, width: '100%', borderColor: takeProfit ? `${F.GREEN}40` : F.BORDER }}
+ onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={e => { e.currentTarget.style.borderColor = takeProfit ? `${F.GREEN}40` : F.BORDER; }}
+ />
+ <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '3px' }}>Exit if profit ≥ this %</div>
+ </div>
+ {/* Trailing Stop */}
+ <div style={{ flex: 1, padding: '10px 16px' }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '5px', marginBottom: '6px' }}>
+ <Gauge size={10} style={{ color: F.YELLOW }} />
+ <span style={{ ...lbl, color: F.YELLOW }}>TRAILING STOP %</span>
</div>
- )}
+ <input type="number" value={trailingStop} onChange={e => setTrailingStop(e.target.value)} placeholder="0.0" step="0.1" min="0"
+ style={{ ...inputStyle, width: '100%', borderColor: trailingStop ? `${F.YELLOW}40` : F.BORDER }}
+ onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={e => { e.currentTarget.style.borderColor = trailingStop ? `${F.YELLOW}40` : F.BORDER; }}
+ />
+ <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '3px' }}>Pullback from peak ≥ this %</div>
+ </div>
</div>
</div>
</div>
- {/* ──── RIGHT COLUMN: Backtest Panel ──── */}
- <div style={{
- width: showBacktest ? '360px' : '40px',
- backgroundColor: F.PANEL_BG,
- borderLeft: `1px solid ${F.BORDER}`,
- display: 'flex',
- flexDirection: 'column',
- overflow: 'hidden',
- flexShrink: 0,
- transition: 'width 0.3s ease',
- }}>
- {/* Toggle Header */}
+ {/* ──── RIGHT: BACKTEST PANEL (320px, collapsible) ──── */}
+ <div style={{ width: showBacktest ? '340px' : '44px', flexShrink: 0, display: 'flex', flexDirection: 'column', overflow: 'hidden', borderLeft: `1px solid ${F.BORDER}`, transition: 'width 0.2s ease' }}>
+ {/* Backtest toggle header */}
<div
onClick={() => setShowBacktest(!showBacktest)}
- style={{
- ...sectionHeaderStyle,
- borderLeft: `3px solid ${F.PURPLE}`,
- cursor: 'pointer',
- justifyContent: 'space-between',
- }}
+ style={{ display: 'flex', alignItems: 'center', gap: '6px', padding: '8px 12px', backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}`, cursor: 'pointer', flexShrink: 0 }}
>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
- <BarChart3 size={14} color={F.PURPLE} />
- {showBacktest && (
- <span style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
- QUICK BACKTEST
- </span>
- )}
- </div>
- {showBacktest ? <ChevronRight size={12} color={F.MUTED} /> : <ChevronDown size={12} color={F.MUTED} />}
+ <Crosshair size={12} style={{ color: F.PURPLE }} />
+ {showBacktest && (
+ <>
+ <span style={{ fontSize: '9px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px', flex: 1 }}>BACKTEST</span>
+ {btResult && (
+ <span style={{ fontSize: '13px', fontWeight: 700, fontFamily: font, color: btResult.metrics.total_return_pct >= 0 ? F.GREEN : F.RED }}>
+ {btResult.metrics.total_return_pct >= 0 ? '+' : ''}{btResult.metrics.total_return_pct}%
+ </span>
+ )}
+ </>
+ )}
</div>
{showBacktest && (
- <div style={{ flex: 1, overflow: 'auto' }}>
+ <div style={{ flex: 1, overflowY: 'auto', overflowX: 'hidden' }}>
{/* Config */}
- <div style={{ padding: '12px 16px', display: 'flex', flexDirection: 'column', gap: '10px' }}>
- <div>
- <label style={labelStyle}>DATA SOURCE</label>
- <select value={btProvider} onChange={e => setBtProvider(e.target.value as 'yfinance' | 'fyers')} style={inputStyle}>
- <option value="fyers">Fyers (Local Cache)</option>
- <option value="yfinance">Yahoo Finance</option>
- </select>
+ <div style={{ padding: '10px 12px', borderBottom: `1px solid ${F.BORDER}` }}>
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '6px', marginBottom: '6px' }}>
+ <div>
+ <span style={{ ...lbl, display: 'block', marginBottom: '3px', fontSize: '8px' }}>SOURCE</span>
+ <select value={btProvider} onChange={e => setBtProvider(e.target.value as 'yfinance' | 'fyers')} style={{ ...selectStyle, width: '100%', padding: '5px 6px' }}>
+ <option value="fyers">Fyers</option><option value="yfinance">Yahoo</option>
+ </select>
+ </div>
+ <div>
+ <span style={{ ...lbl, display: 'block', marginBottom: '3px', fontSize: '8px' }}>PERIOD</span>
+ <select value={btPeriod} onChange={e => setBtPeriod(e.target.value)} style={{ ...selectStyle, width: '100%', padding: '5px 6px' }}>
+ {[['1mo', '1M'], ['3mo', '3M'], ['6mo', '6M'], ['1y', '1Y'], ['2y', '2Y'], ['5y', '5Y']].map(([v, l]) => (
+ <option key={v} value={v}>{l}</option>
+ ))}
+ </select>
+ </div>
</div>
- <div>
- <label style={labelStyle}>SYMBOL</label>
- <input
- value={btSymbol}
- onChange={e => setBtSymbol(e.target.value)}
- placeholder={btProvider === 'fyers' ? 'RELIANCE, TCS' : 'RELIANCE.NS, AAPL'}
- style={inputStyle}
+ <div style={{ display: 'flex', gap: '6px' }}>
+ <input value={btSymbol} onChange={e => setBtSymbol(e.target.value)}
+ placeholder={btProvider === 'fyers' ? 'RELIANCE' : 'AAPL'}
+ style={{ ...inputStyle, flex: 1, padding: '5px 8px' }}
+ onFocus={e => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={e => { e.currentTarget.style.borderColor = F.BORDER; }}
/>
+ <button onClick={handleBacktest} disabled={backtesting}
+ style={{ ...btnPrimary, backgroundColor: F.PURPLE, color: F.WHITE, padding: '5px 12px', opacity: backtesting ? 0.5 : 1, whiteSpace: 'nowrap' }}
+ >
+ {backtesting ? <Loader size={11} className="animate-spin" /> : <Play size={11} />}
+ {backtesting ? 'RUN...' : 'RUN'}
+ </button>
</div>
- <div>
- <label style={labelStyle}>PERIOD</label>
- <select value={btPeriod} onChange={e => setBtPeriod(e.target.value)} style={inputStyle}>
- {[['1mo','1 Month'],['3mo','3 Months'],['6mo','6 Months'],['1y','1 Year'],['2y','2 Years'],['5y','5 Years']].map(([v,l]) => (
- <option key={v} value={v}>{l}</option>
- ))}
- </select>
- </div>
- <button
- onClick={handleBacktest}
- disabled={backtesting}
- style={{
- width: '100%', padding: '10px', backgroundColor: F.PURPLE, color: F.WHITE,
- border: 'none', borderRadius: '2px', fontSize: '9px', fontWeight: 700,
- cursor: backtesting ? 'not-allowed' : 'pointer',
- opacity: backtesting ? 0.5 : 1, display: 'flex', alignItems: 'center',
- justifyContent: 'center', gap: '6px', letterSpacing: '0.5px',
- transition: 'all 0.2s',
- }}
- >
- {backtesting ? <Loader size={10} className="animate-spin" /> : <Play size={10} />}
- {backtesting ? 'RUNNING BACKTEST...' : 'RUN BACKTEST'}
- </button>
</div>
- {/* Backtest Error */}
+ {/* BT Error */}
{btError && (
- <div style={{
- margin: '0 16px 8px', padding: '8px 10px',
- backgroundColor: `${F.RED}15`, border: `1px solid ${F.RED}30`,
- borderRadius: '2px',
- }}>
- <span style={{ fontSize: '9px', color: F.RED, lineHeight: '1.4' }}>{btError}</span>
+ <div style={{ padding: '6px 12px', backgroundColor: `${F.RED}15`, borderBottom: `1px solid ${F.RED}30` }}>
+ <span style={{ fontSize: '9px', color: F.RED }}>{btError}</span>
</div>
)}
- {/* Debug Log */}
+ {/* Debug */}
{btDebug.length > 0 && (
- <div style={{ margin: '0 16px 8px' }}>
- <button
- onClick={() => setShowDebug(!showDebug)}
- style={{
- width: '100%', padding: '6px 8px', backgroundColor: F.HEADER_BG,
- border: `1px solid ${F.BORDER}`, color: F.MUTED, fontSize: '8px',
- fontWeight: 700, cursor: 'pointer', textAlign: 'left', borderRadius: '2px',
- display: 'flex', justifyContent: 'space-between', alignItems: 'center',
- }}
- >
- <span>DEBUG LOG ({btDebug.length})</span>
- {showDebug ? <ChevronDown size={10} /> : <ChevronRight size={10} />}
+ <div style={{ padding: '5px 12px', borderBottom: `1px solid ${F.BORDER}` }}>
+ <button onClick={() => setShowDebug(!showDebug)} style={{ background: 'none', border: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'space-between', width: '100%', fontFamily: font, color: F.MUTED, fontSize: '8px', fontWeight: 700 }}>
+ <span>DEBUG ({btDebug.length})</span>
+ {showDebug ? <ChevronDown size={9} /> : <ChevronRight size={9} />}
</button>
{showDebug && (
- <div style={{
- marginTop: '2px', padding: '6px 8px', backgroundColor: '#0a0a0a',
- border: `1px solid ${F.BORDER}`, borderRadius: '2px', maxHeight: '150px',
- overflow: 'auto', fontSize: '8px', lineHeight: '1.4',
- }}>
+ <div style={{ marginTop: '4px', padding: '4px', backgroundColor: F.DARK_BG, border: `1px solid ${F.BORDER}`, borderRadius: '2px', maxHeight: '100px', overflowY: 'auto', fontSize: '8px', lineHeight: 1.4 }}>
{btDebug.map((line, i) => (
- <div key={i} style={{
- color: line.includes('ERROR') ? F.RED : line.includes('WARNING') ? F.YELLOW : F.MUTED,
- marginBottom: '1px', wordBreak: 'break-all',
- }}>
- {line}
- </div>
+ <div key={i} style={{ wordBreak: 'break-all', color: line.includes('ERROR') ? F.RED : line.includes('WARNING') ? F.YELLOW : F.MUTED }}>{line}</div>
))}
</div>
)}
</div>
)}
- {/* ─── BACKTEST RESULTS ─── */}
+ {/* Results */}
{btResult && (
- <div style={{ borderTop: `1px solid ${F.BORDER}` }}>
- {/* Summary Bar */}
- <div style={{
- padding: '12px 16px', backgroundColor: F.HEADER_BG,
- display: 'flex', alignItems: 'center', justifyContent: 'space-between',
- borderBottom: `1px solid ${F.BORDER}`,
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
- {btResult.metrics.total_return_pct >= 0
- ? <TrendingUp size={14} color={F.GREEN} />
- : <TrendingDown size={14} color={F.RED} />
- }
- <span style={{ fontSize: '9px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>
- RESULTS
- </span>
- </div>
- <span style={{
- fontSize: '14px', fontWeight: 700,
- color: btResult.metrics.total_return_pct >= 0 ? F.GREEN : F.RED,
- }}>
- {btResult.metrics.total_return_pct >= 0 ? '+' : ''}{btResult.metrics.total_return_pct}%
- </span>
- </div>
-
- {/* Metrics Grid */}
- <div style={{ padding: '12px 16px' }}>
- <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '8px' }}>
+ <>
+ <div style={{ padding: '10px 12px', borderBottom: `1px solid ${F.BORDER}` }}>
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '5px' }}>
{[
- { label: 'WIN RATE', value: `${btResult.metrics.win_rate}%`, color: btResult.metrics.win_rate >= 50 ? F.GREEN : F.YELLOW, icon: Target },
- { label: 'MAX DRAWDOWN', value: `${btResult.metrics.max_drawdown}%`, color: F.RED, icon: ArrowDownRight },
- { label: 'SHARPE', value: btResult.metrics.sharpe.toFixed(2), color: btResult.metrics.sharpe >= 1 ? F.GREEN : F.YELLOW, icon: Percent },
- { label: 'PROFIT FACTOR', value: btResult.metrics.profit_factor.toFixed(2), color: btResult.metrics.profit_factor >= 1.5 ? F.GREEN : F.YELLOW, icon: Activity },
- { label: 'TRADES', value: String(btResult.metrics.total_trades), color: F.CYAN, icon: Hash },
- { label: 'AVG P&L', value: btResult.metrics.avg_pnl.toFixed(2), color: btResult.metrics.avg_pnl >= 0 ? F.GREEN : F.RED, icon: TrendingUp },
- { label: 'AVG BARS', value: btResult.metrics.avg_bars_held.toFixed(1), color: F.CYAN, icon: Clock },
- { label: 'W / L', value: `${btResult.metrics.winning_trades} / ${btResult.metrics.losing_trades}`, color: F.WHITE, icon: BarChart3 },
+ { l: 'WIN RATE', v: `${btResult.metrics.win_rate}%`, c: btResult.metrics.win_rate >= 50 ? F.GREEN : F.YELLOW, ic: Target },
+ { l: 'DRAWDOWN', v: `${btResult.metrics.max_drawdown}%`, c: F.RED, ic: ArrowDownRight },
+ { l: 'SHARPE', v: btResult.metrics.sharpe.toFixed(2), c: btResult.metrics.sharpe >= 1 ? F.GREEN : F.YELLOW, ic: Percent },
+ { l: 'PF', v: btResult.metrics.profit_factor.toFixed(2), c: btResult.metrics.profit_factor >= 1.5 ? F.GREEN : F.YELLOW, ic: Activity },
+ { l: 'TRADES', v: String(btResult.metrics.total_trades), c: F.CYAN, ic: Hash },
+ { l: 'AVG P&L', v: btResult.metrics.avg_pnl.toFixed(2), c: btResult.metrics.avg_pnl >= 0 ? F.GREEN : F.RED, ic: TrendingUp },
+ { l: 'AVG BARS', v: btResult.metrics.avg_bars_held.toFixed(1), c: F.CYAN, ic: Clock },
+ { l: 'W / L', v: `${btResult.metrics.winning_trades}/${btResult.metrics.losing_trades}`, c: F.WHITE, ic: BarChart3 },
].map((m, i) => (
- <div key={i} style={{
- backgroundColor: F.DARK_BG, border: `1px solid ${F.BORDER}`,
- borderRadius: '2px', padding: '10px',
- }}>
- <div style={{
- display: 'flex', alignItems: 'center', gap: '4px',
- fontSize: '8px', fontWeight: 700, color: F.MUTED,
- letterSpacing: '0.5px', marginBottom: '4px',
- }}>
- <m.icon size={9} />
- {m.label}
+ <div key={i} style={{ padding: '6px', backgroundColor: F.PANEL_BG, border: `1px solid ${F.BORDER}`, borderRadius: '2px' }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '3px', marginBottom: '3px' }}>
+ <m.ic size={8} style={{ color: F.GRAY }} />
+ <span style={{ fontSize: '7px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>{m.l}</span>
</div>
- <div style={{
- fontSize: '13px', fontWeight: 700, color: m.color,
- }}>{m.value}</div>
+ <div style={{ fontSize: '13px', fontWeight: 700, fontFamily: font, color: m.c }}>{m.v}</div>
</div>
))}
</div>
</div>
- {/* Trade Log */}
{btResult.trades.length > 0 && (
<div>
- <div style={{
- padding: '8px 16px', backgroundColor: F.HEADER_BG,
- borderTop: `1px solid ${F.BORDER}`,
- borderBottom: `1px solid ${F.BORDER}`,
- }}>
- <span style={{ fontSize: '9px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>
- TRADE LOG ({btResult.trades.length})
- </span>
+ <div style={{ padding: '5px 12px', backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}` }}>
+ <span style={{ fontSize: '8px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px' }}>TRADES ({btResult.trades.length})</span>
</div>
- <div style={{ maxHeight: '200px', overflow: 'auto' }}>
- <table style={{
- width: '100%', borderCollapse: 'collapse', fontSize: '9px',
- }}>
+ <div style={{ maxHeight: '200px', overflowY: 'auto' }}>
+ <table style={{ width: '100%', borderCollapse: 'collapse' }}>
<thead>
<tr>
{['#', 'ENTRY', 'EXIT', 'P&L%', 'BARS'].map(h => (
- <th key={h} style={{
- padding: '6px 8px',
- textAlign: h === '#' ? 'left' : 'right',
- fontSize: '8px', fontWeight: 700, color: F.GRAY,
- letterSpacing: '0.5px', position: 'sticky', top: 0,
- backgroundColor: F.HEADER_BG,
- borderBottom: `1px solid ${F.BORDER}`,
- }}>{h}</th>
+ <th key={h} style={{ padding: '4px 6px', fontSize: '7px', fontWeight: 700, color: F.GRAY, letterSpacing: '0.5px', textAlign: h === '#' ? 'left' : 'right', backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}`, position: 'sticky', top: 0 }}>{h}</th>
))}
</tr>
</thead>
<tbody>
{btResult.trades.map((t, i) => (
- <tr key={i} style={{ borderBottom: `1px solid ${F.BORDER}30` }}>
- <td style={{ padding: '5px 8px', color: F.MUTED }}>{i + 1}</td>
- <td style={{ padding: '5px 8px', textAlign: 'right', color: F.WHITE }}>{t.entry_price}</td>
- <td style={{ padding: '5px 8px', textAlign: 'right', color: F.WHITE }}>{t.exit_price}</td>
- <td style={{
- padding: '5px 8px', textAlign: 'right', fontWeight: 700,
- color: t.pnl_pct >= 0 ? F.GREEN : F.RED,
- }}>
- {t.pnl_pct >= 0 ? '+' : ''}{t.pnl_pct}%
- </td>
- <td style={{ padding: '5px 8px', textAlign: 'right', color: F.CYAN }}>{t.bars_held}</td>
+ <tr key={i} style={{ borderBottom: `1px solid ${F.BORDER}30` }}
+ onMouseEnter={e => { e.currentTarget.style.backgroundColor = F.HOVER; }}
+ onMouseLeave={e => { e.currentTarget.style.backgroundColor = 'transparent'; }}
+ >
+ <td style={{ padding: '3px 6px', fontSize: '9px', fontFamily: font, color: F.MUTED }}>{i + 1}</td>
+ <td style={{ padding: '3px 6px', fontSize: '9px', fontFamily: font, color: F.WHITE, textAlign: 'right' }}>{t.entry_price}</td>
+ <td style={{ padding: '3px 6px', fontSize: '9px', fontFamily: font, color: F.WHITE, textAlign: 'right' }}>{t.exit_price}</td>
+ <td style={{ padding: '3px 6px', fontSize: '9px', fontFamily: font, fontWeight: 700, color: t.pnl_pct >= 0 ? F.GREEN : F.RED, textAlign: 'right' }}>{t.pnl_pct >= 0 ? '+' : ''}{t.pnl_pct}%</td>
+ <td style={{ padding: '3px 6px', fontSize: '9px', fontFamily: font, color: F.CYAN, textAlign: 'right' }}>{t.bars_held}</td>
</tr>
))}
</tbody>
@@ -663,19 +568,13 @@ const StrategyEditor: React.FC<StrategyEditorProps> = ({ editStrategyId, onSaved
</div>
</div>
)}
- </div>
+ </>
)}
- {/* Empty state */}
{!btResult && !backtesting && !btError && (
- <div style={{
- flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center',
- justifyContent: 'center', padding: '32px 16px', opacity: 0.5,
- }}>
- <BarChart3 size={28} color={F.MUTED} style={{ marginBottom: '8px' }} />
- <div style={{ fontSize: '9px', color: F.MUTED, textAlign: 'center', lineHeight: '1.5' }}>
- Configure symbol and period, then click RUN BACKTEST to see results.
- </div>
+ <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', padding: '32px 12px', color: F.MUTED, fontSize: '10px', textAlign: 'center' }}>
+ <Crosshair size={20} style={{ marginBottom: '6px', opacity: 0.5 }} />
+ <span>Enter symbol & click RUN</span>
</div>
)}
</div>
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/StrategyLibraryTab.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/StrategyLibraryTab.tsx
index acf7fb1dd..db902ff87 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/StrategyLibraryTab.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/StrategyLibraryTab.tsx
@@ -1,13 +1,15 @@
-import React, { useState, useEffect, useMemo } from 'react';
+import React, { useState, useEffect, useMemo, useCallback, useRef } from 'react';
import {
- Search, FolderOpen, Code, Play, Copy, ChevronRight,
- Loader2, AlertCircle, Filter, Grid, List, Eye, Rocket, X, BookOpen,
+ Search, Code, Play, Copy, Loader2, AlertCircle,
+ X, BookOpen, ChevronRight, FolderOpen, FileCode, Eye, Layers,
+ Edit3, Save, RotateCcw,
} from 'lucide-react';
import type { PythonStrategy } from '../types';
import {
listPythonStrategies,
getStrategyCategories,
getPythonStrategyCode,
+ saveCustomPythonStrategy,
} from '../services/algoTradingService';
import { F } from '../constants/theme';
@@ -18,11 +20,18 @@ interface StrategyLibraryTabProps {
onDeploy?: (strategy: PythonStrategy) => void;
}
+const font = '"IBM Plex Mono", "Consolas", monospace';
+const CAT_COLORS = [F.CYAN, F.PURPLE, F.BLUE, F.GREEN, F.YELLOW, F.ORANGE, '#FF6B9D', '#7B68EE'];
+function catColor(idx: number) { return CAT_COLORS[idx % CAT_COLORS.length]; }
+
+// ── Truncate long CamelCase names into readable form ──
+function shortName(name: string): string {
+ // Insert space before capitals: "BasicTemplateAlgorithm" -> "Basic Template Algorithm"
+ return name.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2');
+}
+
const StrategyLibraryTab: React.FC<StrategyLibraryTabProps> = ({
- onViewCode,
- onClone,
- onBacktest,
- onDeploy,
+ onViewCode, onClone, onBacktest, onDeploy,
}) => {
const [strategies, setStrategies] = useState<PythonStrategy[]>([]);
const [categories, setCategories] = useState<string[]>([]);
@@ -30,675 +39,422 @@ const StrategyLibraryTab: React.FC<StrategyLibraryTabProps> = ({
const [searchQuery, setSearchQuery] = useState('');
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
- const [viewMode, setViewMode] = useState<'grid' | 'list'>('grid');
- const [selectedStrategy, setSelectedStrategy] = useState<PythonStrategy | null>(null);
+ const [selectedId, setSelectedId] = useState<string | null>(null);
const [codePreview, setCodePreview] = useState<string | null>(null);
const [loadingCode, setLoadingCode] = useState(false);
+ const [editing, setEditing] = useState(false);
+ const [editedCode, setEditedCode] = useState('');
+ const [saving, setSaving] = useState(false);
+ const [originalCode, setOriginalCode] = useState('');
+ const editorRef = useRef<HTMLTextAreaElement>(null);
- // Load categories and strategies on mount
- useEffect(() => {
- loadData();
- }, []);
+ useEffect(() => { loadData(); }, []);
const loadData = async () => {
- setLoading(true);
- setError(null);
+ setLoading(true); setError(null);
try {
- const [catResult, stratResult] = await Promise.all([
- getStrategyCategories(),
- listPythonStrategies(),
- ]);
-
- if (!catResult.success) {
- throw new Error(catResult.error || 'Failed to load categories');
- }
- if (!stratResult.success) {
- throw new Error(stratResult.error || 'Failed to load strategies');
- }
-
+ const [catResult, stratResult] = await Promise.all([getStrategyCategories(), listPythonStrategies()]);
+ if (!catResult.success) throw new Error(catResult.error || 'Failed to load categories');
+ if (!stratResult.success) throw new Error(stratResult.error || 'Failed to load strategies');
setCategories(catResult.data || []);
setStrategies(stratResult.data || []);
} catch (err) {
- setError(err instanceof Error ? err.message : 'Unknown error');
- } finally {
- setLoading(false);
- }
+ console.error('[StrategyLibrary] loadData error:', err);
+ setError(err instanceof Error ? err.message : typeof err === 'string' ? err : JSON.stringify(err) || 'Unknown error');
+ } finally { setLoading(false); }
};
- // Filter strategies based on category and search
- const filteredStrategies = useMemo(() => {
- return strategies.filter((s) => {
- const matchesCategory = !selectedCategory || s.category === selectedCategory;
- const matchesSearch =
- !searchQuery ||
- s.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
- s.id.toLowerCase().includes(searchQuery.toLowerCase()) ||
- (s.description && s.description.toLowerCase().includes(searchQuery.toLowerCase()));
- return matchesCategory && matchesSearch;
+ const filtered = useMemo(() => {
+ const q = searchQuery.toLowerCase();
+ return strategies.filter(s => {
+ if (selectedCategory && s.category !== selectedCategory) return false;
+ if (!q) return true;
+ return s.name.toLowerCase().includes(q) || s.id.toLowerCase().includes(q) || s.category.toLowerCase().includes(q);
});
}, [strategies, selectedCategory, searchQuery]);
- // Category counts
const categoryCounts = useMemo(() => {
- const counts: Record<string, number> = {};
- strategies.forEach((s) => {
- counts[s.category] = (counts[s.category] || 0) + 1;
- });
- return counts;
+ const c: Record<string, number> = {};
+ strategies.forEach(s => { c[s.category] = (c[s.category] || 0) + 1; });
+ return c;
}, [strategies]);
- // Load code preview
- const handleViewCode = async (strategy: PythonStrategy) => {
- setSelectedStrategy(strategy);
- setLoadingCode(true);
+ const catColorMap = useMemo(() => {
+ const m: Record<string, string> = {};
+ categories.forEach((c, i) => { m[c] = catColor(i); });
+ return m;
+ }, [categories]);
+
+ const selectedStrategy = useMemo(() => strategies.find(s => s.id === selectedId) || null, [strategies, selectedId]);
+
+ const handleSelect = useCallback(async (strategy: PythonStrategy) => {
+ if (selectedId === strategy.id) { setSelectedId(null); setCodePreview(null); setEditing(false); return; }
+ setSelectedId(strategy.id);
+ setCodePreview(null); setLoadingCode(true); setEditing(false);
try {
const result = await getPythonStrategyCode(strategy.id);
if (result.success && result.data) {
setCodePreview(result.data.code);
- if (onViewCode) {
- onViewCode(strategy, result.data.code);
- }
+ setOriginalCode(result.data.code);
+ setEditedCode(result.data.code);
+ if (onViewCode) onViewCode(strategy, result.data.code);
+ } else { setCodePreview(`# Error: ${result.error || 'Unknown'}`); }
+ } catch (err) { setCodePreview(`# Error: ${err instanceof Error ? err.message : 'Unknown'}`); }
+ finally { setLoadingCode(false); }
+ }, [selectedId, onViewCode]);
+
+ const handleStartEdit = useCallback(() => {
+ if (codePreview) {
+ setEditedCode(codePreview);
+ setEditing(true);
+ setTimeout(() => editorRef.current?.focus(), 50);
+ }
+ }, [codePreview]);
+
+ const handleCancelEdit = useCallback(() => {
+ setEditing(false);
+ setEditedCode(originalCode);
+ }, [originalCode]);
+
+ const handleSave = useCallback(async () => {
+ if (!selectedStrategy || !editedCode) return;
+ setSaving(true);
+ try {
+ const result = await saveCustomPythonStrategy({
+ baseStrategyId: selectedStrategy.id,
+ name: selectedStrategy.name,
+ description: `Modified from ${selectedStrategy.id}`,
+ code: editedCode,
+ category: selectedStrategy.category,
+ });
+ if (result.success) {
+ setCodePreview(editedCode);
+ setOriginalCode(editedCode);
+ setEditing(false);
} else {
- setCodePreview(`// Error loading code: ${result.error}`);
+ alert(`Save failed: ${result.error || 'Unknown error'}`);
}
} catch (err) {
- setCodePreview(`// Error: ${err instanceof Error ? err.message : 'Unknown error'}`);
- } finally {
- setLoadingCode(false);
- }
- };
+ alert(`Save error: ${err instanceof Error ? err.message : 'Unknown'}`);
+ } finally { setSaving(false); }
+ }, [selectedStrategy, editedCode]);
- if (loading) {
- return (
- <div style={{
- display: 'flex', flexDirection: 'column', alignItems: 'center',
- justifyContent: 'center', height: '100%', gap: '12px', color: F.GRAY,
- }}>
- <Loader2 size={20} style={{ animation: 'spin 1s linear infinite', color: F.ORANGE }} />
- <span style={{ fontSize: '10px', fontWeight: 700, letterSpacing: '0.5px' }}>
- LOADING STRATEGY LIBRARY...
- </span>
- <style>{`@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }`}</style>
- </div>
- );
- }
+ const hasChanges = editing && editedCode !== originalCode;
- if (error) {
- return (
- <div style={{
- display: 'flex', flexDirection: 'column', alignItems: 'center',
- justifyContent: 'center', height: '100%', gap: '12px',
- }}>
- <AlertCircle size={20} color={F.RED} />
- <span style={{ fontSize: '10px', color: F.RED, fontWeight: 700 }}>{error}</span>
- <button
- onClick={loadData}
- style={{
- padding: '6px 14px', backgroundColor: F.ORANGE, color: F.DARK_BG,
- border: 'none', borderRadius: '2px', fontSize: '9px', fontWeight: 700,
- cursor: 'pointer', letterSpacing: '0.5px',
- }}
- >
- RETRY
- </button>
- </div>
- );
- }
+ const chipBase: React.CSSProperties = {
+ padding: '3px 10px', borderRadius: '2px', fontSize: '9px', fontWeight: 700,
+ fontFamily: font, cursor: 'pointer', letterSpacing: '0.3px',
+ borderWidth: '1px', borderStyle: 'solid', whiteSpace: 'nowrap', transition: 'all 0.15s',
+ };
return (
- <div style={{ display: 'flex', height: '100%', backgroundColor: F.DARK_BG }}>
- {/* ─── LEFT SIDEBAR — CATEGORIES ─── */}
+ <div style={{ display: 'flex', flexDirection: 'column', height: '100%', fontFamily: font, backgroundColor: F.DARK_BG }}>
+
+ {/* ━━━ TOP BAR ━━━ */}
<div style={{
- width: '200px', backgroundColor: F.PANEL_BG,
- borderRight: `1px solid ${F.BORDER}`,
- display: 'flex', flexDirection: 'column',
+ display: 'flex', alignItems: 'center', gap: '10px', padding: '8px 14px',
+ backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}`, flexShrink: 0,
}}>
+ <BookOpen size={14} style={{ color: F.ORANGE }} />
+ <span style={{ fontSize: '11px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>STRATEGY LIBRARY</span>
+ <span style={{ fontSize: '9px', color: F.MUTED, fontWeight: 600 }}>{strategies.length} strategies · {categories.length} categories</span>
+ <div style={{ flex: 1 }} />
<div style={{
- padding: '12px', borderBottom: `1px solid ${F.BORDER}`,
- display: 'flex', alignItems: 'center', gap: '8px',
- backgroundColor: F.HEADER_BG,
+ display: 'flex', alignItems: 'center', gap: '6px', padding: '4px 10px',
+ backgroundColor: F.DARK_BG, borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER, borderRadius: '2px', minWidth: '260px',
}}>
- <BookOpen size={12} color={F.ORANGE} />
- <span style={{ fontSize: '9px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
- CATEGORIES
- </span>
- <span style={{ fontSize: '8px', color: F.MUTED, marginLeft: 'auto' }}>
- {categories.length}
- </span>
+ <Search size={11} style={{ color: F.GRAY }} />
+ <input type="text" placeholder="Search strategies..." value={searchQuery} onChange={e => setSearchQuery(e.target.value)}
+ style={{ flex: 1, backgroundColor: 'transparent', border: 'none', outline: 'none', color: F.WHITE, fontSize: '10px', fontFamily: font }} />
+ {searchQuery && <X size={10} style={{ color: F.GRAY, cursor: 'pointer' }} onClick={() => setSearchQuery('')} />}
</div>
+ <span style={{ fontSize: '10px', fontWeight: 700, color: filtered.length > 0 ? F.ORANGE : F.MUTED }}>{filtered.length}</span>
+ </div>
- <div style={{ flex: 1, overflow: 'auto' }}>
- {/* All Strategies */}
- <button
- onClick={() => setSelectedCategory(null)}
- style={{
- width: '100%', padding: '8px 12px',
- backgroundColor: selectedCategory === null ? `${F.ORANGE}10` : 'transparent',
- color: selectedCategory === null ? F.ORANGE : F.GRAY,
- border: 'none', borderLeft: selectedCategory === null ? `2px solid ${F.ORANGE}` : '2px solid transparent',
- textAlign: 'left', fontSize: '9px', fontWeight: 700,
- cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '8px',
- transition: 'all 0.15s', letterSpacing: '0.3px',
- }}
- >
- <FolderOpen size={11} />
- <span style={{ flex: 1 }}>ALL</span>
- <span style={{ fontSize: '8px', color: F.MUTED }}>{strategies.length}</span>
- </button>
-
- {/* Category List */}
- {categories.map((cat) => (
- <button
- key={cat}
- onClick={() => setSelectedCategory(cat)}
- style={{
- width: '100%', padding: '8px 12px',
- backgroundColor: selectedCategory === cat ? `${F.ORANGE}10` : 'transparent',
- color: selectedCategory === cat ? F.ORANGE : F.GRAY,
- border: 'none', borderLeft: selectedCategory === cat ? `2px solid ${F.ORANGE}` : '2px solid transparent',
- textAlign: 'left', fontSize: '9px',
- cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '8px',
- transition: 'all 0.15s',
- }}
- >
- <ChevronRight
- size={9}
- style={{
- transform: selectedCategory === cat ? 'rotate(90deg)' : 'none',
- transition: 'transform 0.2s',
- }}
- />
- <span style={{
- flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
- fontWeight: selectedCategory === cat ? 700 : 400,
- }}>
- {cat}
- </span>
- <span style={{ fontSize: '8px', color: F.MUTED }}>{categoryCounts[cat] || 0}</span>
+ {/* ━━━ CATEGORY CHIPS ━━━ */}
+ <div style={{
+ display: 'flex', alignItems: 'center', gap: '5px', padding: '6px 14px',
+ borderBottom: `1px solid ${F.BORDER}`, overflowX: 'auto', flexShrink: 0, backgroundColor: F.PANEL_BG,
+ }}>
+ <button onClick={() => setSelectedCategory(null)} style={{
+ ...chipBase,
+ backgroundColor: selectedCategory === null ? `${F.ORANGE}18` : 'transparent',
+ borderColor: selectedCategory === null ? `${F.ORANGE}50` : F.BORDER,
+ color: selectedCategory === null ? F.ORANGE : F.GRAY,
+ }}>ALL</button>
+ {categories.map(cat => {
+ const col = catColorMap[cat]; const active = selectedCategory === cat;
+ return (
+ <button key={cat} onClick={() => setSelectedCategory(active ? null : cat)} style={{
+ ...chipBase,
+ backgroundColor: active ? `${col}18` : 'transparent',
+ borderColor: active ? `${col}50` : F.BORDER,
+ color: active ? col : F.GRAY,
+ }}>
+ {cat} <span style={{ opacity: 0.6, marginLeft: '3px' }}>{categoryCounts[cat] || 0}</span>
</button>
- ))}
- </div>
+ );
+ })}
</div>
- {/* ─── MAIN CONTENT ─── */}
- <div style={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
- {/* Search & View Controls */}
- <div style={{
- padding: '10px 16px', borderBottom: `1px solid ${F.BORDER}`,
- display: 'flex', alignItems: 'center', gap: '10px',
- backgroundColor: F.HEADER_BG,
- }}>
- <div style={{
- flex: 1, display: 'flex', alignItems: 'center', gap: '8px',
- backgroundColor: F.DARK_BG, padding: '7px 10px', borderRadius: '2px',
- border: `1px solid ${F.BORDER}`,
- }}>
- <Search size={12} color={F.GRAY} />
- <input
- type="text"
- placeholder="Search strategies by name, ID, or description..."
- value={searchQuery}
- onChange={(e) => setSearchQuery(e.target.value)}
- style={{
- flex: 1, backgroundColor: 'transparent', border: 'none',
- color: F.WHITE, fontSize: '10px', outline: 'none',
- fontFamily: '"IBM Plex Mono", monospace',
- }}
- />
- {searchQuery && (
- <button
- onClick={() => setSearchQuery('')}
- style={{
- backgroundColor: 'transparent', border: 'none',
- color: F.GRAY, cursor: 'pointer', padding: '2px',
- display: 'flex', alignItems: 'center',
- }}
- >
- <X size={10} />
- </button>
- )}
- </div>
-
- <span style={{ fontSize: '9px', color: F.MUTED, fontWeight: 700 }}>
- {filteredStrategies.length}
- </span>
-
- {/* View Toggle */}
- <div style={{
- display: 'flex', border: `1px solid ${F.BORDER}`,
- borderRadius: '2px', overflow: 'hidden',
- }}>
- <button
- onClick={() => setViewMode('grid')}
- style={{
- padding: '5px 8px',
- backgroundColor: viewMode === 'grid' ? `${F.ORANGE}20` : 'transparent',
- color: viewMode === 'grid' ? F.ORANGE : F.GRAY,
- border: 'none', borderRight: `1px solid ${F.BORDER}`,
- cursor: 'pointer', display: 'flex', alignItems: 'center',
- }}
- >
- <Grid size={12} />
- </button>
- <button
- onClick={() => setViewMode('list')}
- style={{
- padding: '5px 8px',
- backgroundColor: viewMode === 'list' ? `${F.ORANGE}20` : 'transparent',
- color: viewMode === 'list' ? F.ORANGE : F.GRAY,
- border: 'none', cursor: 'pointer',
- display: 'flex', alignItems: 'center',
- }}
- >
- <List size={12} />
- </button>
- </div>
- </div>
+ {/* ━━━ MAIN: Card grid + Code preview ━━━ */}
+ <div style={{ display: 'flex', flex: 1, overflow: 'hidden', minHeight: 0 }}>
- {/* Strategy Grid/List */}
- <div style={{ flex: 1, overflow: 'auto', padding: '16px' }}>
- {filteredStrategies.length === 0 ? (
- <div style={{
- display: 'flex', flexDirection: 'column', alignItems: 'center',
- justifyContent: 'center', height: '200px', gap: '8px',
- }}>
- <Code size={24} color={F.MUTED} style={{ opacity: 0.4 }} />
- <span style={{ fontSize: '10px', fontWeight: 700, color: F.GRAY }}>
- NO STRATEGIES FOUND
- </span>
- {searchQuery && (
- <span style={{ fontSize: '9px', color: F.MUTED }}>
- Try a different search term
- </span>
- )}
+ {/* ── CARD GRID ── */}
+ <div style={{ flex: 1, overflow: 'auto', padding: '14px', minWidth: 0 }}>
+ {loading ? (
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '200px', gap: '8px' }}>
+ <Loader2 size={16} className="animate-spin" style={{ color: F.ORANGE }} />
+ <span style={{ fontSize: '10px', fontWeight: 600, color: F.GRAY }}>Loading strategies...</span>
</div>
- ) : viewMode === 'grid' ? (
- <div style={{
- display: 'grid',
- gridTemplateColumns: 'repeat(auto-fill, minmax(280px, 1fr))',
- gap: '10px',
- }}>
- {filteredStrategies.map((strategy) => (
- <StrategyCard
- key={strategy.id}
- strategy={strategy}
- onViewCode={() => handleViewCode(strategy)}
- onClone={onClone ? () => onClone(strategy) : undefined}
- onBacktest={onBacktest ? () => onBacktest(strategy) : undefined}
- onDeploy={onDeploy ? () => onDeploy(strategy) : undefined}
- />
- ))}
+ ) : error ? (
+ <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '200px', gap: '8px' }}>
+ <AlertCircle size={20} style={{ color: F.RED }} />
+ <span style={{ fontSize: '10px', fontWeight: 600, color: F.RED }}>{error}</span>
+ <button onClick={loadData} style={{
+ padding: '5px 14px', fontSize: '9px', fontWeight: 700, fontFamily: font,
+ backgroundColor: 'transparent', borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER,
+ color: F.GRAY, borderRadius: '2px', cursor: 'pointer',
+ }}>RETRY</button>
+ </div>
+ ) : filtered.length === 0 ? (
+ <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '200px', gap: '8px' }}>
+ <FolderOpen size={24} style={{ color: F.MUTED, opacity: 0.3 }} />
+ <span style={{ fontSize: '10px', fontWeight: 600, color: F.GRAY }}>No strategies match</span>
</div>
) : (
- <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
- {filteredStrategies.map((strategy) => (
- <StrategyRow
- key={strategy.id}
- strategy={strategy}
- onViewCode={() => handleViewCode(strategy)}
- onClone={onClone ? () => onClone(strategy) : undefined}
- onBacktest={onBacktest ? () => onBacktest(strategy) : undefined}
- />
- ))}
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(260px, 1fr))', gap: '10px' }}>
+ {filtered.map(strategy => {
+ const isSelected = selectedId === strategy.id;
+ const col = catColorMap[strategy.category] || F.CYAN;
+ return (
+ <div key={strategy.id} onClick={() => handleSelect(strategy)} style={{
+ display: 'flex', flexDirection: 'column', borderRadius: '3px', cursor: 'pointer',
+ backgroundColor: F.PANEL_BG, overflow: 'hidden', transition: 'all 0.15s',
+ borderWidth: '1px', borderStyle: 'solid',
+ borderColor: isSelected ? F.ORANGE : F.BORDER,
+ boxShadow: isSelected ? `0 0 0 1px ${F.ORANGE}40` : 'none',
+ }}
+ onMouseEnter={e => { if (!isSelected) { e.currentTarget.style.borderColor = `${col}60`; e.currentTarget.style.transform = 'translateY(-1px)'; } }}
+ onMouseLeave={e => { if (!isSelected) { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.transform = 'none'; } }}
+ >
+ {/* Card top accent */}
+ <div style={{ height: '3px', backgroundColor: col, opacity: isSelected ? 1 : 0.4, transition: 'opacity 0.15s' }} />
+
+ {/* Card body */}
+ <div style={{ padding: '12px 14px 10px' }}>
+ {/* Category + ID */}
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '8px' }}>
+ <span style={{
+ fontSize: '8px', fontWeight: 700, letterSpacing: '0.5px',
+ padding: '2px 6px', borderRadius: '2px',
+ backgroundColor: `${col}15`, color: col,
+ }}>{strategy.category}</span>
+ <span style={{ fontSize: '8px', color: F.MUTED, fontFamily: font }}>{strategy.id}</span>
+ </div>
+
+ {/* Name */}
+ <div style={{
+ fontSize: '11px', fontWeight: 700, color: isSelected ? F.WHITE : '#DDDDDD',
+ lineHeight: '1.35', marginBottom: '6px',
+ display: '-webkit-box', WebkitLineClamp: 2, WebkitBoxOrient: 'vertical' as const,
+ overflow: 'hidden', textOverflow: 'ellipsis', wordBreak: 'break-word',
+ }} title={strategy.name}>
+ {shortName(strategy.name)}
+ </div>
+
+ {/* File path */}
+ <div style={{ fontSize: '8px', color: F.MUTED, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', marginBottom: '10px' }} title={strategy.path}>
+ <FileCode size={9} style={{ display: 'inline', verticalAlign: 'middle', marginRight: '4px' }} />
+ {strategy.path}
+ </div>
+ </div>
+
+ {/* Card footer — action buttons */}
+ <div style={{
+ display: 'flex', gap: '6px', padding: '8px 14px',
+ borderTop: `1px solid ${F.BORDER}`, backgroundColor: `${F.HEADER_BG}80`,
+ }}>
+ <button onClick={e => { e.stopPropagation(); handleSelect(strategy); }} style={{
+ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '4px',
+ padding: '5px 0', fontSize: '9px', fontWeight: 700, fontFamily: font,
+ backgroundColor: 'transparent', borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER,
+ color: F.GRAY, borderRadius: '2px', cursor: 'pointer', transition: 'all 0.15s',
+ }}
+ onMouseEnter={e => { e.currentTarget.style.borderColor = F.CYAN; e.currentTarget.style.color = F.CYAN; }}
+ onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
+ ><Eye size={10} /> VIEW</button>
+ {onClone && (
+ <button onClick={e => { e.stopPropagation(); onClone(strategy); }} style={{
+ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '4px',
+ padding: '5px 0', fontSize: '9px', fontWeight: 700, fontFamily: font,
+ backgroundColor: 'transparent', borderWidth: '1px', borderStyle: 'solid', borderColor: `${F.BLUE}35`,
+ color: F.BLUE, borderRadius: '2px', cursor: 'pointer', transition: 'all 0.15s',
+ }}
+ onMouseEnter={e => { e.currentTarget.style.backgroundColor = `${F.BLUE}10`; }}
+ onMouseLeave={e => { e.currentTarget.style.backgroundColor = 'transparent'; }}
+ ><Copy size={10} /> CLONE</button>
+ )}
+ {onBacktest && (
+ <button onClick={e => { e.stopPropagation(); onBacktest(strategy); }} style={{
+ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '4px',
+ padding: '5px 0', fontSize: '9px', fontWeight: 700, fontFamily: font,
+ backgroundColor: F.ORANGE, border: 'none',
+ color: F.DARK_BG, borderRadius: '2px', cursor: 'pointer', transition: 'all 0.15s',
+ }}
+ onMouseEnter={e => { e.currentTarget.style.opacity = '0.85'; }}
+ onMouseLeave={e => { e.currentTarget.style.opacity = '1'; }}
+ ><Play size={10} /> TEST</button>
+ )}
+ </div>
+ </div>
+ );
+ })}
</div>
)}
</div>
- </div>
- {/* ─── RIGHT SIDEBAR — CODE PREVIEW ─── */}
- {selectedStrategy && (
- <div style={{
- width: '380px', backgroundColor: F.PANEL_BG,
- borderLeft: `1px solid ${F.BORDER}`,
- display: 'flex', flexDirection: 'column',
- }}>
- {/* Preview Header */}
+ {/* ── CODE PREVIEW PANEL ── */}
+ {selectedStrategy && (
<div style={{
- padding: '12px', borderBottom: `1px solid ${F.BORDER}`,
- display: 'flex', alignItems: 'center', justifyContent: 'space-between',
- backgroundColor: F.HEADER_BG,
+ width: '480px', flexShrink: 0, display: 'flex', flexDirection: 'column',
+ borderLeft: `1px solid ${F.BORDER}`, backgroundColor: F.PANEL_BG, overflow: 'hidden',
}}>
- <div style={{ minWidth: 0, flex: 1 }}>
+ {/* Header */}
+ <div style={{
+ display: 'flex', alignItems: 'center', gap: '8px', padding: '10px 14px',
+ backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}`, flexShrink: 0,
+ }}>
<div style={{
- fontSize: '10px', fontWeight: 700, color: F.WHITE,
- overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
+ width: '28px', height: '28px', borderRadius: '3px', display: 'flex', alignItems: 'center', justifyContent: 'center',
+ backgroundColor: `${catColorMap[selectedStrategy.category] || F.CYAN}15`,
}}>
- {selectedStrategy.name}
+ <FileCode size={14} style={{ color: catColorMap[selectedStrategy.category] || F.CYAN }} />
</div>
- <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '2px' }}>
- {selectedStrategy.id}
+ <div style={{ flex: 1, minWidth: 0 }}>
+ <div style={{ fontSize: '11px', fontWeight: 700, color: F.WHITE, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
+ {shortName(selectedStrategy.name)}
+ </div>
+ <div style={{ fontSize: '8px', color: F.MUTED, marginTop: '2px', display: 'flex', alignItems: 'center', gap: '6px' }}>
+ <span>{selectedStrategy.id}</span>
+ <span style={{ color: catColorMap[selectedStrategy.category] || F.CYAN }}>{selectedStrategy.category}</span>
+ <span>{selectedStrategy.path}</span>
+ </div>
</div>
+ <button onClick={() => { setSelectedId(null); setCodePreview(null); }}
+ style={{ padding: '4px', backgroundColor: 'transparent', border: 'none', color: F.MUTED, cursor: 'pointer', borderRadius: '2px', display: 'flex' }}
+ onMouseEnter={e => { e.currentTarget.style.color = F.RED; }}
+ onMouseLeave={e => { e.currentTarget.style.color = F.MUTED; }}
+ ><X size={13} /></button>
</div>
- <button
- onClick={() => { setSelectedStrategy(null); setCodePreview(null); }}
- style={{
- padding: '4px', backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`, color: F.MUTED,
- cursor: 'pointer', borderRadius: '2px', marginLeft: '8px',
- display: 'flex', alignItems: 'center',
- }}
- onMouseEnter={e => { e.currentTarget.style.borderColor = F.RED; e.currentTarget.style.color = F.RED; }}
- onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.MUTED; }}
- >
- <X size={10} />
- </button>
- </div>
- {/* Strategy Info */}
- <div style={{
- padding: '10px 12px', borderBottom: `1px solid ${F.BORDER}`,
- display: 'flex', gap: '6px', flexWrap: 'wrap',
- }}>
- <span style={{
- padding: '2px 6px', borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- backgroundColor: `${F.CYAN}15`, color: F.CYAN,
- }}>
- {selectedStrategy.category}
- </span>
- {selectedStrategy.compatibility.map((mode) => (
- <span
- key={mode}
- style={{
- padding: '2px 6px', borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- backgroundColor: mode === 'live' ? `${F.GREEN}15` : mode === 'paper' ? `${F.YELLOW}15` : `${F.BLUE}15`,
- color: mode === 'live' ? F.GREEN : mode === 'paper' ? F.YELLOW : F.BLUE,
- textTransform: 'uppercase',
+ {/* Action bar */}
+ <div style={{ display: 'flex', gap: '6px', padding: '8px 14px', borderBottom: `1px solid ${F.BORDER}`, flexShrink: 0, alignItems: 'center' }}>
+ {/* Edit / Save / Cancel */}
+ {!editing ? (
+ <button onClick={handleStartEdit} disabled={!codePreview || loadingCode} style={{
+ display: 'flex', alignItems: 'center', gap: '4px', padding: '5px 12px',
+ fontSize: '9px', fontWeight: 700, fontFamily: font, borderRadius: '2px', cursor: 'pointer',
+ backgroundColor: 'transparent', borderWidth: '1px', borderStyle: 'solid', borderColor: `${F.CYAN}40`,
+ color: F.CYAN, transition: 'all 0.15s', opacity: !codePreview || loadingCode ? 0.4 : 1,
}}
- >
- {mode}
- </span>
- ))}
- </div>
+ onMouseEnter={e => { e.currentTarget.style.backgroundColor = `${F.CYAN}12`; }}
+ onMouseLeave={e => { e.currentTarget.style.backgroundColor = 'transparent'; }}
+ ><Edit3 size={10} /> EDIT</button>
+ ) : (
+ <>
+ <button onClick={handleSave} disabled={saving || !hasChanges} style={{
+ display: 'flex', alignItems: 'center', gap: '4px', padding: '5px 12px',
+ fontSize: '9px', fontWeight: 700, fontFamily: font, borderRadius: '2px', cursor: 'pointer',
+ backgroundColor: hasChanges ? F.GREEN : 'transparent', border: 'none',
+ color: hasChanges ? F.DARK_BG : F.MUTED, transition: 'all 0.15s',
+ opacity: saving ? 0.5 : 1,
+ }}>
+ {saving ? <Loader2 size={10} className="animate-spin" /> : <Save size={10} />}
+ {saving ? 'SAVING...' : 'SAVE COPY'}
+ </button>
+ <button onClick={handleCancelEdit} style={{
+ display: 'flex', alignItems: 'center', gap: '4px', padding: '5px 12px',
+ fontSize: '9px', fontWeight: 700, fontFamily: font, borderRadius: '2px', cursor: 'pointer',
+ backgroundColor: 'transparent', borderWidth: '1px', borderStyle: 'solid', borderColor: F.BORDER,
+ color: F.GRAY, transition: 'all 0.15s',
+ }}
+ onMouseEnter={e => { e.currentTarget.style.borderColor = F.RED; e.currentTarget.style.color = F.RED; }}
+ onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
+ ><RotateCcw size={10} /> CANCEL</button>
+ {hasChanges && <span style={{ fontSize: '8px', color: F.YELLOW, fontWeight: 600 }}>MODIFIED</span>}
+ </>
+ )}
- {/* Code Preview */}
- <div style={{ flex: 1, overflow: 'auto', padding: '12px' }}>
- {loadingCode ? (
- <div style={{
- display: 'flex', alignItems: 'center', justifyContent: 'center',
- height: '100px', color: F.GRAY,
- }}>
- <Loader2 size={14} style={{ animation: 'spin 1s linear infinite' }} />
- </div>
- ) : (
- <pre style={{
- margin: 0, padding: '10px',
- backgroundColor: F.DARK_BG, borderRadius: '2px',
- border: `1px solid ${F.BORDER}`,
- fontSize: '9px', fontFamily: '"IBM Plex Mono", monospace',
- color: F.WHITE, overflow: 'auto',
- whiteSpace: 'pre-wrap', wordBreak: 'break-word',
- lineHeight: '1.5',
- }}>
- {codePreview || '// No code available'}
- </pre>
- )}
- </div>
+ <div style={{ flex: 1 }} />
- {/* Preview Actions */}
- <div style={{
- padding: '10px 12px', borderTop: `1px solid ${F.BORDER}`,
- display: 'flex', gap: '6px',
- }}>
- {onClone && (
- <button
- onClick={() => onClone(selectedStrategy)}
- style={{
- flex: 1, padding: '8px',
- backgroundColor: `${F.BLUE}15`, color: F.BLUE,
- border: `1px solid ${F.BLUE}30`, borderRadius: '2px',
- fontSize: '9px', fontWeight: 700, cursor: 'pointer',
- display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '4px',
- letterSpacing: '0.5px', transition: 'all 0.2s',
+ {onClone && (
+ <button onClick={() => onClone(selectedStrategy)} style={{
+ display: 'flex', alignItems: 'center', gap: '4px', padding: '5px 12px',
+ fontSize: '9px', fontWeight: 700, fontFamily: font, borderRadius: '2px', cursor: 'pointer',
+ backgroundColor: 'transparent', borderWidth: '1px', borderStyle: 'solid', borderColor: `${F.BLUE}40`,
+ color: F.BLUE, transition: 'all 0.15s',
}}
- onMouseEnter={e => { e.currentTarget.style.backgroundColor = `${F.BLUE}25`; }}
- onMouseLeave={e => { e.currentTarget.style.backgroundColor = `${F.BLUE}15`; }}
- >
- <Copy size={10} />
- CLONE
- </button>
- )}
- {onBacktest && (
- <button
- onClick={() => onBacktest(selectedStrategy)}
- style={{
- flex: 1, padding: '8px',
- backgroundColor: F.ORANGE, color: F.DARK_BG,
- border: 'none', borderRadius: '2px',
- fontSize: '9px', fontWeight: 700, cursor: 'pointer',
- display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '4px',
- letterSpacing: '0.5px', transition: 'opacity 0.2s',
+ onMouseEnter={e => { e.currentTarget.style.backgroundColor = `${F.BLUE}12`; }}
+ onMouseLeave={e => { e.currentTarget.style.backgroundColor = 'transparent'; }}
+ ><Copy size={10} /> CLONE</button>
+ )}
+ {onBacktest && (
+ <button onClick={() => onBacktest(selectedStrategy)} style={{
+ display: 'flex', alignItems: 'center', gap: '4px', padding: '5px 12px',
+ fontSize: '9px', fontWeight: 700, fontFamily: font, borderRadius: '2px', cursor: 'pointer',
+ backgroundColor: F.ORANGE, border: 'none', color: F.DARK_BG, transition: 'all 0.15s',
}}
- onMouseEnter={e => { e.currentTarget.style.opacity = '0.85'; }}
- onMouseLeave={e => { e.currentTarget.style.opacity = '1'; }}
- >
- <Play size={10} />
- BACKTEST
- </button>
- )}
- </div>
- </div>
- )}
- </div>
- );
-};
-
-// ── Strategy Card Component ──────────────────────────────────────────────
-const StrategyCard: React.FC<{
- strategy: PythonStrategy;
- onViewCode: () => void;
- onClone?: () => void;
- onBacktest?: () => void;
- onDeploy?: () => void;
-}> = ({ strategy, onViewCode, onClone, onBacktest, onDeploy }) => {
- return (
- <div style={{
- backgroundColor: F.PANEL_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- overflow: 'hidden',
- display: 'flex', flexDirection: 'column',
- transition: 'border-color 0.2s',
- }}
- onMouseEnter={e => { (e.currentTarget as HTMLElement).style.borderColor = `${F.ORANGE}40`; }}
- onMouseLeave={e => { (e.currentTarget as HTMLElement).style.borderColor = F.BORDER; }}
- >
- {/* Header */}
- <div style={{
- padding: '10px 12px', backgroundColor: F.HEADER_BG,
- borderBottom: `1px solid ${F.BORDER}`,
- borderLeft: `3px solid ${F.PURPLE}`,
- }}>
- <div style={{ display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between', gap: '8px' }}>
- <div style={{ flex: 1, minWidth: 0 }}>
- <div style={{
- fontSize: '10px', fontWeight: 700, color: F.WHITE,
- marginBottom: '2px', wordBreak: 'break-word', lineHeight: '1.3',
- }}>
- {strategy.name}
+ onMouseEnter={e => { e.currentTarget.style.opacity = '0.85'; }}
+ onMouseLeave={e => { e.currentTarget.style.opacity = '1'; }}
+ ><Play size={10} /> BACKTEST</button>
+ )}
</div>
- <div style={{
- fontSize: '8px', color: F.MUTED,
- overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
- }}>
- {strategy.id}
+
+ {/* Code editor / viewer */}
+ <div style={{ flex: 1, overflow: 'hidden', display: 'flex', flexDirection: 'column' }}>
+ {loadingCode ? (
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100px', gap: '8px' }}>
+ <Loader2 size={14} className="animate-spin" style={{ color: F.ORANGE }} />
+ <span style={{ fontSize: '10px', color: F.GRAY }}>Loading source...</span>
+ </div>
+ ) : editing ? (
+ <textarea
+ ref={editorRef}
+ value={editedCode}
+ onChange={e => setEditedCode(e.target.value)}
+ spellCheck={false}
+ style={{
+ flex: 1, margin: 0, padding: '14px', resize: 'none',
+ fontSize: '10px', lineHeight: '1.65', fontFamily: font,
+ color: '#CCCCCC', backgroundColor: '#050505',
+ border: 'none', outline: 'none', whiteSpace: 'pre',
+ tabSize: 4, overflowX: 'auto',
+ }}
+ onKeyDown={e => {
+ // Tab key inserts 4 spaces
+ if (e.key === 'Tab') {
+ e.preventDefault();
+ const ta = e.currentTarget;
+ const start = ta.selectionStart;
+ const end = ta.selectionEnd;
+ const val = ta.value;
+ setEditedCode(val.substring(0, start) + ' ' + val.substring(end));
+ setTimeout(() => { ta.selectionStart = ta.selectionEnd = start + 4; }, 0);
+ }
+ }}
+ />
+ ) : (
+ <pre style={{
+ flex: 1, margin: 0, padding: '14px', fontSize: '10px', lineHeight: '1.65',
+ fontFamily: font, color: '#CCCCCC', whiteSpace: 'pre', overflowX: 'auto', overflow: 'auto',
+ backgroundColor: F.DARK_BG, cursor: 'text',
+ }} onClick={handleStartEdit}>
+ {codePreview || '# Select a strategy to view source code'}
+ </pre>
+ )}
</div>
</div>
- <span style={{
- fontSize: '7px', padding: '2px 6px',
- backgroundColor: `${F.CYAN}15`, color: F.CYAN,
- borderRadius: '2px', fontWeight: 700, flexShrink: 0,
- maxWidth: '80px', overflow: 'hidden', textOverflow: 'ellipsis',
- whiteSpace: 'nowrap', letterSpacing: '0.5px',
- }}
- title={strategy.category}
- >
- {strategy.category}
- </span>
- </div>
- </div>
-
- {/* Body */}
- <div style={{ padding: '10px 12px', flex: 1 }}>
- {/* Description */}
- <div style={{
- fontSize: '9px', color: F.GRAY, lineHeight: '1.4',
- height: '26px', overflow: 'hidden', textOverflow: 'ellipsis',
- display: '-webkit-box', WebkitLineClamp: 2,
- WebkitBoxOrient: 'vertical' as const, marginBottom: '8px',
- }}
- title={strategy.description || 'No description available'}
- >
- {strategy.description || 'No description available'}
- </div>
-
- {/* Compatibility Tags */}
- <div style={{ display: 'flex', gap: '4px', flexWrap: 'wrap' }}>
- {strategy.compatibility.map((mode) => (
- <span
- key={mode}
- style={{
- fontSize: '7px', padding: '2px 5px', fontWeight: 700,
- backgroundColor: mode === 'live' ? `${F.GREEN}15` : mode === 'paper' ? `${F.YELLOW}15` : `${F.BLUE}15`,
- color: mode === 'live' ? F.GREEN : mode === 'paper' ? F.YELLOW : F.BLUE,
- borderRadius: '2px', textTransform: 'uppercase', letterSpacing: '0.5px',
- }}
- >
- {mode}
- </span>
- ))}
- </div>
- </div>
-
- {/* Actions */}
- <div style={{
- display: 'flex', gap: '4px', padding: '8px 12px',
- borderTop: `1px solid ${F.BORDER}`,
- }}>
- <button
- onClick={onViewCode}
- style={{
- flex: 1, padding: '5px',
- backgroundColor: 'transparent', border: `1px solid ${F.BORDER}`,
- color: F.GRAY, borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '3px',
- transition: 'all 0.2s', letterSpacing: '0.5px',
- }}
- onMouseEnter={e => { e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.color = F.WHITE; }}
- onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
- >
- <Eye size={9} /> VIEW
- </button>
- {onClone && (
- <button
- onClick={onClone}
- style={{
- flex: 1, padding: '5px',
- backgroundColor: 'transparent', border: `1px solid ${F.BLUE}30`,
- color: F.BLUE, borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '3px',
- transition: 'all 0.2s', letterSpacing: '0.5px',
- }}
- onMouseEnter={e => { e.currentTarget.style.backgroundColor = `${F.BLUE}10`; }}
- onMouseLeave={e => { e.currentTarget.style.backgroundColor = 'transparent'; }}
- >
- <Copy size={9} /> CLONE
- </button>
- )}
- {onBacktest && (
- <button
- onClick={onBacktest}
- style={{
- flex: 1, padding: '5px',
- backgroundColor: F.ORANGE, border: 'none',
- color: F.DARK_BG, borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '3px',
- letterSpacing: '0.5px', transition: 'opacity 0.2s',
- }}
- onMouseEnter={e => { e.currentTarget.style.opacity = '0.85'; }}
- onMouseLeave={e => { e.currentTarget.style.opacity = '1'; }}
- >
- <Play size={9} /> TEST
- </button>
- )}
- </div>
- </div>
- );
-};
-
-// ── Strategy Row Component (List View) ──────────────────────────────────
-const StrategyRow: React.FC<{
- strategy: PythonStrategy;
- onViewCode: () => void;
- onClone?: () => void;
- onBacktest?: () => void;
-}> = ({ strategy, onViewCode, onClone, onBacktest }) => {
- return (
- <div style={{
- backgroundColor: F.PANEL_BG,
- border: `1px solid ${F.BORDER}`,
- borderRadius: '2px',
- padding: '8px 12px',
- display: 'flex', alignItems: 'center', gap: '12px',
- transition: 'border-color 0.15s',
- }}
- onMouseEnter={e => { (e.currentTarget as HTMLElement).style.borderColor = `${F.ORANGE}40`; }}
- onMouseLeave={e => { (e.currentTarget as HTMLElement).style.borderColor = F.BORDER; }}
- >
- <Code size={12} color={F.PURPLE} />
- <div style={{ flex: 1, minWidth: 0 }}>
- <div style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE }}>{strategy.name}</div>
- <div style={{
- fontSize: '8px', color: F.MUTED,
- overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
- }}>
- {strategy.id} — {strategy.description || 'No description'}
- </div>
- </div>
- <span style={{
- fontSize: '7px', padding: '2px 6px',
- backgroundColor: `${F.CYAN}15`, color: F.CYAN,
- borderRadius: '2px', fontWeight: 700,
- }}>
- {strategy.category}
- </span>
- <div style={{ display: 'flex', gap: '4px' }}>
- <button
- onClick={onViewCode}
- style={{
- padding: '4px 8px', backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`, color: F.GRAY,
- borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- cursor: 'pointer', transition: 'all 0.2s',
- }}
- onMouseEnter={e => { e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.color = F.WHITE; }}
- onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
- >
- VIEW
- </button>
- {onClone && (
- <button
- onClick={onClone}
- style={{
- padding: '4px 8px', backgroundColor: 'transparent',
- border: `1px solid ${F.BLUE}30`, color: F.BLUE,
- borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- cursor: 'pointer', transition: 'all 0.2s',
- }}
- >
- CLONE
- </button>
- )}
- {onBacktest && (
- <button
- onClick={onBacktest}
- style={{
- padding: '4px 8px', backgroundColor: F.ORANGE,
- border: 'none', color: F.DARK_BG, borderRadius: '2px',
- fontSize: '8px', fontWeight: 700, cursor: 'pointer',
- }}
- >
- TEST
- </button>
)}
</div>
</div>
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/StrategyManager.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/StrategyManager.tsx
index 385dd46aa..da099dc8a 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/StrategyManager.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/StrategyManager.tsx
@@ -14,6 +14,7 @@ import {
import DeployPanel from './DeployPanel';
import PythonStrategyEditor from './PythonStrategyEditor';
import { F } from '../constants/theme';
+import { S } from '../constants/styles';
type StrategyType = 'all' | 'json' | 'python';
@@ -174,55 +175,48 @@ const StrategyManager: React.FC<StrategyManagerProps> = ({
const pythonCount = strategies.filter((s) => s.type === 'python').length;
return (
- <div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
+ <div className="flex flex-col h-full">
{/* ─── HEADER TOOLBAR ─── */}
- <div style={{
- padding: '12px 16px',
- backgroundColor: F.HEADER_BG,
- borderBottom: `1px solid ${F.BORDER}`,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
- <Folder size={14} color={F.ORANGE} />
- <span style={{ fontSize: '11px', fontWeight: 700, color: F.WHITE, letterSpacing: '0.5px' }}>
+ <div
+ className="flex items-center justify-between px-4 py-3 shrink-0"
+ style={{ backgroundColor: F.HEADER_BG, borderBottom: `1px solid ${F.BORDER}` }}
+ >
+ <div className="flex items-center gap-3">
+ <Folder size={16} style={{ color: F.ORANGE }} />
+ <span className="text-[12px] font-bold tracking-wide" style={{ color: F.WHITE }}>
MY STRATEGIES
</span>
- <div style={{ display: 'flex', gap: '4px' }}>
- <span style={{
- padding: '2px 8px', borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- backgroundColor: `${F.CYAN}15`, color: F.CYAN,
- }}>
+ <div className="flex gap-1.5">
+ <span
+ className={S.badge}
+ style={{ backgroundColor: `${F.CYAN}15`, color: F.CYAN }}
+ >
{jsonCount} JSON
</span>
- <span style={{
- padding: '2px 8px', borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- backgroundColor: `${F.PURPLE}15`, color: F.PURPLE,
- }}>
+ <span
+ className={S.badge}
+ style={{ backgroundColor: `${F.PURPLE}15`, color: F.PURPLE }}
+ >
{pythonCount} PYTHON
</span>
</div>
</div>
- <div style={{ display: 'flex', gap: '6px', alignItems: 'center' }}>
+ <div className="flex gap-2 items-center">
{/* Filter Tabs */}
- <div style={{
- display: 'flex', gap: '0px',
- border: `1px solid ${F.BORDER}`, borderRadius: '2px', overflow: 'hidden',
- }}>
+ <div
+ className="flex overflow-hidden rounded"
+ style={{ border: `1px solid ${F.BORDER}` }}
+ >
{(['all', 'json', 'python'] as StrategyType[]).map((type) => (
<button
key={type}
onClick={() => setFilterType(type)}
+ className="px-3 py-1.5 text-[9px] font-bold tracking-wide cursor-pointer border-none transition-all duration-150"
style={{
- padding: '5px 10px',
backgroundColor: filterType === type ? `${F.ORANGE}20` : 'transparent',
- border: 'none',
borderRight: type !== 'python' ? `1px solid ${F.BORDER}` : 'none',
color: filterType === type ? F.ORANGE : F.GRAY,
- fontSize: '8px', fontWeight: 700, letterSpacing: '0.5px',
- cursor: 'pointer', transition: 'all 0.15s',
}}
>
{type === 'all' ? 'ALL' : type.toUpperCase()}
@@ -232,30 +226,22 @@ const StrategyManager: React.FC<StrategyManagerProps> = ({
<button
onClick={loadStrategies}
- style={{
- padding: '6px', backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`, color: F.GRAY,
- cursor: 'pointer', borderRadius: '2px', transition: 'all 0.2s',
- display: 'flex', alignItems: 'center',
- }}
+ className={S.btnGhost}
+ style={{ border: `1px solid ${F.BORDER}` }}
onMouseEnter={e => { e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.color = F.WHITE; }}
onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
>
- <RefreshCw size={11} />
+ <RefreshCw size={12} />
</button>
<button
onClick={onNew}
- style={{
- padding: '6px 14px', backgroundColor: F.ORANGE, color: F.DARK_BG,
- border: 'none', borderRadius: '2px', fontSize: '9px', fontWeight: 700,
- cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '4px',
- letterSpacing: '0.5px', transition: 'opacity 0.2s',
- }}
+ className={S.btnPrimary}
+ style={{ backgroundColor: F.ORANGE, color: F.DARK_BG }}
onMouseEnter={e => { e.currentTarget.style.opacity = '0.85'; }}
onMouseLeave={e => { e.currentTarget.style.opacity = '1'; }}
>
- <Plus size={10} />
+ <Plus size={12} />
NEW STRATEGY
</button>
</div>
@@ -288,32 +274,24 @@ const StrategyManager: React.FC<StrategyManagerProps> = ({
)}
{/* ─── STRATEGY CARDS ─── */}
- <div style={{ flex: 1, overflow: 'auto', padding: '16px' }}>
+ <div className="flex-1 overflow-auto p-4">
{loading ? (
- <div style={{
- display: 'flex', flexDirection: 'column', alignItems: 'center',
- justifyContent: 'center', height: '200px', gap: '8px',
- }}>
- <RefreshCw size={18} color={F.ORANGE} style={{ animation: 'spin 1s linear infinite' }} />
- <span style={{ fontSize: '10px', color: F.MUTED, fontWeight: 700 }}>LOADING STRATEGIES...</span>
- <style>{`@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }`}</style>
+ <div className="flex flex-col items-center justify-center h-[200px] gap-2">
+ <RefreshCw size={20} className="animate-spin" style={{ color: F.ORANGE }} />
+ <span className="text-[11px] font-bold" style={{ color: F.MUTED }}>LOADING STRATEGIES...</span>
</div>
) : filteredStrategies.length === 0 ? (
- <div style={{
- display: 'flex', flexDirection: 'column', alignItems: 'center',
- justifyContent: 'center', height: '300px', gap: '12px',
- }}>
- <div style={{
- width: '48px', height: '48px', borderRadius: '2px',
- backgroundColor: `${F.ORANGE}10`, border: `1px solid ${F.ORANGE}20`,
- display: 'flex', alignItems: 'center', justifyContent: 'center',
- }}>
- <Rocket size={20} color={F.ORANGE} style={{ opacity: 0.6 }} />
+ <div className="flex flex-col items-center justify-center h-[300px] gap-3">
+ <div
+ className="w-12 h-12 rounded flex items-center justify-center"
+ style={{ backgroundColor: `${F.ORANGE}10`, border: `1px solid ${F.ORANGE}20` }}
+ >
+ <Rocket size={22} style={{ color: F.ORANGE, opacity: 0.6 }} />
</div>
- <span style={{ fontSize: '11px', fontWeight: 700, color: F.GRAY }}>
+ <span className="text-[12px] font-bold" style={{ color: F.GRAY }}>
{filterType === 'all' ? 'NO STRATEGIES YET' : `NO ${filterType.toUpperCase()} STRATEGIES`}
</span>
- <span style={{ fontSize: '9px', color: F.MUTED, maxWidth: '300px', textAlign: 'center', lineHeight: '1.5' }}>
+ <span className="text-[10px] max-w-[320px] text-center leading-relaxed" style={{ color: F.MUTED }}>
{filterType === 'python'
? 'Clone strategies from the LIBRARY tab to create Python strategies'
: 'Create your first strategy using the builder or write a Python strategy'}
@@ -321,27 +299,21 @@ const StrategyManager: React.FC<StrategyManagerProps> = ({
{filterType !== 'python' && (
<button
onClick={onNew}
- style={{
- marginTop: '4px', padding: '8px 16px',
- backgroundColor: 'transparent', border: `1px solid ${F.ORANGE}`,
- color: F.ORANGE, fontSize: '9px', fontWeight: 700, letterSpacing: '0.5px',
- borderRadius: '2px', cursor: 'pointer', transition: 'all 0.2s',
- display: 'flex', alignItems: 'center', gap: '6px',
- }}
+ className={S.btnOutline + ' mt-1'}
+ style={{ borderColor: F.ORANGE, color: F.ORANGE }}
onMouseEnter={e => { e.currentTarget.style.backgroundColor = `${F.ORANGE}15`; }}
onMouseLeave={e => { e.currentTarget.style.backgroundColor = 'transparent'; }}
>
- <Plus size={10} />
+ <Plus size={11} />
CREATE STRATEGY
</button>
)}
</div>
) : (
- <div style={{
- display: 'grid',
- gridTemplateColumns: 'repeat(auto-fill, minmax(320px, 1fr))',
- gap: '10px',
- }}>
+ <div
+ className="grid gap-3"
+ style={{ gridTemplateColumns: 'repeat(auto-fill, minmax(340px, 1fr))' }}
+ >
{filteredStrategies.map((strategy) => (
<StrategyCard
key={strategy.id}
@@ -363,7 +335,7 @@ const StrategyManager: React.FC<StrategyManagerProps> = ({
{/* Click outside to close menu */}
{menuOpenId && (
<div
- style={{ position: 'fixed', top: 0, left: 0, right: 0, bottom: 0, zIndex: 99 }}
+ className="fixed inset-0 z-[99]"
onClick={() => setMenuOpenId(null)}
/>
)}
@@ -391,91 +363,77 @@ const StrategyCard: React.FC<{
<div
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
+ className="rounded overflow-hidden transition-colors duration-200"
style={{
backgroundColor: F.PANEL_BG,
border: `1px solid ${isHovered ? `${F.ORANGE}40` : F.BORDER}`,
- borderRadius: '2px',
- overflow: 'hidden',
- transition: 'border-color 0.2s',
}}
>
{/* Card Header */}
- <div style={{
- padding: '10px 12px',
- backgroundColor: F.HEADER_BG,
- borderBottom: `1px solid ${F.BORDER}`,
- borderLeft: `3px solid ${typeColor}`,
- display: 'flex',
- alignItems: 'center',
- gap: '8px',
- }}>
- <TypeIcon size={12} color={typeColor} />
- <div style={{ flex: 1, minWidth: 0 }}>
- <div style={{
- fontSize: '10px', fontWeight: 700, color: F.WHITE,
- overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
- }}>
+ <div
+ className="flex items-center gap-2 px-4 py-3"
+ style={{
+ backgroundColor: F.HEADER_BG,
+ borderBottom: `1px solid ${F.BORDER}`,
+ borderLeft: `3px solid ${typeColor}`,
+ }}
+ >
+ <TypeIcon size={14} style={{ color: typeColor }} />
+ <div className="flex-1 min-w-0">
+ <div className="text-[11px] font-bold overflow-hidden text-ellipsis whitespace-nowrap" style={{ color: F.WHITE }}>
{strategy.name}
</div>
</div>
- <span style={{
- padding: '2px 6px', borderRadius: '2px', fontSize: '7px', fontWeight: 700,
- backgroundColor: `${typeColor}15`, color: typeColor, letterSpacing: '0.5px',
- }}>
+ <span
+ className={S.badge}
+ style={{ backgroundColor: `${typeColor}15`, color: typeColor }}
+ >
{strategy.type.toUpperCase()}
</span>
{/* Menu button */}
- <div style={{ position: 'relative' }}>
+ <div className="relative">
<button
onClick={(e) => { e.stopPropagation(); onMenuToggle(); }}
- style={{
- padding: '3px', backgroundColor: 'transparent', border: 'none',
- color: F.MUTED, cursor: 'pointer', borderRadius: '2px',
- display: 'flex', alignItems: 'center',
- }}
+ className={S.btnGhost}
>
- <MoreHorizontal size={12} />
+ <MoreHorizontal size={14} />
</button>
{menuOpen && (
- <div style={{
- position: 'absolute', top: '100%', right: 0, marginTop: '4px',
- backgroundColor: F.PANEL_BG, border: `1px solid ${F.BORDER}`,
- borderRadius: '2px', zIndex: 100, minWidth: '120px',
- boxShadow: '0 4px 12px rgba(0,0,0,0.5)',
- }}>
- <button onClick={onEdit} style={{
- width: '100%', padding: '8px 12px', backgroundColor: 'transparent',
- border: 'none', color: F.WHITE, fontSize: '9px', fontWeight: 700,
- textAlign: 'left', cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '6px',
- transition: 'background-color 0.15s',
+ <div
+ className="absolute top-full right-0 mt-1 rounded z-[100] min-w-[130px]"
+ style={{
+ backgroundColor: F.PANEL_BG,
+ border: `1px solid ${F.BORDER}`,
+ boxShadow: '0 4px 12px rgba(0,0,0,0.5)',
}}
+ >
+ <button
+ onClick={onEdit}
+ className="w-full flex items-center gap-2 px-4 py-2.5 bg-transparent border-none text-[10px] font-bold text-left cursor-pointer transition-colors duration-150"
+ style={{ color: F.WHITE }}
onMouseEnter={e => { e.currentTarget.style.backgroundColor = F.HOVER; }}
onMouseLeave={e => { e.currentTarget.style.backgroundColor = 'transparent'; }}
>
- <Edit size={10} /> EDIT
+ <Edit size={11} /> EDIT
</button>
- <button onClick={onDeploy} style={{
- width: '100%', padding: '8px 12px', backgroundColor: 'transparent',
- border: 'none', color: F.GREEN, fontSize: '9px', fontWeight: 700,
- textAlign: 'left', cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '6px',
- transition: 'background-color 0.15s',
- }}
+ <button
+ onClick={onDeploy}
+ className="w-full flex items-center gap-2 px-4 py-2.5 bg-transparent border-none text-[10px] font-bold text-left cursor-pointer transition-colors duration-150"
+ style={{ color: F.GREEN }}
onMouseEnter={e => { e.currentTarget.style.backgroundColor = F.HOVER; }}
onMouseLeave={e => { e.currentTarget.style.backgroundColor = 'transparent'; }}
>
- <Rocket size={10} /> DEPLOY
+ <Rocket size={11} /> DEPLOY
</button>
<div style={{ borderTop: `1px solid ${F.BORDER}` }} />
- <button onClick={onDelete} style={{
- width: '100%', padding: '8px 12px', backgroundColor: 'transparent',
- border: 'none', color: F.RED, fontSize: '9px', fontWeight: 700,
- textAlign: 'left', cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '6px',
- transition: 'background-color 0.15s',
- }}
+ <button
+ onClick={onDelete}
+ className="w-full flex items-center gap-2 px-4 py-2.5 bg-transparent border-none text-[10px] font-bold text-left cursor-pointer transition-colors duration-150"
+ style={{ color: F.RED }}
onMouseEnter={e => { e.currentTarget.style.backgroundColor = `${F.RED}10`; }}
onMouseLeave={e => { e.currentTarget.style.backgroundColor = 'transparent'; }}
>
- <Trash2 size={10} /> DELETE
+ <Trash2 size={11} /> DELETE
</button>
</div>
)}
@@ -483,65 +441,62 @@ const StrategyCard: React.FC<{
</div>
{/* Card Body */}
- <div style={{ padding: '10px 12px' }}>
+ <div className={S.cardBody}>
{/* Description */}
{strategy.description && (
- <div style={{
- fontSize: '9px', color: F.MUTED, lineHeight: '1.5',
- marginBottom: '8px', maxHeight: '28px', overflow: 'hidden',
- textOverflow: 'ellipsis', display: '-webkit-box',
- WebkitLineClamp: 2, WebkitBoxOrient: 'vertical' as const,
- }}>
+ <div
+ className="text-[10px] leading-relaxed mb-2 max-h-[32px] overflow-hidden"
+ style={{
+ color: F.MUTED,
+ display: '-webkit-box',
+ WebkitLineClamp: 2,
+ WebkitBoxOrient: 'vertical' as const,
+ textOverflow: 'ellipsis',
+ }}
+ >
{strategy.description}
</div>
)}
{/* Strategy Details */}
{isJson ? (
- <div style={{
- display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: '6px',
- }}>
- <div style={{ backgroundColor: F.DARK_BG, padding: '6px 8px', borderRadius: '2px', border: `1px solid ${F.BORDER}` }}>
- <div style={{ fontSize: '7px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '2px' }}>TIMEFRAME</div>
- <div style={{ fontSize: '10px', fontWeight: 700, color: F.CYAN }}>{strategy.timeframe || '—'}</div>
+ <div className="grid grid-cols-4 gap-2">
+ <div className="rounded p-2" style={{ backgroundColor: F.DARK_BG, border: `1px solid ${F.BORDER}` }}>
+ <div className="text-[8px] font-bold tracking-wide mb-0.5" style={{ color: F.MUTED }}>TIMEFRAME</div>
+ <div className="text-[11px] font-bold" style={{ color: F.CYAN }}>{strategy.timeframe || '—'}</div>
</div>
- <div style={{ backgroundColor: F.DARK_BG, padding: '6px 8px', borderRadius: '2px', border: `1px solid ${F.BORDER}` }}>
- <div style={{ fontSize: '7px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '2px' }}>ENTRY</div>
- <div style={{ fontSize: '10px', fontWeight: 700, color: F.GREEN, display: 'flex', alignItems: 'center', gap: '3px' }}>
- <ArrowUpRight size={9} /> {strategy.entryConditionCount}
+ <div className="rounded p-2" style={{ backgroundColor: F.DARK_BG, border: `1px solid ${F.BORDER}` }}>
+ <div className="text-[8px] font-bold tracking-wide mb-0.5" style={{ color: F.MUTED }}>ENTRY</div>
+ <div className="flex items-center gap-1 text-[11px] font-bold" style={{ color: F.GREEN }}>
+ <ArrowUpRight size={10} /> {strategy.entryConditionCount}
</div>
</div>
- <div style={{ backgroundColor: F.DARK_BG, padding: '6px 8px', borderRadius: '2px', border: `1px solid ${F.BORDER}` }}>
- <div style={{ fontSize: '7px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '2px' }}>EXIT</div>
- <div style={{ fontSize: '10px', fontWeight: 700, color: F.RED, display: 'flex', alignItems: 'center', gap: '3px' }}>
- <ArrowDownRight size={9} /> {strategy.exitConditionCount}
+ <div className="rounded p-2" style={{ backgroundColor: F.DARK_BG, border: `1px solid ${F.BORDER}` }}>
+ <div className="text-[8px] font-bold tracking-wide mb-0.5" style={{ color: F.MUTED }}>EXIT</div>
+ <div className="flex items-center gap-1 text-[11px] font-bold" style={{ color: F.RED }}>
+ <ArrowDownRight size={10} /> {strategy.exitConditionCount}
</div>
</div>
- <div style={{ backgroundColor: F.DARK_BG, padding: '6px 8px', borderRadius: '2px', border: `1px solid ${F.BORDER}` }}>
- <div style={{ fontSize: '7px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '2px' }}>RISK</div>
- <div style={{ fontSize: '9px', fontWeight: 700, color: F.YELLOW, display: 'flex', alignItems: 'center', gap: '2px' }}>
- <Shield size={8} />
+ <div className="rounded p-2" style={{ backgroundColor: F.DARK_BG, border: `1px solid ${F.BORDER}` }}>
+ <div className="text-[8px] font-bold tracking-wide mb-0.5" style={{ color: F.MUTED }}>RISK</div>
+ <div className="flex items-center gap-1 text-[10px] font-bold" style={{ color: F.YELLOW }}>
+ <Shield size={9} />
{strategy.stopLoss != null ? `${strategy.stopLoss}%` : '—'}
</div>
</div>
</div>
) : (
- <div style={{
- display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '6px',
- }}>
+ <div className="grid grid-cols-2 gap-2">
{strategy.category && (
- <div style={{ backgroundColor: F.DARK_BG, padding: '6px 8px', borderRadius: '2px', border: `1px solid ${F.BORDER}` }}>
- <div style={{ fontSize: '7px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '2px' }}>CATEGORY</div>
- <div style={{ fontSize: '9px', fontWeight: 700, color: F.PURPLE }}>{strategy.category}</div>
+ <div className="rounded p-2" style={{ backgroundColor: F.DARK_BG, border: `1px solid ${F.BORDER}` }}>
+ <div className="text-[8px] font-bold tracking-wide mb-0.5" style={{ color: F.MUTED }}>CATEGORY</div>
+ <div className="text-[10px] font-bold" style={{ color: F.PURPLE }}>{strategy.category}</div>
</div>
)}
{strategy.baseStrategyId && (
- <div style={{ backgroundColor: F.DARK_BG, padding: '6px 8px', borderRadius: '2px', border: `1px solid ${F.BORDER}` }}>
- <div style={{ fontSize: '7px', fontWeight: 700, color: F.MUTED, letterSpacing: '0.5px', marginBottom: '2px' }}>BASE</div>
- <div style={{
- fontSize: '9px', color: F.GRAY, overflow: 'hidden',
- textOverflow: 'ellipsis', whiteSpace: 'nowrap',
- }}>
+ <div className="rounded p-2" style={{ backgroundColor: F.DARK_BG, border: `1px solid ${F.BORDER}` }}>
+ <div className="text-[8px] font-bold tracking-wide mb-0.5" style={{ color: F.MUTED }}>BASE</div>
+ <div className="text-[10px] overflow-hidden text-ellipsis whitespace-nowrap" style={{ color: F.GRAY }}>
{strategy.baseStrategyId}
</div>
</div>
@@ -551,49 +506,39 @@ const StrategyCard: React.FC<{
</div>
{/* Card Footer — Action Buttons */}
- <div style={{
- padding: '8px 12px',
- borderTop: `1px solid ${F.BORDER}`,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
+ <div
+ className="flex items-center justify-between px-4 py-2.5"
+ style={{ borderTop: `1px solid ${F.BORDER}` }}
+ >
+ <div className="flex items-center gap-2">
{strategy.updatedAt && (
- <span style={{ fontSize: '8px', color: F.MUTED, display: 'flex', alignItems: 'center', gap: '3px' }}>
- <Calendar size={8} />
+ <span className="flex items-center gap-1 text-[9px]" style={{ color: F.MUTED }}>
+ <Calendar size={9} />
{new Date(strategy.updatedAt).toLocaleDateString()}
</span>
)}
</div>
- <div style={{ display: 'flex', gap: '4px' }}>
+ <div className="flex gap-1.5">
<button
onClick={onEdit}
- style={{
- padding: '5px 10px', backgroundColor: 'transparent',
- border: `1px solid ${F.BORDER}`, color: F.GRAY,
- borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '3px',
- transition: 'all 0.2s', letterSpacing: '0.5px',
- }}
+ className={S.btnOutline}
onMouseEnter={e => { e.currentTarget.style.borderColor = F.ORANGE; e.currentTarget.style.color = F.WHITE; }}
onMouseLeave={e => { e.currentTarget.style.borderColor = F.BORDER; e.currentTarget.style.color = F.GRAY; }}
>
- <Edit size={9} /> EDIT
+ <Edit size={10} /> EDIT
</button>
<button
onClick={onDeploy}
+ className="flex items-center gap-1.5 px-3 py-1.5 rounded text-[10px] font-bold tracking-wide cursor-pointer transition-all duration-200"
style={{
- padding: '5px 10px', backgroundColor: `${F.GREEN}15`,
- border: `1px solid ${F.GREEN}30`, color: F.GREEN,
- borderRadius: '2px', fontSize: '8px', fontWeight: 700,
- cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '3px',
- transition: 'all 0.2s', letterSpacing: '0.5px',
+ backgroundColor: `${F.GREEN}15`,
+ border: `1px solid ${F.GREEN}30`,
+ color: F.GREEN,
}}
onMouseEnter={e => { e.currentTarget.style.backgroundColor = `${F.GREEN}25`; }}
onMouseLeave={e => { e.currentTarget.style.backgroundColor = `${F.GREEN}15`; }}
>
- <Rocket size={9} /> DEPLOY
+ <Rocket size={10} /> DEPLOY
</button>
</div>
</div>
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/TradeHistoryTable.tsx b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/TradeHistoryTable.tsx
index 9ddd64605..455b6b3d1 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/components/TradeHistoryTable.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/components/TradeHistoryTable.tsx
@@ -2,16 +2,7 @@ import React, { useState, useEffect } from 'react';
import type { AlgoTrade } from '../types';
import { getAlgoTrades } from '../services/algoTradingService';
import { F } from '../constants/theme';
-
-const thStyle: React.CSSProperties = {
- padding: '6px 12px', fontSize: '8px', fontWeight: 700, color: F.GRAY,
- letterSpacing: '0.5px',
-};
-
-const tdStyle: React.CSSProperties = {
- padding: '5px 12px', fontSize: '9px',
- fontFamily: '"IBM Plex Mono", monospace',
-};
+import { S } from '../constants/styles';
interface TradeHistoryTableProps {
deploymentId: string;
@@ -34,7 +25,7 @@ const TradeHistoryTable: React.FC<TradeHistoryTableProps> = ({ deploymentId }) =
if (loading) {
return (
- <div style={{ padding: '12px', fontSize: '9px', color: F.MUTED }}>
+ <div className="p-4 text-[11px]" style={{ color: F.MUTED }}>
Loading trades...
</div>
);
@@ -42,53 +33,53 @@ const TradeHistoryTable: React.FC<TradeHistoryTableProps> = ({ deploymentId }) =
if (trades.length === 0) {
return (
- <div style={{ padding: '12px', fontSize: '9px', color: F.MUTED }}>
+ <div className="p-4 text-[11px]" style={{ color: F.MUTED }}>
No trades yet
</div>
);
}
return (
- <div style={{ overflow: 'auto' }}>
- <table style={{ width: '100%', borderCollapse: 'collapse', fontSize: '9px', fontFamily: '"IBM Plex Mono", monospace' }}>
+ <div className="overflow-auto">
+ <table className="w-full border-collapse font-mono">
<thead>
<tr style={{ borderBottom: `1px solid ${F.BORDER}` }}>
- <th style={{ ...thStyle, textAlign: 'left' }}>TIME</th>
- <th style={{ ...thStyle, textAlign: 'left' }}>SIDE</th>
- <th style={{ ...thStyle, textAlign: 'right' }}>QTY</th>
- <th style={{ ...thStyle, textAlign: 'right' }}>PRICE</th>
- <th style={{ ...thStyle, textAlign: 'right' }}>P&L</th>
- <th style={{ ...thStyle, textAlign: 'left' }}>REASON</th>
+ <th className={S.th} style={{ textAlign: 'left' }}>TIME</th>
+ <th className={S.th} style={{ textAlign: 'left' }}>SIDE</th>
+ <th className={S.th} style={{ textAlign: 'right' }}>QTY</th>
+ <th className={S.th} style={{ textAlign: 'right' }}>PRICE</th>
+ <th className={S.th} style={{ textAlign: 'right' }}>P&L</th>
+ <th className={S.th} style={{ textAlign: 'left' }}>REASON</th>
</tr>
</thead>
<tbody>
{trades.map(trade => (
<tr key={trade.id} style={{ borderBottom: `1px solid ${F.BORDER}15` }}>
- <td style={{ ...tdStyle, textAlign: 'left', color: F.MUTED }}>
+ <td className={S.td} style={{ textAlign: 'left', color: F.MUTED }}>
{new Date(trade.timestamp).toLocaleString()}
</td>
- <td style={{
- ...tdStyle, textAlign: 'left', fontWeight: 700,
+ <td className={S.td + ' font-bold'} style={{
+ textAlign: 'left',
color: trade.side === 'BUY' ? F.GREEN : F.RED,
}}>
{trade.side}
</td>
- <td style={{ ...tdStyle, textAlign: 'right', color: F.WHITE }}>
+ <td className={S.td} style={{ textAlign: 'right', color: F.WHITE }}>
{trade.quantity}
</td>
- <td style={{ ...tdStyle, textAlign: 'right', color: F.CYAN }}>
+ <td className={S.td} style={{ textAlign: 'right', color: F.CYAN }}>
{trade.price.toFixed(2)}
</td>
- <td style={{
- ...tdStyle, textAlign: 'right', fontWeight: 700,
+ <td className={S.td + ' font-bold'} style={{
+ textAlign: 'right',
color: trade.pnl >= 0 ? F.GREEN : F.RED,
}}>
{trade.pnl >= 0 ? '+' : ''}{trade.pnl.toFixed(2)}
</td>
- <td style={{
- ...tdStyle, textAlign: 'left', color: F.MUTED,
- maxWidth: '200px', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
- }}>
+ <td
+ className={S.td + ' max-w-[220px] overflow-hidden text-ellipsis whitespace-nowrap'}
+ style={{ textAlign: 'left', color: F.MUTED }}
+ >
{trade.signal_reason}
</td>
</tr>
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/constants/styles.ts b/fincept-terminal-desktop/src/components/tabs/algo-trading/constants/styles.ts
new file mode 100644
index 000000000..07784fa63
--- /dev/null
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/constants/styles.ts
@@ -0,0 +1,48 @@
+// Reusable Tailwind class strings for Algo Trading tab UI
+// Dynamic colors still use inline style={{ }} with F constants from theme.ts
+
+export const S = {
+ // Section containers
+ section: 'rounded border border-[#2A2A2A] overflow-hidden',
+ sectionHeader: 'flex items-center gap-2 px-4 py-3 border-b border-[#2A2A2A]',
+ sectionBody: 'p-4',
+
+ // Typography
+ pageTitle: 'text-[15px] font-bold tracking-wide text-white',
+ heading: 'text-[13px] font-bold tracking-wide text-white',
+ body: 'text-[11px] text-white',
+ label: 'text-[10px] font-bold text-[#787878] tracking-wide uppercase mb-1.5 block',
+ muted: 'text-[10px] text-[#4A4A4A]',
+ secondary: 'text-[10px] text-[#787878]',
+
+ // Inputs
+ input: 'w-full px-3 py-2 bg-black text-white border border-[#2A2A2A] rounded text-[11px] font-mono outline-none transition-colors duration-200 focus:border-[#FF8800]',
+ select: 'bg-black text-white border border-[#2A2A2A] rounded px-3 py-2 text-[11px] font-mono outline-none transition-colors duration-200 focus:border-[#FF8800]',
+
+ // Buttons
+ btnPrimary: 'flex items-center justify-center gap-1.5 px-4 py-2 rounded text-[11px] font-bold tracking-wide cursor-pointer transition-all duration-200 border-none',
+ btnOutline: 'flex items-center gap-1.5 px-3 py-1.5 bg-transparent border border-[#2A2A2A] text-[#787878] rounded text-[10px] font-bold tracking-wide cursor-pointer transition-all duration-200 hover:border-[#FF8800] hover:text-white',
+ btnGhost: 'flex items-center gap-1.5 p-1.5 bg-transparent border-none text-[#787878] rounded cursor-pointer transition-all duration-200 hover:text-white hover:bg-[#1F1F1F]',
+ btnDanger: 'flex items-center gap-1.5 px-3 py-1.5 bg-transparent border border-[#2A2A2A] text-[#787878] rounded text-[10px] font-bold tracking-wide cursor-pointer transition-all duration-200 hover:border-[#FF3B3B] hover:text-[#FF3B3B]',
+
+ // Cards
+ card: 'rounded border border-[#2A2A2A] overflow-hidden transition-colors duration-200 hover:border-[#FF8800]/40',
+ cardHeader: 'px-4 py-3 border-b border-[#2A2A2A]',
+ cardBody: 'p-4',
+
+ // Badges
+ badge: 'text-[9px] font-bold px-2 py-0.5 rounded tracking-wide inline-flex items-center gap-1',
+
+ // Layout
+ modalOverlay: 'fixed inset-0 flex items-center justify-center z-[1000]',
+ flexCenter: 'flex items-center justify-center',
+ flexBetween: 'flex items-center justify-between',
+
+ // Table
+ th: 'px-3 py-2 text-[10px] font-bold text-[#787878] tracking-wide uppercase',
+ td: 'px-3 py-2 text-[11px] font-mono',
+
+ // Metric card
+ metricLabel: 'text-[10px] font-bold text-[#787878] tracking-wide flex items-center gap-1.5 mb-1.5',
+ metricValue: 'text-lg font-bold',
+} as const;
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/services/algoTradingService.ts b/fincept-terminal-desktop/src/components/tabs/algo-trading/services/algoTradingService.ts
index 10666c91f..33feec9fb 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/services/algoTradingService.ts
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/services/algoTradingService.ts
@@ -309,10 +309,8 @@ export async function stopOrderSignalBridge(): Promise<ApiResult> {
// ============================================================================
/** List all Python strategies from the library registry */
-export async function listPythonStrategies(
- category?: string
-): Promise<ApiResult<PythonStrategy[]>> {
- const raw = await invoke<string>('list_python_strategies', { category: category || null });
+export async function listPythonStrategies(): Promise<ApiResult<PythonStrategy[]>> {
+ const raw = await invoke<string>('list_python_strategies');
return parseResult(raw);
}
@@ -326,7 +324,7 @@ export async function getStrategyCategories(): Promise<ApiResult<string[]>> {
export async function getPythonStrategy(
strategyId: string
): Promise<ApiResult<PythonStrategy>> {
- const raw = await invoke<string>('get_python_strategy', { strategyId });
+ const raw = await invoke<string>('get_python_strategy', { id: strategyId });
return parseResult(raw);
}
@@ -334,7 +332,7 @@ export async function getPythonStrategy(
export async function getPythonStrategyCode(
strategyId: string
): Promise<ApiResult<{ code: string }>> {
- const raw = await invoke<string>('get_python_strategy_code', { strategyId });
+ const raw = await invoke<string>('get_python_strategy_code', { id: strategyId });
return parseResult(raw);
}
@@ -420,17 +418,52 @@ export async function validatePythonSyntax(
export async function runPythonBacktest(
request: PythonBacktestRequest
): Promise<ApiResult<PythonBacktestResult>> {
+ console.log('[algoTradingService] runPythonBacktest invoke params:', {
+ strategyId: request.strategy_id,
+ symbol: request.symbol,
+ startDate: request.start_date,
+ endDate: request.end_date,
+ initialCapital: request.initial_capital,
+ params: request.params || null,
+ });
const raw = await invoke<string>('run_python_backtest', {
strategyId: request.strategy_id,
- customCode: request.custom_code || null,
- symbols: request.symbols,
+ symbol: request.symbol,
startDate: request.start_date,
endDate: request.end_date,
- initialCash: request.initial_cash,
- parameters: request.parameters || {},
- dataProvider: request.data_provider,
+ initialCapital: request.initial_capital,
+ params: request.params || null,
});
- return parseResult(raw);
+ console.log('[algoTradingService] runPythonBacktest raw response:', raw);
+
+ // Rust now passes through the Python engine JSON directly:
+ // { success: true, trades: [...], equity_curve: [...], metrics: {...}, debug: [...] }
+ // or { success: false, error: "...", debug: [...] }
+ try {
+ const parsed = JSON.parse(raw) as Record<string, unknown>;
+ console.log('[algoTradingService] Parsed backtest response:', parsed);
+
+ if (!parsed.success) {
+ const debugInfo = parsed.debug as string[] | undefined;
+ if (debugInfo) {
+ console.warn('[algoTradingService] Backtest debug log:', debugInfo);
+ }
+ return { success: false, error: (parsed.error as string) || 'Backtest failed', debug: debugInfo };
+ }
+
+ // Map flat response to ApiResult<PythonBacktestResult>
+ const data: PythonBacktestResult = {
+ success: true,
+ trades: (parsed.trades || []) as PythonBacktestResult['trades'],
+ equity_curve: (parsed.equity_curve || []) as PythonBacktestResult['equity_curve'],
+ metrics: (parsed.metrics || {}) as PythonBacktestResult['metrics'],
+ debug: parsed.debug as string[] | undefined,
+ };
+ return { success: true, data };
+ } catch (e) {
+ console.error('[algoTradingService] Failed to parse backtest response:', e, raw);
+ return { success: false, error: 'Failed to parse backtest response' };
+ }
}
/** Extract parameters from Python strategy code */
@@ -438,7 +471,27 @@ export async function extractStrategyParameters(
code: string
): Promise<ApiResult<StrategyParameter[]>> {
const raw = await invoke<string>('extract_strategy_parameters', { code });
- return parseResult(raw);
+ console.log('[algoTradingService] extractStrategyParameters raw:', raw);
+
+ // Rust returns { success, parameters: [{ name, default, type }] }
+ // We need to map to ApiResult<StrategyParameter[]> with default_value field
+ try {
+ const parsed = JSON.parse(raw) as { success: boolean; parameters?: Array<{ name: string; default: string; type: string }>; error?: string };
+
+ if (parsed.success && parsed.parameters) {
+ const mapped: StrategyParameter[] = parsed.parameters.map(p => ({
+ name: p.name,
+ type: (p.type || 'string') as StrategyParameter['type'],
+ default_value: String(p.default ?? ''),
+ }));
+ console.log('[algoTradingService] Extracted parameters:', mapped);
+ return { success: true, data: mapped };
+ }
+
+ return { success: false, error: parsed.error || 'No parameters found' };
+ } catch {
+ return { success: false, error: 'Failed to parse parameter extraction response' };
+ }
}
// ============================================================================
diff --git a/fincept-terminal-desktop/src/components/tabs/algo-trading/types/index.ts b/fincept-terminal-desktop/src/components/tabs/algo-trading/types/index.ts
index 9a2e49d5f..44fd3d5fd 100644
--- a/fincept-terminal-desktop/src/components/tabs/algo-trading/types/index.ts
+++ b/fincept-terminal-desktop/src/components/tabs/algo-trading/types/index.ts
@@ -169,16 +169,14 @@ export interface StrategyParameter {
max?: number;
}
-/** Python backtest request */
+/** Python backtest request — matches Rust run_python_backtest command params */
export interface PythonBacktestRequest {
strategy_id: string;
- custom_code?: string; // Optional override
- symbols: string[];
+ symbol: string; // comma-separated symbols (Rust param: symbol)
start_date: string;
end_date: string;
- initial_cash: number;
- parameters?: Record<string, string>;
- data_provider: 'yfinance' | 'fyers';
+ initial_capital: number; // Rust param: initial_capital
+ params?: string; // JSON-stringified parameters (Rust param: params: Option<String>)
}
/** Python backtest result */
diff --git a/fincept-terminal-desktop/src/components/tabs/code-editor/FinScriptDocsPanel.tsx b/fincept-terminal-desktop/src/components/tabs/code-editor/FinScriptDocsPanel.tsx
index 8cc20913a..82a50fd69 100644
--- a/fincept-terminal-desktop/src/components/tabs/code-editor/FinScriptDocsPanel.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/code-editor/FinScriptDocsPanel.tsx
@@ -58,7 +58,7 @@ export const FinScriptDocsPanel: React.FC<FinScriptDocsPanelProps> = ({ onClose,
if (line.trimStart().startsWith('•') || line.trimStart().startsWith('-')) {
const bulletItems: string[] = [];
while (i < lines.length && (lines[i].trimStart().startsWith('•') || lines[i].trimStart().startsWith('-'))) {
- bulletItems.push(lines[i].trimStart().replace(/^[•\-]\s*/, ''));
+ bulletItems.push(lines[i].trimStart().replace(/^[•-]\s*/, ''));
i++;
}
elements.push(
diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/AddWidgetModal.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/AddWidgetModal.tsx
index 116b7d821..d47a4f547 100644
--- a/fincept-terminal-desktop/src/components/tabs/dashboard/AddWidgetModal.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/AddWidgetModal.tsx
@@ -6,7 +6,7 @@ import { X, Plus, Newspaper, BarChart3, Eye, MessageSquare, Bitcoin,
Package, Globe, DollarSign, Ship, Database, TrendingUp,
Activity, Briefcase, Bell, Calendar, Zap, Shield, LineChart, StickyNote,
Quote, ArrowUpDown, Search, AlertTriangle, Brain, Bot, Trophy, TestTube,
- BellRing, Cpu, DatabaseZap, Flag, Anchor } from 'lucide-react';
+ BellRing, Cpu, DatabaseZap, Flag, Anchor, Video } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { WidgetType, DEFAULT_WIDGET_CONFIGS } from './widgets';
import { watchlistService } from '../../../services/core/watchlistService';
@@ -78,6 +78,7 @@ const WIDGET_OPTIONS: WidgetOption[] = [
{ type: 'alphaarena', label: 'ALPHA ARENA', description: 'AI model competition leaderboard', icon: <Trophy size={14} />, color: FC.YELLOW, category: 'tools' },
{ type: 'watchlistalerts', label: 'WATCHLIST ALERTS', description: 'Big movers in your watchlists', icon: <BellRing size={14} />, color: FC.ORANGE, category: 'tools' },
{ type: 'livesignals', label: 'LIVE SIGNALS', description: 'AI Quant Lab trading signals', icon: <Cpu size={14} />, color: FC.GREEN, category: 'tools' },
+ { type: 'videoplayer', label: 'VIDEO PLAYER', description: 'Live financial TV streams and custom video URLs', icon: <Video size={14} />, color: FC.PURPLE, category: 'tools' },
];
const CATEGORIES = [
@@ -106,6 +107,8 @@ export const AddWidgetModal: React.FC<AddWidgetModalProps> = ({
const [screenerPreset, setScreenerPreset] = useState<'value' | 'growth' | 'momentum'>('value');
const [alertThreshold, setAlertThreshold] = useState(3);
const [dbnomicsSeriesId, setDbnomicsSeriesId] = useState('FRED/UNRATE');
+ const [videoUrl, setVideoUrl] = useState('');
+ const [videoTitle, setVideoTitle] = useState('Video Player');
const { t } = useTranslation('dashboard');
useEffect(() => {
@@ -141,23 +144,26 @@ export const AddWidgetModal: React.FC<AddWidgetModalProps> = ({
case 'news':
config = { newsCategory, newsLimit: 5 };
break;
- case 'market':
+ case 'market': {
const tickers = marketCategory === 'Indices' ? ['^GSPC', '^IXIC', '^DJI', '^RUT']
: marketCategory === 'Tech' ? ['AAPL', 'MSFT', 'GOOGL', 'AMZN', 'NVDA']
: ['GC=F', 'CL=F', 'SI=F'];
config = { marketCategory, marketTickers: tickers };
break;
- case 'watchlist':
+ }
+ case 'watchlist': {
const wl = watchlists.find(w => w.id === selectedWatchlist);
config = { watchlistId: selectedWatchlist, watchlistName: wl?.name || 'Watchlist' };
break;
+ }
case 'forum':
config = { forumCategoryName: forumCategory, forumLimit: 5 };
break;
- case 'datasource':
+ case 'datasource': {
const ds = dataSources.find(d => d.alias === selectedDataSource);
config = { dataSourceAlias: selectedDataSource, dataSourceDisplayName: ds?.display_name };
break;
+ }
case 'stockquote':
config = { stockSymbol };
break;
@@ -170,6 +176,9 @@ export const AddWidgetModal: React.FC<AddWidgetModalProps> = ({
case 'dbnomics':
config = { dbnomicsSeriesId };
break;
+ case 'videoplayer':
+ config = { videoUrl: videoUrl.trim(), videoTitle: videoTitle.trim() || 'Video Player' };
+ break;
}
onAdd(selectedType, config);
onClose();
@@ -490,7 +499,49 @@ export const AddWidgetModal: React.FC<AddWidgetModalProps> = ({
/>
)}
- {!['news', 'market', 'watchlist', 'forum', 'datasource', 'stockquote', 'screener', 'watchlistalerts', 'dbnomics'].includes(selectedType) && (
+ {selectedType === 'videoplayer' && (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
+ <input
+ type="text"
+ value={videoTitle}
+ onChange={(e) => setVideoTitle(e.target.value)}
+ placeholder="Widget title (e.g. Bloomberg TV)"
+ style={{
+ width: '100%',
+ padding: '6px 8px',
+ backgroundColor: FC.DARK_BG,
+ border: `1px solid ${FC.BORDER}`,
+ color: FC.WHITE,
+ fontSize: '10px',
+ borderRadius: '2px',
+ fontFamily: '"IBM Plex Mono", monospace',
+ boxSizing: 'border-box',
+ }}
+ />
+ <input
+ type="text"
+ value={videoUrl}
+ onChange={(e) => setVideoUrl(e.target.value)}
+ placeholder="YouTube, HLS (.m3u8) or MP4 URL — leave blank to pick preset"
+ style={{
+ width: '100%',
+ padding: '6px 8px',
+ backgroundColor: FC.DARK_BG,
+ border: `1px solid ${FC.BORDER}`,
+ color: FC.WHITE,
+ fontSize: '10px',
+ borderRadius: '2px',
+ fontFamily: '"IBM Plex Mono", monospace',
+ boxSizing: 'border-box',
+ }}
+ />
+ <div style={{ fontSize: '9px', color: FC.MUTED }}>
+ Supports YouTube links, HLS streams (.m3u8), and MP4 files. Leave blank to choose from preset financial channels.
+ </div>
+ </div>
+ )}
+
+ {!['news', 'market', 'watchlist', 'forum', 'datasource', 'stockquote', 'screener', 'watchlistalerts', 'dbnomics', 'videoplayer'].includes(selectedType) && (
<InfoText text={selectedOption?.description || 'No additional configuration needed.'} />
)}
diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/DashboardTab.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/DashboardTab.tsx
index 54cca9d13..8a0313997 100644
--- a/fincept-terminal-desktop/src/components/tabs/dashboard/DashboardTab.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/DashboardTab.tsx
@@ -49,6 +49,7 @@ import {
DBnomicsWidget,
AkShareWidget,
MaritimeWidget,
+ VideoPlayerWidget,
WidgetType,
WidgetConfig
} from './widgets';
@@ -446,19 +447,20 @@ const DashboardTab: React.FC<DashboardTabProps> = ({ onNavigateToTab }) => {
// Add widget
const handleAddWidget = useCallback((widgetType: WidgetType, config?: any) => {
+ const isVideoPlayer = widgetType === 'videoplayer';
const newWidget: WidgetInstance = {
id: `${widgetType}-${state.nextId}`,
type: widgetType,
- title: config?.watchlistName || config?.marketCategory || config?.newsCategory || config?.forumCategoryName || widgetType,
+ title: config?.videoTitle || config?.watchlistName || config?.marketCategory || config?.newsCategory || config?.forumCategoryName || widgetType,
config: config || {},
layout: {
i: `${widgetType}-${state.nextId}`,
x: (state.widgets.length * 4) % 12,
y: Infinity,
- w: 4,
- h: 4,
- minW: 2,
- minH: 3,
+ w: isVideoPlayer ? 6 : 4,
+ h: isVideoPlayer ? 6 : 4,
+ minW: isVideoPlayer ? 4 : 2,
+ minH: isVideoPlayer ? 5 : 3,
},
};
dispatch({ type: 'ADD_WIDGET', widget: newWidget });
@@ -581,6 +583,8 @@ const DashboardTab: React.FC<DashboardTabProps> = ({ onNavigateToTab }) => {
return <AkShareWidget id={widget.id} onRemove={() => handleRemoveWidget(widget.id)} onNavigate={() => onNavigateToTab?.('akshare-data')} />;
case 'maritime':
return <MaritimeWidget id={widget.id} onRemove={() => handleRemoveWidget(widget.id)} onNavigate={() => onNavigateToTab?.('maritime')} />;
+ case 'videoplayer':
+ return <VideoPlayerWidget id={widget.id} videoUrl={widget.config?.videoUrl} videoTitle={widget.config?.videoTitle} onRemove={() => handleRemoveWidget(widget.id)} onConfigure={() => handleConfigureWidget(widget.id)} />;
default:
return <div style={{ padding: '12px', color: FC.MUTED, fontSize: '10px' }}>UNKNOWN WIDGET</div>;
}
diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/WidgetSettingsModal.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/WidgetSettingsModal.tsx
index fbaa08675..09f72e730 100644
--- a/fincept-terminal-desktop/src/components/tabs/dashboard/WidgetSettingsModal.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/WidgetSettingsModal.tsx
@@ -529,6 +529,91 @@ export const WidgetSettingsModal: React.FC<WidgetSettingsModalProps> = ({
</div>
);
+ case 'videoplayer':
+ return (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
+ <div>
+ <label style={{ fontSize: '9px', color: FC.GRAY, fontWeight: 700, display: 'block', marginBottom: '4px' }}>
+ WIDGET TITLE
+ </label>
+ <input
+ type="text"
+ value={config.videoTitle || 'Video Player'}
+ onChange={(e) => setConfig({ ...config, videoTitle: e.target.value })}
+ placeholder="e.g. Bloomberg TV"
+ style={{
+ width: '100%',
+ padding: '6px 8px',
+ backgroundColor: FC.DARK_BG,
+ border: `1px solid ${FC.BORDER}`,
+ color: FC.WHITE,
+ fontSize: '10px',
+ borderRadius: '2px',
+ fontFamily: '"IBM Plex Mono", monospace',
+ boxSizing: 'border-box',
+ }}
+ />
+ </div>
+ <div>
+ <label style={{ fontSize: '9px', color: FC.GRAY, fontWeight: 700, display: 'block', marginBottom: '4px' }}>
+ VIDEO URL
+ </label>
+ <input
+ type="text"
+ value={config.videoUrl || ''}
+ onChange={(e) => setConfig({ ...config, videoUrl: e.target.value })}
+ placeholder="YouTube, HLS (.m3u8), or MP4 URL"
+ style={{
+ width: '100%',
+ padding: '6px 8px',
+ backgroundColor: FC.DARK_BG,
+ border: `1px solid ${FC.BORDER}`,
+ color: FC.WHITE,
+ fontSize: '10px',
+ borderRadius: '2px',
+ fontFamily: '"IBM Plex Mono", monospace',
+ boxSizing: 'border-box',
+ }}
+ />
+ <div style={{ fontSize: '8px', color: FC.MUTED, marginTop: '4px' }}>
+ Supports YouTube links, HLS streams (.m3u8), and MP4 URLs. Leave blank to show preset channels.
+ </div>
+ </div>
+ <div>
+ <label style={{ fontSize: '9px', color: FC.GRAY, fontWeight: 700, display: 'block', marginBottom: '6px' }}>
+ PRESET CHANNELS
+ </label>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
+ {[
+ { url: 'https://www.youtube.com/watch?v=dp8PhLsUcFE', label: 'Bloomberg TV' },
+ { url: 'https://www.youtube.com/watch?v=9ApRjK3RVSY', label: 'CNBC Live' },
+ { url: 'https://www.youtube.com/watch?v=vAvNMaWlkrc', label: 'Reuters TV' },
+ { url: 'https://www.youtube.com/watch?v=WUm7b7GiTFM', label: 'Yahoo Finance' },
+ { url: 'https://www.youtube.com/watch?v=6IlWB5R_Oso', label: 'Fox Business' },
+ ].map(ch => (
+ <button
+ key={ch.url}
+ onClick={() => setConfig({ ...config, videoUrl: ch.url, videoTitle: ch.label })}
+ style={{
+ padding: '5px 8px',
+ backgroundColor: config.videoUrl === ch.url ? FC.ORANGE + '20' : FC.DARK_BG,
+ border: `1px solid ${config.videoUrl === ch.url ? FC.ORANGE : FC.BORDER}`,
+ color: config.videoUrl === ch.url ? FC.ORANGE : FC.GRAY,
+ fontSize: '9px',
+ borderRadius: '2px',
+ cursor: 'pointer',
+ fontFamily: '"IBM Plex Mono", monospace',
+ textAlign: 'left',
+ }}
+ >
+ {ch.label}
+ </button>
+ ))}
+ </div>
+ </div>
+ </div>
+ );
+
case 'notes':
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
@@ -594,7 +679,7 @@ export const WidgetSettingsModal: React.FC<WidgetSettingsModalProps> = ({
// Non-configurable widgets
const isConfigurable = [
'news', 'market', 'watchlist', 'forum', 'datasource', 'calendar', 'notes',
- 'stockquote', 'screener', 'watchlistalerts', 'dbnomics', 'performance'
+ 'stockquote', 'screener', 'watchlistalerts', 'dbnomics', 'performance', 'videoplayer'
].includes(widgetType);
return (
diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/VideoPlayerWidget.tsx b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/VideoPlayerWidget.tsx
new file mode 100644
index 000000000..02775052b
--- /dev/null
+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/VideoPlayerWidget.tsx
@@ -0,0 +1,264 @@
+import React, { useEffect, useRef, useState } from 'react';
+import { Play, Settings } from 'lucide-react';
+import { BaseWidget } from './BaseWidget';
+
+interface VideoPlayerWidgetProps {
+ id: string;
+ videoUrl?: string;
+ videoTitle?: string;
+ onRemove?: () => void;
+ onConfigure?: () => void;
+}
+
+interface PresetChannel {
+ name: string;
+ label: string;
+ url: string;
+ type: 'youtube' | 'hls' | 'mp4';
+}
+
+const PRESET_CHANNELS: PresetChannel[] = [
+ {
+ name: 'Bloomberg TV',
+ label: 'BLOOMBERG',
+ url: 'https://www.youtube.com/watch?v=dp8PhLsUcFE',
+ type: 'youtube',
+ },
+ {
+ name: 'CNBC Live',
+ label: 'CNBC',
+ url: 'https://www.youtube.com/watch?v=9ApRjK3RVSY',
+ type: 'youtube',
+ },
+ {
+ name: 'Reuters TV',
+ label: 'REUTERS',
+ url: 'https://www.youtube.com/watch?v=vAvNMaWlkrc',
+ type: 'youtube',
+ },
+ {
+ name: 'Yahoo Finance',
+ label: 'YAHOO FINANCE',
+ url: 'https://www.youtube.com/watch?v=WUm7b7GiTFM',
+ type: 'youtube',
+ },
+ {
+ name: 'Fox Business',
+ label: 'FOX BUSINESS',
+ url: 'https://www.youtube.com/watch?v=6IlWB5R_Oso',
+ type: 'youtube',
+ },
+];
+
+function getYouTubeEmbedUrl(url: string): string | null {
+ const patterns = [
+ /(?:youtube\.com\/watch\?v=|youtu\.be\/)([A-Za-z0-9_-]{11})/,
+ /youtube\.com\/live\/([A-Za-z0-9_-]{11})/,
+ /youtube\.com\/embed\/([A-Za-z0-9_-]{11})/,
+ ];
+ for (const pattern of patterns) {
+ const match = url.match(pattern);
+ if (match) return `https://www.youtube.com/embed/${match[1]}?autoplay=1&mute=1`;
+ }
+ return null;
+}
+
+function isYouTubeUrl(url: string): boolean {
+ return url.includes('youtube.com') || url.includes('youtu.be');
+}
+
+function isHlsUrl(url: string): boolean {
+ return url.includes('.m3u8');
+}
+
+export const VideoPlayerWidget: React.FC<VideoPlayerWidgetProps> = ({
+ id,
+ videoUrl = '',
+ videoTitle = 'Video Player',
+ onRemove,
+ onConfigure,
+}) => {
+ const playerContainerRef = useRef<HTMLDivElement>(null);
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const playerInstanceRef = useRef<any>(null);
+ const [playerError, setPlayerError] = useState<string | null>(null);
+
+ const trimmedUrl = videoUrl.trim();
+ const isYouTube = trimmedUrl ? isYouTubeUrl(trimmedUrl) : false;
+ const isHls = trimmedUrl ? isHlsUrl(trimmedUrl) : false;
+ const useXgplayer = trimmedUrl && !isYouTube;
+
+ // Initialize xgplayer for HLS/MP4 URLs
+ useEffect(() => {
+ if (!useXgplayer || !playerContainerRef.current) return;
+
+ let destroyed = false;
+
+ const initPlayer = async () => {
+ try {
+ // Dynamically import xgplayer to avoid SSR issues
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const { default: Player } = await import('xgplayer') as { default: any };
+
+ const playerConfig: Record<string, unknown> = {
+ el: playerContainerRef.current,
+ url: trimmedUrl,
+ width: '100%',
+ height: '100%',
+ autoplay: false,
+ volume: 0.5,
+ lang: 'en',
+ fluid: true,
+ };
+
+ if (isHls) {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const { default: HlsPlugin } = await import('xgplayer-hls') as { default: any };
+ playerConfig.plugins = [HlsPlugin];
+ }
+
+ if (destroyed) return;
+
+ playerInstanceRef.current = new Player(playerConfig);
+ } catch (err: unknown) {
+ if (!destroyed) {
+ setPlayerError(err instanceof Error ? err.message : 'Failed to load player');
+ }
+ }
+ };
+
+ setPlayerError(null);
+ initPlayer();
+
+ return () => {
+ destroyed = true;
+ if (playerInstanceRef.current) {
+ try {
+ playerInstanceRef.current.destroy();
+ } catch {
+ /* ignore destroy errors */
+ }
+ playerInstanceRef.current = null;
+ }
+ };
+ }, [trimmedUrl, useXgplayer, isHls]);
+
+ const renderContent = () => {
+ // No URL configured — show preset channels
+ if (!trimmedUrl) {
+ return (
+ <div style={{ padding: '8px', height: '100%', overflowY: 'auto' }}>
+ <div style={{
+ fontSize: '9px',
+ color: '#787878',
+ marginBottom: '10px',
+ textTransform: 'uppercase',
+ letterSpacing: '1px',
+ }}>
+ SELECT A CHANNEL OR CONFIGURE A CUSTOM URL
+ </div>
+ {PRESET_CHANNELS.map((ch) => (
+ <div
+ key={ch.name}
+ onClick={onConfigure}
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: '8px',
+ padding: '8px',
+ marginBottom: '4px',
+ backgroundColor: '#0F0F0F',
+ border: '1px solid #2A2A2A',
+ borderRadius: '2px',
+ cursor: 'pointer',
+ transition: 'border-color 0.15s',
+ }}
+ onMouseEnter={(e) => { (e.currentTarget as HTMLDivElement).style.borderColor = '#FF8800'; }}
+ onMouseLeave={(e) => { (e.currentTarget as HTMLDivElement).style.borderColor = '#2A2A2A'; }}
+ >
+ <Play size={10} color="#FF8800" />
+ <div>
+ <div style={{ fontSize: '10px', color: '#FFFFFF', fontWeight: 'bold', fontFamily: 'monospace' }}>
+ {ch.label}
+ </div>
+ <div style={{ fontSize: '9px', color: '#787878' }}>{ch.name}</div>
+ </div>
+ </div>
+ ))}
+ <div
+ onClick={onConfigure}
+ style={{
+ marginTop: '8px',
+ padding: '8px',
+ border: '1px dashed #2A2A2A',
+ borderRadius: '2px',
+ textAlign: 'center',
+ cursor: 'pointer',
+ fontSize: '9px',
+ color: '#787878',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ gap: '4px',
+ }}
+ onMouseEnter={(e) => { (e.currentTarget as HTMLDivElement).style.borderColor = '#FF8800'; (e.currentTarget as HTMLDivElement).style.color = '#FF8800'; }}
+ onMouseLeave={(e) => { (e.currentTarget as HTMLDivElement).style.borderColor = '#2A2A2A'; (e.currentTarget as HTMLDivElement).style.color = '#787878'; }}
+ >
+ <Settings size={10} /> CONFIGURE CUSTOM URL
+ </div>
+ </div>
+ );
+ }
+
+ // YouTube — use iframe embed
+ if (isYouTube) {
+ const embedUrl = getYouTubeEmbedUrl(trimmedUrl);
+ if (!embedUrl) {
+ return (
+ <div style={{ padding: '16px', textAlign: 'center', color: '#FF3B3B', fontSize: '11px' }}>
+ Invalid YouTube URL
+ </div>
+ );
+ }
+ return (
+ <iframe
+ src={embedUrl}
+ style={{ width: '100%', height: '100%', border: 'none', display: 'block' }}
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
+ allowFullScreen
+ title={videoTitle}
+ />
+ );
+ }
+
+ // HLS / MP4 — xgplayer container
+ if (playerError) {
+ return (
+ <div style={{ padding: '16px', textAlign: 'center', color: '#FF3B3B', fontSize: '11px' }}>
+ {playerError}
+ </div>
+ );
+ }
+
+ return (
+ <div
+ ref={playerContainerRef}
+ style={{ width: '100%', height: '100%' }}
+ />
+ );
+ };
+
+ return (
+ <BaseWidget
+ id={id}
+ title={videoTitle.toUpperCase() || 'VIDEO PLAYER'}
+ onRemove={onRemove}
+ onConfigure={onConfigure}
+ headerColor="#9D4EDD"
+ >
+ <div style={{ width: '100%', height: 'calc(100% - 32px)', overflow: 'hidden' }}>
+ {renderContent()}
+ </div>
+ </BaseWidget>
+ );
+};
diff --git a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/index.ts b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/index.ts
index 0eeb25cbd..38d4e0164 100644
--- a/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/index.ts
+++ b/fincept-terminal-desktop/src/components/tabs/dashboard/widgets/index.ts
@@ -29,6 +29,7 @@ export { LiveSignalsWidget } from './LiveSignalsWidget';
export { DBnomicsWidget } from './DBnomicsWidget';
export { AkShareWidget } from './AkShareWidget';
export { MaritimeWidget } from './MaritimeWidget';
+export { VideoPlayerWidget } from './VideoPlayerWidget';
// Widget type definitions
export type WidgetType =
@@ -62,7 +63,8 @@ export type WidgetType =
| 'livesignals'
| 'dbnomics'
| 'akshare'
- | 'maritime';
+ | 'maritime'
+ | 'videoplayer';
export interface WidgetConfig {
id: string;
@@ -114,6 +116,10 @@ export interface WidgetConfig {
// DBnomics widget config
dbnomicsSeriesId?: string;
+ // Video Player widget config
+ videoUrl?: string;
+ videoTitle?: string;
+
};
}
@@ -289,5 +295,10 @@ export const DEFAULT_WIDGET_CONFIGS: Record<WidgetType, Partial<WidgetConfig>> =
type: 'maritime',
title: 'Maritime Sector',
config: {}
+ },
+ videoplayer: {
+ type: 'videoplayer',
+ title: 'Video Player',
+ config: { videoUrl: '', videoTitle: 'Video Player' }
}
};
diff --git a/fincept-terminal-desktop/src/components/tabs/data-mapping/DataMappingTab.tsx b/fincept-terminal-desktop/src/components/tabs/data-mapping/DataMappingTab.tsx
index 494a07fe3..af06946c7 100644
--- a/fincept-terminal-desktop/src/components/tabs/data-mapping/DataMappingTab.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/data-mapping/DataMappingTab.tsx
@@ -217,7 +217,7 @@ export default function DataMappingTab() {
}, []);
const initializeDatabase = async () => {
- try { await mappingDatabase.initialize(); } catch {}
+ try { await mappingDatabase.initialize(); } catch { /* db init failed, will retry on next use */ }
};
const loadSavedMappings = async () => {
@@ -225,7 +225,7 @@ export default function DataMappingTab() {
try {
const mappings = await mappingDatabase.getAllMappings();
dispatch({ type: 'SET_MAPPINGS', payload: mappings });
- } catch {}
+ } catch { /* failed to load mappings, start with empty state */ }
finally { dispatch({ type: 'SET_LOADING', payload: false }); }
};
diff --git a/fincept-terminal-desktop/src/components/tabs/data-mapping/engine/parsers/DirectParser.ts b/fincept-terminal-desktop/src/components/tabs/data-mapping/engine/parsers/DirectParser.ts
index 30ec2bd86..eb6cee0ff 100644
--- a/fincept-terminal-desktop/src/components/tabs/data-mapping/engine/parsers/DirectParser.ts
+++ b/fincept-terminal-desktop/src/components/tabs/data-mapping/engine/parsers/DirectParser.ts
@@ -20,7 +20,7 @@ export class DirectParser extends BaseParser {
}
// Simple validation - check for valid characters
- if (!/^[a-zA-Z0-9_.\[\]]+$/.test(expression)) {
+ if (!/^[a-zA-Z0-9_.[\]]+$/.test(expression)) {
return {
valid: false,
error: 'Expression can only contain alphanumeric characters, dots, and brackets'
diff --git a/fincept-terminal-desktop/src/components/tabs/data-mapping/engine/parsers/JSONPathParser.ts b/fincept-terminal-desktop/src/components/tabs/data-mapping/engine/parsers/JSONPathParser.ts
index 7bd20e99a..98496fca3 100644
--- a/fincept-terminal-desktop/src/components/tabs/data-mapping/engine/parsers/JSONPathParser.ts
+++ b/fincept-terminal-desktop/src/components/tabs/data-mapping/engine/parsers/JSONPathParser.ts
@@ -120,7 +120,7 @@ Multiple Selection:
*/
pathToKeys(expression: string): string[] {
// Remove leading $
- let path = expression.replace(/^\$\.?/, '');
+ const path = expression.replace(/^\$\.?/, '');
// Split by . but respect brackets
const keys: string[] = [];
diff --git a/fincept-terminal-desktop/src/components/tabs/data-mapping/services/EncryptionService.ts b/fincept-terminal-desktop/src/components/tabs/data-mapping/services/EncryptionService.ts
index 052cd6ab7..f33bc64b3 100644
--- a/fincept-terminal-desktop/src/components/tabs/data-mapping/services/EncryptionService.ts
+++ b/fincept-terminal-desktop/src/components/tabs/data-mapping/services/EncryptionService.ts
@@ -20,7 +20,7 @@ class EncryptionService {
if (!enabled) return;
// PURE SQLite - Get or generate encryption key
- let keyData = await getSetting(EncryptionService.STORAGE_KEY);
+ const keyData = await getSetting(EncryptionService.STORAGE_KEY);
if (!keyData) {
// Generate new key
diff --git a/fincept-terminal-desktop/src/components/tabs/docs/DocsTab.tsx b/fincept-terminal-desktop/src/components/tabs/docs/DocsTab.tsx
index 8c52aa5b6..3f0fd561b 100644
--- a/fincept-terminal-desktop/src/components/tabs/docs/DocsTab.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/docs/DocsTab.tsx
@@ -147,7 +147,7 @@ function ContentRenderer({ content, colors }: { content: string; colors: ReturnT
if (line.trimStart().startsWith('•') || line.trimStart().startsWith('-')) {
const bulletItems: string[] = [];
while (i < lines.length && (lines[i].trimStart().startsWith('•') || lines[i].trimStart().startsWith('-'))) {
- bulletItems.push(lines[i].trimStart().replace(/^[•\-]\s*/, ''));
+ bulletItems.push(lines[i].trimStart().replace(/^[•-]\s*/, ''));
i++;
}
elements.push(
@@ -481,10 +481,108 @@ function OutputPanel({ result, isRunning, colors }: {
);
}
+// ─── RunnableCodeBlock ───────────────────────────────────────────────────────
+// Extracted as a proper component so hooks (useState, useMemo) are valid
+
+interface RunnableCodeBlockProps {
+ code: string;
+ colors: ReturnType<typeof getColors>;
+ activeCode: string | null;
+ isRunning: boolean;
+ onRun: (code: string) => void;
+}
+
+function RunnableCodeBlock({ code, colors: c, activeCode, isRunning, onRun }: RunnableCodeBlockProps) {
+ const [copied, setCopied] = useState(false);
+ const highlighted = useMemo(() => highlightCode(code, c), [code, c]);
+ const isActive = activeCode === code;
+
+ const handleCopy = () => {
+ navigator.clipboard.writeText(code).then(() => {
+ setCopied(true);
+ setTimeout(() => setCopied(false), 2000);
+ });
+ };
+
+ return (
+ <div style={{
+ margin: '8px 0',
+ backgroundColor: '#0d0d0d',
+ border: `1px solid ${isActive ? c.ORANGE : '#222'}`,
+ borderRadius: '3px',
+ overflow: 'hidden',
+ transition: 'border-color 0.2s'
+ }}>
+ <div style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ padding: '3px 8px',
+ backgroundColor: '#141414',
+ borderBottom: `1px solid #222`
+ }}>
+ <span style={{ fontSize: '9px', color: c.ORANGE, letterSpacing: '0.5px', fontWeight: 'bold' }}>FINSCRIPT</span>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
+ <button
+ onClick={handleCopy}
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: '3px',
+ background: 'none',
+ border: 'none',
+ color: copied ? c.GREEN : c.GRAY,
+ fontSize: '9px',
+ cursor: 'pointer',
+ padding: '2px 5px'
+ }}
+ >
+ {copied ? <Check size={9} /> : <Copy size={9} />}
+ {copied ? 'COPIED' : 'COPY'}
+ </button>
+ <button
+ onClick={() => onRun(code)}
+ disabled={isRunning}
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: '3px',
+ backgroundColor: isRunning ? '#333' : c.ORANGE,
+ color: isRunning ? c.GRAY : '#000',
+ border: 'none',
+ fontSize: '9px',
+ fontWeight: 'bold',
+ cursor: isRunning ? 'not-allowed' : 'pointer',
+ padding: '2px 8px',
+ borderRadius: '2px'
+ }}
+ >
+ {isRunning ? <Square size={8} /> : <Play size={8} />}
+ {isRunning ? 'RUNNING' : 'RUN'}
+ </button>
+ </div>
+ </div>
+ <pre style={{
+ margin: 0,
+ padding: '8px',
+ overflowX: 'auto',
+ fontSize: '10px',
+ lineHeight: '1.5',
+ fontFamily: 'Consolas, monospace',
+ color: c.WHITE,
+ maxHeight: '300px',
+ overflowY: 'auto'
+ }}>
+ <code dangerouslySetInnerHTML={{ __html: highlighted }} />
+ </pre>
+ </div>
+ );
+}
+
// ─── Main Component ─────────────────────────────────────────────────────────
export default function DocsTab() {
- const { colors: themeColors } = useTerminalTheme();
+ useTerminalTheme();
const COLORS = getColors();
const [expandedSections, setExpandedSections] = useState<Record<string, boolean>>(() => {
@@ -581,92 +679,7 @@ export default function DocsTab() {
}, []);
// Runnable code block component
- const RunnableCodeBlock = useCallback(({ code, colors: c }: { code: string; colors: ReturnType<typeof getColors> }) => {
- const [copied, setCopied] = useState(false);
- const highlighted = useMemo(() => highlightCode(code, c), [code, c]);
- const isActive = activeCode === code;
-
- const handleCopy = () => {
- navigator.clipboard.writeText(code).then(() => {
- setCopied(true);
- setTimeout(() => setCopied(false), 2000);
- });
- };
-
- return (
- <div style={{
- margin: '8px 0',
- backgroundColor: '#0d0d0d',
- border: `1px solid ${isActive ? c.ORANGE : '#222'}`,
- borderRadius: '3px',
- overflow: 'hidden',
- transition: 'border-color 0.2s'
- }}>
- <div style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- padding: '3px 8px',
- backgroundColor: '#141414',
- borderBottom: `1px solid #222`
- }}>
- <span style={{ fontSize: '9px', color: c.ORANGE, letterSpacing: '0.5px', fontWeight: 'bold' }}>FINSCRIPT</span>
- <div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
- <button
- onClick={handleCopy}
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: '3px',
- background: 'none',
- border: 'none',
- color: copied ? c.GREEN : c.GRAY,
- fontSize: '9px',
- cursor: 'pointer',
- padding: '2px 5px'
- }}
- >
- {copied ? <Check size={9} /> : <Copy size={9} />}
- {copied ? 'COPIED' : 'COPY'}
- </button>
- <button
- onClick={() => runCode(code)}
- disabled={isRunning}
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: '3px',
- backgroundColor: isRunning ? '#333' : c.ORANGE,
- color: isRunning ? c.GRAY : '#000',
- border: 'none',
- fontSize: '9px',
- fontWeight: 'bold',
- cursor: isRunning ? 'not-allowed' : 'pointer',
- padding: '2px 8px',
- borderRadius: '2px'
- }}
- >
- {isRunning ? <Square size={8} /> : <Play size={8} />}
- {isRunning ? 'RUNNING' : 'RUN'}
- </button>
- </div>
- </div>
- <pre style={{
- margin: 0,
- padding: '8px',
- overflowX: 'auto',
- fontSize: '10px',
- lineHeight: '1.5',
- fontFamily: 'Consolas, monospace',
- color: c.WHITE,
- maxHeight: '300px',
- overflowY: 'auto'
- }}>
- <code dangerouslySetInnerHTML={{ __html: highlighted }} />
- </pre>
- </div>
- );
- }, [activeCode, isRunning, runCode]);
+ // RunnableCodeBlock is defined as a proper component above DocsTab (hooks-safe)
return (
<div
@@ -947,7 +960,13 @@ export default function DocsTab() {
{isFinScriptSection ? 'RUNNABLE EXAMPLE' : 'EXAMPLE'}
</div>
{isFinScriptSection ? (
- <RunnableCodeBlock code={currentContent.codeExample} colors={COLORS} />
+ <RunnableCodeBlock
+ code={currentContent.codeExample}
+ colors={COLORS}
+ activeCode={activeCode}
+ isRunning={isRunning}
+ onRun={runCode}
+ />
) : (
<CodeBlock code={currentContent.codeExample} colors={COLORS} />
)}
diff --git a/fincept-terminal-desktop/src/components/tabs/economics/hooks/useEconomicsData.ts b/fincept-terminal-desktop/src/components/tabs/economics/hooks/useEconomicsData.ts
index d9c9a3d90..8f2943b5b 100644
--- a/fincept-terminal-desktop/src/components/tabs/economics/hooks/useEconomicsData.ts
+++ b/fincept-terminal-desktop/src/components/tabs/economics/hooks/useEconomicsData.ts
@@ -310,7 +310,7 @@ export function useEconomicsData(): UseEconomicsDataReturn {
}
break;
- case 'adb':
+ case 'adb': {
// Check if country has ADB code
if (!country?.adb) {
throw new Error(`${country?.name || selectedCountry} is not available in ADB database. ADB covers Asia-Pacific region only.`);
@@ -341,6 +341,7 @@ export function useEconomicsData(): UseEconomicsDataReturn {
}) as string;
}
break;
+ }
case 'fed':
// Federal Reserve data - US only, no country selection needed
@@ -409,7 +410,7 @@ export function useEconomicsData(): UseEconomicsDataReturn {
}) as string;
break;
- case 'unesco':
+ case 'unesco': {
// UNESCO UIS uses 3-letter ISO country codes and year-based dates
const unescoStartYear = startDate.substring(0, 4);
const unescoEndYear = endDate.substring(0, 4);
@@ -419,6 +420,7 @@ export function useEconomicsData(): UseEconomicsDataReturn {
env: {},
}) as string;
break;
+ }
case 'fiscaldata':
// FiscalData is US-only, uses full date range (YYYY-MM-DD)
@@ -486,7 +488,7 @@ export function useEconomicsData(): UseEconomicsDataReturn {
if (!finceptResponse.ok) {
const errBody = await finceptResponse.text().catch(() => '');
let errMsg = `${finceptResponse.status} ${finceptResponse.statusText}`;
- try { errMsg = JSON.parse(errBody).message || errMsg; } catch {}
+ try { errMsg = JSON.parse(errBody).message || errMsg; } catch { /* ignore parse error */ }
throw new Error(errMsg);
}
result = await finceptResponse.text();
diff --git a/fincept-terminal-desktop/src/components/tabs/equity-trading/components/HoldingsPanel.tsx b/fincept-terminal-desktop/src/components/tabs/equity-trading/components/HoldingsPanel.tsx
index da7c3f3c6..5b996578c 100644
--- a/fincept-terminal-desktop/src/components/tabs/equity-trading/components/HoldingsPanel.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/equity-trading/components/HoldingsPanel.tsx
@@ -71,8 +71,8 @@ export function HoldingsPanel({ onSell }: HoldingsPanelProps) {
// Sort
result.sort((a, b) => {
- let aVal = a[sortField];
- let bVal = b[sortField];
+ const aVal = a[sortField];
+ const bVal = b[sortField];
if (typeof aVal === 'string') {
return sortDirection === 'asc'
diff --git a/fincept-terminal-desktop/src/components/tabs/gov-data/hooks/usePxWebData.ts b/fincept-terminal-desktop/src/components/tabs/gov-data/hooks/usePxWebData.ts
index ec296b283..fc97ce579 100644
--- a/fincept-terminal-desktop/src/components/tabs/gov-data/hooks/usePxWebData.ts
+++ b/fincept-terminal-desktop/src/components/tabs/gov-data/hooks/usePxWebData.ts
@@ -110,7 +110,7 @@ export function usePxWebData(): UsePxWebDataReturn {
setPathStack(prev => [...prev, newPath]);
fetchNodes(newPath);
}
- // eslint-disable-next-line react-hooks/exhaustive-deps
+
}, [currentPath, fetchNodes]);
const navigateBack = useCallback(() => {
@@ -160,7 +160,7 @@ export function usePxWebData(): UsePxWebDataReturn {
const fetchMetadata = useCallback(async (tablePath: string) => {
setSelectedTable(tablePath);
await fetchMetadataInternal(tablePath);
- // eslint-disable-next-line react-hooks/exhaustive-deps
+
}, []);
const fetchData = useCallback(async (tablePath: string, query: any[] = []) => {
diff --git a/fincept-terminal-desktop/src/components/tabs/market-sim/MarketSimTab.tsx b/fincept-terminal-desktop/src/components/tabs/market-sim/MarketSimTab.tsx
index 1e462b2e0..752a2d879 100644
--- a/fincept-terminal-desktop/src/components/tabs/market-sim/MarketSimTab.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/market-sim/MarketSimTab.tsx
@@ -444,7 +444,7 @@ export const MarketSimTab: React.FC = () => {
if (resp.success && resp.data) {
setAnalytics(resp.data);
}
- } catch (_) {}
+ } catch { /* analytics fetch errors are non-fatal */ }
}, []);
const injectNews = useCallback(async () => {
diff --git a/fincept-terminal-desktop/src/components/tabs/node-editor/nodes/NodeParameterInput.tsx b/fincept-terminal-desktop/src/components/tabs/node-editor/nodes/NodeParameterInput.tsx
index ce23a28cb..1139d7fc7 100644
--- a/fincept-terminal-desktop/src/components/tabs/node-editor/nodes/NodeParameterInput.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/node-editor/nodes/NodeParameterInput.tsx
@@ -202,7 +202,7 @@ export const NodeParameterInput: React.FC<NodeParameterInputProps> = ({
const renderBooleanInput = () => (
<div
- onClick={() => !disabled && onChange(!Boolean(value))}
+ onClick={() => !disabled && onChange(!value)}
style={{
display: 'flex',
alignItems: 'center',
@@ -223,7 +223,7 @@ export const NodeParameterInput: React.FC<NodeParameterInputProps> = ({
<div style={{
width: '32px',
height: '16px',
- backgroundColor: Boolean(value) ? FINCEPT.GREEN : FINCEPT.GRAY,
+ backgroundColor: value ? FINCEPT.GREEN : FINCEPT.GRAY,
borderRadius: '8px',
position: 'relative',
transition: 'all 0.15s ease',
@@ -231,7 +231,7 @@ export const NodeParameterInput: React.FC<NodeParameterInputProps> = ({
<div style={{
position: 'absolute',
top: '2px',
- left: Boolean(value) ? '16px' : '2px',
+ left: value ? '16px' : '2px',
width: '12px',
height: '12px',
backgroundColor: FINCEPT.WHITE,
@@ -240,13 +240,13 @@ export const NodeParameterInput: React.FC<NodeParameterInputProps> = ({
}} />
</div>
<span style={{
- color: Boolean(value) ? FINCEPT.GREEN : FINCEPT.GRAY,
+ color: value ? FINCEPT.GREEN : FINCEPT.GRAY,
fontSize: '13px',
fontFamily: FONT_FAMILY,
fontWeight: 600,
textTransform: 'uppercase',
}}>
- {Boolean(value) ? 'ENABLED' : 'DISABLED'}
+ {value ? 'ENABLED' : 'DISABLED'}
</span>
</div>
);
diff --git a/fincept-terminal-desktop/src/components/tabs/node-editor/nodes/WorkflowExecutor.ts b/fincept-terminal-desktop/src/components/tabs/node-editor/nodes/WorkflowExecutor.ts
index a2ae02da9..7ea1edc22 100644
--- a/fincept-terminal-desktop/src/components/tabs/node-editor/nodes/WorkflowExecutor.ts
+++ b/fincept-terminal-desktop/src/components/tabs/node-editor/nodes/WorkflowExecutor.ts
@@ -111,7 +111,7 @@ class WorkflowExecutor {
});
break;
- case 'input':
+ case 'input': {
// Get data from previous node
const inputEdges = node.data.inputEdges || [];
if (inputEdges.length === 0) {
@@ -131,6 +131,7 @@ class WorkflowExecutor {
categories: categoriesStr
});
break;
+ }
default:
throw new Error(`Unknown data source: ${dataSource}`);
diff --git a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/PortfolioTab.tsx b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/PortfolioTab.tsx
index 064b4a8a9..e60c708ba 100644
--- a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/PortfolioTab.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/PortfolioTab.tsx
@@ -362,14 +362,60 @@ const PortfolioTab: React.FC = () => {
{/* Empty state when nothing selected */}
{!selectedPortfolio ? (
- <div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
- <Briefcase size={36} color={FINCEPT.MUTED} style={{ opacity: 0.2, marginBottom: '16px' }} />
+ <div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: '16px' }}>
+ <Briefcase size={36} color={FINCEPT.MUTED} style={{ opacity: 0.2 }} />
<div style={{ color: FINCEPT.GRAY, fontSize: '12px', fontWeight: 700, letterSpacing: '1px' }}>
{t('extracted.noPortfolioSelected', 'NO PORTFOLIO SELECTED')}
</div>
- <div style={{ color: FINCEPT.MUTED, fontSize: '10px', marginTop: '6px' }}>
+ <div style={{ color: FINCEPT.MUTED, fontSize: '10px' }}>
{t('content.selectOrCreate', 'Select a portfolio or create a new one')}
</div>
+ <div style={{ display: 'flex', gap: '12px', marginTop: '8px' }}>
+ <button
+ onClick={() => modals.setShowCreatePortfolio(true)}
+ style={{
+ padding: '8px 16px',
+ backgroundColor: FINCEPT.ORANGE,
+ border: 'none',
+ color: '#000',
+ fontSize: '10px',
+ fontWeight: 700,
+ cursor: 'pointer',
+ letterSpacing: '0.5px',
+ borderRadius: '2px',
+ transition: 'opacity 0.2s ease',
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.opacity = '0.85'; }}
+ onMouseLeave={(e) => { e.currentTarget.style.opacity = '1'; }}
+ >
+ CREATE NEW
+ </button>
+ <button
+ onClick={() => modals.setShowImportPortfolio(true)}
+ style={{
+ padding: '8px 16px',
+ backgroundColor: 'transparent',
+ border: `1px solid ${FINCEPT.BORDER}`,
+ color: FINCEPT.GRAY,
+ fontSize: '10px',
+ fontWeight: 700,
+ cursor: 'pointer',
+ letterSpacing: '0.5px',
+ borderRadius: '2px',
+ transition: 'all 0.2s ease',
+ }}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.backgroundColor = FINCEPT.HOVER;
+ e.currentTarget.style.color = FINCEPT.WHITE;
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.backgroundColor = 'transparent';
+ e.currentTarget.style.color = FINCEPT.GRAY;
+ }}
+ >
+ IMPORT JSON
+ </button>
+ </div>
</div>
) : !portfolioSummary ? (
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
diff --git a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/hooks/useModalState.ts b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/hooks/useModalState.ts
index 9b84e0e1d..a23d2d4e2 100644
--- a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/hooks/useModalState.ts
+++ b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/hooks/useModalState.ts
@@ -68,7 +68,7 @@ export const useModalState = (operations: PortfolioOps) => {
const confirmDeletePortfolio = useCallback(async () => {
if (!portfolioToDelete) return;
- try { await operations.deletePortfolio(portfolioToDelete); } catch {}
+ try { await operations.deletePortfolio(portfolioToDelete); } catch { /* ignore delete error */ }
setShowDeleteConfirm(false);
setPortfolioToDelete(null);
}, [operations, portfolioToDelete]);
diff --git a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/hooks/usePortfolioOperations.ts b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/hooks/usePortfolioOperations.ts
index 1f12ad33c..26e284c4a 100644
--- a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/hooks/usePortfolioOperations.ts
+++ b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/hooks/usePortfolioOperations.ts
@@ -33,7 +33,7 @@ function loadRefreshInterval(): number {
const val = parseInt(saved, 10);
if (val > 0) return val;
}
- } catch {}
+ } catch { /* localStorage not available */ }
return DEFAULT_REFRESH_MS;
}
@@ -44,16 +44,16 @@ export const usePortfolioOperations = () => {
const setRefreshIntervalMs = useCallback((ms: number) => {
_setRefreshIntervalMs(ms);
- try { localStorage.setItem(REFRESH_INTERVAL_KEY, String(ms)); } catch {}
+ try { localStorage.setItem(REFRESH_INTERVAL_KEY, String(ms)); } catch { /* localStorage not available */ }
}, []);
// Wrap setter to persist selection to localStorage
const setSelectedPortfolio = useCallback((p: Portfolio | null) => {
_setSelectedPortfolio(p);
if (p) {
- try { localStorage.setItem(LAST_PORTFOLIO_KEY, p.id); } catch {}
+ try { localStorage.setItem(LAST_PORTFOLIO_KEY, p.id); } catch { /* localStorage not available */ }
} else {
- try { localStorage.removeItem(LAST_PORTFOLIO_KEY); } catch {}
+ try { localStorage.removeItem(LAST_PORTFOLIO_KEY); } catch { /* localStorage not available */ }
}
}, []);
const [portfolioSummary, setPortfolioSummary] = useState<PortfolioSummary | null>(null);
@@ -359,7 +359,7 @@ export const usePortfolioOperations = () => {
restored = true;
}
}
- } catch {}
+ } catch { /* localStorage not available */ }
// Fallback to first portfolio if no saved selection
if (!restored) {
diff --git a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/modals/CreatePortfolioModal.tsx b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/modals/CreatePortfolioModal.tsx
index 6e1d8ded6..bd882e8df 100644
--- a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/modals/CreatePortfolioModal.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/modals/CreatePortfolioModal.tsx
@@ -2,6 +2,44 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { useTerminalTheme } from '@/contexts/ThemeContext';
+const CURRENCIES = [
+ { code: 'USD', name: 'US Dollar' },
+ { code: 'EUR', name: 'Euro' },
+ { code: 'GBP', name: 'British Pound' },
+ { code: 'JPY', name: 'Japanese Yen' },
+ { code: 'CNY', name: 'Chinese Yuan' },
+ { code: 'INR', name: 'Indian Rupee' },
+ { code: 'CAD', name: 'Canadian Dollar' },
+ { code: 'AUD', name: 'Australian Dollar' },
+ { code: 'CHF', name: 'Swiss Franc' },
+ { code: 'KRW', name: 'South Korean Won' },
+ { code: 'SGD', name: 'Singapore Dollar' },
+ { code: 'HKD', name: 'Hong Kong Dollar' },
+ { code: 'SEK', name: 'Swedish Krona' },
+ { code: 'NOK', name: 'Norwegian Krone' },
+ { code: 'DKK', name: 'Danish Krone' },
+ { code: 'NZD', name: 'New Zealand Dollar' },
+ { code: 'MXN', name: 'Mexican Peso' },
+ { code: 'BRL', name: 'Brazilian Real' },
+ { code: 'ZAR', name: 'South African Rand' },
+ { code: 'RUB', name: 'Russian Ruble' },
+ { code: 'TRY', name: 'Turkish Lira' },
+ { code: 'PLN', name: 'Polish Zloty' },
+ { code: 'THB', name: 'Thai Baht' },
+ { code: 'IDR', name: 'Indonesian Rupiah' },
+ { code: 'MYR', name: 'Malaysian Ringgit' },
+ { code: 'PHP', name: 'Philippine Peso' },
+ { code: 'AED', name: 'UAE Dirham' },
+ { code: 'SAR', name: 'Saudi Riyal' },
+ { code: 'ILS', name: 'Israeli Shekel' },
+ { code: 'ARS', name: 'Argentine Peso' },
+ { code: 'CLP', name: 'Chilean Peso' },
+ { code: 'COP', name: 'Colombian Peso' },
+ { code: 'CZK', name: 'Czech Koruna' },
+ { code: 'HUF', name: 'Hungarian Forint' },
+ { code: 'RON', name: 'Romanian Leu' },
+] as const;
+
interface CreatePortfolioModalProps {
show: boolean;
formState: {
@@ -155,10 +193,11 @@ const CreatePortfolioModal: React.FC<CreatePortfolioModalProps> = ({
cursor: 'pointer',
}}
>
- <option value="USD">USD - US Dollar</option>
- <option value="EUR">EUR - Euro</option>
- <option value="GBP">GBP - British Pound</option>
- <option value="INR">INR - Indian Rupee</option>
+ {CURRENCIES.map(({ code, name }) => (
+ <option key={code} value={code}>
+ {code} - {name}
+ </option>
+ ))}
</select>
</div>
diff --git a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/views/AnalyticsSectorsPanel.tsx b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/views/AnalyticsSectorsPanel.tsx
index 216bcdf44..80effcfa9 100644
--- a/fincept-terminal-desktop/src/components/tabs/portfolio-tab/views/AnalyticsSectorsPanel.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/portfolio-tab/views/AnalyticsSectorsPanel.tsx
@@ -156,7 +156,7 @@ const AnalyticsSectorsPanel: React.FC<AnalyticsSectorsPanelProps> = ({ portfolio
};
restore();
return () => { cancelled = true; };
- }, [cachePrefix]); // eslint-disable-line react-hooks/exhaustive-deps
+ }, [cachePrefix]);
// Fetch analytics data
const fetchAnalytics = useCallback(async () => {
diff --git a/fincept-terminal-desktop/src/components/tabs/report-builder/DocxEditorCanvas.tsx b/fincept-terminal-desktop/src/components/tabs/report-builder/DocxEditorCanvas.tsx
new file mode 100644
index 000000000..47b8349ee
--- /dev/null
+++ b/fincept-terminal-desktop/src/components/tabs/report-builder/DocxEditorCanvas.tsx
@@ -0,0 +1,587 @@
+import React, { useRef, useEffect, useState } from 'react';
+import { EditorContent } from '@tiptap/react';
+import { AlertTriangle, PanelTop, PanelBottom } from 'lucide-react';
+import { DocxEditorCanvasProps } from './types';
+import './docx-editor.css';
+
+// ── Fincept Design Tokens ──────────────────────────────────────────
+const F = {
+ ORANGE: '#FF8800',
+ WHITE: '#FFFFFF',
+ GRAY: '#787878',
+ DARK_BG: '#000000',
+ PANEL_BG: '#0F0F0F',
+ BORDER: '#2A2A2A',
+ MUTED: '#4A4A4A',
+};
+
+// Lazy-load docx-preview to avoid bundling it when not needed
+let renderAsyncFn: ((data: any, container: HTMLElement, styleContainer?: HTMLElement, options?: any) => Promise<any>) | null = null;
+
+const loadDocxPreview = async () => {
+ if (!renderAsyncFn) {
+ const docxPreview = await import('docx-preview');
+ renderAsyncFn = docxPreview.renderAsync;
+ }
+ return renderAsyncFn!;
+};
+
+// ── Watermark Overlay ──────────────────────────────────────────────
+const WatermarkOverlay: React.FC<{ text: string }> = ({ text }) => (
+ <div
+ style={{
+ position: 'absolute',
+ inset: 0,
+ pointerEvents: 'none',
+ overflow: 'hidden',
+ zIndex: 1,
+ }}
+ >
+ <div
+ style={{
+ position: 'absolute',
+ top: '50%',
+ left: '50%',
+ transform: 'translate(-50%, -50%) rotate(-45deg)',
+ fontSize: '64px',
+ fontWeight: 700,
+ color: 'rgba(200, 200, 200, 0.15)',
+ whiteSpace: 'nowrap',
+ userSelect: 'none',
+ letterSpacing: '8px',
+ textTransform: 'uppercase',
+ fontFamily: '"IBM Plex Mono", monospace',
+ }}
+ >
+ {text}
+ </div>
+ </div>
+);
+
+// ── Editable Header Zone ───────────────────────────────────────────
+// Always visible: when enabled shows editable text, when disabled shows
+// a clickable placeholder to enable it (like Word's "Double-click to edit header")
+const HeaderZone: React.FC<{
+ text: string;
+ enabled: boolean;
+ compact?: boolean;
+ onToggle?: () => void;
+ onTextChange?: (text: string) => void;
+}> = ({ text, enabled, compact, onToggle, onTextChange }) => {
+ if (!enabled) {
+ // Show a subtle clickable area to enable header
+ return (
+ <div
+ onClick={onToggle}
+ style={{
+ textAlign: 'center',
+ padding: compact ? '3px 8px' : '4px 16px',
+ fontSize: compact ? '7px' : '8px',
+ color: '#ccc',
+ minHeight: compact ? '14px' : '18px',
+ backgroundColor: '#f9f9f9',
+ borderBottom: '1px dashed #e0e0e0',
+ cursor: 'pointer',
+ fontFamily: '"IBM Plex Mono", monospace',
+ fontStyle: 'italic',
+ opacity: 0.6,
+ transition: 'opacity 0.2s',
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.opacity = '1'; }}
+ onMouseLeave={(e) => { e.currentTarget.style.opacity = '0.6'; }}
+ title="Click to enable header"
+ >
+ <PanelTop size={8} style={{ display: 'inline', verticalAlign: 'middle', marginRight: '4px' }} />
+ Click to add header
+ </div>
+ );
+ }
+
+ return (
+ <div
+ style={{
+ borderBottom: '1px solid #e0e0e0',
+ padding: compact ? '4px 8px' : '6px 16px',
+ minHeight: compact ? '20px' : '28px',
+ backgroundColor: '#fafafa',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '6px',
+ }}
+ >
+ <span title="Click to disable header" onClick={onToggle} style={{ cursor: 'pointer', flexShrink: 0, display: 'flex' }}>
+ <PanelTop size={compact ? 8 : 10} style={{ color: '#bbb' }} />
+ </span>
+ <input
+ type="text"
+ value={text}
+ onChange={(e) => onTextChange?.(e.target.value)}
+ placeholder="Type header text..."
+ style={{
+ flex: 1,
+ border: 'none',
+ outline: 'none',
+ backgroundColor: 'transparent',
+ fontSize: compact ? '8px' : '9px',
+ color: '#666',
+ fontFamily: '"IBM Plex Mono", monospace',
+ textAlign: 'center',
+ padding: 0,
+ }}
+ />
+ </div>
+ );
+};
+
+// ── Editable Footer Zone ───────────────────────────────────────────
+const FooterZone: React.FC<{
+ text: string;
+ enabled: boolean;
+ compact?: boolean;
+ onToggle?: () => void;
+ onTextChange?: (text: string) => void;
+}> = ({ text, enabled, compact, onToggle, onTextChange }) => {
+ if (!enabled) {
+ return (
+ <div
+ onClick={onToggle}
+ style={{
+ textAlign: 'center',
+ padding: compact ? '3px 8px' : '4px 16px',
+ fontSize: compact ? '7px' : '8px',
+ color: '#ccc',
+ minHeight: compact ? '14px' : '18px',
+ backgroundColor: '#f9f9f9',
+ borderTop: '1px dashed #e0e0e0',
+ cursor: 'pointer',
+ fontFamily: '"IBM Plex Mono", monospace',
+ fontStyle: 'italic',
+ opacity: 0.6,
+ transition: 'opacity 0.2s',
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.opacity = '1'; }}
+ onMouseLeave={(e) => { e.currentTarget.style.opacity = '0.6'; }}
+ title="Click to enable footer"
+ >
+ <PanelBottom size={8} style={{ display: 'inline', verticalAlign: 'middle', marginRight: '4px' }} />
+ Click to add footer
+ </div>
+ );
+ }
+
+ return (
+ <div
+ style={{
+ borderTop: '1px solid #e0e0e0',
+ padding: compact ? '4px 8px' : '6px 16px',
+ minHeight: compact ? '20px' : '28px',
+ backgroundColor: '#fafafa',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '6px',
+ }}
+ >
+ <span title="Click to disable footer" onClick={onToggle} style={{ cursor: 'pointer', flexShrink: 0, display: 'flex' }}>
+ <PanelBottom size={compact ? 8 : 10} style={{ color: '#bbb' }} />
+ </span>
+ <input
+ type="text"
+ value={text}
+ onChange={(e) => onTextChange?.(e.target.value)}
+ placeholder="Type footer text..."
+ style={{
+ flex: 1,
+ border: 'none',
+ outline: 'none',
+ backgroundColor: 'transparent',
+ fontSize: compact ? '8px' : '9px',
+ color: '#666',
+ fontFamily: '"IBM Plex Mono", monospace',
+ textAlign: 'center',
+ padding: 0,
+ }}
+ />
+ </div>
+ );
+};
+
+// ── Page Break Divider ─────────────────────────────────────────────
+// Visual gap between A4 pages (like Google Docs / Word)
+const PageGap: React.FC<{ pageNumber: number; compact?: boolean }> = ({ pageNumber, compact }) => (
+ <div
+ style={{
+ width: '100%',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ padding: compact ? '4px 0' : '10px 0',
+ position: 'relative',
+ }}
+ >
+ <div
+ style={{
+ position: 'absolute',
+ left: '50%',
+ transform: 'translateX(-50%)',
+ backgroundColor: F.DARK_BG,
+ padding: '0 10px',
+ fontSize: compact ? '7px' : '8px',
+ color: F.MUTED,
+ fontFamily: '"IBM Plex Mono", monospace',
+ letterSpacing: '1px',
+ zIndex: 1,
+ }}
+ >
+ PAGE {pageNumber}
+ </div>
+ <div style={{ width: '100%', borderTop: `1px dashed ${F.MUTED}` }} />
+ </div>
+);
+
+// ── Preview Panel (docx-preview) ───────────────────────────────────
+const DocxPreviewPanel: React.FC<{ arrayBuffer: ArrayBuffer | null; compact?: boolean }> = ({ arrayBuffer, compact }) => {
+ const containerRef = useRef<HTMLDivElement>(null);
+ const [error, setError] = useState<string | null>(null);
+ const [loading, setLoading] = useState(false);
+
+ useEffect(() => {
+ if (!arrayBuffer || !containerRef.current) return;
+
+ let cancelled = false;
+ setLoading(true);
+ setError(null);
+
+ (async () => {
+ try {
+ const render = await loadDocxPreview();
+ if (cancelled || !containerRef.current) return;
+ containerRef.current.innerHTML = '';
+
+ await render(arrayBuffer, containerRef.current, undefined, {
+ className: 'docx',
+ inWrapper: true,
+ ignoreWidth: compact,
+ ignoreHeight: false,
+ ignoreFonts: false,
+ breakPages: !compact,
+ ignoreLastRenderedPageBreak: true,
+ experimental: true,
+ trimXmlDeclaration: true,
+ useBase64URL: true,
+ renderChanges: false,
+ renderHeaders: true,
+ renderFooters: true,
+ renderFootnotes: true,
+ renderEndnotes: true,
+ renderComments: false,
+ debug: false,
+ });
+ } catch (err) {
+ if (!cancelled) {
+ console.error('[DocxPreview] Render failed:', err);
+ setError('Failed to render DOCX preview');
+ }
+ } finally {
+ if (!cancelled) setLoading(false);
+ }
+ })();
+
+ return () => { cancelled = true; };
+ }, [arrayBuffer, compact]);
+
+ if (!arrayBuffer) {
+ return (
+ <div
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ height: '100%',
+ color: F.MUTED,
+ fontSize: '10px',
+ fontFamily: '"IBM Plex Mono", monospace',
+ }}
+ >
+ No DOCX file loaded for preview
+ </div>
+ );
+ }
+
+ return (
+ <div className={`docx-preview-container ${compact ? 'docx-preview-compact' : ''}`} style={{ height: '100%', overflowY: 'auto' }}>
+ {loading && (
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '24px', color: F.GRAY, fontSize: '10px', fontFamily: '"IBM Plex Mono", monospace' }}>
+ Rendering preview...
+ </div>
+ )}
+ {error && (
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '24px', color: F.ORANGE, fontSize: '10px', fontFamily: '"IBM Plex Mono", monospace' }}>
+ {error}
+ </div>
+ )}
+ <div ref={containerRef} />
+ </div>
+ );
+};
+
+// ── A4 Page Shell ──────────────────────────────────────────────────
+// Renders one A4 page with header, content area, and footer
+const A4Page: React.FC<{
+ children: React.ReactNode;
+ compact?: boolean;
+ pageWidth: string;
+ watermarkEnabled?: boolean;
+ watermarkText?: string;
+ headerEnabled?: boolean;
+ footerEnabled?: boolean;
+ headerText?: string;
+ footerText?: string;
+ onToggleHeader?: () => void;
+ onToggleFooter?: () => void;
+ onHeaderTextChange?: (text: string) => void;
+ onFooterTextChange?: (text: string) => void;
+ mt: number;
+ mr: number;
+ mb: number;
+ ml: number;
+ lineSpacing?: string;
+ isMainPage?: boolean;
+}> = ({
+ children, compact, pageWidth, watermarkEnabled, watermarkText,
+ headerEnabled, footerEnabled, headerText, footerText,
+ onToggleHeader, onToggleFooter, onHeaderTextChange, onFooterTextChange,
+ mt, mr, mb, ml, lineSpacing, isMainPage,
+}) => (
+ <div
+ style={{
+ width: pageWidth,
+ maxWidth: '100%',
+ minHeight: compact ? 'auto' : '297mm',
+ margin: '0 auto',
+ backgroundColor: '#FFFFFF',
+ boxShadow: compact
+ ? '0 2px 8px rgba(0,0,0,0.4)'
+ : `0 4px 16px rgba(0,0,0,0.5), 0 0 0 1px ${F.BORDER}`,
+ position: 'relative',
+ display: 'flex',
+ flexDirection: 'column',
+ }}
+ >
+ {watermarkEnabled && <WatermarkOverlay text={watermarkText || 'DRAFT'} />}
+ <HeaderZone
+ text={headerText || ''}
+ enabled={!!headerEnabled}
+ compact={compact}
+ onToggle={onToggleHeader}
+ onTextChange={onHeaderTextChange}
+ />
+ <div
+ style={{
+ flex: 1,
+ padding: `${mt}mm ${mr}mm ${mb}mm ${ml}mm`,
+ lineHeight: lineSpacing || '1.6',
+ position: 'relative',
+ zIndex: 2,
+ }}
+ >
+ {children}
+ </div>
+ <FooterZone
+ text={footerText || ''}
+ enabled={!!footerEnabled}
+ compact={compact}
+ onToggle={onToggleFooter}
+ onTextChange={onFooterTextChange}
+ />
+ </div>
+);
+
+// ── Edit Panel (TipTap Editor) ─────────────────────────────────────
+const DocxEditPanel: React.FC<{
+ editor: any;
+ hasOriginal: boolean;
+ compact?: boolean;
+ watermarkEnabled?: boolean;
+ watermarkText?: string;
+ headerEnabled?: boolean;
+ footerEnabled?: boolean;
+ headerText?: string;
+ footerText?: string;
+ onToggleHeader?: () => void;
+ onToggleFooter?: () => void;
+ onHeaderTextChange?: (text: string) => void;
+ onFooterTextChange?: (text: string) => void;
+ lineSpacing?: string;
+ margins?: { top: number; right: number; bottom: number; left: number };
+ zoom?: number;
+}> = ({
+ editor, hasOriginal, compact, watermarkEnabled, watermarkText,
+ headerEnabled, footerEnabled, headerText, footerText,
+ onToggleHeader, onToggleFooter, onHeaderTextChange, onFooterTextChange,
+ lineSpacing, margins, zoom = 100,
+}) => {
+ if (!editor) return null;
+
+ const pageWidth = compact ? '100%' : '210mm';
+ const defaultMargin = compact ? 10 : 20;
+ const mt = compact ? Math.min(margins?.top ?? defaultMargin, 10) : (margins?.top ?? 20);
+ const mr = compact ? Math.min(margins?.right ?? defaultMargin, 10) : (margins?.right ?? 20);
+ const mb = compact ? Math.min(margins?.bottom ?? defaultMargin, 10) : (margins?.bottom ?? 20);
+ const ml = compact ? Math.min(margins?.left ?? defaultMargin, 10) : (margins?.left ?? 20);
+
+ const sharedPageProps = {
+ compact,
+ pageWidth,
+ watermarkEnabled,
+ watermarkText,
+ headerEnabled,
+ footerEnabled,
+ headerText,
+ footerText,
+ onToggleHeader,
+ onToggleFooter,
+ onHeaderTextChange,
+ onFooterTextChange,
+ mt, mr, mb, ml,
+ lineSpacing,
+ };
+
+ return (
+ <div style={{ height: '100%', overflowY: 'auto', backgroundColor: F.DARK_BG }}>
+ {hasOriginal && !compact && (
+ <div style={{ maxWidth: pageWidth, margin: '12px auto 0' }}>
+ <div
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: '8px',
+ padding: '6px 12px',
+ backgroundColor: `${F.ORANGE}15`,
+ border: `1px solid ${F.ORANGE}40`,
+ borderRadius: '2px',
+ fontSize: '10px',
+ color: F.ORANGE,
+ fontFamily: '"IBM Plex Mono", monospace',
+ }}
+ >
+ <AlertTriangle size={12} />
+ Edit mode shows converted content. Use Preview to see original formatting.
+ </div>
+ </div>
+ )}
+
+ <div style={{
+ padding: compact ? '6px' : '16px',
+ transformOrigin: 'top center',
+ transform: !compact && zoom !== 100 ? `scale(${zoom / 100})` : undefined,
+ width: !compact && zoom !== 100 ? `${10000 / zoom}%` : undefined,
+ }}>
+ {/* Page 1 — contains the actual editor */}
+ <A4Page {...sharedPageProps} isMainPage>
+ <EditorContent editor={editor} />
+ </A4Page>
+
+ {/* Page separator + Page 2 (visual continuation) */}
+ {!compact && (
+ <>
+ <PageGap pageNumber={2} compact={compact} />
+ <A4Page {...sharedPageProps}>
+ <div
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ minHeight: '80px',
+ color: '#ccc',
+ fontSize: '11px',
+ fontFamily: '"IBM Plex Mono", monospace',
+ fontStyle: 'italic',
+ }}
+ >
+ Content overflows here automatically...
+ </div>
+ </A4Page>
+
+ <PageGap pageNumber={3} compact={compact} />
+ <A4Page {...sharedPageProps}>
+ <div
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ minHeight: '80px',
+ color: '#ddd',
+ fontSize: '10px',
+ fontFamily: '"IBM Plex Mono", monospace',
+ fontStyle: 'italic',
+ }}
+ >
+ &nbsp;
+ </div>
+ </A4Page>
+ </>
+ )}
+ </div>
+ </div>
+ );
+};
+
+// ── Main Canvas Component ──────────────────────────────────────────
+export const DocxEditorCanvas: React.FC<DocxEditorCanvasProps> = ({
+ editor,
+ viewMode,
+ originalArrayBuffer,
+ watermarkText,
+ watermarkEnabled,
+ headerText,
+ footerText,
+ headerEnabled,
+ footerEnabled,
+ onToggleHeader,
+ onToggleFooter,
+ onHeaderTextChange,
+ onFooterTextChange,
+ lineSpacing,
+ margins,
+ zoom = 100,
+}) => {
+ const editProps = {
+ editor,
+ hasOriginal: !!originalArrayBuffer,
+ watermarkEnabled,
+ watermarkText,
+ headerEnabled,
+ footerEnabled,
+ headerText,
+ footerText,
+ onToggleHeader,
+ onToggleFooter,
+ onHeaderTextChange,
+ onFooterTextChange,
+ lineSpacing,
+ margins,
+ zoom,
+ };
+
+ if (viewMode === 'edit') {
+ return <DocxEditPanel {...editProps} />;
+ }
+
+ if (viewMode === 'preview') {
+ return <DocxPreviewPanel arrayBuffer={originalArrayBuffer} />;
+ }
+
+ // Split view — each child scrolls independently
+ return (
+ <div style={{ display: 'flex', height: '100%', overflow: 'hidden' }}>
+ <div style={{ flex: 1, minWidth: 0, borderRight: `1px solid ${F.BORDER}`, height: '100%', overflow: 'auto' }}>
+ <DocxEditPanel {...editProps} compact />
+ </div>
+ <div style={{ flex: 1, minWidth: 0, height: '100%', overflow: 'auto' }}>
+ <DocxPreviewPanel arrayBuffer={originalArrayBuffer} compact />
+ </div>
+ </div>
+ );
+};
+
+export default DocxEditorCanvas;
diff --git a/fincept-terminal-desktop/src/components/tabs/report-builder/DocxEditorToolbar.tsx b/fincept-terminal-desktop/src/components/tabs/report-builder/DocxEditorToolbar.tsx
new file mode 100644
index 000000000..6b7822c18
--- /dev/null
+++ b/fincept-terminal-desktop/src/components/tabs/report-builder/DocxEditorToolbar.tsx
@@ -0,0 +1,794 @@
+import React, { useCallback } from 'react';
+import {
+ Bold,
+ Italic,
+ Underline as UnderlineIcon,
+ Strikethrough,
+ AlignLeft,
+ AlignCenter,
+ AlignRight,
+ AlignJustify,
+ List,
+ ListOrdered,
+ Image as ImageIcon,
+ Table as TableIcon,
+ Link as LinkIcon,
+ Minus,
+ Type,
+ Undo2,
+ Redo2,
+ Eye,
+ Edit3,
+ Columns,
+ Palette,
+ Highlighter,
+ ChevronDown,
+ Unlink,
+ Trash2,
+ Plus,
+ Superscript,
+ Subscript,
+ Quote,
+ Code,
+ IndentIncrease,
+ IndentDecrease,
+ RemoveFormatting,
+ SeparatorHorizontal,
+ Droplets,
+ ArrowUpDown,
+ PanelTop,
+ PanelBottom,
+ ZoomIn,
+ ZoomOut,
+} from 'lucide-react';
+import { DocxEditorToolbarProps } from './types';
+import { FONT_FAMILIES, PRESET_COLORS } from './constants';
+
+// ── Fincept Design Tokens ──────────────────────────────────────────
+const F = {
+ ORANGE: '#FF8800',
+ WHITE: '#FFFFFF',
+ RED: '#FF3B3B',
+ GREEN: '#00D66F',
+ GRAY: '#787878',
+ DARK_BG: '#000000',
+ PANEL_BG: '#0F0F0F',
+ HEADER_BG: '#1A1A1A',
+ BORDER: '#2A2A2A',
+ HOVER: '#1F1F1F',
+ MUTED: '#4A4A4A',
+};
+
+const FONT_SIZES = [
+ '8', '9', '10', '10.5', '11', '12', '14', '16', '18', '20', '24', '28', '32', '36', '48', '72',
+];
+
+const HEADING_OPTIONS = [
+ { level: 0, label: 'Normal' },
+ { level: 1, label: 'Heading 1' },
+ { level: 2, label: 'Heading 2' },
+ { level: 3, label: 'Heading 3' },
+ { level: 4, label: 'Heading 4' },
+ { level: 5, label: 'Heading 5' },
+ { level: 6, label: 'Heading 6' },
+];
+
+const LINE_SPACING_OPTIONS = [
+ { value: '1', label: '1.0' },
+ { value: '1.15', label: '1.15' },
+ { value: '1.5', label: '1.5' },
+ { value: '2', label: '2.0' },
+ { value: '2.5', label: '2.5' },
+ { value: '3', label: '3.0' },
+];
+
+// ── Toolbar Button ─────────────────────────────────────────────────
+const Btn: React.FC<{
+ onClick: () => void;
+ isActive?: boolean;
+ disabled?: boolean;
+ title: string;
+ children: React.ReactNode;
+}> = ({ onClick, isActive, disabled, title, children }) => (
+ <button
+ onClick={onClick}
+ disabled={disabled}
+ title={title}
+ style={{
+ padding: '4px',
+ borderRadius: '2px',
+ border: 'none',
+ backgroundColor: isActive ? F.ORANGE : 'transparent',
+ color: isActive ? F.DARK_BG : F.WHITE,
+ cursor: disabled ? 'default' : 'pointer',
+ opacity: disabled ? 0.3 : 1,
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ transition: 'all 0.2s',
+ }}
+ onMouseEnter={(e) => { if (!isActive && !disabled) e.currentTarget.style.backgroundColor = F.HOVER; }}
+ onMouseLeave={(e) => { e.currentTarget.style.backgroundColor = isActive ? F.ORANGE : 'transparent'; }}
+ >
+ {children}
+ </button>
+);
+
+// ── Separator ──────────────────────────────────────────────────────
+const Sep: React.FC = () => (
+ <div style={{ width: '1px', height: '16px', backgroundColor: F.BORDER, margin: '0 2px', flexShrink: 0 }} />
+);
+
+// ── Dropdown ───────────────────────────────────────────────────────
+const Dropdown: React.FC<{
+ trigger: React.ReactNode;
+ open: boolean;
+ onToggle: () => void;
+ children: React.ReactNode;
+ align?: 'left' | 'right';
+}> = ({ trigger, open, onToggle, children, align = 'left' }) => {
+ const ref = React.useRef<HTMLDivElement>(null);
+ React.useEffect(() => {
+ if (!open) return;
+ const handler = (e: MouseEvent) => {
+ if (ref.current && !ref.current.contains(e.target as Node)) onToggle();
+ };
+ document.addEventListener('mousedown', handler);
+ return () => document.removeEventListener('mousedown', handler);
+ }, [open, onToggle]);
+
+ return (
+ <div ref={ref} style={{ position: 'relative' }}>
+ <div onClick={onToggle}>{trigger}</div>
+ {open && (
+ <div
+ style={{
+ position: 'absolute',
+ top: '100%',
+ marginTop: '4px',
+ padding: '4px 0',
+ borderRadius: '2px',
+ boxShadow: '0 4px 12px rgba(0,0,0,0.6)',
+ border: `1px solid ${F.BORDER}`,
+ backgroundColor: F.HEADER_BG,
+ minWidth: '140px',
+ zIndex: 50,
+ [align === 'right' ? 'right' : 'left']: 0,
+ }}
+ >
+ {children}
+ </div>
+ )}
+ </div>
+ );
+};
+
+// ── Dropdown Menu Item ─────────────────────────────────────────────
+const MenuItem: React.FC<{
+ onClick: () => void;
+ color?: string;
+ children: React.ReactNode;
+}> = ({ onClick, color, children }) => (
+ <button
+ onClick={onClick}
+ style={{
+ width: '100%',
+ textAlign: 'left',
+ padding: '6px 12px',
+ fontSize: '10px',
+ fontFamily: '"IBM Plex Mono", "Consolas", monospace',
+ color: color || F.WHITE,
+ backgroundColor: 'transparent',
+ border: 'none',
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '8px',
+ transition: 'all 0.2s',
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.backgroundColor = F.HOVER; }}
+ onMouseLeave={(e) => { e.currentTarget.style.backgroundColor = 'transparent'; }}
+ >
+ {children}
+ </button>
+);
+
+const MenuDivider: React.FC = () => (
+ <div style={{ borderTop: `1px solid ${F.BORDER}`, margin: '4px 0' }} />
+);
+
+// ── Color Picker ───────────────────────────────────────────────────
+const ColorPicker: React.FC<{
+ currentColor: string;
+ onColorChange: (color: string) => void;
+ icon: React.ReactNode;
+ title: string;
+}> = ({ currentColor, onColorChange, icon, title }) => {
+ const [open, setOpen] = React.useState(false);
+ const ref = React.useRef<HTMLDivElement>(null);
+
+ React.useEffect(() => {
+ if (!open) return;
+ const handler = (e: MouseEvent) => {
+ if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);
+ };
+ document.addEventListener('mousedown', handler);
+ return () => document.removeEventListener('mousedown', handler);
+ }, [open]);
+
+ return (
+ <div ref={ref} style={{ position: 'relative' }}>
+ <button
+ onClick={() => setOpen(!open)}
+ title={title}
+ style={{
+ padding: '4px',
+ borderRadius: '2px',
+ border: 'none',
+ backgroundColor: 'transparent',
+ color: F.GRAY,
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '2px',
+ transition: 'all 0.2s',
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.backgroundColor = F.HOVER; }}
+ onMouseLeave={(e) => { e.currentTarget.style.backgroundColor = 'transparent'; }}
+ >
+ {icon}
+ <div style={{ width: '12px', height: '4px', borderRadius: '1px', backgroundColor: currentColor || '#000' }} />
+ </button>
+ {open && (
+ <div
+ style={{
+ position: 'absolute',
+ top: '100%',
+ left: 0,
+ marginTop: '4px',
+ padding: '8px',
+ borderRadius: '2px',
+ boxShadow: '0 4px 12px rgba(0,0,0,0.6)',
+ border: `1px solid ${F.BORDER}`,
+ backgroundColor: F.HEADER_BG,
+ width: '180px',
+ zIndex: 50,
+ }}
+ >
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(8, 1fr)', gap: '4px' }}>
+ {PRESET_COLORS.map((color) => (
+ <button
+ key={color}
+ onClick={() => { onColorChange(color); setOpen(false); }}
+ style={{
+ width: '16px',
+ height: '16px',
+ borderRadius: '2px',
+ border: `1px solid ${F.MUTED}`,
+ backgroundColor: color,
+ cursor: 'pointer',
+ transition: 'transform 0.15s',
+ }}
+ title={color}
+ onMouseEnter={(e) => { e.currentTarget.style.transform = 'scale(1.2)'; }}
+ onMouseLeave={(e) => { e.currentTarget.style.transform = 'scale(1)'; }}
+ />
+ ))}
+ </div>
+ <div style={{ marginTop: '8px', display: 'flex', alignItems: 'center', gap: '8px' }}>
+ <input
+ type="color"
+ value={currentColor || '#000000'}
+ onChange={(e) => { onColorChange(e.target.value); setOpen(false); }}
+ style={{ width: '20px', height: '20px', cursor: 'pointer', border: 'none', background: 'transparent' }}
+ />
+ <span style={{ fontSize: '9px', color: F.GRAY, fontFamily: '"IBM Plex Mono", monospace' }}>CUSTOM</span>
+ </div>
+ </div>
+ )}
+ </div>
+ );
+};
+
+// ── Select styling (fixes white bg + white text issue) ─────────────
+const selectStyle: React.CSSProperties = {
+ backgroundColor: F.DARK_BG,
+ color: F.WHITE,
+ border: `1px solid ${F.BORDER}`,
+ borderRadius: '2px',
+ padding: '2px 4px',
+ fontSize: '10px',
+ fontFamily: '"IBM Plex Mono", "Consolas", monospace',
+ cursor: 'pointer',
+ outline: 'none',
+};
+
+// ── Main Toolbar Component ─────────────────────────────────────────
+export const DocxEditorToolbar: React.FC<DocxEditorToolbarProps> = ({
+ editor,
+ viewMode,
+ onViewModeChange,
+ onInsertImage,
+ onToggleWatermark,
+ watermarkEnabled,
+ onToggleHeader,
+ onToggleFooter,
+ headerEnabled,
+ footerEnabled,
+ lineSpacing,
+ onLineSpacingChange,
+ zoom,
+ onZoomChange,
+}) => {
+ const [showHeadingMenu, setShowHeadingMenu] = React.useState(false);
+ const [showTableMenu, setShowTableMenu] = React.useState(false);
+ const [showInsertMenu, setShowInsertMenu] = React.useState(false);
+ const [showSpacingMenu, setShowSpacingMenu] = React.useState(false);
+
+ const setLink = useCallback(() => {
+ if (!editor) return;
+ const previousUrl = editor.getAttributes('link').href;
+ const url = window.prompt('URL', previousUrl);
+ if (url === null) return;
+ if (url === '') {
+ editor.chain().focus().extendMarkRange('link').unsetLink().run();
+ return;
+ }
+ editor.chain().focus().extendMarkRange('link').setLink({ href: url }).run();
+ }, [editor]);
+
+ if (!editor) return null;
+
+ const currentHeading = HEADING_OPTIONS.find(h =>
+ h.level > 0 ? editor.isActive('heading', { level: h.level }) : !editor.isActive('heading')
+ ) || HEADING_OPTIONS[0];
+
+ return (
+ <div
+ style={{
+ display: 'flex',
+ flexWrap: 'wrap',
+ alignItems: 'center',
+ gap: '2px',
+ padding: '6px 12px',
+ backgroundColor: F.HEADER_BG,
+ borderBottom: `1px solid ${F.BORDER}`,
+ flexShrink: 0,
+ fontFamily: '"IBM Plex Mono", "Consolas", monospace',
+ }}
+ >
+ {/* Undo / Redo */}
+ <Btn onClick={() => editor.chain().focus().undo().run()} disabled={!editor.can().undo()} title="Undo (Ctrl+Z)">
+ <Undo2 size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().redo().run()} disabled={!editor.can().redo()} title="Redo (Ctrl+Y)">
+ <Redo2 size={13} />
+ </Btn>
+
+ <Sep />
+
+ {/* Heading dropdown */}
+ <Dropdown
+ open={showHeadingMenu}
+ onToggle={() => setShowHeadingMenu(!showHeadingMenu)}
+ trigger={
+ <button
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px',
+ padding: '2px 6px',
+ borderRadius: '2px',
+ border: `1px solid ${F.BORDER}`,
+ backgroundColor: 'transparent',
+ color: F.WHITE,
+ fontSize: '10px',
+ fontFamily: '"IBM Plex Mono", monospace',
+ cursor: 'pointer',
+ minWidth: '80px',
+ transition: 'all 0.2s',
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onMouseLeave={(e) => { e.currentTarget.style.borderColor = F.BORDER; }}
+ title="Paragraph style"
+ >
+ <Type size={11} />
+ <span style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{currentHeading.label}</span>
+ <ChevronDown size={9} />
+ </button>
+ }
+ >
+ {HEADING_OPTIONS.map((opt) => (
+ <button
+ key={opt.level}
+ onClick={() => {
+ if (opt.level === 0) editor.chain().focus().setParagraph().run();
+ else editor.chain().focus().toggleHeading({ level: opt.level as 1|2|3|4|5|6 }).run();
+ setShowHeadingMenu(false);
+ }}
+ style={{
+ width: '100%',
+ textAlign: 'left',
+ padding: '6px 12px',
+ fontSize: opt.level === 0 ? '10px' : `${15 - opt.level}px`,
+ fontWeight: opt.level > 0 ? 700 : 400,
+ fontFamily: '"IBM Plex Mono", monospace',
+ color: currentHeading.level === opt.level ? F.ORANGE : F.WHITE,
+ backgroundColor: 'transparent',
+ border: 'none',
+ cursor: 'pointer',
+ transition: 'all 0.2s',
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.backgroundColor = F.HOVER; }}
+ onMouseLeave={(e) => { e.currentTarget.style.backgroundColor = 'transparent'; }}
+ >
+ {opt.label}
+ </button>
+ ))}
+ </Dropdown>
+
+ {/* Font family */}
+ <select
+ value={editor.getAttributes('textStyle').fontFamily || ''}
+ onChange={(e) => {
+ if (e.target.value) editor.chain().focus().setFontFamily(e.target.value).run();
+ else editor.chain().focus().unsetFontFamily().run();
+ }}
+ style={{ ...selectStyle, maxWidth: '90px' }}
+ title="Font family"
+ >
+ <option value="" style={{ backgroundColor: F.DARK_BG, color: F.WHITE }}>Default</option>
+ {FONT_FAMILIES.map((f) => (
+ <option key={f.value} value={f.value} style={{ backgroundColor: F.DARK_BG, color: F.WHITE }}>{f.label}</option>
+ ))}
+ </select>
+
+ {/* Font size */}
+ <select
+ value="11"
+ onChange={(e) => {
+ editor.chain().focus().setMark('textStyle', { fontSize: `${e.target.value}pt` } as any).run();
+ }}
+ style={{ ...selectStyle, width: '42px' }}
+ title="Font size"
+ >
+ {FONT_SIZES.map((s) => (
+ <option key={s} value={s} style={{ backgroundColor: F.DARK_BG, color: F.WHITE }}>{s}</option>
+ ))}
+ </select>
+
+ <Sep />
+
+ {/* Text formatting */}
+ <Btn onClick={() => editor.chain().focus().toggleBold().run()} isActive={editor.isActive('bold')} title="Bold (Ctrl+B)">
+ <Bold size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().toggleItalic().run()} isActive={editor.isActive('italic')} title="Italic (Ctrl+I)">
+ <Italic size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().toggleUnderline().run()} isActive={editor.isActive('underline')} title="Underline (Ctrl+U)">
+ <UnderlineIcon size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().toggleStrike().run()} isActive={editor.isActive('strike')} title="Strikethrough">
+ <Strikethrough size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().toggleSuperscript().run()} isActive={editor.isActive('superscript')} title="Superscript">
+ <Superscript size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().toggleSubscript().run()} isActive={editor.isActive('subscript')} title="Subscript">
+ <Subscript size={13} />
+ </Btn>
+
+ {/* Colors */}
+ <ColorPicker
+ currentColor={editor.getAttributes('textStyle').color || '#000000'}
+ onColorChange={(color) => editor.chain().focus().setColor(color).run()}
+ icon={<Palette size={13} />}
+ title="Text color"
+ />
+ <ColorPicker
+ currentColor={editor.getAttributes('highlight').color || '#ffff00'}
+ onColorChange={(color) => editor.chain().focus().toggleHighlight({ color }).run()}
+ icon={<Highlighter size={13} />}
+ title="Highlight color"
+ />
+
+ {/* Clear formatting */}
+ <Btn
+ onClick={() => { editor.chain().focus().unsetAllMarks().run(); editor.chain().focus().clearNodes().run(); }}
+ title="Clear formatting"
+ >
+ <RemoveFormatting size={13} />
+ </Btn>
+
+ <Sep />
+
+ {/* Alignment */}
+ <Btn onClick={() => editor.chain().focus().setTextAlign('left').run()} isActive={editor.isActive({ textAlign: 'left' })} title="Align left">
+ <AlignLeft size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().setTextAlign('center').run()} isActive={editor.isActive({ textAlign: 'center' })} title="Align center">
+ <AlignCenter size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().setTextAlign('right').run()} isActive={editor.isActive({ textAlign: 'right' })} title="Align right">
+ <AlignRight size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().setTextAlign('justify').run()} isActive={editor.isActive({ textAlign: 'justify' })} title="Justify">
+ <AlignJustify size={13} />
+ </Btn>
+
+ {/* Line spacing dropdown */}
+ <Dropdown
+ open={showSpacingMenu}
+ onToggle={() => setShowSpacingMenu(!showSpacingMenu)}
+ trigger={
+ <Btn onClick={() => {}} title="Line spacing">
+ <ArrowUpDown size={13} />
+ </Btn>
+ }
+ >
+ {LINE_SPACING_OPTIONS.map((opt) => (
+ <MenuItem
+ key={opt.value}
+ onClick={() => { onLineSpacingChange?.(opt.value); setShowSpacingMenu(false); }}
+ color={lineSpacing === opt.value ? F.ORANGE : F.WHITE}
+ >
+ {opt.label}
+ </MenuItem>
+ ))}
+ </Dropdown>
+
+ <Sep />
+
+ {/* Lists & Indent */}
+ <Btn onClick={() => editor.chain().focus().toggleBulletList().run()} isActive={editor.isActive('bulletList')} title="Bullet list">
+ <List size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().toggleOrderedList().run()} isActive={editor.isActive('orderedList')} title="Numbered list">
+ <ListOrdered size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().sinkListItem('listItem').run()} disabled={!editor.can().sinkListItem('listItem')} title="Increase indent">
+ <IndentIncrease size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().liftListItem('listItem').run()} disabled={!editor.can().liftListItem('listItem')} title="Decrease indent">
+ <IndentDecrease size={13} />
+ </Btn>
+
+ <Sep />
+
+ {/* Blockquote & Code */}
+ <Btn onClick={() => editor.chain().focus().toggleBlockquote().run()} isActive={editor.isActive('blockquote')} title="Blockquote">
+ <Quote size={13} />
+ </Btn>
+ <Btn onClick={() => editor.chain().focus().toggleCodeBlock().run()} isActive={editor.isActive('codeBlock')} title="Code block">
+ <Code size={13} />
+ </Btn>
+
+ <Sep />
+
+ {/* Insert menu */}
+ <Dropdown
+ open={showInsertMenu}
+ onToggle={() => setShowInsertMenu(!showInsertMenu)}
+ trigger={
+ <button
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: '2px',
+ padding: '2px 6px',
+ borderRadius: '2px',
+ border: 'none',
+ backgroundColor: 'transparent',
+ color: F.WHITE,
+ fontSize: '9px',
+ fontWeight: 700,
+ fontFamily: '"IBM Plex Mono", monospace',
+ letterSpacing: '0.5px',
+ cursor: 'pointer',
+ transition: 'all 0.2s',
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.backgroundColor = F.HOVER; }}
+ onMouseLeave={(e) => { e.currentTarget.style.backgroundColor = 'transparent'; }}
+ title="Insert"
+ >
+ <Plus size={11} />
+ INSERT
+ <ChevronDown size={9} />
+ </button>
+ }
+ >
+ <MenuItem onClick={() => { onInsertImage(); setShowInsertMenu(false); }}>
+ <ImageIcon size={12} /> Image
+ </MenuItem>
+ <MenuItem onClick={() => { setLink(); setShowInsertMenu(false); }}>
+ <LinkIcon size={12} /> Link
+ </MenuItem>
+ {editor.isActive('link') && (
+ <MenuItem onClick={() => { editor.chain().focus().unsetLink().run(); setShowInsertMenu(false); }} color={F.RED}>
+ <Unlink size={12} /> Remove Link
+ </MenuItem>
+ )}
+ <MenuDivider />
+ <MenuItem onClick={() => { editor.chain().focus().setHorizontalRule().run(); setShowInsertMenu(false); }}>
+ <Minus size={12} /> Horizontal Rule
+ </MenuItem>
+ <MenuItem onClick={() => { editor.chain().focus().setHardBreak().run(); setShowInsertMenu(false); }}>
+ <SeparatorHorizontal size={12} /> Page Break
+ </MenuItem>
+ <MenuDivider />
+ <MenuItem onClick={() => { onToggleHeader?.(); setShowInsertMenu(false); }} color={headerEnabled ? F.ORANGE : F.WHITE}>
+ <PanelTop size={12} /> Header {headerEnabled ? '(On)' : '(Off)'}
+ </MenuItem>
+ <MenuItem onClick={() => { onToggleFooter?.(); setShowInsertMenu(false); }} color={footerEnabled ? F.ORANGE : F.WHITE}>
+ <PanelBottom size={12} /> Footer {footerEnabled ? '(On)' : '(Off)'}
+ </MenuItem>
+ <MenuDivider />
+ <MenuItem onClick={() => { onToggleWatermark?.(); setShowInsertMenu(false); }} color={watermarkEnabled ? F.ORANGE : F.WHITE}>
+ <Droplets size={12} /> Watermark {watermarkEnabled ? '(On)' : '(Off)'}
+ </MenuItem>
+ </Dropdown>
+
+ {/* Table dropdown */}
+ <Dropdown
+ open={showTableMenu}
+ onToggle={() => setShowTableMenu(!showTableMenu)}
+ trigger={
+ <button
+ style={{
+ padding: '4px',
+ borderRadius: '2px',
+ border: 'none',
+ backgroundColor: 'transparent',
+ color: editor.isActive('table') ? F.ORANGE : F.WHITE,
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '2px',
+ transition: 'all 0.2s',
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.backgroundColor = F.HOVER; }}
+ onMouseLeave={(e) => { e.currentTarget.style.backgroundColor = 'transparent'; }}
+ title="Table"
+ >
+ <TableIcon size={13} />
+ <ChevronDown size={8} />
+ </button>
+ }
+ >
+ <MenuItem onClick={() => { editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(); setShowTableMenu(false); }}>
+ <Plus size={11} /> Insert Table (3x3)
+ </MenuItem>
+ <MenuItem onClick={() => { editor.chain().focus().insertTable({ rows: 5, cols: 5, withHeaderRow: true }).run(); setShowTableMenu(false); }}>
+ <Plus size={11} /> Insert Table (5x5)
+ </MenuItem>
+ {editor.isActive('table') && (
+ <>
+ <MenuDivider />
+ <MenuItem onClick={() => { editor.chain().focus().addColumnBefore().run(); setShowTableMenu(false); }}>
+ Add Column Before
+ </MenuItem>
+ <MenuItem onClick={() => { editor.chain().focus().addColumnAfter().run(); setShowTableMenu(false); }}>
+ Add Column After
+ </MenuItem>
+ <MenuItem onClick={() => { editor.chain().focus().addRowBefore().run(); setShowTableMenu(false); }}>
+ Add Row Before
+ </MenuItem>
+ <MenuItem onClick={() => { editor.chain().focus().addRowAfter().run(); setShowTableMenu(false); }}>
+ Add Row After
+ </MenuItem>
+ <MenuItem onClick={() => { editor.chain().focus().mergeCells().run(); setShowTableMenu(false); }}>
+ Merge Cells
+ </MenuItem>
+ <MenuItem onClick={() => { editor.chain().focus().splitCell().run(); setShowTableMenu(false); }}>
+ Split Cell
+ </MenuItem>
+ <MenuDivider />
+ <MenuItem onClick={() => { editor.chain().focus().deleteColumn().run(); setShowTableMenu(false); }} color={F.RED}>
+ Delete Column
+ </MenuItem>
+ <MenuItem onClick={() => { editor.chain().focus().deleteRow().run(); setShowTableMenu(false); }} color={F.RED}>
+ Delete Row
+ </MenuItem>
+ <MenuItem onClick={() => { editor.chain().focus().deleteTable().run(); setShowTableMenu(false); }} color={F.RED}>
+ <Trash2 size={11} /> Delete Table
+ </MenuItem>
+ </>
+ )}
+ </Dropdown>
+
+ <Sep />
+
+ {/* Header / Footer / Watermark toggles — always visible */}
+ <Btn
+ onClick={() => onToggleHeader?.()}
+ isActive={headerEnabled}
+ title={headerEnabled ? 'Header (On) — click to disable' : 'Header (Off) — click to enable'}
+ >
+ <PanelTop size={13} />
+ </Btn>
+ <Btn
+ onClick={() => onToggleFooter?.()}
+ isActive={footerEnabled}
+ title={footerEnabled ? 'Footer (On) — click to disable' : 'Footer (Off) — click to enable'}
+ >
+ <PanelBottom size={13} />
+ </Btn>
+ <Btn
+ onClick={() => onToggleWatermark?.()}
+ isActive={watermarkEnabled}
+ title={watermarkEnabled ? 'Watermark (On) — click to disable' : 'Watermark (Off) — click to enable'}
+ >
+ <Droplets size={13} />
+ </Btn>
+
+ <Sep />
+
+ {/* Zoom controls */}
+ <Btn onClick={() => onZoomChange(Math.max(25, zoom - 10))} title="Zoom out (−10%)">
+ <ZoomOut size={13} />
+ </Btn>
+ <button
+ onClick={() => onZoomChange(100)}
+ title="Reset zoom to 100%"
+ style={{
+ padding: '2px 4px',
+ borderRadius: '2px',
+ border: `1px solid ${F.BORDER}`,
+ backgroundColor: 'transparent',
+ color: F.WHITE,
+ fontSize: '9px',
+ fontFamily: '"IBM Plex Mono", monospace',
+ cursor: 'pointer',
+ minWidth: '38px',
+ textAlign: 'center',
+ transition: 'all 0.2s',
+ }}
+ onMouseEnter={(e) => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onMouseLeave={(e) => { e.currentTarget.style.borderColor = F.BORDER; }}
+ >
+ {zoom}%
+ </button>
+ <Btn onClick={() => onZoomChange(Math.min(200, zoom + 10))} title="Zoom in (+10%)">
+ <ZoomIn size={13} />
+ </Btn>
+
+ {/* Spacer */}
+ <div style={{ flex: 1, minWidth: '8px' }} />
+
+ {/* View mode toggle */}
+ <div style={{ display: 'flex', alignItems: 'center', border: `1px solid ${F.BORDER}`, borderRadius: '2px', overflow: 'hidden', flexShrink: 0 }}>
+ {([
+ { mode: 'edit' as const, icon: <Edit3 size={9} />, label: 'EDIT' },
+ { mode: 'preview' as const, icon: <Eye size={9} />, label: 'PREVIEW' },
+ { mode: 'split' as const, icon: <Columns size={9} />, label: 'SPLIT' },
+ ]).map(({ mode, icon, label }) => (
+ <button
+ key={mode}
+ onClick={() => onViewModeChange(mode)}
+ style={{
+ padding: '4px 8px',
+ fontSize: '9px',
+ fontWeight: 700,
+ fontFamily: '"IBM Plex Mono", monospace',
+ letterSpacing: '0.5px',
+ border: 'none',
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '3px',
+ backgroundColor: viewMode === mode ? F.ORANGE : 'transparent',
+ color: viewMode === mode ? F.DARK_BG : F.GRAY,
+ transition: 'all 0.2s',
+ }}
+ title={`${label} mode`}
+ >
+ {icon} {label}
+ </button>
+ ))}
+ </div>
+ </div>
+ );
+};
+
+export default DocxEditorToolbar;
diff --git a/fincept-terminal-desktop/src/components/tabs/report-builder/DocxPropertiesPanel.tsx b/fincept-terminal-desktop/src/components/tabs/report-builder/DocxPropertiesPanel.tsx
new file mode 100644
index 000000000..17e35a7d8
--- /dev/null
+++ b/fincept-terminal-desktop/src/components/tabs/report-builder/DocxPropertiesPanel.tsx
@@ -0,0 +1,472 @@
+import React, { useMemo } from 'react';
+import {
+ FileText,
+ User,
+ Building2,
+ Calendar,
+ Camera,
+ RotateCcw,
+ Trash2,
+ Hash,
+ Type,
+ FileIcon,
+ Info,
+ Droplets,
+ PanelTop,
+ Maximize2,
+} from 'lucide-react';
+import { DocxPropertiesPanelProps } from './types';
+
+// ── Fincept Design Tokens ──────────────────────────────────────────
+const F = {
+ ORANGE: '#FF8800',
+ WHITE: '#FFFFFF',
+ RED: '#FF3B3B',
+ GREEN: '#00D66F',
+ GRAY: '#787878',
+ DARK_BG: '#000000',
+ PANEL_BG: '#0F0F0F',
+ HEADER_BG: '#1A1A1A',
+ BORDER: '#2A2A2A',
+ HOVER: '#1F1F1F',
+ MUTED: '#4A4A4A',
+ CYAN: '#00E5FF',
+};
+
+// ── Shared Styles ──────────────────────────────────────────────────
+const inputStyle: React.CSSProperties = {
+ width: '100%',
+ padding: '6px 8px',
+ backgroundColor: F.DARK_BG,
+ color: F.WHITE,
+ border: `1px solid ${F.BORDER}`,
+ borderRadius: '2px',
+ fontSize: '10px',
+ fontFamily: '"IBM Plex Mono", "Consolas", monospace',
+ outline: 'none',
+};
+
+const labelStyle: React.CSSProperties = {
+ fontSize: '9px',
+ fontWeight: 700,
+ color: F.GRAY,
+ letterSpacing: '0.5px',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px',
+ marginBottom: '4px',
+};
+
+const sectionHeaderStyle: React.CSSProperties = {
+ display: 'flex',
+ alignItems: 'center',
+ gap: '6px',
+ marginBottom: '12px',
+ color: F.ORANGE,
+ fontSize: '9px',
+ fontWeight: 700,
+ letterSpacing: '0.5px',
+ fontFamily: '"IBM Plex Mono", monospace',
+};
+
+const sectionStyle: React.CSSProperties = {
+ padding: '12px',
+ borderBottom: `1px solid ${F.BORDER}`,
+};
+
+const statBoxStyle: React.CSSProperties = {
+ padding: '8px',
+ backgroundColor: F.DARK_BG,
+ border: `1px solid ${F.BORDER}`,
+ borderRadius: '2px',
+};
+
+// ── Utility Functions ──────────────────────────────────────────────
+const countWords = (html: string): number => {
+ const text = html.replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim();
+ return text ? text.split(' ').length : 0;
+};
+
+const countChars = (html: string): number => {
+ const text = html.replace(/<[^>]*>/g, '').trim();
+ return text.length;
+};
+
+// ── Main Component ─────────────────────────────────────────────────
+export const DocxPropertiesPanel: React.FC<DocxPropertiesPanelProps> = ({
+ metadata,
+ onMetadataChange,
+ htmlContent,
+ filePath,
+ fileId,
+ isDirty,
+ onCreateSnapshot,
+ onRestoreSnapshot,
+ onDeleteSnapshot,
+ snapshots,
+ pageSettings,
+ onPageSettingsChange,
+}) => {
+ const wordCount = useMemo(() => countWords(htmlContent), [htmlContent]);
+ const charCount = useMemo(() => countChars(htmlContent), [htmlContent]);
+ const pageEstimate = useMemo(() => Math.max(1, Math.ceil(wordCount / 300)), [wordCount]);
+
+ return (
+ <div
+ style={{
+ height: '100%',
+ overflowY: 'auto',
+ backgroundColor: F.PANEL_BG,
+ fontFamily: '"IBM Plex Mono", "Consolas", monospace',
+ }}
+ >
+ {/* Document Properties */}
+ <div style={sectionStyle}>
+ <div style={sectionHeaderStyle}>
+ <FileText size={12} />
+ DOCUMENT PROPERTIES
+ </div>
+
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
+ <div>
+ <label style={labelStyle}><Type size={10} /> TITLE</label>
+ <input
+ type="text"
+ value={metadata.title}
+ onChange={(e) => onMetadataChange({ title: e.target.value })}
+ placeholder="Document title"
+ style={inputStyle}
+ onFocus={(e) => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={(e) => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ </div>
+
+ <div>
+ <label style={labelStyle}><User size={10} /> AUTHOR</label>
+ <input
+ type="text"
+ value={metadata.author}
+ onChange={(e) => onMetadataChange({ author: e.target.value })}
+ placeholder="Author name"
+ style={inputStyle}
+ onFocus={(e) => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={(e) => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ </div>
+
+ <div>
+ <label style={labelStyle}><Building2 size={10} /> COMPANY</label>
+ <input
+ type="text"
+ value={metadata.company}
+ onChange={(e) => onMetadataChange({ company: e.target.value })}
+ placeholder="Company name"
+ style={inputStyle}
+ onFocus={(e) => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={(e) => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ </div>
+
+ <div>
+ <label style={labelStyle}><Calendar size={10} /> DATE</label>
+ <input
+ type="date"
+ value={metadata.date}
+ onChange={(e) => onMetadataChange({ date: e.target.value })}
+ style={{ ...inputStyle, colorScheme: 'dark' }}
+ onFocus={(e) => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={(e) => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ </div>
+ </div>
+ </div>
+
+ {/* Statistics */}
+ <div style={sectionStyle}>
+ <div style={sectionHeaderStyle}>
+ <Hash size={12} />
+ STATISTICS
+ </div>
+
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '6px' }}>
+ <div style={statBoxStyle}>
+ <div style={{ fontSize: '9px', color: F.GRAY, letterSpacing: '0.5px' }}>WORDS</div>
+ <div style={{ fontSize: '12px', fontWeight: 700, color: F.CYAN }}>{wordCount.toLocaleString()}</div>
+ </div>
+ <div style={statBoxStyle}>
+ <div style={{ fontSize: '9px', color: F.GRAY, letterSpacing: '0.5px' }}>CHARS</div>
+ <div style={{ fontSize: '12px', fontWeight: 700, color: F.CYAN }}>{charCount.toLocaleString()}</div>
+ </div>
+ <div style={statBoxStyle}>
+ <div style={{ fontSize: '9px', color: F.GRAY, letterSpacing: '0.5px' }}>PAGES</div>
+ <div style={{ fontSize: '12px', fontWeight: 700, color: F.CYAN }}>{pageEstimate}</div>
+ </div>
+ <div style={statBoxStyle}>
+ <div style={{ fontSize: '9px', color: F.GRAY, letterSpacing: '0.5px' }}>STATUS</div>
+ <div style={{ fontSize: '12px', fontWeight: 700, color: isDirty ? F.ORANGE : F.GREEN }}>
+ {isDirty ? 'Modified' : 'Saved'}
+ </div>
+ </div>
+ </div>
+ </div>
+
+ {/* File Info */}
+ {filePath && (
+ <div style={sectionStyle}>
+ <div style={sectionHeaderStyle}>
+ <Info size={12} />
+ FILE INFO
+ </div>
+ <div
+ style={{
+ padding: '8px',
+ backgroundColor: F.DARK_BG,
+ border: `1px solid ${F.BORDER}`,
+ borderRadius: '2px',
+ fontSize: '9px',
+ color: F.GRAY,
+ wordBreak: 'break-all',
+ display: 'flex',
+ alignItems: 'flex-start',
+ gap: '4px',
+ }}
+ >
+ <FileIcon size={10} style={{ flexShrink: 0, marginTop: '1px' }} />
+ {filePath}
+ </div>
+ </div>
+ )}
+
+ {/* Watermark */}
+ <div style={sectionStyle}>
+ <div style={sectionHeaderStyle}>
+ <Droplets size={12} />
+ WATERMARK
+ </div>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
+ <label
+ style={{ display: 'flex', alignItems: 'center', gap: '8px', cursor: 'pointer', fontSize: '10px', color: F.WHITE }}
+ >
+ <input
+ type="checkbox"
+ checked={pageSettings.watermarkEnabled}
+ onChange={() => onPageSettingsChange({ watermarkEnabled: !pageSettings.watermarkEnabled })}
+ style={{ accentColor: F.ORANGE }}
+ />
+ Enable watermark
+ </label>
+ {pageSettings.watermarkEnabled && (
+ <input
+ type="text"
+ value={pageSettings.watermarkText}
+ onChange={(e) => onPageSettingsChange({ watermarkText: e.target.value })}
+ placeholder="Watermark text"
+ style={inputStyle}
+ onFocus={(e) => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={(e) => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ )}
+ </div>
+ </div>
+
+ {/* Header & Footer */}
+ <div style={sectionStyle}>
+ <div style={sectionHeaderStyle}>
+ <PanelTop size={12} />
+ HEADER & FOOTER
+ </div>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
+ <label
+ style={{ display: 'flex', alignItems: 'center', gap: '8px', cursor: 'pointer', fontSize: '10px', color: F.WHITE }}
+ >
+ <input
+ type="checkbox"
+ checked={pageSettings.headerEnabled}
+ onChange={() => onPageSettingsChange({ headerEnabled: !pageSettings.headerEnabled })}
+ style={{ accentColor: F.ORANGE }}
+ />
+ Enable header
+ </label>
+ {pageSettings.headerEnabled && (
+ <input
+ type="text"
+ value={pageSettings.headerText}
+ onChange={(e) => onPageSettingsChange({ headerText: e.target.value })}
+ placeholder="Header text"
+ style={inputStyle}
+ onFocus={(e) => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={(e) => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ )}
+ <label
+ style={{ display: 'flex', alignItems: 'center', gap: '8px', cursor: 'pointer', fontSize: '10px', color: F.WHITE }}
+ >
+ <input
+ type="checkbox"
+ checked={pageSettings.footerEnabled}
+ onChange={() => onPageSettingsChange({ footerEnabled: !pageSettings.footerEnabled })}
+ style={{ accentColor: F.ORANGE }}
+ />
+ Enable footer
+ </label>
+ {pageSettings.footerEnabled && (
+ <input
+ type="text"
+ value={pageSettings.footerText}
+ onChange={(e) => onPageSettingsChange({ footerText: e.target.value })}
+ placeholder="Footer text"
+ style={inputStyle}
+ onFocus={(e) => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={(e) => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ )}
+ </div>
+ </div>
+
+ {/* Page Margins */}
+ <div style={sectionStyle}>
+ <div style={sectionHeaderStyle}>
+ <Maximize2 size={12} />
+ PAGE MARGINS (mm)
+ </div>
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '6px' }}>
+ {(['top', 'right', 'bottom', 'left'] as const).map((side) => (
+ <div key={side}>
+ <label style={{ ...labelStyle, marginBottom: '2px' }}>
+ {side.toUpperCase()}
+ </label>
+ <input
+ type="number"
+ min={0}
+ max={50}
+ value={pageSettings.margins[side]}
+ onChange={(e) => {
+ const val = parseInt(e.target.value, 10);
+ if (!isNaN(val)) {
+ onPageSettingsChange({ margins: { ...pageSettings.margins, [side]: val } });
+ }
+ }}
+ style={inputStyle}
+ onFocus={(e) => { e.currentTarget.style.borderColor = F.ORANGE; }}
+ onBlur={(e) => { e.currentTarget.style.borderColor = F.BORDER; }}
+ />
+ </div>
+ ))}
+ </div>
+ </div>
+
+ {/* Snapshots */}
+ <div style={{ padding: '12px' }}>
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '12px' }}>
+ <div style={sectionHeaderStyle}>
+ <Camera size={12} />
+ SNAPSHOTS
+ </div>
+ <button
+ onClick={onCreateSnapshot}
+ style={{
+ padding: '4px 8px',
+ backgroundColor: F.ORANGE,
+ color: F.DARK_BG,
+ border: 'none',
+ borderRadius: '2px',
+ fontSize: '9px',
+ fontWeight: 700,
+ fontFamily: '"IBM Plex Mono", monospace',
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px',
+ transition: 'all 0.2s',
+ }}
+ title="Create snapshot of current state"
+ >
+ <Camera size={10} />
+ CREATE
+ </button>
+ </div>
+
+ {snapshots.length === 0 ? (
+ <div
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ padding: '16px',
+ color: F.MUTED,
+ fontSize: '10px',
+ textAlign: 'center',
+ }}
+ >
+ {fileId ? 'No snapshots yet' : 'Save the file first to create snapshots'}
+ </div>
+ ) : (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '6px', maxHeight: '200px', overflowY: 'auto' }}>
+ {snapshots.map((snap) => (
+ <div
+ key={snap.id}
+ style={{
+ padding: '8px',
+ backgroundColor: F.DARK_BG,
+ border: `1px solid ${F.BORDER}`,
+ borderRadius: '2px',
+ }}
+ >
+ <div style={{ fontSize: '10px', fontWeight: 700, color: F.WHITE, marginBottom: '4px' }}>
+ {snap.snapshot_name}
+ </div>
+ <div style={{ fontSize: '9px', color: F.GRAY }}>
+ {new Date(snap.created_at).toLocaleString()}
+ </div>
+ <div style={{ display: 'flex', gap: '4px', marginTop: '6px' }}>
+ <button
+ onClick={() => onRestoreSnapshot(snap.id)}
+ style={{
+ padding: '3px 6px',
+ backgroundColor: `${F.GREEN}20`,
+ color: F.GREEN,
+ border: 'none',
+ borderRadius: '2px',
+ fontSize: '9px',
+ fontWeight: 700,
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '3px',
+ transition: 'all 0.2s',
+ }}
+ >
+ <RotateCcw size={9} />
+ RESTORE
+ </button>
+ <button
+ onClick={() => onDeleteSnapshot(snap.id)}
+ style={{
+ padding: '3px 6px',
+ backgroundColor: `${F.RED}20`,
+ color: F.RED,
+ border: 'none',
+ borderRadius: '2px',
+ fontSize: '9px',
+ fontWeight: 700,
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '3px',
+ transition: 'all 0.2s',
+ }}
+ >
+ <Trash2 size={9} />
+ DELETE
+ </button>
+ </div>
+ </div>
+ ))}
+ </div>
+ )}
+ </div>
+ </div>
+ );
+};
+
+export default DocxPropertiesPanel;
diff --git a/fincept-terminal-desktop/src/components/tabs/report-builder/ExportDialog.tsx b/fincept-terminal-desktop/src/components/tabs/report-builder/ExportDialog.tsx
index 1d7e0c2f8..1802f5847 100644
--- a/fincept-terminal-desktop/src/components/tabs/report-builder/ExportDialog.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/report-builder/ExportDialog.tsx
@@ -17,12 +17,17 @@ import { ReportTemplate } from '@/services/core/reportService';
import { BrandKit } from '@/services/core/brandKitService';
import { reportExportService, ExportFormat } from '@/services/core/reportExportService';
import { toast } from '@/components/ui/terminal-toast';
+import { ReportBuilderMode, DocxDocumentMetadata } from './types';
interface ExportDialogProps {
open: boolean;
onClose: () => void;
template: ReportTemplate;
brandKit: BrandKit | null;
+ // DOCX mode props
+ builderMode?: ReportBuilderMode;
+ docxHtmlContent?: string;
+ docxMetadata?: DocxDocumentMetadata;
}
const EXPORT_OPTIONS: { format: ExportFormat; label: string; icon: React.ReactNode; desc: string }[] = [
@@ -32,12 +37,14 @@ const EXPORT_OPTIONS: { format: ExportFormat; label: string; icon: React.ReactNo
{ format: 'markdown', label: 'Markdown', icon: <FileText size={20} />, desc: 'For documentation' },
];
-export const ExportDialog: React.FC<ExportDialogProps> = ({ open, onClose, template, brandKit }) => {
+export const ExportDialog: React.FC<ExportDialogProps> = ({ open, onClose, template, brandKit, builderMode, docxHtmlContent, docxMetadata }) => {
const [selectedFormats, setSelectedFormats] = useState<ExportFormat[]>(['pdf']);
const [isExporting, setIsExporting] = useState(false);
const [showPreview, setShowPreview] = useState(false);
const [previewHtml, setPreviewHtml] = useState('');
+ const isDocxMode = builderMode === 'docx';
+
const toggleFormat = (format: ExportFormat) => {
setSelectedFormats(prev =>
prev.includes(format) ? prev.filter(f => f !== format) : [...prev, format]
@@ -52,13 +59,31 @@ export const ExportDialog: React.FC<ExportDialogProps> = ({ open, onClose, templ
setIsExporting(true);
try {
- if (selectedFormats.length === 1) {
- const path = await reportExportService.exportToFile(template, selectedFormats[0], brandKit);
- if (path) toast.success(`Exported to ${path}`);
+ if (isDocxMode && docxHtmlContent) {
+ // DOCX mode: export from TipTap HTML content
+ if (selectedFormats.length === 1) {
+ const path = await reportExportService.exportDocxModeToFile(docxHtmlContent, selectedFormats[0], docxMetadata);
+ if (path) toast.success(`Exported to ${path}`);
+ } else {
+ for (const format of selectedFormats) {
+ try {
+ const path = await reportExportService.exportDocxModeToFile(docxHtmlContent, format, docxMetadata);
+ if (path) toast.success(`Exported ${format.toUpperCase()} to ${path}`);
+ } catch (error) {
+ console.error(`Failed to export ${format}:`, error);
+ }
+ }
+ }
} else {
- const results = await reportExportService.batchExport(template, selectedFormats, brandKit);
- const success = Object.values(results).filter(Boolean).length;
- toast.success(`Exported ${success}/${selectedFormats.length} formats`);
+ // Builder mode: existing export logic
+ if (selectedFormats.length === 1) {
+ const path = await reportExportService.exportToFile(template, selectedFormats[0], brandKit);
+ if (path) toast.success(`Exported to ${path}`);
+ } else {
+ const results = await reportExportService.batchExport(template, selectedFormats, brandKit);
+ const success = Object.values(results).filter(Boolean).length;
+ toast.success(`Exported ${success}/${selectedFormats.length} formats`);
+ }
}
onClose();
} catch (error) {
@@ -69,13 +94,32 @@ export const ExportDialog: React.FC<ExportDialogProps> = ({ open, onClose, templ
};
const handlePreview = () => {
- const html = reportExportService.getPrintPreviewHTML(template, brandKit);
+ let html: string;
+ if (isDocxMode && docxHtmlContent) {
+ // Wrap DOCX HTML content in a basic printable page
+ html = `<!DOCTYPE html><html><head><style>
+ body { font-family: Arial, sans-serif; max-width: 210mm; margin: 0 auto; padding: 20mm; }
+ table { border-collapse: collapse; width: 100%; } th, td { border: 1px solid #ccc; padding: 8px; }
+ img { max-width: 100%; } h1,h2,h3,h4,h5,h6 { margin: 0.5em 0; }
+ </style></head><body>${docxHtmlContent}</body></html>`;
+ } else {
+ html = reportExportService.getPrintPreviewHTML(template, brandKit);
+ }
setPreviewHtml(html);
setShowPreview(true);
};
const handlePrint = () => {
- const html = reportExportService.getPrintPreviewHTML(template, brandKit);
+ let html: string;
+ if (isDocxMode && docxHtmlContent) {
+ html = `<!DOCTYPE html><html><head><style>
+ body { font-family: Arial, sans-serif; max-width: 210mm; margin: 0 auto; padding: 20mm; }
+ table { border-collapse: collapse; width: 100%; } th, td { border: 1px solid #ccc; padding: 8px; }
+ img { max-width: 100%; } h1,h2,h3,h4,h5,h6 { margin: 0.5em 0; }
+ </style></head><body>${docxHtmlContent}</body></html>`;
+ } else {
+ html = reportExportService.getPrintPreviewHTML(template, brandKit);
+ }
const printWindow = window.open('', '_blank');
if (printWindow) {
printWindow.document.write(html);
diff --git a/fincept-terminal-desktop/src/components/tabs/report-builder/ReportBuilderTab.tsx b/fincept-terminal-desktop/src/components/tabs/report-builder/ReportBuilderTab.tsx
index 963c09adb..48140d689 100644
--- a/fincept-terminal-desktop/src/components/tabs/report-builder/ReportBuilderTab.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/report-builder/ReportBuilderTab.tsx
@@ -1,4 +1,4 @@
-import React, { useState, useCallback, useEffect, useRef } from 'react';
+import React, { useState, useCallback, useEffect, useRef, lazy, Suspense } from 'react';
import { useWorkspaceTabState } from '@/hooks/useWorkspaceTabState';
import {
FolderOpen,
@@ -7,6 +7,7 @@ import {
Bot,
MessageCircle,
History,
+ FileType,
} from 'lucide-react';
import { toast } from '@/components/ui/terminal-toast';
import { useTranslation } from 'react-i18next';
@@ -41,6 +42,14 @@ import {
ShortcutsDialog,
} from './ProductivityFeatures';
+// Lazy-load DOCX editor components for bundle optimization
+const DocxEditorToolbar = lazy(() => import('./DocxEditorToolbar'));
+const DocxEditorCanvas = lazy(() => import('./DocxEditorCanvas'));
+const DocxPropertiesPanel = lazy(() => import('./DocxPropertiesPanel'));
+
+// Import DOCX editor hook (lightweight, no heavy deps)
+import { useDocxEditor } from './useDocxEditor';
+
// Import hooks
import {
useReportTemplate,
@@ -51,13 +60,19 @@ import {
} from './hooks';
// Import types and constants
-import { PageTheme, RightPanelView } from './types';
+import { PageTheme, RightPanelView, ReportBuilderMode } from './types';
const ReportBuilderTab: React.FC = () => {
const { t } = useTranslation('reportBuilder');
const { colors, fontSize } = useTerminalTheme();
const [currentTime, setCurrentTime] = useState(new Date());
+ // Builder mode: 'builder' (existing) or 'docx' (new DOCX editor)
+ const [builderMode, setBuilderMode] = useState<ReportBuilderMode>('builder');
+
+ // DOCX Editor hook (always initialized so TipTap editor is ready when switching modes)
+ const docxEditor = useDocxEditor();
+
// Template management hook
const {
template,
@@ -159,13 +174,15 @@ const ReportBuilderTab: React.FC = () => {
fontFamily,
defaultFontSize,
rightPanelView,
- }), [pageTheme, fontFamily, defaultFontSize, rightPanelView]);
+ builderMode,
+ }), [pageTheme, fontFamily, defaultFontSize, rightPanelView, builderMode]);
const setWorkspaceState = useCallback((state: Record<string, unknown>) => {
if (typeof state.pageTheme === 'string') setPageTheme(state.pageTheme as PageTheme);
if (typeof state.fontFamily === 'string') setFontFamily(state.fontFamily);
if (typeof state.defaultFontSize === 'number') setDefaultFontSize(state.defaultFontSize);
if (typeof state.rightPanelView === 'string') setRightPanelView(state.rightPanelView as RightPanelView);
+ if (typeof state.builderMode === 'string') setBuilderMode(state.builderMode as ReportBuilderMode);
}, []);
useWorkspaceTabState('report-builder', getWorkspaceState, setWorkspaceState);
@@ -332,59 +349,117 @@ const ReportBuilderTab: React.FC = () => {
onShortcuts={() => setShowShortcuts(true)}
onTemplateGallery={() => setShowTemplateGallery(true)}
onLoad={loadTemplate}
- onSave={saveTemplate}
- onExport={() => setShowExportDialog(true)}
+ onSave={builderMode === 'docx' ? docxEditor.saveDocx : saveTemplate}
+ onExport={builderMode === 'docx' ? docxEditor.exportDocx : () => setShowExportDialog(true)}
isSaving={isSaving}
isAutoSaving={isAutoSaving}
lastSaved={lastSaved}
hasComponents={template.components.length > 0}
+ builderMode={builderMode}
+ onModeChange={setBuilderMode}
+ onImportDocx={docxEditor.importDocx}
+ onExportDocx={docxEditor.exportDocx}
+ docxFileName={docxEditor.docxState.fileName}
+ isDocxDirty={docxEditor.docxState.isDirty}
/>
{/* Main Content */}
- <div className="flex-1 flex overflow-hidden">
- {/* Left Panel - Components */}
- <ComponentToolbar
- onAddComponent={handleAddComponent}
- template={template}
- selectedComponent={selectedComponent}
- onSelectComponent={setSelectedComponent}
- onDeleteComponent={deleteComponent}
- onDuplicateComponent={duplicateComponent}
- onDragEnd={handleDragEnd}
- pageTheme={pageTheme}
- onPageThemeChange={setPageTheme}
- customBgColor={customBgColor}
- onCustomBgColorChange={setCustomBgColor}
- showColorPicker={showColorPicker}
- onShowColorPickerChange={setShowColorPicker}
- fontFamily={fontFamily}
- onFontFamilyChange={setFontFamily}
- defaultFontSize={defaultFontSize}
- onDefaultFontSizeChange={setDefaultFontSize}
- isBold={isBold}
- onIsBoldChange={setIsBold}
- isItalic={isItalic}
- onIsItalicChange={setIsItalic}
- />
-
- {/* Center - Canvas */}
- <DocumentCanvas
- template={template}
- selectedComponent={selectedComponent}
- onSelectComponent={setSelectedComponent}
- onUpdateComponent={updateComponent}
- pageTheme={pageTheme}
- customBgColor={customBgColor}
- fontFamily={fontFamily}
- defaultFontSize={defaultFontSize}
- isBold={isBold}
- isItalic={isItalic}
- advancedStyles={advancedStyles}
- tocItems={tocItems}
- />
+ <div style={{ flex: 1, display: 'flex', overflow: 'hidden', minHeight: 0 }}>
+ {builderMode === 'builder' ? (
+ <>
+ {/* Left Panel - Components */}
+ <ComponentToolbar
+ onAddComponent={handleAddComponent}
+ template={template}
+ selectedComponent={selectedComponent}
+ onSelectComponent={setSelectedComponent}
+ onDeleteComponent={deleteComponent}
+ onDuplicateComponent={duplicateComponent}
+ onDragEnd={handleDragEnd}
+ pageTheme={pageTheme}
+ onPageThemeChange={setPageTheme}
+ customBgColor={customBgColor}
+ onCustomBgColorChange={setCustomBgColor}
+ showColorPicker={showColorPicker}
+ onShowColorPickerChange={setShowColorPicker}
+ fontFamily={fontFamily}
+ onFontFamilyChange={setFontFamily}
+ defaultFontSize={defaultFontSize}
+ onDefaultFontSizeChange={setDefaultFontSize}
+ isBold={isBold}
+ onIsBoldChange={setIsBold}
+ isItalic={isItalic}
+ onIsItalicChange={setIsItalic}
+ />
+
+ {/* Center - Canvas */}
+ <DocumentCanvas
+ template={template}
+ selectedComponent={selectedComponent}
+ onSelectComponent={setSelectedComponent}
+ onUpdateComponent={updateComponent}
+ pageTheme={pageTheme}
+ customBgColor={customBgColor}
+ fontFamily={fontFamily}
+ defaultFontSize={defaultFontSize}
+ isBold={isBold}
+ isItalic={isItalic}
+ advancedStyles={advancedStyles}
+ tocItems={tocItems}
+ />
+ </>
+ ) : (
+ /* DOCX Editor Mode */
+ <div style={{ flex: 1, display: 'flex', flexDirection: 'column', minHeight: 0, minWidth: 0, overflow: 'hidden' }}>
+ <Suspense fallback={
+ <div className="flex-1 flex items-center justify-center" style={{ color: colors.textMuted }}>
+ Loading DOCX editor...
+ </div>
+ }>
+ {/* DOCX Toolbar */}
+ <DocxEditorToolbar
+ editor={docxEditor.editor}
+ viewMode={docxEditor.docxState.viewMode}
+ onViewModeChange={docxEditor.setViewMode}
+ onInsertImage={docxEditor.insertImage}
+ onToggleWatermark={docxEditor.toggleWatermark}
+ watermarkEnabled={docxEditor.pageSettings.watermarkEnabled}
+ onToggleHeader={docxEditor.toggleHeader}
+ onToggleFooter={docxEditor.toggleFooter}
+ headerEnabled={docxEditor.pageSettings.headerEnabled}
+ footerEnabled={docxEditor.pageSettings.footerEnabled}
+ lineSpacing={docxEditor.pageSettings.lineSpacing}
+ onLineSpacingChange={(spacing) => docxEditor.updatePageSettings({ lineSpacing: spacing })}
+ zoom={docxEditor.zoom}
+ onZoomChange={docxEditor.setZoom}
+ />
+ {/* DOCX Canvas */}
+ <div style={{ flex: 1, minHeight: 0, overflow: 'hidden' }}>
+ <DocxEditorCanvas
+ editor={docxEditor.editor}
+ viewMode={docxEditor.docxState.viewMode}
+ originalArrayBuffer={docxEditor.docxState.originalArrayBuffer}
+ watermarkEnabled={docxEditor.pageSettings.watermarkEnabled}
+ watermarkText={docxEditor.pageSettings.watermarkText}
+ headerEnabled={docxEditor.pageSettings.headerEnabled}
+ footerEnabled={docxEditor.pageSettings.footerEnabled}
+ headerText={docxEditor.pageSettings.headerText}
+ footerText={docxEditor.pageSettings.footerText}
+ onToggleHeader={docxEditor.toggleHeader}
+ onToggleFooter={docxEditor.toggleFooter}
+ onHeaderTextChange={(text) => docxEditor.updatePageSettings({ headerText: text })}
+ onFooterTextChange={(text) => docxEditor.updatePageSettings({ footerText: text })}
+ lineSpacing={docxEditor.pageSettings.lineSpacing}
+ margins={docxEditor.pageSettings.margins}
+ zoom={docxEditor.zoom}
+ />
+ </div>
+ </Suspense>
+ </div>
+ )}
{/* Right Panel - Properties, AI Chat, and Advanced Styling */}
- <div className="w-1/5 border-l flex flex-col min-h-0" style={{ borderColor: colors.panel, backgroundColor: colors.panel }}>
+ <div style={{ width: '280px', minWidth: '280px', maxWidth: '280px', borderLeft: `1px solid ${colors.panel}`, display: 'flex', flexDirection: 'column', minHeight: 0, backgroundColor: colors.panel, flexShrink: 0 }}>
{/* Toggle Buttons */}
<div className="flex flex-wrap border-b" style={{ borderColor: colors.panel }}>
<button
@@ -465,15 +540,34 @@ const ReportBuilderTab: React.FC = () => {
{/* Properties Section */}
{(rightPanelView === 'properties' || rightPanelView === 'split') && (
<div className={`${rightPanelView === 'split' ? 'flex-1 border-b' : 'flex-1'} overflow-y-auto min-h-0`} style={{ borderColor: colors.panel }}>
- <PropertiesPanel
- selectedComponent={selectedComp}
- onUpdateComponent={updateComponent}
- onDeleteComponent={deleteComponent}
- onDuplicateComponent={duplicateComponent}
- onClearSelection={() => setSelectedComponent(null)}
- onSaveAsTemplate={saveAsTemplate}
- onImageUpload={handleImageUpload}
- />
+ {builderMode === 'docx' ? (
+ <Suspense fallback={<div className="p-3 text-xs" style={{ color: colors.textMuted }}>Loading...</div>}>
+ <DocxPropertiesPanel
+ metadata={docxEditor.docxState.metadata}
+ onMetadataChange={docxEditor.updateMetadata}
+ htmlContent={docxEditor.docxState.htmlContent}
+ filePath={docxEditor.docxState.filePath}
+ fileId={docxEditor.docxState.fileId}
+ isDirty={docxEditor.docxState.isDirty}
+ onCreateSnapshot={docxEditor.createSnapshot}
+ onRestoreSnapshot={docxEditor.restoreSnapshot}
+ onDeleteSnapshot={docxEditor.deleteSnapshot}
+ snapshots={docxEditor.snapshots}
+ pageSettings={docxEditor.pageSettings}
+ onPageSettingsChange={docxEditor.updatePageSettings}
+ />
+ </Suspense>
+ ) : (
+ <PropertiesPanel
+ selectedComponent={selectedComp}
+ onUpdateComponent={updateComponent}
+ onDeleteComponent={deleteComponent}
+ onDuplicateComponent={duplicateComponent}
+ onClearSelection={() => setSelectedComponent(null)}
+ onSaveAsTemplate={saveAsTemplate}
+ onImageUpload={handleImageUpload}
+ />
+ )}
</div>
)}
@@ -583,6 +677,9 @@ const ReportBuilderTab: React.FC = () => {
onClose={() => setShowExportDialog(false)}
template={template}
brandKit={activeBrandKit}
+ builderMode={builderMode}
+ docxHtmlContent={builderMode === 'docx' ? (docxEditor.editor?.getHTML() || docxEditor.docxState.htmlContent) : undefined}
+ docxMetadata={builderMode === 'docx' ? docxEditor.docxState.metadata : undefined}
/>
{/* Template Gallery Dialog */}
@@ -615,7 +712,11 @@ const ReportBuilderTab: React.FC = () => {
<TabFooter
tabName="REPORT BUILDER"
- leftInfo={[
+ leftInfo={builderMode === 'docx' ? [
+ { label: `Mode: DOCX Editor`, color: colors.primary },
+ { label: docxEditor.docxState.fileName, color: colors.text },
+ { label: docxEditor.docxState.isDirty ? 'Modified' : 'Saved', color: docxEditor.docxState.isDirty ? '#FFA500' : '#10b981' },
+ ] : [
{ label: `Components: ${template.components.length}`, color: colors.text },
{ label: `Theme: ${pageTheme.charAt(0).toUpperCase() + pageTheme.slice(1)}`, color: colors.text },
...(activeBrandKit ? [{ label: `Brand: ${activeBrandKit.name}`, color: colors.primary }] : []),
diff --git a/fincept-terminal-desktop/src/components/tabs/report-builder/ReportHeader.tsx b/fincept-terminal-desktop/src/components/tabs/report-builder/ReportHeader.tsx
index 4a908f47e..a1d616747 100644
--- a/fincept-terminal-desktop/src/components/tabs/report-builder/ReportHeader.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/report-builder/ReportHeader.tsx
@@ -9,6 +9,9 @@ import {
Search,
Keyboard,
LayoutTemplate,
+ Upload,
+ FileType,
+ Circle,
} from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { useTerminalTheme } from '@/contexts/ThemeContext';
@@ -29,6 +32,12 @@ export const ReportHeader: React.FC<ReportHeaderProps> = ({
isAutoSaving,
lastSaved,
hasComponents,
+ builderMode,
+ onModeChange,
+ onImportDocx,
+ onExportDocx,
+ docxFileName,
+ isDocxDirty,
}) => {
const { t } = useTranslation('reportBuilder');
const { colors, fontSize } = useTerminalTheme();
@@ -46,42 +55,83 @@ export const ReportHeader: React.FC<ReportHeaderProps> = ({
</span>
</div>
- {/* Productivity Toolbar */}
- <div className="flex items-center gap-1 border-l border-[#333333] pl-3">
+ {/* Mode Toggle */}
+ <div className="flex items-center border rounded overflow-hidden" style={{ borderColor: '#404040' }}>
<button
- onClick={onUndo}
- disabled={!canUndo}
- className="p-1.5 rounded hover:bg-[#2a2a2a] disabled:opacity-30"
- title="Undo (Ctrl+Z)"
+ onClick={() => onModeChange('builder')}
+ className="px-3 py-1 text-[10px] font-semibold transition-colors"
+ style={{
+ backgroundColor: builderMode === 'builder' ? colors.primary : 'transparent',
+ color: builderMode === 'builder' ? '#000' : colors.text,
+ }}
>
- <Undo2 size={14} />
+ Builder
</button>
<button
- onClick={onRedo}
- disabled={!canRedo}
- className="p-1.5 rounded hover:bg-[#2a2a2a] disabled:opacity-30"
- title="Redo (Ctrl+Y)"
+ onClick={() => onModeChange('docx')}
+ className="px-3 py-1 text-[10px] font-semibold transition-colors flex items-center gap-1"
+ style={{
+ backgroundColor: builderMode === 'docx' ? colors.primary : 'transparent',
+ color: builderMode === 'docx' ? '#000' : colors.text,
+ }}
>
- <Redo2 size={14} />
- </button>
- <button
- onClick={onFindReplace}
- className="p-1.5 rounded hover:bg-[#2a2a2a]"
- title="Find & Replace (Ctrl+F)"
- >
- <Search size={14} />
- </button>
- <button
- onClick={onShortcuts}
- className="p-1.5 rounded hover:bg-[#2a2a2a]"
- title="Keyboard Shortcuts"
- >
- <Keyboard size={14} />
+ <FileType size={10} />
+ DOCX Editor
</button>
</div>
+ {/* Builder mode: Productivity Toolbar */}
+ {builderMode === 'builder' && (
+ <div className="flex items-center gap-1 border-l border-[#333333] pl-3">
+ <button
+ onClick={onUndo}
+ disabled={!canUndo}
+ className="p-1.5 rounded hover:bg-[#2a2a2a] disabled:opacity-30"
+ title="Undo (Ctrl+Z)"
+ >
+ <Undo2 size={14} />
+ </button>
+ <button
+ onClick={onRedo}
+ disabled={!canRedo}
+ className="p-1.5 rounded hover:bg-[#2a2a2a] disabled:opacity-30"
+ title="Redo (Ctrl+Y)"
+ >
+ <Redo2 size={14} />
+ </button>
+ <button
+ onClick={onFindReplace}
+ className="p-1.5 rounded hover:bg-[#2a2a2a]"
+ title="Find & Replace (Ctrl+F)"
+ >
+ <Search size={14} />
+ </button>
+ <button
+ onClick={onShortcuts}
+ className="p-1.5 rounded hover:bg-[#2a2a2a]"
+ title="Keyboard Shortcuts"
+ >
+ <Keyboard size={14} />
+ </button>
+ </div>
+ )}
+
+ {/* DOCX mode: File info */}
+ {builderMode === 'docx' && docxFileName && (
+ <div className="flex items-center gap-2 border-l border-[#333333] pl-3">
+ <span className="text-[10px]" style={{ color: colors.textMuted }}>
+ {docxFileName}
+ </span>
+ {isDocxDirty && (
+ <span title="Unsaved changes">
+ <Circle size={8} fill="#FFA500" style={{ color: '#FFA500' }} />
+ </span>
+ )}
+ </div>
+ )}
+
{/* Auto-save status */}
- {lastSaved && (
+ {builderMode === 'builder' && lastSaved && (
<span className="text-[10px]" style={{ color: colors.textMuted }}>
{isAutoSaving ? 'Saving...' : `Saved ${lastSaved.toLocaleTimeString()}`}
</span>
@@ -89,44 +139,80 @@ export const ReportHeader: React.FC<ReportHeaderProps> = ({
</div>
<div className="flex items-center gap-2">
- <button
- onClick={onTemplateGallery}
- className="px-3 py-1 text-xs rounded hover:bg-[#2a2a2a] transition-colors flex items-center gap-1"
- style={{ color: colors.text }}
- >
- <LayoutTemplate size={14} />
- Templates
- </button>
- <button
- onClick={onLoad}
- className="px-3 py-1 text-xs rounded hover:bg-[#2a2a2a] transition-colors flex items-center gap-1"
- style={{ color: colors.text }}
- >
- <FolderOpen size={14} />
- {t('header.load')}
- </button>
- <button
- onClick={onSave}
- disabled={isSaving}
- className="px-3 py-1 text-xs rounded hover:bg-[#2a2a2a] transition-colors flex items-center gap-1 disabled:opacity-50"
- style={{ color: colors.text }}
- >
- <Save size={14} />
- {isSaving ? t('header.saving') : t('header.save')}
- </button>
- <button
- onClick={onExport}
- disabled={!hasComponents}
- className="px-3 py-1 text-xs rounded transition-colors flex items-center gap-1 disabled:opacity-50"
- style={{
- backgroundColor: colors.primary,
- color: '#000',
- fontWeight: 'bold'
- }}
- >
- <Download size={14} />
- Export
- </button>
+ {builderMode === 'builder' ? (
+ <>
+ <button
+ onClick={onTemplateGallery}
+ className="px-3 py-1 text-xs rounded hover:bg-[#2a2a2a] transition-colors flex items-center gap-1"
+ style={{ color: colors.text }}
+ >
+ <LayoutTemplate size={14} />
+ Templates
+ </button>
+ <button
+ onClick={onLoad}
+ className="px-3 py-1 text-xs rounded hover:bg-[#2a2a2a] transition-colors flex items-center gap-1"
+ style={{ color: colors.text }}
+ >
+ <FolderOpen size={14} />
+ {t('header.load')}
+ </button>
+ <button
+ onClick={onSave}
+ disabled={isSaving}
+ className="px-3 py-1 text-xs rounded hover:bg-[#2a2a2a] transition-colors flex items-center gap-1 disabled:opacity-50"
+ style={{ color: colors.text }}
+ >
+ <Save size={14} />
+ {isSaving ? t('header.saving') : t('header.save')}
+ </button>
+ <button
+ onClick={onExport}
+ disabled={!hasComponents}
+ className="px-3 py-1 text-xs rounded transition-colors flex items-center gap-1 disabled:opacity-50"
+ style={{
+ backgroundColor: colors.primary,
+ color: '#000',
+ fontWeight: 'bold'
+ }}
+ >
+ <Download size={14} />
+ Export
+ </button>
+ </>
+ ) : (
+ <>
+ <button
+ onClick={onImportDocx}
+ className="px-3 py-1 text-xs rounded hover:bg-[#2a2a2a] transition-colors flex items-center gap-1"
+ style={{ color: colors.text }}
+ >
+ <Upload size={14} />
+ Import DOCX
+ </button>
+ <button
+ onClick={onSave}
+ disabled={isSaving}
+ className="px-3 py-1 text-xs rounded hover:bg-[#2a2a2a] transition-colors flex items-center gap-1 disabled:opacity-50"
+ style={{ color: colors.text }}
+ >
+ <Save size={14} />
+ Save
+ </button>
+ <button
+ onClick={onExportDocx || onExport}
+ className="px-3 py-1 text-xs rounded transition-colors flex items-center gap-1"
+ style={{
+ backgroundColor: colors.primary,
+ color: '#000',
+ fontWeight: 'bold'
+ }}
+ >
+ <Download size={14} />
+ Export DOCX
+ </button>
+ </>
+ )}
</div>
</div>
);
diff --git a/fincept-terminal-desktop/src/components/tabs/report-builder/docx-editor.css b/fincept-terminal-desktop/src/components/tabs/report-builder/docx-editor.css
new file mode 100644
index 000000000..ca1639b9e
--- /dev/null
+++ b/fincept-terminal-desktop/src/components/tabs/report-builder/docx-editor.css
@@ -0,0 +1,345 @@
+/* ══════════════════════════════════════════════════════════════════
+ TipTap Editor Content Styles
+ Fincept Terminal Design System
+ ══════════════════════════════════════════════════════════════════ */
+
+.tiptap {
+ outline: none;
+ min-height: 297mm;
+ line-height: 1.6;
+ color: #000;
+ font-size: 11pt;
+ font-family: 'Calibri', 'Arial', 'Helvetica Neue', sans-serif;
+}
+
+.tiptap:focus {
+ outline: none;
+}
+
+.tiptap p {
+ margin-bottom: 0.5em;
+}
+
+/* Headings — use document fonts (Calibri/Cambria as in Word) */
+.tiptap h1 { font-size: 2em; font-weight: bold; margin: 0.67em 0; font-family: 'Cambria', 'Georgia', 'Times New Roman', serif; }
+.tiptap h2 { font-size: 1.5em; font-weight: bold; margin: 0.83em 0; font-family: 'Cambria', 'Georgia', 'Times New Roman', serif; }
+.tiptap h3 { font-size: 1.17em; font-weight: bold; margin: 1em 0; font-family: 'Cambria', 'Georgia', 'Times New Roman', serif; }
+.tiptap h4 { font-size: 1em; font-weight: bold; margin: 1.33em 0; }
+.tiptap h5 { font-size: 0.83em; font-weight: bold; margin: 1.67em 0; }
+.tiptap h6 { font-size: 0.67em; font-weight: bold; margin: 2.33em 0; }
+
+/* ── Document styles (mapped from mammoth) ─────────────────────── */
+.tiptap h1.doc-title {
+ font-size: 28pt;
+ font-weight: bold;
+ text-align: center;
+ margin: 0.5em 0;
+ font-family: 'Cambria', 'Georgia', 'Times New Roman', serif;
+ color: #1a1a2e;
+}
+
+.tiptap h2.doc-subtitle {
+ font-size: 16pt;
+ font-weight: normal;
+ text-align: center;
+ margin: 0.3em 0 1em;
+ font-family: 'Cambria', 'Georgia', 'Times New Roman', serif;
+ color: #444;
+}
+
+/* TOC styles */
+.tiptap h2.toc-heading {
+ font-size: 16pt;
+ font-weight: bold;
+ margin: 1em 0 0.5em;
+}
+
+.tiptap p.toc-1 { padding-left: 0; margin: 4px 0; }
+.tiptap p.toc-2 { padding-left: 1.5em; margin: 3px 0; }
+.tiptap p.toc-3 { padding-left: 3em; margin: 2px 0; font-size: 0.9em; }
+
+/* Caption & footnote styles */
+.tiptap p.caption { font-size: 0.85em; color: #666; font-style: italic; text-align: center; margin: 0.5em 0; }
+.tiptap p.footnote { font-size: 0.8em; color: #555; border-top: 1px solid #ddd; padding-top: 4px; margin-top: 1em; }
+.tiptap p.endnote { font-size: 0.8em; color: #555; }
+.tiptap p.comment { font-size: 0.8em; color: #888; background: #fff9e6; padding: 4px 8px; border-left: 3px solid #f0c040; }
+
+/* Book title character style */
+.tiptap em.book-title { font-style: italic; font-weight: bold; }
+
+/* ── Tables ────────────────────────────────────────────────────── */
+.tiptap table {
+ border-collapse: collapse;
+ width: 100%;
+ margin: 1em 0;
+ table-layout: fixed;
+ overflow: hidden;
+}
+
+.tiptap td,
+.tiptap th {
+ border: 1px solid #ccc;
+ padding: 8px 12px;
+ min-width: 80px;
+ vertical-align: top;
+ position: relative;
+}
+
+.tiptap th {
+ background: #f5f5f5;
+ font-weight: bold;
+}
+
+.tiptap .selectedCell:after {
+ z-index: 2;
+ position: absolute;
+ content: "";
+ left: 0; right: 0; top: 0; bottom: 0;
+ background: rgba(255, 136, 0, 0.15);
+ pointer-events: none;
+}
+
+.tiptap .column-resize-handle {
+ position: absolute;
+ right: -2px;
+ top: 0;
+ bottom: -2px;
+ width: 4px;
+ background-color: #FF8800;
+ pointer-events: none;
+}
+
+.tiptap .tableWrapper {
+ overflow-x: auto;
+ margin: 1em 0;
+}
+
+.tiptap .resize-cursor {
+ cursor: col-resize;
+}
+
+/* ── Images ────────────────────────────────────────────────────── */
+.tiptap img {
+ max-width: 100%;
+ height: auto;
+ margin: 0.5em 0;
+ display: block;
+}
+
+.tiptap img.ProseMirror-selectednode {
+ outline: 2px solid #FF8800;
+ border-radius: 2px;
+}
+
+/* ── Lists (CRITICAL: ensure visible text on white page) ─────── */
+.tiptap ul,
+.tiptap ol {
+ margin: 0.5em 0;
+ padding-left: 1.5em;
+ color: #000;
+}
+
+.tiptap li {
+ margin: 0.25em 0;
+ color: #000;
+}
+
+.tiptap li p {
+ margin: 0;
+ color: #000;
+}
+
+.tiptap ul li::marker {
+ color: #000;
+}
+
+.tiptap ol li::marker {
+ color: #000;
+}
+
+/* ── Blockquotes ───────────────────────────────────────────────── */
+.tiptap blockquote {
+ border-left: 3px solid #FF8800;
+ padding-left: 1em;
+ margin: 1em 0;
+ color: #444;
+ font-style: italic;
+}
+
+/* ── Code Blocks ───────────────────────────────────────────────── */
+.tiptap pre {
+ background: #1a1a1a;
+ color: #00E5FF;
+ padding: 12px 16px;
+ border-radius: 2px;
+ font-family: 'IBM Plex Mono', 'Consolas', monospace;
+ font-size: 0.9em;
+ overflow-x: auto;
+ margin: 1em 0;
+}
+
+.tiptap code {
+ background: #f0f0f0;
+ color: #c7254e;
+ padding: 2px 4px;
+ border-radius: 2px;
+ font-family: 'IBM Plex Mono', 'Consolas', monospace;
+ font-size: 0.9em;
+}
+
+.tiptap pre code {
+ background: none;
+ color: inherit;
+ padding: 0;
+}
+
+/* ── Horizontal Rule ───────────────────────────────────────────── */
+.tiptap hr {
+ border: none;
+ border-top: 1px solid #ccc;
+ margin: 1.5em 0;
+}
+
+/* ── Links ─────────────────────────────────────────────────────── */
+.tiptap a {
+ color: #0066cc;
+ text-decoration: underline;
+ cursor: pointer;
+}
+
+/* ── Placeholder ───────────────────────────────────────────────── */
+.tiptap p.is-editor-empty:first-child::before {
+ content: attr(data-placeholder);
+ float: left;
+ color: #adb5bd;
+ pointer-events: none;
+ height: 0;
+ font-style: italic;
+}
+
+/* ── Mark Highlight ────────────────────────────────────────────── */
+.tiptap mark {
+ border-radius: 2px;
+ padding: 0 2px;
+}
+
+/* ── Strikethrough ─────────────────────────────────────────────── */
+.tiptap s {
+ text-decoration: line-through;
+}
+
+/* ── Superscript / Subscript ───────────────────────────────────── */
+.tiptap sup {
+ font-size: 0.75em;
+ vertical-align: super;
+}
+
+.tiptap sub {
+ font-size: 0.75em;
+ vertical-align: sub;
+}
+
+/* ══════════════════════════════════════════════════════════════════
+ docx-preview container overrides (dark theme)
+ ══════════════════════════════════════════════════════════════════ */
+.docx-preview-container {
+ background: #000000;
+ padding: 24px;
+ overflow-y: auto;
+ height: 100%;
+}
+
+.docx-preview-container .docx-wrapper {
+ background: #000000 !important;
+}
+
+.docx-preview-container section.docx {
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
+ margin-bottom: 20px;
+}
+
+/* ── Compact mode (split view) ─────────────────────────────────── */
+.docx-preview-compact {
+ padding: 8px !important;
+}
+
+.docx-preview-compact .docx-wrapper {
+ padding: 0 !important;
+}
+
+.docx-preview-compact section.docx {
+ margin-bottom: 8px !important;
+ transform-origin: top left;
+ transform: scale(0.85);
+ width: 117.6%;
+}
+
+/* ── Fidelity Warning Banner ───────────────────────────────────── */
+.docx-fidelity-banner {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 6px 12px;
+ background: rgba(255, 136, 0, 0.08);
+ border: 1px solid rgba(255, 136, 0, 0.25);
+ border-radius: 2px;
+ font-size: 10px;
+ color: #FF8800;
+ font-family: 'IBM Plex Mono', monospace;
+}
+
+/* ── Page Break Visual Indicator ───────────────────────────────── */
+.tiptap .page-break {
+ page-break-after: always;
+ border-top: 2px dashed #ccc;
+ margin: 2em 0;
+ position: relative;
+}
+
+.tiptap .page-break::after {
+ content: 'Page Break';
+ position: absolute;
+ top: -10px;
+ left: 50%;
+ transform: translateX(-50%);
+ background: #fff;
+ padding: 0 8px;
+ color: #999;
+ font-size: 9px;
+ text-transform: uppercase;
+ font-family: 'IBM Plex Mono', monospace;
+}
+
+/* ── Select dropdown dark fix (prevents white-on-white) ──────── */
+.docx-toolbar-select {
+ background-color: #000 !important;
+ color: #fff !important;
+}
+
+.docx-toolbar-select option {
+ background-color: #000 !important;
+ color: #fff !important;
+}
+
+/* ── Scrollbar Styling (Fincept Terminal) ─────────────────────── */
+.docx-preview-container::-webkit-scrollbar,
+.tiptap::-webkit-scrollbar {
+ width: 6px;
+ height: 6px;
+}
+
+.docx-preview-container::-webkit-scrollbar-track,
+.tiptap::-webkit-scrollbar-track {
+ background: #000000;
+}
+
+.docx-preview-container::-webkit-scrollbar-thumb,
+.tiptap::-webkit-scrollbar-thumb {
+ background: #2A2A2A;
+ border-radius: 3px;
+}
+
+.docx-preview-container::-webkit-scrollbar-thumb:hover,
+.tiptap::-webkit-scrollbar-thumb:hover {
+ background: #4A4A4A;
+}
diff --git a/fincept-terminal-desktop/src/components/tabs/report-builder/index.ts b/fincept-terminal-desktop/src/components/tabs/report-builder/index.ts
index 5199586a4..54d77e90e 100644
--- a/fincept-terminal-desktop/src/components/tabs/report-builder/index.ts
+++ b/fincept-terminal-desktop/src/components/tabs/report-builder/index.ts
@@ -19,6 +19,11 @@ export * from './AdditionalComponents';
export * from './CollaborationFeatures';
export * from './ProductivityFeatures';
+// DOCX Editor components
+export { DocxEditorToolbar } from './DocxEditorToolbar';
+export { DocxEditorCanvas } from './DocxEditorCanvas';
+export { DocxPropertiesPanel } from './DocxPropertiesPanel';
+
// Hooks
export {
useReportTemplate,
@@ -27,6 +32,7 @@ export {
useBrandKit,
useImageUpload,
} from './hooks';
+export { useDocxEditor } from './useDocxEditor';
// Types
export * from './types';
diff --git a/fincept-terminal-desktop/src/components/tabs/report-builder/types.ts b/fincept-terminal-desktop/src/components/tabs/report-builder/types.ts
index d76052471..fcb125f39 100644
--- a/fincept-terminal-desktop/src/components/tabs/report-builder/types.ts
+++ b/fincept-terminal-desktop/src/components/tabs/report-builder/types.ts
@@ -147,6 +147,13 @@ export interface ReportHeaderProps {
isAutoSaving: boolean;
lastSaved: Date | null;
hasComponents: boolean;
+ // DOCX mode props
+ builderMode: ReportBuilderMode;
+ onModeChange: (mode: ReportBuilderMode) => void;
+ onImportDocx: () => void;
+ onExportDocx?: () => void;
+ docxFileName?: string;
+ isDocxDirty?: boolean;
}
// Theme background style result
@@ -158,3 +165,107 @@ export interface ThemeBackgroundStyle {
backgroundImage?: string;
color: string;
}
+
+// ---- DOCX Editor Types ----
+
+// Editor mode for the Report Builder
+export type ReportBuilderMode = 'builder' | 'docx';
+
+// DOCX editor view states
+export type DocxViewMode = 'edit' | 'preview' | 'split';
+
+// DOCX editor state
+export interface DocxEditorState {
+ viewMode: DocxViewMode;
+ filePath: string | null;
+ fileName: string;
+ originalArrayBuffer: ArrayBuffer | null;
+ htmlContent: string;
+ isDirty: boolean;
+ fileId: string | null;
+ metadata: DocxDocumentMetadata;
+}
+
+// DOCX document metadata
+export interface DocxDocumentMetadata {
+ title: string;
+ author: string;
+ company: string;
+ date: string;
+}
+
+// DOCX Editor Toolbar props
+export interface DocxEditorToolbarProps {
+ editor: any; // TipTap Editor instance
+ viewMode: DocxViewMode;
+ onViewModeChange: (mode: DocxViewMode) => void;
+ onInsertImage: () => void;
+ // Watermark
+ onToggleWatermark?: () => void;
+ watermarkEnabled?: boolean;
+ // Header / Footer
+ onToggleHeader?: () => void;
+ onToggleFooter?: () => void;
+ headerEnabled?: boolean;
+ footerEnabled?: boolean;
+ // Line spacing
+ lineSpacing?: string;
+ onLineSpacingChange?: (spacing: string) => void;
+ // Zoom
+ zoom: number;
+ onZoomChange: (zoom: number) => void;
+}
+
+// DOCX Editor Canvas props
+export interface DocxEditorCanvasProps {
+ editor: any; // TipTap Editor instance
+ viewMode: DocxViewMode;
+ originalArrayBuffer: ArrayBuffer | null;
+ // Watermark
+ watermarkText?: string;
+ watermarkEnabled?: boolean;
+ // Header / Footer
+ headerText?: string;
+ footerText?: string;
+ headerEnabled?: boolean;
+ footerEnabled?: boolean;
+ onToggleHeader?: () => void;
+ onToggleFooter?: () => void;
+ onHeaderTextChange?: (text: string) => void;
+ onFooterTextChange?: (text: string) => void;
+ // Line spacing
+ lineSpacing?: string;
+ // Page margins
+ margins?: { top: number; right: number; bottom: number; left: number };
+ // Zoom
+ zoom?: number;
+}
+
+// DOCX page layout settings
+export interface DocxPageSettings {
+ watermarkEnabled: boolean;
+ watermarkText: string;
+ headerEnabled: boolean;
+ footerEnabled: boolean;
+ headerText: string;
+ footerText: string;
+ lineSpacing: string;
+ margins: { top: number; right: number; bottom: number; left: number };
+}
+
+// DOCX Properties Panel props
+export interface DocxPropertiesPanelProps {
+ metadata: DocxDocumentMetadata;
+ onMetadataChange: (updates: Partial<DocxDocumentMetadata>) => void;
+ htmlContent: string;
+ filePath: string | null;
+ fileId: string | null;
+ isDirty: boolean;
+ onCreateSnapshot: () => void;
+ onRestoreSnapshot: (snapshotId: string) => void;
+ snapshots: Array<{ id: string; snapshot_name: string; created_at: string }>;
+ onDeleteSnapshot: (snapshotId: string) => void;
+ // Page settings
+ pageSettings: DocxPageSettings;
+ onPageSettingsChange: (updates: Partial<DocxPageSettings>) => void;
+}
diff --git a/fincept-terminal-desktop/src/components/tabs/report-builder/useDocxEditor.ts b/fincept-terminal-desktop/src/components/tabs/report-builder/useDocxEditor.ts
new file mode 100644
index 000000000..5967311fc
--- /dev/null
+++ b/fincept-terminal-desktop/src/components/tabs/report-builder/useDocxEditor.ts
@@ -0,0 +1,418 @@
+import { useState, useCallback, useEffect } from 'react';
+import { useEditor } from '@tiptap/react';
+import StarterKit from '@tiptap/starter-kit';
+import Underline from '@tiptap/extension-underline';
+import TextAlign from '@tiptap/extension-text-align';
+import { TextStyle } from '@tiptap/extension-text-style';
+import Color from '@tiptap/extension-color';
+import Highlight from '@tiptap/extension-highlight';
+import FontFamily from '@tiptap/extension-font-family';
+import Image from '@tiptap/extension-image';
+import { Table } from '@tiptap/extension-table';
+import TableRow from '@tiptap/extension-table-row';
+import TableHeader from '@tiptap/extension-table-header';
+import TableCell from '@tiptap/extension-table-cell';
+import Link from '@tiptap/extension-link';
+import Placeholder from '@tiptap/extension-placeholder';
+import Typography from '@tiptap/extension-typography';
+import SuperscriptExt from '@tiptap/extension-superscript';
+import SubscriptExt from '@tiptap/extension-subscript';
+import { open, save } from '@tauri-apps/plugin-dialog';
+import { toast } from '@/components/ui/terminal-toast';
+import { docxService, DocxSnapshot } from '@/services/core/docxService';
+import { DocxEditorState, DocxViewMode, DocxDocumentMetadata, DocxPageSettings } from './types';
+import { showPrompt, showConfirm } from '@/utils/notifications';
+
+const DEFAULT_STATE: DocxEditorState = {
+ viewMode: 'edit',
+ filePath: null,
+ fileName: 'Untitled.docx',
+ originalArrayBuffer: null,
+ htmlContent: '',
+ isDirty: false,
+ fileId: null,
+ metadata: {
+ title: '',
+ author: '',
+ company: '',
+ date: new Date().toISOString().split('T')[0],
+ },
+};
+
+const DEFAULT_PAGE_SETTINGS: DocxPageSettings = {
+ watermarkEnabled: false,
+ watermarkText: 'DRAFT',
+ headerEnabled: false,
+ footerEnabled: false,
+ headerText: '',
+ footerText: '',
+ lineSpacing: '1.6',
+ margins: { top: 20, right: 20, bottom: 20, left: 20 },
+};
+
+export const useDocxEditor = () => {
+ const [docxState, setDocxState] = useState<DocxEditorState>(DEFAULT_STATE);
+ const [snapshots, setSnapshots] = useState<DocxSnapshot[]>([]);
+ const [pageSettings, setPageSettings] = useState<DocxPageSettings>(DEFAULT_PAGE_SETTINGS);
+ const [zoom, setZoom] = useState<number>(100);
+
+ // TipTap editor instance
+ const editor = useEditor({
+ extensions: [
+ StarterKit.configure({
+ heading: { levels: [1, 2, 3, 4, 5, 6] },
+ }),
+ Underline,
+ TextAlign.configure({
+ types: ['heading', 'paragraph'],
+ }),
+ TextStyle,
+ Color,
+ Highlight.configure({ multicolor: true }),
+ FontFamily,
+ Image.configure({
+ inline: true,
+ allowBase64: true,
+ }),
+ Table.configure({
+ resizable: true,
+ }),
+ TableRow,
+ TableHeader,
+ TableCell,
+ Link.configure({
+ openOnClick: false,
+ HTMLAttributes: {
+ rel: 'noopener noreferrer',
+ },
+ }),
+ Placeholder.configure({
+ placeholder: 'Start typing or import a DOCX file...',
+ }),
+ Typography,
+ SuperscriptExt,
+ SubscriptExt,
+ ],
+ content: '',
+ onUpdate: ({ editor: ed }) => {
+ setDocxState(prev => ({
+ ...prev,
+ htmlContent: ed.getHTML(),
+ isDirty: true,
+ }));
+ },
+ });
+
+ // Import DOCX file via Tauri dialog
+ const importDocx = useCallback(async () => {
+ try {
+ const selected = await open({
+ multiple: false,
+ filters: [{
+ name: 'Word Documents',
+ extensions: ['docx'],
+ }],
+ });
+
+ if (!selected) return;
+
+ const filePath = typeof selected === 'string' ? selected : selected;
+ toast.info('Importing DOCX file...');
+
+ const result = await docxService.importDocx(filePath);
+
+ // Set editor content
+ if (editor) {
+ editor.commands.setContent(result.html);
+ }
+
+ const fileName = filePath.split(/[\\/]/).pop() || 'Untitled.docx';
+
+ // Save to file history
+ const fileId = await docxService.addOrUpdateFile({
+ file_name: fileName,
+ file_path: filePath,
+ page_count: 0,
+ last_opened: new Date().toISOString(),
+ last_modified: new Date().toISOString(),
+ created_at: new Date().toISOString(),
+ });
+
+ setDocxState({
+ viewMode: 'edit',
+ filePath,
+ fileName,
+ originalArrayBuffer: result.arrayBuffer,
+ htmlContent: result.html,
+ isDirty: false,
+ fileId,
+ metadata: {
+ title: fileName.replace(/\.docx$/i, ''),
+ author: '',
+ company: '',
+ date: new Date().toISOString().split('T')[0],
+ },
+ });
+
+ // Use real header/footer extracted from the DOCX file
+ const hf = result.headerFooter;
+ setPageSettings(prev => ({
+ ...prev,
+ headerEnabled: hf.hasHeader,
+ footerEnabled: hf.hasFooter,
+ headerText: hf.headerText || '',
+ footerText: hf.footerText || '',
+ }));
+
+ // Load snapshots for this file
+ const snaps = await docxService.getSnapshots(fileId);
+ setSnapshots(snaps);
+
+ if (result.messages.length > 0) {
+ // Log each warning so user can see exactly what's happening
+ console.warn(`[DocxEditor] Import warnings for "${fileName}" (${result.messages.length}):`);
+ result.messages.forEach((msg, i) => {
+ console.warn(` [${i + 1}] [${msg.type}] ${msg.message}`);
+ });
+
+ // Group warnings by type for a useful toast
+ const warningsByType: Record<string, number> = {};
+ result.messages.forEach((msg) => {
+ warningsByType[msg.type] = (warningsByType[msg.type] || 0) + 1;
+ });
+ const summary = Object.entries(warningsByType)
+ .map(([type, count]) => `${count} ${type}`)
+ .join(', ');
+
+ // Show first 3 unique warning messages in toast for visibility
+ const uniqueMessages = [...new Set(result.messages.map(m => m.message))];
+ const preview = uniqueMessages.slice(0, 3).join(' | ');
+ const moreCount = uniqueMessages.length > 3 ? ` (+${uniqueMessages.length - 3} more)` : '';
+
+ toast.warning(`Import: ${summary}${moreCount}\n${preview}`);
+ } else {
+ toast.success(`Imported: ${fileName}`);
+ }
+ } catch (error) {
+ console.error('[DocxEditor] Import failed:', error);
+ toast.error('Failed to import DOCX file');
+ }
+ }, [editor]);
+
+ // Export to DOCX
+ const exportDocx = useCallback(async () => {
+ try {
+ const html = editor?.getHTML() || docxState.htmlContent;
+ if (!html.trim()) {
+ toast.error('Nothing to export');
+ return;
+ }
+
+ const filePath = await save({
+ filters: [{
+ name: 'Word Documents',
+ extensions: ['docx'],
+ }],
+ defaultPath: docxState.fileName,
+ });
+
+ if (!filePath) return;
+
+ toast.info('Exporting DOCX...');
+
+ const docxBuffer = await docxService.exportToDocx(html, {
+ title: docxState.metadata.title,
+ author: docxState.metadata.author,
+ company: docxState.metadata.company,
+ date: docxState.metadata.date,
+ });
+
+ await docxService.writeDocxFile(filePath, docxBuffer);
+
+ setDocxState(prev => ({
+ ...prev,
+ isDirty: false,
+ fileName: filePath.split(/[\\/]/).pop() || prev.fileName,
+ filePath,
+ }));
+
+ toast.success('DOCX exported successfully');
+ } catch (error) {
+ console.error('[DocxEditor] Export failed:', error);
+ toast.error('Failed to export DOCX');
+ }
+ }, [editor, docxState]);
+
+ // Save (quick save to existing path or export)
+ const saveDocx = useCallback(async () => {
+ if (docxState.filePath) {
+ try {
+ const html = editor?.getHTML() || docxState.htmlContent;
+ const docxBuffer = await docxService.exportToDocx(html, {
+ title: docxState.metadata.title,
+ author: docxState.metadata.author,
+ company: docxState.metadata.company,
+ date: docxState.metadata.date,
+ });
+ await docxService.writeDocxFile(docxState.filePath, docxBuffer);
+ setDocxState(prev => ({ ...prev, isDirty: false }));
+ toast.success('Saved');
+ } catch (error) {
+ console.error('[DocxEditor] Save failed:', error);
+ toast.error('Failed to save');
+ }
+ } else {
+ await exportDocx();
+ }
+ }, [editor, docxState, exportDocx]);
+
+ // View mode
+ const setViewMode = useCallback((mode: DocxViewMode) => {
+ setDocxState(prev => ({ ...prev, viewMode: mode }));
+ }, []);
+
+ // Metadata
+ const updateMetadata = useCallback((updates: Partial<DocxDocumentMetadata>) => {
+ setDocxState(prev => ({
+ ...prev,
+ metadata: { ...prev.metadata, ...updates },
+ isDirty: true,
+ }));
+ }, []);
+
+ // Image insert
+ const insertImage = useCallback(async () => {
+ try {
+ const selected = await open({
+ multiple: false,
+ filters: [{
+ name: 'Images',
+ extensions: ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'webp', 'svg'],
+ }],
+ });
+
+ if (selected && editor) {
+ // For Tauri, we need to use file:// protocol
+ editor.chain().focus().setImage({ src: `file://${selected}` }).run();
+ }
+ } catch (error) {
+ console.error('[DocxEditor] Image insert failed:', error);
+ toast.error('Failed to insert image');
+ }
+ }, [editor]);
+
+ // Snapshots
+ const createSnapshot = useCallback(async () => {
+ if (!docxState.fileId) {
+ toast.warning('Save the file first to create snapshots');
+ return;
+ }
+
+ const name = await showPrompt('Enter snapshot name:', {
+ title: 'Create Snapshot',
+ defaultValue: `Snapshot ${new Date().toLocaleString()}`,
+ });
+ if (!name) return;
+
+ try {
+ const html = editor?.getHTML() || docxState.htmlContent;
+ await docxService.createSnapshot(docxState.fileId, name, html);
+ const snaps = await docxService.getSnapshots(docxState.fileId);
+ setSnapshots(snaps);
+ toast.success('Snapshot created');
+ } catch (error) {
+ console.error('[DocxEditor] Snapshot creation failed:', error);
+ toast.error('Failed to create snapshot');
+ }
+ }, [editor, docxState]);
+
+ const restoreSnapshot = useCallback(async (snapshotId: string) => {
+ const snapshot = snapshots.find(s => s.id === snapshotId);
+ if (!snapshot) return;
+
+ const confirmed = await showConfirm(
+ 'Current changes will be lost.',
+ { title: `Restore: ${snapshot.snapshot_name}?`, type: 'warning' }
+ );
+ if (!confirmed) return;
+
+ if (editor) {
+ editor.commands.setContent(snapshot.html_content);
+ }
+ setDocxState(prev => ({
+ ...prev,
+ htmlContent: snapshot.html_content,
+ isDirty: true,
+ }));
+ toast.success('Snapshot restored');
+ }, [editor, snapshots]);
+
+ const deleteSnapshot = useCallback(async (snapshotId: string) => {
+ if (!docxState.fileId) return;
+
+ const confirmed = await showConfirm(
+ 'This action cannot be undone.',
+ { title: 'Delete this snapshot?', type: 'danger' }
+ );
+ if (!confirmed) return;
+
+ try {
+ await docxService.deleteSnapshot(docxState.fileId, snapshotId);
+ const snaps = await docxService.getSnapshots(docxState.fileId);
+ setSnapshots(snaps);
+ toast.success('Snapshot deleted');
+ } catch (error) {
+ toast.error('Failed to delete snapshot');
+ }
+ }, [docxState.fileId]);
+
+ // New blank document
+ const newDocument = useCallback(() => {
+ if (editor) {
+ editor.commands.setContent('');
+ }
+ setDocxState(DEFAULT_STATE);
+ setPageSettings(DEFAULT_PAGE_SETTINGS);
+ setSnapshots([]);
+ }, [editor]);
+
+ // Page settings toggles
+ const toggleWatermark = useCallback(() => {
+ setPageSettings(prev => ({ ...prev, watermarkEnabled: !prev.watermarkEnabled }));
+ }, []);
+
+ const toggleHeader = useCallback(() => {
+ setPageSettings(prev => ({ ...prev, headerEnabled: !prev.headerEnabled }));
+ }, []);
+
+ const toggleFooter = useCallback(() => {
+ setPageSettings(prev => ({ ...prev, footerEnabled: !prev.footerEnabled }));
+ }, []);
+
+ const updatePageSettings = useCallback((updates: Partial<DocxPageSettings>) => {
+ setPageSettings(prev => ({ ...prev, ...updates }));
+ }, []);
+
+ return {
+ editor,
+ docxState,
+ snapshots,
+ pageSettings,
+ zoom,
+ setZoom,
+ importDocx,
+ exportDocx,
+ saveDocx,
+ newDocument,
+ setViewMode,
+ updateMetadata,
+ insertImage,
+ createSnapshot,
+ restoreSnapshot,
+ deleteSnapshot,
+ toggleWatermark,
+ toggleHeader,
+ toggleFooter,
+ updatePageSettings,
+ };
+};
diff --git a/fincept-terminal-desktop/src/components/tabs/settings-tab/hooks/useSettingsData.ts b/fincept-terminal-desktop/src/components/tabs/settings-tab/hooks/useSettingsData.ts
index fbd08f5c4..dd9b723eb 100644
--- a/fincept-terminal-desktop/src/components/tabs/settings-tab/hooks/useSettingsData.ts
+++ b/fincept-terminal-desktop/src/components/tabs/settings-tab/hooks/useSettingsData.ts
@@ -58,8 +58,15 @@ export function useSettingsData() {
const loadLLMConfigs = async (sessionApiKey?: string) => {
try {
- let configs = await sqliteService.getLLMConfigs();
-
+ // Load all LLM data in parallel
+ const [configs, globalSettings, modelCfgs] = await Promise.all([
+ sqliteService.getLLMConfigs(),
+ sqliteService.getLLMGlobalSettings(),
+ sqliteService.getLLMModelConfigs(),
+ ]);
+
+ // Handle empty configs or update session key (only if needed)
+ let finalConfigs = configs;
if (configs.length === 0) {
const userApiKey = sessionApiKey || '';
const now = new Date().toISOString();
@@ -73,26 +80,21 @@ export function useSettingsData() {
updated_at: now,
};
await sqliteService.saveLLMConfig(finceptConfig);
- configs = await sqliteService.getLLMConfigs();
+ finalConfigs = await sqliteService.getLLMConfigs();
} else if (sessionApiKey) {
- // Ensure the fincept config has the session API key populated
const finceptConfig = configs.find(c => c.provider === 'fincept');
if (finceptConfig && !finceptConfig.api_key) {
finceptConfig.api_key = sessionApiKey;
await sqliteService.saveLLMConfig(finceptConfig);
- configs = await sqliteService.getLLMConfigs();
+ finalConfigs = await sqliteService.getLLMConfigs();
}
}
- setLlmConfigs(configs);
-
- const globalSettings = await sqliteService.getLLMGlobalSettings();
+ setLlmConfigs(finalConfigs);
setLlmGlobalSettings(globalSettings);
-
- const modelCfgs = await sqliteService.getLLMModelConfigs();
setModelConfigs(modelCfgs);
- return { configs, modelCfgs };
+ return { configs: finalConfigs, modelCfgs };
} catch (error) {
console.error('Failed to load LLM configs:', error);
return { configs: [], modelCfgs: [] };
@@ -127,10 +129,13 @@ export function useSettingsData() {
setDbInitialized(true);
- await loadApiKeys();
- await loadLLMConfigs(sessionApiKey);
- await loadWSProviders();
- await loadKeyMappings();
+ // Load all data in parallel for maximum speed
+ await Promise.all([
+ loadApiKeys(),
+ loadLLMConfigs(sessionApiKey),
+ loadWSProviders(),
+ loadKeyMappings(),
+ ]);
console.log('[SettingsTab] Data loaded successfully');
} catch (error) {
diff --git a/fincept-terminal-desktop/src/components/tabs/settings-tab/sections/llm-config/components/ProviderConfigPanel.tsx b/fincept-terminal-desktop/src/components/tabs/settings-tab/sections/llm-config/components/ProviderConfigPanel.tsx
index 3ba0d7e49..ca2a4cc26 100644
--- a/fincept-terminal-desktop/src/components/tabs/settings-tab/sections/llm-config/components/ProviderConfigPanel.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/settings-tab/sections/llm-config/components/ProviderConfigPanel.tsx
@@ -165,7 +165,7 @@ export function ProviderConfigPanel({
) : (
<>
{providerModels.length === 0 && !providerModelsLoading && (
- <option value="">No models found - Click REFRESH</option>
+ <option value="">Click "REFRESH MODELS" to load available models</option>
)}
{providerModelsLoading && <option value="">Loading models...</option>}
{providerModels.map((model) => (
@@ -204,24 +204,30 @@ export function ProviderConfigPanel({
{ollamaModels.length} model{ollamaModels.length !== 1 ? 's' : ''} available
</div>
)}
- {!isOllama && !isFincept && providerModels.length > 0 && (
- <div style={{
- marginTop: '8px',
- fontSize: '11px',
- color: '#AAA',
- display: 'flex',
- flexDirection: 'column',
- gap: '4px'
- }}>
- <div style={styles.successMessage}>
- <Check size={14} />
- {providerModels.length} model{providerModels.length !== 1 ? 's' : ''} available
+ {!isOllama && !isFincept && (
+ providerModels.length > 0 ? (
+ <div style={{
+ marginTop: '8px',
+ fontSize: '11px',
+ color: '#AAA',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '4px'
+ }}>
+ <div style={styles.successMessage}>
+ <Check size={14} />
+ {providerModels.length} model{providerModels.length !== 1 ? 's' : ''} available
+ </div>
+ <div style={{ fontSize: '10px', color: '#666' }}>
+ Models fetched from {currentConfig.provider.toUpperCase()} API
+ {providerModelsLoading && ' (updating...)'}
+ </div>
</div>
- <div style={{ fontSize: '10px', color: '#666' }}>
- Models fetched from {currentConfig.provider.toUpperCase()} API
- {providerModelsLoading && ' (updating...)'}
+ ) : !providerModelsLoading && (
+ <div style={{ marginTop: '8px', fontSize: '10px', color: '#888', fontStyle: 'italic' }}>
+ 💡 Tip: Click "REFRESH MODELS" to see available models from {currentConfig.provider.toUpperCase()}
</div>
- </div>
+ )
)}
</div>
) : (
diff --git a/fincept-terminal-desktop/src/components/tabs/settings-tab/sections/llm-config/hooks/useLLMConfigState.ts b/fincept-terminal-desktop/src/components/tabs/settings-tab/sections/llm-config/hooks/useLLMConfigState.ts
index 9bb5bd217..61b7dd47d 100644
--- a/fincept-terminal-desktop/src/components/tabs/settings-tab/sections/llm-config/hooks/useLLMConfigState.ts
+++ b/fincept-terminal-desktop/src/components/tabs/settings-tab/sections/llm-config/hooks/useLLMConfigState.ts
@@ -206,19 +206,20 @@ export function useLLMConfigState({
if (provider === LLM_PROVIDERS.OLLAMA) {
fetchOllamaModels();
- } else if (provider !== LLM_PROVIDERS.FINCEPT) {
- fetchProviderModels();
}
+ // Skip auto-fetching external provider models - only load on user click
};
loadModels();
- }, [activeProvider, getCurrentLLMConfig, fetchOllamaModels, fetchProviderModels]);
+ }, [activeProvider, getCurrentLLMConfig, fetchOllamaModels]);
- // Load models for new model config form
+ // Load models for new model config form (LAZY - only on manual trigger)
useEffect(() => {
const loadNewModelConfigModels = async () => {
if (!showAddModel) return;
-
+ // Don't auto-fetch - let user click button or use manual entry
+ setNewModelConfigModels([]);
+ /* Disabled auto-fetch for performance
try {
const models = await LLMModelsService.getModelsByProvider(newModelConfig.provider);
if (models && models.length > 0) {
@@ -228,11 +229,11 @@ export function useLLMConfigState({
}
} catch {
setNewModelConfigModels([]);
- }
+ } */
};
loadNewModelConfigModels();
- }, [newModelConfig.provider, showAddModel]);
+ }, [showAddModel]);
// Reset new model config when closing form
const resetNewModelConfig = useCallback(() => {
diff --git a/fincept-terminal-desktop/src/components/tabs/surface-analytics/SurfaceAnalyticsTab.tsx b/fincept-terminal-desktop/src/components/tabs/surface-analytics/SurfaceAnalyticsTab.tsx
index d3af50560..0e1e1e2dc 100644
--- a/fincept-terminal-desktop/src/components/tabs/surface-analytics/SurfaceAnalyticsTab.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/surface-analytics/SurfaceAnalyticsTab.tsx
@@ -69,58 +69,59 @@ const ApiKeySetupScreen: React.FC<{
alignItems: 'center',
justifyContent: 'center',
height: '100%',
- padding: '48px',
+ padding: '16px',
backgroundColor: colors.background,
}}
>
{/* Main Container */}
<div
style={{
- maxWidth: '560px',
- padding: '32px',
+ maxWidth: '480px',
+ width: '100%',
+ padding: '16px',
backgroundColor: colors.panel,
border: `1px solid ${colors.textMuted}`,
borderRadius: 'var(--ft-border-radius)',
textAlign: 'center',
}}
>
- {/* Icon */}
- <div
- style={{
- width: '64px',
- height: '64px',
- margin: '0 auto 24px',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- backgroundColor: colors.primary + '15',
- borderRadius: '50%',
- }}
- >
- <Database size={32} style={{ color: colors.primary }} />
+ {/* Icon + Title row */}
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '8px', marginBottom: '8px' }}>
+ <div
+ style={{
+ width: '28px',
+ height: '28px',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ backgroundColor: colors.primary + '15',
+ borderRadius: '50%',
+ flexShrink: 0,
+ }}
+ >
+ <Database size={14} style={{ color: colors.primary }} />
+ </div>
+ <h2
+ style={{
+ fontSize: fontSize.subheading,
+ fontWeight: 700,
+ color: colors.text,
+ margin: 0,
+ fontFamily,
+ letterSpacing: '0.5px',
+ }}
+ >
+ {t('surfaceAnalytics.apiKeyRequired')}
+ </h2>
</div>
- {/* Title */}
- <h2
- style={{
- fontSize: fontSize.heading,
- fontWeight: 700,
- color: colors.text,
- marginBottom: '12px',
- fontFamily,
- letterSpacing: '0.5px',
- }}
- >
- {t('surfaceAnalytics.apiKeyRequired')}
- </h2>
-
{/* Description */}
<p
style={{
- fontSize: fontSize.body,
+ fontSize: fontSize.small,
color: colors.textMuted,
- marginBottom: '24px',
- lineHeight: '1.6',
+ marginBottom: '12px',
+ lineHeight: '1.5',
fontFamily,
}}
>
@@ -132,8 +133,8 @@ const ApiKeySetupScreen: React.FC<{
style={{
display: 'grid',
gridTemplateColumns: '1fr 1fr',
- gap: '12px',
- marginBottom: '24px',
+ gap: '6px',
+ marginBottom: '12px',
textAlign: 'left',
}}
>
@@ -148,14 +149,14 @@ const ApiKeySetupScreen: React.FC<{
style={{
display: 'flex',
alignItems: 'flex-start',
- gap: '8px',
- padding: '8px',
+ gap: '6px',
+ padding: '6px',
backgroundColor: colors.background,
border: `1px solid ${colors.textMuted}`,
borderRadius: 'var(--ft-border-radius)',
}}
>
- <Icon size={14} style={{ color: colors.primary, marginTop: '2px' }} />
+ <Icon size={12} style={{ color: colors.primary, marginTop: '2px', flexShrink: 0 }} />
<div>
<div style={{ fontSize: fontSize.tiny, fontWeight: 700, color: colors.text, letterSpacing: '0.5px' }}>
{label}
@@ -169,28 +170,28 @@ const ApiKeySetupScreen: React.FC<{
</div>
{/* Action Buttons */}
- <div style={{ display: 'flex', flexDirection: 'column', gap: '12px', alignItems: 'center' }}>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px', alignItems: 'center' }}>
{/* Primary action row */}
- <div style={{ display: 'flex', gap: '12px', justifyContent: 'center' }}>
+ <div style={{ display: 'flex', gap: '8px', justifyContent: 'center' }}>
<button
onClick={onOpenSettings}
style={{
display: 'flex',
alignItems: 'center',
- gap: '8px',
- padding: '10px 20px',
+ gap: '6px',
+ padding: '7px 14px',
backgroundColor: colors.primary,
color: colors.background,
border: 'none',
borderRadius: 'var(--ft-border-radius)',
- fontSize: fontSize.small,
+ fontSize: fontSize.tiny,
fontWeight: 700,
cursor: 'pointer',
fontFamily,
letterSpacing: '0.5px',
}}
>
- <Key size={14} />
+ <Key size={12} />
{t('surfaceAnalytics.configureApiKey')}
</button>
@@ -201,13 +202,13 @@ const ApiKeySetupScreen: React.FC<{
style={{
display: 'flex',
alignItems: 'center',
- gap: '8px',
- padding: '10px 20px',
+ gap: '6px',
+ padding: '7px 14px',
backgroundColor: 'transparent',
color: colors.info,
border: `1px solid ${colors.textMuted}`,
borderRadius: 'var(--ft-border-radius)',
- fontSize: fontSize.small,
+ fontSize: fontSize.tiny,
fontWeight: 700,
cursor: 'pointer',
textDecoration: 'none',
@@ -215,21 +216,21 @@ const ApiKeySetupScreen: React.FC<{
letterSpacing: '0.5px',
}}
>
- <ExternalLink size={14} />
+ <ExternalLink size={12} />
{t('surfaceAnalytics.getApiKey')}
</a>
</div>
{/* Demo mode option */}
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
+ <div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
<span style={{ fontSize: fontSize.tiny, color: colors.textMuted }}>{t('common.or')}</span>
<button
onClick={onUseDemoData}
style={{
display: 'flex',
alignItems: 'center',
- gap: '6px',
- padding: '8px 16px',
+ gap: '5px',
+ padding: '6px 12px',
backgroundColor: 'transparent',
color: colors.success,
border: `1px solid ${colors.success}50`,
@@ -241,7 +242,7 @@ const ApiKeySetupScreen: React.FC<{
letterSpacing: '0.5px',
}}
>
- <BarChart3 size={12} />
+ <BarChart3 size={11} />
{t('surfaceAnalytics.useDemoData')}
</button>
<span style={{ fontSize: fontSize.tiny, color: colors.textMuted }}>({t('surfaceAnalytics.syntheticData')})</span>
@@ -251,17 +252,17 @@ const ApiKeySetupScreen: React.FC<{
{/* Cost Notice */}
<div
style={{
- marginTop: '20px',
- padding: '10px',
+ marginTop: '10px',
+ padding: '7px 10px',
backgroundColor: colors.warning + '10',
border: `1px solid ${colors.warning}30`,
borderRadius: 'var(--ft-border-radius)',
display: 'flex',
alignItems: 'flex-start',
- gap: '8px',
+ gap: '6px',
}}
>
- <AlertTriangle size={14} style={{ color: colors.warning, flexShrink: 0, marginTop: '2px' }} />
+ <AlertTriangle size={12} style={{ color: colors.warning, flexShrink: 0, marginTop: '2px' }} />
<span style={{ fontSize: fontSize.tiny, color: colors.textMuted, textAlign: 'left' }}>
<strong style={{ color: colors.warning }}>{t('common.note')}:</strong> {t('surfaceAnalytics.paidServiceNotice')}
</span>
@@ -496,7 +497,7 @@ const SurfaceAnalyticsTab: React.FC = () => {
// Compute real metrics from actual data
const currentMetrics: ChartMetric[] = useMemo(() => {
switch (activeChart) {
- case 'volatility':
+ case 'volatility': {
if (!volatilityData) {
return [
{ label: 'ATM VOL', value: '--', change: '--', positive: null },
@@ -523,8 +524,9 @@ const SurfaceAnalyticsTab: React.FC = () => {
{ label: 'SPOT', value: `$${volatilityData.spotPrice.toFixed(2)}`, change: volatilityData.underlying, positive: null },
{ label: 'OPTIONS', value: `${volatilityData.strikes.length * volatilityData.expirations.length}`, change: 'CONTRACTS', positive: null },
];
+ }
- case 'correlation':
+ case 'correlation': {
if (!correlationData) {
return [
{ label: 'AVG CORR', value: '--', change: '--', positive: null },
@@ -549,8 +551,9 @@ const SurfaceAnalyticsTab: React.FC = () => {
{ label: 'MIN CORR', value: minCorr.toFixed(3), change: minCorr < 0 ? 'NEGATIVE' : 'POSITIVE', positive: minCorr > 0 },
{ label: 'ASSETS', value: `${correlationData.assets.length}`, change: `${correlationData.window}D WINDOW`, positive: null },
];
+ }
- case 'yield-curve':
+ case 'yield-curve': {
if (!yieldCurveData) {
return [
{ label: '2Y YIELD', value: '--', change: '--', positive: null },
@@ -574,8 +577,9 @@ const SurfaceAnalyticsTab: React.FC = () => {
{ label: '2-10 SPREAD', value: `${spread2_10.toFixed(2)}%`, change: spread2_10 < 0 ? 'INVERTED' : 'NORMAL', positive: spread2_10 >= 0 },
{ label: 'CURVE', value: spread2_10 < 0 ? 'INVERTED' : 'NORMAL', change: `${yieldCurveData.maturities.length} TENORS`, positive: spread2_10 >= 0 },
];
+ }
- case 'pca':
+ case 'pca': {
if (!pcaData) {
return [
{ label: 'PC1 VAR', value: '--', change: '--', positive: null },
@@ -592,6 +596,7 @@ const SurfaceAnalyticsTab: React.FC = () => {
{ label: 'PC3 VAR', value: `${(pcaData.varianceExplained[2] * 100).toFixed(1)}%`, change: 'TERTIARY', positive: null },
{ label: 'TOP 3', value: `${(totalVar * 100).toFixed(1)}%`, change: totalVar > 0.9 ? 'EXCELLENT' : 'GOOD', positive: totalVar > 0.9 },
];
+ }
default:
return [];
diff --git a/fincept-terminal-desktop/src/components/tabs/surface-analytics/components/MetricsPanel.tsx b/fincept-terminal-desktop/src/components/tabs/surface-analytics/components/MetricsPanel.tsx
index 9a7490df0..26610d79a 100644
--- a/fincept-terminal-desktop/src/components/tabs/surface-analytics/components/MetricsPanel.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/surface-analytics/components/MetricsPanel.tsx
@@ -42,7 +42,7 @@ export const MetricsPanel: React.FC<MetricsPanelProps> = ({
return (
<div
style={{
- width: '280px',
+ width: '200px',
borderRight: `1px solid ${colors.textMuted}`,
display: 'flex',
flexDirection: 'column',
@@ -53,7 +53,7 @@ export const MetricsPanel: React.FC<MetricsPanelProps> = ({
>
{/* Header */}
<div style={{
- padding: '12px',
+ padding: '6px 10px',
backgroundColor: colors.panel,
borderBottom: `1px solid ${colors.textMuted}`,
}}>
@@ -67,10 +67,10 @@ export const MetricsPanel: React.FC<MetricsPanelProps> = ({
</span>
{symbol && (
<div style={{
- fontSize: fontSize.body,
+ fontSize: fontSize.small,
fontWeight: 700,
color: accentColor,
- marginTop: '4px',
+ marginTop: '2px',
}}>
{symbol}
</div>
@@ -83,7 +83,7 @@ export const MetricsPanel: React.FC<MetricsPanelProps> = ({
<div
key={idx}
style={{
- padding: '10px 12px',
+ padding: '6px 10px',
borderBottom: `1px solid ${colors.textMuted}`,
}}
>
@@ -136,17 +136,17 @@ export const MetricsPanel: React.FC<MetricsPanelProps> = ({
))}
{/* Data Info Section */}
- <div style={{ padding: '12px', marginTop: '8px' }}>
+ <div style={{ padding: '6px 10px', marginTop: '4px' }}>
<div style={{
fontSize: fontSize.tiny,
fontWeight: 700,
color: colors.textMuted,
letterSpacing: '0.5px',
- marginBottom: '8px',
+ marginBottom: '4px',
}}>
{t('metricsPanel.dataInfo')}
</div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', fontSize: fontSize.small }}>
<span style={{ color: colors.textMuted }}>{t('metricsPanel.source')}:</span>
<span style={{ color: colors.info }}>{dataSource}</span>
@@ -164,17 +164,17 @@ export const MetricsPanel: React.FC<MetricsPanelProps> = ({
{/* Legend for correlation */}
{chartType === 'correlation' && (
- <div style={{ padding: '12px', marginTop: '8px' }}>
+ <div style={{ padding: '6px 10px', marginTop: '4px' }}>
<div style={{
fontSize: fontSize.tiny,
fontWeight: 700,
color: colors.textMuted,
letterSpacing: '0.5px',
- marginBottom: '8px',
+ marginBottom: '4px',
}}>
{t('metricsPanel.correlationScale')}
</div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: '6px', fontSize: fontSize.small }}>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '4px', fontSize: fontSize.small }}>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<div style={{ width: '12px', height: '12px', backgroundColor: colors.success, borderRadius: 'var(--ft-border-radius)' }} />
<span style={{ color: colors.textMuted }}>{t('metricsPanel.strongPositive')}</span>
@@ -193,17 +193,17 @@ export const MetricsPanel: React.FC<MetricsPanelProps> = ({
{/* Greeks legend for volatility */}
{chartType === 'volatility' && (
- <div style={{ padding: '12px', marginTop: '8px' }}>
+ <div style={{ padding: '6px 10px', marginTop: '4px' }}>
<div style={{
fontSize: fontSize.tiny,
fontWeight: 700,
color: colors.textMuted,
letterSpacing: '0.5px',
- marginBottom: '8px',
+ marginBottom: '4px',
}}>
{t('metricsPanel.ivInterpretation')}
</div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: '4px', fontSize: fontSize.small, color: colors.textMuted }}>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '3px', fontSize: fontSize.small, color: colors.textMuted }}>
<div>{t('metricsPanel.highIv')}</div>
<div>{t('metricsPanel.lowIv')}</div>
<div>{t('metricsPanel.skew')}</div>
@@ -214,17 +214,17 @@ export const MetricsPanel: React.FC<MetricsPanelProps> = ({
{/* PCA legend */}
{chartType === 'pca' && (
- <div style={{ padding: '12px', marginTop: '8px' }}>
+ <div style={{ padding: '6px 10px', marginTop: '4px' }}>
<div style={{
fontSize: fontSize.tiny,
fontWeight: 700,
color: colors.textMuted,
letterSpacing: '0.5px',
- marginBottom: '8px',
+ marginBottom: '4px',
}}>
{t('metricsPanel.pcaInterpretation')}
</div>
- <div style={{ display: 'flex', flexDirection: 'column', gap: '4px', fontSize: fontSize.small, color: colors.textMuted }}>
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '3px', fontSize: fontSize.small, color: colors.textMuted }}>
<div>{t('metricsPanel.pc1')}</div>
<div>{t('metricsPanel.pc2')}</div>
<div>{t('metricsPanel.pc3')}</div>
diff --git a/fincept-terminal-desktop/src/components/tabs/trading/ai-agents/ModelChatPanel.tsx b/fincept-terminal-desktop/src/components/tabs/trading/ai-agents/ModelChatPanel.tsx
index f4a5dbf03..293a2d51b 100644
--- a/fincept-terminal-desktop/src/components/tabs/trading/ai-agents/ModelChatPanel.tsx
+++ b/fincept-terminal-desktop/src/components/tabs/trading/ai-agents/ModelChatPanel.tsx
@@ -278,7 +278,7 @@ function DecisionCard({ decision, modelColor, actionColor, formatTimestamp }: De
{/* Display action/sentiment/recommendation based on type */}
{(() => {
let label = '';
- let showIcon = true;
+ const showIcon = true;
if (decision.type === 'signal') {
label = (decision.direction || decision.action || 'HOLD').toUpperCase();
diff --git a/fincept-terminal-desktop/src/components/tabs/trading/hooks/usePositions.ts b/fincept-terminal-desktop/src/components/tabs/trading/hooks/usePositions.ts
index af6c98e45..a5aecfabd 100644
--- a/fincept-terminal-desktop/src/components/tabs/trading/hooks/usePositions.ts
+++ b/fincept-terminal-desktop/src/components/tabs/trading/hooks/usePositions.ts
@@ -164,7 +164,7 @@ export function usePositions(symbol?: string, autoRefresh: boolean = true, refre
// Use ref in interval so it always calls the latest version
const interval = setInterval(() => fetchPositionsRef.current?.(), refreshInterval);
return () => clearInterval(interval);
- // eslint-disable-next-line react-hooks/exhaustive-deps
+
}, [activeBrokerKey, autoRefresh, refreshInterval]);
// Cleanup subscriptions on unmount
diff --git a/fincept-terminal-desktop/src/components/tabs/watchlist/utils.ts b/fincept-terminal-desktop/src/components/tabs/watchlist/utils.ts
index 36b086161..ad2a6674a 100644
--- a/fincept-terminal-desktop/src/components/tabs/watchlist/utils.ts
+++ b/fincept-terminal-desktop/src/components/tabs/watchlist/utils.ts
@@ -84,21 +84,24 @@ export const sortStocks = <T extends { symbol: string; quote: any }>(
case 'TICKER':
compareValue = a.symbol.localeCompare(b.symbol);
break;
- case 'CHANGE':
+ case 'CHANGE': {
const changeA = a.quote?.change_percent || 0;
const changeB = b.quote?.change_percent || 0;
compareValue = changeB - changeA;
break;
- case 'VOLUME':
+ }
+ case 'VOLUME': {
const volA = a.quote?.volume || 0;
const volB = b.quote?.volume || 0;
compareValue = volB - volA;
break;
- case 'PRICE':
+ }
+ case 'PRICE': {
const priceA = a.quote?.price || 0;
const priceB = b.quote?.price || 0;
compareValue = priceB - priceA;
break;
+ }
}
return ascending ? -compareValue : compareValue;
diff --git a/fincept-terminal-desktop/src/hooks/useAutoUpdater.ts b/fincept-terminal-desktop/src/hooks/useAutoUpdater.ts
index f8f90190e..a8071634d 100644
--- a/fincept-terminal-desktop/src/hooks/useAutoUpdater.ts
+++ b/fincept-terminal-desktop/src/hooks/useAutoUpdater.ts
@@ -117,11 +117,12 @@ export function useAutoUpdater(): UseAutoUpdaterReturn {
setInstallProgress(0);
console.log('[AutoUpdater] Download started, size:', totalBytes);
break;
- case 'Progress':
+ case 'Progress': {
downloadedBytes += event.data.chunkLength;
const progress = totalBytes > 0 ? (downloadedBytes / totalBytes) * 100 : 0;
setInstallProgress(Math.min(progress, 100));
break;
+ }
case 'Finished':
setInstallProgress(100);
console.log('[AutoUpdater] Download finished');
diff --git a/fincept-terminal-desktop/src/lib/akshareDataParser.ts b/fincept-terminal-desktop/src/lib/akshareDataParser.ts
index 53bb468fd..6e6b4f993 100644
--- a/fincept-terminal-desktop/src/lib/akshareDataParser.ts
+++ b/fincept-terminal-desktop/src/lib/akshareDataParser.ts
@@ -112,7 +112,7 @@ function cleanColumnNames(columns: string[]): string[] {
// Remove special characters that might cause issues
// Keep: letters, numbers, Chinese characters, spaces, underscores, hyphens
- cleaned = cleaned.replace(/[^\w\u4e00-\u9fa5\s\-]/g, '_');
+ cleaned = cleaned.replace(/[^\w\u4e00-\u9fa5\s-]/g, '_');
return cleaned;
});
diff --git a/fincept-terminal-desktop/src/polyfills/globals-inject.ts b/fincept-terminal-desktop/src/polyfills/globals-inject.ts
index ec6be3bf7..366c48cdf 100644
--- a/fincept-terminal-desktop/src/polyfills/globals-inject.ts
+++ b/fincept-terminal-desktop/src/polyfills/globals-inject.ts
@@ -23,7 +23,7 @@ if (typeof globalThis.process === 'undefined') {
env: { NODE_ENV: import.meta.env.MODE || 'production' },
version: 'v18.0.0',
browser: true,
- nextTick: (fn: Function, ...args: any[]) => setTimeout(() => fn(...args), 0),
+ nextTick: (fn: (...a: unknown[]) => void, ...args: unknown[]) => setTimeout(() => fn(...args), 0),
cwd: () => '/',
platform: 'browser',
argv: [],
diff --git a/fincept-terminal-desktop/src/polyfills/init.ts b/fincept-terminal-desktop/src/polyfills/init.ts
index bf51a1401..8acb8f194 100644
--- a/fincept-terminal-desktop/src/polyfills/init.ts
+++ b/fincept-terminal-desktop/src/polyfills/init.ts
@@ -8,7 +8,7 @@ const processShim: any = {
env: {
NODE_ENV: typeof process !== 'undefined' && process.env ? process.env.NODE_ENV : 'production'
},
- nextTick: (fn: Function, ...args: any[]) => {
+ nextTick: (fn: (...a: unknown[]) => void, ...args: unknown[]) => {
setTimeout(() => fn(...args), 0);
},
cwd: () => '/',
diff --git a/fincept-terminal-desktop/src/services/agentService.ts b/fincept-terminal-desktop/src/services/agentService.ts
index f548dcad3..7610ef9c0 100644
--- a/fincept-terminal-desktop/src/services/agentService.ts
+++ b/fincept-terminal-desktop/src/services/agentService.ts
@@ -126,12 +126,12 @@ export interface AgentPayload {
params?: Record<string, any>;
}
-export interface AgentResponse<T = any> {
+export interface AgentResponse<T = unknown> {
success: boolean;
error?: string;
response?: string;
data?: T;
- result?: any;
+ result?: string | T;
}
export interface SystemInfo {
diff --git a/fincept-terminal-desktop/src/services/core/docxService.ts b/fincept-terminal-desktop/src/services/core/docxService.ts
new file mode 100644
index 000000000..0240fb714
--- /dev/null
+++ b/fincept-terminal-desktop/src/services/core/docxService.ts
@@ -0,0 +1,490 @@
+// DOCX Service - Import, export, and history management for DOCX files
+// Uses mammoth for DOCX→HTML, html-to-docx for HTML→DOCX, and sqliteService for persistence
+
+import mammoth from 'mammoth';
+import JSZip from 'jszip';
+import { readFile as tauriReadFile, writeFile as tauriWriteFile } from '@tauri-apps/plugin-fs';
+import { saveSetting, getSetting } from './sqliteService';
+
+export interface DocxFileRecord {
+ id: string;
+ file_name: string;
+ file_path: string;
+ page_count: number;
+ last_opened: string;
+ last_modified: string;
+ created_at: string;
+}
+
+export interface DocxSnapshot {
+ id: string;
+ file_id: string;
+ snapshot_name: string;
+ html_content: string;
+ created_at: string;
+}
+
+export interface DocxMetadata {
+ title?: string;
+ author?: string;
+ company?: string;
+ date?: string;
+}
+
+export interface DocxHeaderFooter {
+ headerText: string;
+ footerText: string;
+ hasHeader: boolean;
+ hasFooter: boolean;
+}
+
+export interface DocxImportResult {
+ html: string;
+ messages: Array<{ type: string; message: string }>;
+ arrayBuffer: ArrayBuffer;
+ headerFooter: DocxHeaderFooter;
+}
+
+class DocxService {
+ private readonly RECENT_FILES_KEY = 'docx_recent_files';
+ private readonly SNAPSHOTS_KEY_PREFIX = 'docx_snapshots_';
+
+ /**
+ * Extract plain text from OOXML body content (word/header*.xml, word/footer*.xml).
+ * Parses <w:t> text runs from the XML.
+ */
+ private extractTextFromOoxml(xml: string): string {
+ // Extract all <w:t ...>text</w:t> runs
+ const textRuns: string[] = [];
+ const regex = /<w:t[^>]*>([\s\S]*?)<\/w:t>/g;
+ let match: RegExpExecArray | null;
+ while ((match = regex.exec(xml)) !== null) {
+ textRuns.push(match[1]);
+ }
+ return textRuns.join('').trim();
+ }
+
+ /**
+ * Extract header and footer text from DOCX ZIP archive.
+ * DOCX files are ZIP archives; headers are in word/header*.xml, footers in word/footer*.xml.
+ */
+ async extractHeaderFooter(arrayBuffer: ArrayBuffer): Promise<DocxHeaderFooter> {
+ const result: DocxHeaderFooter = {
+ headerText: '',
+ footerText: '',
+ hasHeader: false,
+ hasFooter: false,
+ };
+
+ try {
+ const zip = await JSZip.loadAsync(arrayBuffer);
+
+ // Collect all header XML files (header1.xml, header2.xml, header3.xml)
+ const headerFiles = Object.keys(zip.files).filter(
+ name => /^word\/header\d*\.xml$/i.test(name)
+ );
+ // Collect all footer XML files
+ const footerFiles = Object.keys(zip.files).filter(
+ name => /^word\/footer\d*\.xml$/i.test(name)
+ );
+
+ // Extract text from headers — use the first one with content (default header)
+ for (const hf of headerFiles) {
+ const xml = await zip.files[hf].async('text');
+ const text = this.extractTextFromOoxml(xml);
+ if (text) {
+ result.headerText = text;
+ result.hasHeader = true;
+ break; // Use first non-empty header
+ }
+ }
+
+ // Extract text from footers
+ for (const ff of footerFiles) {
+ const xml = await zip.files[ff].async('text');
+ const text = this.extractTextFromOoxml(xml);
+ if (text) {
+ result.footerText = text;
+ result.hasFooter = true;
+ break; // Use first non-empty footer
+ }
+ }
+
+ console.log('[DocxService] Extracted header/footer:', {
+ hasHeader: result.hasHeader,
+ headerText: result.headerText.substring(0, 100),
+ hasFooter: result.hasFooter,
+ footerText: result.footerText.substring(0, 100),
+ headerFiles: headerFiles.length,
+ footerFiles: footerFiles.length,
+ });
+ } catch (err) {
+ console.warn('[DocxService] Failed to extract header/footer from DOCX ZIP:', err);
+ }
+
+ return result;
+ }
+
+ /**
+ * Extract paragraph alignment info from DOCX document.xml.
+ * Returns an ordered list of alignment values ('center', 'right', 'both')
+ * for each <w:p> in the document body, in order.
+ */
+ private async extractAlignments(arrayBuffer: ArrayBuffer): Promise<string[]> {
+ const alignments: string[] = [];
+ try {
+ const zip = await JSZip.loadAsync(arrayBuffer);
+ const docXml = zip.files['word/document.xml'];
+ if (!docXml) return alignments;
+
+ const xml = await docXml.async('text');
+ // Match each <w:p ...> ... </w:p> block
+ const paraRegex = /<w:p[ >][\s\S]*?<\/w:p>/g;
+ let paraMatch: RegExpExecArray | null;
+ while ((paraMatch = paraRegex.exec(xml)) !== null) {
+ const para = paraMatch[0];
+ // Look for <w:jc w:val="center|right|both|left"/>
+ const jcMatch = para.match(/<w:jc\s+w:val="([^"]+)"/);
+ if (jcMatch) {
+ const val = jcMatch[1];
+ // Map Word alignment to CSS
+ if (val === 'center') alignments.push('center');
+ else if (val === 'right') alignments.push('right');
+ else if (val === 'both') alignments.push('justify');
+ else alignments.push(''); // left or unknown
+ } else {
+ alignments.push(''); // no explicit alignment (left default)
+ }
+ }
+ } catch (err) {
+ console.warn('[DocxService] Failed to extract alignments:', err);
+ }
+ return alignments;
+ }
+
+ /**
+ * Post-process mammoth HTML to inject text-align styles based on DOCX alignment data.
+ * Mammoth outputs block elements (p, h1-h6, li, blockquote>p) in document order.
+ * We match them 1:1 with the alignment array extracted from the DOCX XML.
+ */
+ private applyAlignments(html: string, alignments: string[]): string {
+ if (alignments.length === 0) return html;
+
+ let alignIdx = 0;
+ // Match opening tags of block elements that mammoth generates
+ const blockTagRegex = /(<(?:p|h[1-6]|li)(?:\s[^>]*)?>)/gi;
+
+ return html.replace(blockTagRegex, (match) => {
+ if (alignIdx >= alignments.length) return match;
+ const align = alignments[alignIdx];
+ alignIdx++;
+
+ if (!align) return match;
+
+ // If tag already has a style attribute, append to it
+ if (match.includes('style="')) {
+ return match.replace('style="', `style="text-align: ${align}; `);
+ }
+ // Otherwise inject style before the closing >
+ return match.replace(/>$/, ` style="text-align: ${align};">`);
+ });
+ }
+
+ /**
+ * Import a DOCX file: read bytes, convert to HTML via mammoth, extract header/footer
+ */
+ async importDocx(filePath: string): Promise<DocxImportResult> {
+ try {
+ const fileData = await tauriReadFile(filePath);
+ const arrayBuffer = fileData.buffer.slice(
+ fileData.byteOffset,
+ fileData.byteOffset + fileData.byteLength
+ );
+
+ // Extract header/footer, alignments, and convert HTML in parallel
+ const [headerFooter, alignments, result] = await Promise.all([
+ this.extractHeaderFooter(arrayBuffer),
+ this.extractAlignments(arrayBuffer),
+ mammoth.convertToHtml(
+ { arrayBuffer },
+ {
+ convertImage: mammoth.images.imgElement(function (image: any) {
+ return image.read('base64').then(function (imageBuffer: string) {
+ return {
+ src: 'data:' + image.contentType + ';base64,' + imageBuffer,
+ };
+ });
+ }),
+ styleMap: [
+ // ── Headings ──────────────────────────────────
+ "p[style-name='Heading 1'] => h1:fresh",
+ "p[style-name='Heading 2'] => h2:fresh",
+ "p[style-name='Heading 3'] => h3:fresh",
+ "p[style-name='Heading 4'] => h4:fresh",
+ "p[style-name='Heading 5'] => h5:fresh",
+ "p[style-name='Heading 6'] => h6:fresh",
+ "p[style-name='heading 1'] => h1:fresh",
+ "p[style-name='heading 2'] => h2:fresh",
+ "p[style-name='heading 3'] => h3:fresh",
+ "p[style-name='heading 4'] => h4:fresh",
+ "p[style-name='heading 5'] => h5:fresh",
+ "p[style-name='heading 6'] => h6:fresh",
+
+ // ── Title / Subtitle ──────────────────────────
+ "p[style-name='Title'] => h1.doc-title:fresh",
+ "p[style-name='Subtitle'] => h2.doc-subtitle:fresh",
+
+ // ── Lists ─────────────────────────────────────
+ "p[style-name='List Paragraph'] => p:fresh",
+ "p[style-name='List Bullet'] => ul > li:fresh",
+ "p[style-name='List Bullet 2'] => ul > li:fresh",
+ "p[style-name='List Bullet 3'] => ul > li:fresh",
+ "p[style-name='List Number'] => ol > li:fresh",
+ "p[style-name='List Number 2'] => ol > li:fresh",
+ "p[style-name='List Number 3'] => ol > li:fresh",
+ "p[style-name='List Continue'] => p:fresh",
+ "p[style-name='List Continue 2'] => p:fresh",
+
+ // ── Character styles ──────────────────────────
+ "r[style-name='Strong'] => strong",
+ "r[style-name='Emphasis'] => em",
+ "r[style-name='Intense Emphasis'] => em > strong",
+ "r[style-name='Book Title'] => em.book-title",
+ "r[style-name='Subtle Emphasis'] => em",
+ "r[style-name='Intense Reference'] => strong",
+ "r[style-name='Subtle Reference'] => span",
+ "r[style-name='Hyperlink'] => a",
+
+ // ── Paragraph styles ──────────────────────────
+ "p[style-name='Quote'] => blockquote > p:fresh",
+ "p[style-name='Intense Quote'] => blockquote > p:fresh",
+ "p[style-name='Block Text'] => blockquote > p:fresh",
+ "p[style-name='No Spacing'] => p:fresh",
+ "p[style-name='Normal'] => p:fresh",
+ "p[style-name='Normal (Web)'] => p:fresh",
+ "p[style-name='Body Text'] => p:fresh",
+ "p[style-name='Body Text 2'] => p:fresh",
+ "p[style-name='Body Text 3'] => p:fresh",
+ "p[style-name='Body Text Indent'] => p:fresh",
+ "p[style-name='Body Text First Indent'] => p:fresh",
+ "p[style-name='Plain Text'] => p:fresh",
+
+ // ── Table of Contents ─────────────────────────
+ "p[style-name='TOC Heading'] => h2.toc-heading:fresh",
+ "p[style-name='toc 1'] => p.toc-1:fresh",
+ "p[style-name='toc 2'] => p.toc-2:fresh",
+ "p[style-name='toc 3'] => p.toc-3:fresh",
+
+ // ── Header / Footer ───────────────────────────
+ "p[style-name='Header'] => p.doc-header:fresh",
+ "p[style-name='Footer'] => p.doc-footer:fresh",
+ "p[style-name='header'] => p.doc-header:fresh",
+ "p[style-name='footer'] => p.doc-footer:fresh",
+
+ // ── Captions / Annotations ────────────────────
+ "p[style-name='Caption'] => p.caption:fresh",
+ "p[style-name='Footnote Text'] => p.footnote:fresh",
+ "p[style-name='Endnote Text'] => p.endnote:fresh",
+ "p[style-name='annotation text'] => p.comment:fresh",
+ "p[style-name='Balloon Text'] => p:fresh",
+ "r[style-name='annotation reference'] => span",
+ "r[style-name='Footnote Reference'] => sup",
+ "r[style-name='Endnote Reference'] => sup",
+
+ // ── Table styles ──────────────────────────────
+ "p[style-name='Table Paragraph'] => p:fresh",
+
+ // ── Catch-all: map any unknown paragraph style to p:fresh
+ // (reduces noise from custom/legacy styles)
+ ],
+ }
+ ),
+ ]);
+
+ // Post-process HTML to inject text alignment from DOCX
+ const alignedHtml = this.applyAlignments(result.value, alignments);
+
+ return {
+ html: alignedHtml,
+ messages: result.messages,
+ arrayBuffer,
+ headerFooter,
+ };
+ } catch (error) {
+ console.error('[DocxService] Failed to import DOCX:', error);
+ throw error;
+ }
+ }
+
+ /**
+ * Read raw DOCX file bytes for docx-preview rendering
+ */
+ async getDocxArrayBuffer(filePath: string): Promise<ArrayBuffer> {
+ try {
+ const fileData = await tauriReadFile(filePath);
+ return fileData.buffer.slice(
+ fileData.byteOffset,
+ fileData.byteOffset + fileData.byteLength
+ );
+ } catch (error) {
+ console.error('[DocxService] Failed to read DOCX file:', error);
+ throw error;
+ }
+ }
+
+ /**
+ * Export HTML content to DOCX binary using html-to-docx
+ */
+ async exportToDocx(htmlContent: string, metadata?: DocxMetadata): Promise<Uint8Array> {
+ try {
+ const { default: HTMLtoDOCX } = await import('html-to-docx');
+
+ const fullHtml = `
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="UTF-8">
+ <style>
+ body { font-family: Arial, sans-serif; font-size: 11pt; line-height: 1.6; color: #000; }
+ h1 { font-size: 24pt; font-weight: bold; margin: 16pt 0 8pt; }
+ h2 { font-size: 18pt; font-weight: bold; margin: 14pt 0 6pt; }
+ h3 { font-size: 14pt; font-weight: bold; margin: 12pt 0 6pt; }
+ h4 { font-size: 12pt; font-weight: bold; margin: 10pt 0 4pt; }
+ p { margin: 0 0 6pt; }
+ table { border-collapse: collapse; width: 100%; margin: 8pt 0; }
+ td, th { border: 1px solid #999; padding: 4pt 8pt; }
+ th { background: #f0f0f0; font-weight: bold; }
+ img { max-width: 100%; }
+ ul, ol { margin: 6pt 0; padding-left: 24pt; }
+ li { margin: 2pt 0; }
+ blockquote { border-left: 3pt solid #ccc; padding-left: 12pt; margin: 8pt 0; color: #555; }
+ pre { background: #f5f5f5; padding: 8pt; font-family: Courier New, monospace; font-size: 10pt; }
+ hr { border: none; border-top: 1pt solid #ccc; margin: 12pt 0; }
+ </style>
+ </head>
+ <body>
+ ${htmlContent}
+ </body>
+ </html>
+ `;
+
+ const docxBlob = await HTMLtoDOCX(fullHtml, null, {
+ table: { row: { cantSplit: true } },
+ footer: true,
+ pageNumber: true,
+ title: metadata?.title || 'Document',
+ creator: metadata?.author || '',
+ description: metadata?.company || '',
+ });
+
+ // html-to-docx returns a Blob in browser
+ if (docxBlob instanceof Blob) {
+ const arrayBuffer = await docxBlob.arrayBuffer();
+ return new Uint8Array(arrayBuffer);
+ }
+ // In case it returns a Buffer (Node.js environment)
+ return new Uint8Array(docxBlob as ArrayBuffer);
+ } catch (error) {
+ console.error('[DocxService] Failed to export to DOCX:', error);
+ throw error;
+ }
+ }
+
+ /**
+ * Write DOCX binary to a file path via Tauri FS
+ */
+ async writeDocxFile(filePath: string, data: Uint8Array): Promise<void> {
+ try {
+ await tauriWriteFile(filePath, data);
+ } catch (error) {
+ console.error('[DocxService] Failed to write DOCX file:', error);
+ throw error;
+ }
+ }
+
+ // ---- File History (persisted via sqliteService settings) ----
+
+ async addOrUpdateFile(file: Omit<DocxFileRecord, 'id'>): Promise<string> {
+ try {
+ const files = await this.getRecentFiles();
+ const existing = files.find(f => f.file_path === file.file_path);
+ const id = existing?.id || `docx-${Date.now()}`;
+
+ const record: DocxFileRecord = {
+ id,
+ ...file,
+ };
+
+ // Update or add
+ const updated = existing
+ ? files.map(f => (f.id === id ? record : f))
+ : [record, ...files];
+
+ // Keep only last 50 files
+ const trimmed = updated.slice(0, 50);
+ await saveSetting(this.RECENT_FILES_KEY, JSON.stringify(trimmed), 'docx');
+ return id;
+ } catch (error) {
+ console.error('[DocxService] Failed to add/update file record:', error);
+ throw error;
+ }
+ }
+
+ async getRecentFiles(limit: number = 20): Promise<DocxFileRecord[]> {
+ try {
+ const data = await getSetting(this.RECENT_FILES_KEY);
+ if (!data) return [];
+ const files: DocxFileRecord[] = JSON.parse(data);
+ return files.slice(0, limit);
+ } catch (error) {
+ console.error('[DocxService] Failed to get recent files:', error);
+ return [];
+ }
+ }
+
+ // ---- Snapshots (persisted via sqliteService settings) ----
+
+ async createSnapshot(fileId: string, snapshotName: string, htmlContent: string): Promise<string> {
+ try {
+ const snapshots = await this.getSnapshots(fileId);
+ const snapshot: DocxSnapshot = {
+ id: `snap-${Date.now()}`,
+ file_id: fileId,
+ snapshot_name: snapshotName,
+ html_content: htmlContent,
+ created_at: new Date().toISOString(),
+ };
+ const updated = [snapshot, ...snapshots].slice(0, 20); // Keep max 20 snapshots
+ await saveSetting(`${this.SNAPSHOTS_KEY_PREFIX}${fileId}`, JSON.stringify(updated), 'docx');
+ return snapshot.id;
+ } catch (error) {
+ console.error('[DocxService] Failed to create snapshot:', error);
+ throw error;
+ }
+ }
+
+ async getSnapshots(fileId: string): Promise<DocxSnapshot[]> {
+ try {
+ const data = await getSetting(`${this.SNAPSHOTS_KEY_PREFIX}${fileId}`);
+ if (!data) return [];
+ return JSON.parse(data);
+ } catch (error) {
+ console.error('[DocxService] Failed to get snapshots:', error);
+ return [];
+ }
+ }
+
+ async deleteSnapshot(fileId: string, snapshotId: string): Promise<void> {
+ try {
+ const snapshots = await this.getSnapshots(fileId);
+ const filtered = snapshots.filter(s => s.id !== snapshotId);
+ await saveSetting(`${this.SNAPSHOTS_KEY_PREFIX}${fileId}`, JSON.stringify(filtered), 'docx');
+ } catch (error) {
+ console.error('[DocxService] Failed to delete snapshot:', error);
+ throw error;
+ }
+ }
+}
+
+export const docxService = new DocxService();
+export default docxService;
diff --git a/fincept-terminal-desktop/src/services/core/nodeExecutionManager.ts b/fincept-terminal-desktop/src/services/core/nodeExecutionManager.ts
index 49e92e99c..99533a3ce 100644
--- a/fincept-terminal-desktop/src/services/core/nodeExecutionManager.ts
+++ b/fincept-terminal-desktop/src/services/core/nodeExecutionManager.ts
@@ -326,7 +326,7 @@ class NodeExecutionManager {
try {
// Get input data (first input or merged inputs)
- let data = Object.values(inputs)[0];
+ const data = Object.values(inputs)[0];
if (!data) {
return {
@@ -400,7 +400,7 @@ class NodeExecutionManager {
}
break;
- case 'select':
+ case 'select': {
// Select specific fields
const { selectFields } = transformConfig || {};
if (selectFields && Array.isArray(selectFields)) {
@@ -424,6 +424,7 @@ class NodeExecutionManager {
result = data;
}
break;
+ }
default:
// Pass through if no transformation type
diff --git a/fincept-terminal-desktop/src/services/core/reportExportService.ts b/fincept-terminal-desktop/src/services/core/reportExportService.ts
index 2ada838a3..49be6b6e6 100644
--- a/fincept-terminal-desktop/src/services/core/reportExportService.ts
+++ b/fincept-terminal-desktop/src/services/core/reportExportService.ts
@@ -1,8 +1,9 @@
import { invoke } from '@tauri-apps/api/core';
import { save } from '@tauri-apps/plugin-dialog';
-import { writeTextFile } from '@tauri-apps/plugin-fs';
+import { writeTextFile, writeFile } from '@tauri-apps/plugin-fs';
import { ReportTemplate, ReportComponent } from './reportService';
import { BrandKit } from './brandKitService';
+import { docxService } from './docxService';
export type ExportFormat = 'pdf' | 'html' | 'docx' | 'markdown';
@@ -275,11 +276,20 @@ class ReportExportService {
await writeTextFile(filePath, this.generateMarkdown(template));
break;
case 'docx':
- // For DOCX, we'll generate HTML and let Rust handle conversion
- await invoke('export_report_docx', {
- htmlContent: this.generateHTML(template, brandKit),
- outputPath: filePath
- });
+ // Convert template HTML to DOCX using html-to-docx
+ try {
+ const htmlForDocx = this.generateHTML(template, brandKit);
+ const docxBuffer = await docxService.exportToDocx(htmlForDocx, {
+ title: template.metadata.title || 'Report',
+ author: template.metadata.author || '',
+ company: template.metadata.company || '',
+ date: template.metadata.date || new Date().toISOString().split('T')[0],
+ });
+ await docxService.writeDocxFile(filePath, docxBuffer);
+ } catch (error) {
+ console.error('[ReportExport] DOCX export failed:', error);
+ throw error;
+ }
break;
case 'pdf':
await invoke('generate_report_pdf', {
@@ -310,6 +320,108 @@ class ReportExportService {
return results;
}
+ // Export from DOCX editor mode (TipTap HTML content) to various formats
+ async exportDocxModeToFile(
+ htmlContent: string,
+ format: ExportFormat,
+ metadata?: { title?: string; author?: string; company?: string; date?: string }
+ ): Promise<string | null> {
+ const extensions: Record<ExportFormat, string> = {
+ pdf: 'pdf', html: 'html', docx: 'docx', markdown: 'md'
+ };
+
+ const defaultName = metadata?.title || 'document';
+ const filePath = await save({
+ filters: [{ name: format.toUpperCase(), extensions: [extensions[format]] }],
+ defaultPath: `${defaultName}.${extensions[format]}`
+ });
+
+ if (!filePath) return null;
+
+ switch (format) {
+ case 'html': {
+ const fullHtml = `<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>${metadata?.title || 'Document'}</title>
+ <style>
+ body { font-family: Arial, sans-serif; max-width: 210mm; margin: 0 auto; padding: 20mm; line-height: 1.6; color: #1a1a1a; }
+ table { border-collapse: collapse; width: 100%; margin: 1em 0; }
+ th, td { border: 1px solid #ccc; padding: 8px 12px; }
+ th { background: #f5f5f5; font-weight: bold; }
+ img { max-width: 100%; height: auto; }
+ blockquote { border-left: 3px solid #ccc; padding-left: 1em; color: #555; font-style: italic; }
+ pre { background: #1a1a1a; color: #00ff00; padding: 12px; border-radius: 4px; overflow-x: auto; }
+ code { background: #f0f0f0; padding: 2px 4px; border-radius: 2px; }
+ </style>
+</head>
+<body>${htmlContent}</body>
+</html>`;
+ await writeTextFile(filePath, fullHtml);
+ break;
+ }
+ case 'markdown': {
+ // Simple HTML → Markdown conversion
+ let md = htmlContent;
+ md = md.replace(/<h1[^>]*>(.*?)<\/h1>/gi, '# $1\n\n');
+ md = md.replace(/<h2[^>]*>(.*?)<\/h2>/gi, '## $1\n\n');
+ md = md.replace(/<h3[^>]*>(.*?)<\/h3>/gi, '### $1\n\n');
+ md = md.replace(/<h4[^>]*>(.*?)<\/h4>/gi, '#### $1\n\n');
+ md = md.replace(/<h5[^>]*>(.*?)<\/h5>/gi, '##### $1\n\n');
+ md = md.replace(/<h6[^>]*>(.*?)<\/h6>/gi, '###### $1\n\n');
+ md = md.replace(/<strong>(.*?)<\/strong>/gi, '**$1**');
+ md = md.replace(/<b>(.*?)<\/b>/gi, '**$1**');
+ md = md.replace(/<em>(.*?)<\/em>/gi, '*$1*');
+ md = md.replace(/<i>(.*?)<\/i>/gi, '*$1*');
+ md = md.replace(/<u>(.*?)<\/u>/gi, '$1');
+ md = md.replace(/<s>(.*?)<\/s>/gi, '~~$1~~');
+ md = md.replace(/<a[^>]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi, '[$2]($1)');
+ md = md.replace(/<img[^>]*src="([^"]*)"[^>]*\/?>/gi, '![]($1)');
+ md = md.replace(/<br\s*\/?>/gi, '\n');
+ md = md.replace(/<hr\s*\/?>/gi, '\n---\n\n');
+ md = md.replace(/<p[^>]*>(.*?)<\/p>/gi, '$1\n\n');
+ md = md.replace(/<li[^>]*>(.*?)<\/li>/gi, '- $1\n');
+ md = md.replace(/<blockquote[^>]*>(.*?)<\/blockquote>/gis, '> $1\n\n');
+ md = md.replace(/<pre[^>]*><code[^>]*>(.*?)<\/code><\/pre>/gis, '```\n$1\n```\n\n');
+ md = md.replace(/<code>(.*?)<\/code>/gi, '`$1`');
+ md = md.replace(/<[^>]*>/g, '');
+ md = md.replace(/\n{3,}/g, '\n\n');
+ await writeTextFile(filePath, md.trim());
+ break;
+ }
+ case 'docx': {
+ const docxBuffer = await docxService.exportToDocx(htmlContent, {
+ title: metadata?.title || '',
+ author: metadata?.author || '',
+ company: metadata?.company || '',
+ date: metadata?.date || '',
+ });
+ await docxService.writeDocxFile(filePath, docxBuffer);
+ break;
+ }
+ case 'pdf': {
+ // For PDF in DOCX mode, use print-based approach through HTML
+ await invoke('generate_report_pdf', {
+ templateJson: JSON.stringify({
+ metadata: {
+ title: metadata?.title || 'Document',
+ author: metadata?.author || '',
+ company: metadata?.company || '',
+ date: metadata?.date || '',
+ },
+ components: [{ type: 'text', content: htmlContent, config: {} }],
+ }),
+ outputPath: filePath,
+ });
+ break;
+ }
+ }
+
+ return filePath;
+ }
+
// Get print-ready HTML for preview
getPrintPreviewHTML(template: ReportTemplate, brandKit?: BrandKit | null): string {
return this.generateHTML(template, brandKit);
diff --git a/fincept-terminal-desktop/src/services/core/sqliteService.ts b/fincept-terminal-desktop/src/services/core/sqliteService.ts
index e0d4bd7e4..c141bb20e 100644
--- a/fincept-terminal-desktop/src/services/core/sqliteService.ts
+++ b/fincept-terminal-desktop/src/services/core/sqliteService.ts
@@ -458,7 +458,7 @@ export const getChatStatistics = async (): Promise<ChatStatistics> => {
console.warn('[SqliteService] db_get_chat_statistics not implemented, using fallback');
const sessions = await getChatSessions(10000);
let totalMessages = 0;
- let totalTokens = 0;
+ const totalTokens = 0;
for (const session of sessions) {
totalMessages += session.message_count || 0;
diff --git a/fincept-terminal-desktop/src/services/core/validators.ts b/fincept-terminal-desktop/src/services/core/validators.ts
index cd8d3955c..b600d85d5 100644
--- a/fincept-terminal-desktop/src/services/core/validators.ts
+++ b/fincept-terminal-desktop/src/services/core/validators.ts
@@ -228,6 +228,7 @@ export function sanitizeInput(input: string): string {
return input
.trim()
.replace(/[<>]/g, '') // Remove potential HTML/script tags
+ // eslint-disable-next-line no-control-regex
.replace(/[\x00-\x1F\x7F]/g, ''); // Remove control characters
}
diff --git a/fincept-terminal-desktop/src/services/data-sources/sectorService.ts b/fincept-terminal-desktop/src/services/data-sources/sectorService.ts
index 8ab382a97..05565995f 100644
--- a/fincept-terminal-desktop/src/services/data-sources/sectorService.ts
+++ b/fincept-terminal-desktop/src/services/data-sources/sectorService.ts
@@ -87,7 +87,7 @@ function loadManualMappings(): void {
sectorCache[sym.toUpperCase()] = { ...info, _manual: true } as SectorInfo & { _manual?: boolean };
});
}
- } catch {}
+ } catch { /* localStorage not available */ }
}
function saveManualMappings(): void {
@@ -97,7 +97,7 @@ function saveManualMappings(): void {
if ((info as any)._manual) manual[sym] = info;
});
localStorage.setItem(MANUAL_MAPPINGS_KEY, JSON.stringify(manual));
- } catch {}
+ } catch { /* localStorage not available */ }
}
// Init: load ETF fallbacks then manual overrides
diff --git a/fincept-terminal-desktop/src/services/mcp/internal/BrokerMCPBridge.ts b/fincept-terminal-desktop/src/services/mcp/internal/BrokerMCPBridge.ts
index 88125a191..f03a5ae39 100644
--- a/fincept-terminal-desktop/src/services/mcp/internal/BrokerMCPBridge.ts
+++ b/fincept-terminal-desktop/src/services/mcp/internal/BrokerMCPBridge.ts
@@ -609,7 +609,7 @@ export class BrokerMCPBridge {
// Get orders
getOrders: async (filters?: any) => {
try {
- let orders: any[] = [];
+ const orders: any[] = [];
if (!filters?.status || filters.status === 'open' || filters.status === 'all') {
const openOrders = await activeAdapter.fetchOpenOrders(filters?.symbol);
diff --git a/fincept-terminal-desktop/src/services/mcp/internal/EconomicsMCPBridge.ts b/fincept-terminal-desktop/src/services/mcp/internal/EconomicsMCPBridge.ts
index 037278210..38b0e4902 100644
--- a/fincept-terminal-desktop/src/services/mcp/internal/EconomicsMCPBridge.ts
+++ b/fincept-terminal-desktop/src/services/mcp/internal/EconomicsMCPBridge.ts
@@ -26,7 +26,7 @@ async function finceptFetch(path: string): Promise<any> {
if (!res.ok) {
const body = await res.text().catch(() => '');
let msg = `${res.status} ${res.statusText}`;
- try { msg = JSON.parse(body).message || msg; } catch {}
+ try { msg = JSON.parse(body).message || msg; } catch { /* ignore JSON parse error */ }
throw new Error(msg);
}
const json = await res.json();
diff --git a/fincept-terminal-desktop/src/services/mcp/internal/tools/portfolio-panels.ts b/fincept-terminal-desktop/src/services/mcp/internal/tools/portfolio-panels.ts
index ec10f82c9..eb50c2cbf 100644
--- a/fincept-terminal-desktop/src/services/mcp/internal/tools/portfolio-panels.ts
+++ b/fincept-terminal-desktop/src/services/mcp/internal/tools/portfolio-panels.ts
@@ -1314,7 +1314,7 @@ export const portfolioPanelTools: InternalTool[] = [
for (const sym of symbols) {
const m = fullAnalysis[sym] ?? fullAnalysis?.metrics?.[sym];
if (m) {
- message += ` ${sym}: CAGR ${(m.cagr_pct ?? m.cagr * 100 ?? 0).toFixed(1)}%`;
+ message += ` ${sym}: CAGR ${(m.cagr_pct ?? (m.cagr != null ? m.cagr * 100 : 0)).toFixed(1)}%`;
if (m.sharpe_ratio !== undefined) message += ` Sharpe ${m.sharpe_ratio.toFixed(2)}`;
if (m.max_drawdown !== undefined) message += ` MaxDD ${(m.max_drawdown * 100).toFixed(1)}%`;
message += '\n';
diff --git a/fincept-terminal-desktop/src/services/nodeSystem/ParameterProcessor.ts b/fincept-terminal-desktop/src/services/nodeSystem/ParameterProcessor.ts
index eab89b273..2ce37140e 100644
--- a/fincept-terminal-desktop/src/services/nodeSystem/ParameterProcessor.ts
+++ b/fincept-terminal-desktop/src/services/nodeSystem/ParameterProcessor.ts
@@ -307,13 +307,14 @@ export function validateParameterValue(
}
return { valid: true };
- case 'dateTime':
+ case 'dateTime': {
// Check if valid date
const date = new Date(value as string | number);
if (isNaN(date.getTime())) {
return { valid: false, error: 'Expected valid date/time' };
}
return { valid: true };
+ }
case 'url':
// Basic URL validation
@@ -327,7 +328,7 @@ export function validateParameterValue(
return { valid: false, error: 'Invalid URL format' };
}
- case 'email':
+ case 'email': {
// Basic email validation
if (typeof value !== 'string') {
return { valid: false, error: 'Expected string email' };
@@ -337,6 +338,7 @@ export function validateParameterValue(
return { valid: false, error: 'Invalid email format' };
}
return { valid: true };
+ }
default:
return { valid: true }; // Unknown types are considered valid
diff --git a/fincept-terminal-desktop/src/services/nodeSystem/nodes/agents/AgentNode.ts b/fincept-terminal-desktop/src/services/nodeSystem/nodes/agents/AgentNode.ts
index 6886a8460..3b844deb1 100644
--- a/fincept-terminal-desktop/src/services/nodeSystem/nodes/agents/AgentNode.ts
+++ b/fincept-terminal-desktop/src/services/nodeSystem/nodes/agents/AgentNode.ts
@@ -214,7 +214,7 @@ export class AgentNode implements INodeType {
});
// Format output based on preference
- let formattedOutput: Record<string, any> = {
+ const formattedOutput: Record<string, any> = {
success: true,
agentId: agentId || category,
agentName,
diff --git a/fincept-terminal-desktop/src/services/nodeSystem/nodes/base/BaseFinanceNode.ts b/fincept-terminal-desktop/src/services/nodeSystem/nodes/base/BaseFinanceNode.ts
index f0c2727e9..c9f8989e7 100644
--- a/fincept-terminal-desktop/src/services/nodeSystem/nodes/base/BaseFinanceNode.ts
+++ b/fincept-terminal-desktop/src/services/nodeSystem/nodes/base/BaseFinanceNode.ts
@@ -258,7 +258,7 @@ export abstract class BaseFinanceNode implements INodeType {
} {
// Handle crypto symbols
if (symbol.includes('-') || symbol.includes('/')) {
- const parts = symbol.split(/[-\/]/);
+ const parts = symbol.split(/[-/]/);
return {
symbol: parts[0],
exchange: exchange || 'crypto',
diff --git a/fincept-terminal-desktop/src/services/nodeSystem/nodes/core/SetNode.ts b/fincept-terminal-desktop/src/services/nodeSystem/nodes/core/SetNode.ts
index cde0a74ab..433903c45 100644
--- a/fincept-terminal-desktop/src/services/nodeSystem/nodes/core/SetNode.ts
+++ b/fincept-terminal-desktop/src/services/nodeSystem/nodes/core/SetNode.ts
@@ -195,9 +195,10 @@ function convertValue(value: any, type: string): any {
case 'string':
return String(value);
- case 'number':
+ case 'number': {
const num = Number(value);
return isNaN(num) ? 0 : num;
+ }
case 'boolean':
if (typeof value === 'string') {
diff --git a/fincept-terminal-desktop/src/services/nodeSystem/nodes/data/XMLNode.ts b/fincept-terminal-desktop/src/services/nodeSystem/nodes/data/XMLNode.ts
index a419d4386..55e38c4f5 100644
--- a/fincept-terminal-desktop/src/services/nodeSystem/nodes/data/XMLNode.ts
+++ b/fincept-terminal-desktop/src/services/nodeSystem/nodes/data/XMLNode.ts
@@ -148,7 +148,7 @@ export class XMLNode implements INodeType {
private objToXml(obj: any): string {
let xml = '';
for (const key in obj) {
- if (obj.hasOwnProperty(key)) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
if (Array.isArray(obj[key])) {
for (const item of obj[key]) {
xml += `<${key}>${typeof item === 'object' ? this.objToXml(item) : item}</${key}>`;
diff --git a/fincept-terminal-desktop/src/services/nodeSystem/nodes/marketData/GetTickerStatsNode.ts b/fincept-terminal-desktop/src/services/nodeSystem/nodes/marketData/GetTickerStatsNode.ts
index d133b0ee7..dc14129eb 100644
--- a/fincept-terminal-desktop/src/services/nodeSystem/nodes/marketData/GetTickerStatsNode.ts
+++ b/fincept-terminal-desktop/src/services/nodeSystem/nodes/marketData/GetTickerStatsNode.ts
@@ -186,13 +186,14 @@ export class GetTickerStatsNode implements INodeType {
};
break;
- case 'performance':
+ case 'performance': {
const periods = this.getNodeParameter('performancePeriods', 0) as string[];
result.performance = {};
for (const period of periods) {
(result.performance as Record<string, any>)[period] = GetTickerStatsNode.calculatePerformance(stats, period);
}
break;
+ }
case 'ath':
result.allTimeHigh = null;
diff --git a/fincept-terminal-desktop/src/services/nodeSystem/nodes/transform/FilterNode.ts b/fincept-terminal-desktop/src/services/nodeSystem/nodes/transform/FilterNode.ts
index fb1261e4d..dfe23a952 100644
--- a/fincept-terminal-desktop/src/services/nodeSystem/nodes/transform/FilterNode.ts
+++ b/fincept-terminal-desktop/src/services/nodeSystem/nodes/transform/FilterNode.ts
@@ -193,7 +193,7 @@ function applyPresetFilter(items: any[], preset: string): any[] {
return !isNaN(close) && !isNaN(open) && close < open;
});
- case 'highVolume':
+ case 'highVolume': {
// Volume > average volume
const volumes = items.map((item) => Number(getFieldValue(item.json, 'volume'))).filter((v) => !isNaN(v));
const avgVolume = volumes.length > 0 ? volumes.reduce((a, b) => a + b, 0) / volumes.length : 0;
@@ -201,9 +201,10 @@ function applyPresetFilter(items: any[], preset: string): any[] {
const volume = Number(getFieldValue(item.json, 'volume'));
return !isNaN(volume) && volume > avgVolume;
});
+ }
case 'priceUp':
- case 'priceDown':
+ case 'priceDown': {
// Compare with previous close - requires sorted data
const sorted = [...items].sort((a, b) => {
const dateA = new Date(getFieldValue(a.json, 'timestamp') || getFieldValue(a.json, 'date') || 0);
@@ -218,6 +219,7 @@ function applyPresetFilter(items: any[], preset: string): any[] {
if (isNaN(currentClose) || isNaN(prevClose)) return false;
return preset === 'priceUp' ? currentClose > prevClose : currentClose < prevClose;
});
+ }
default:
return items;
diff --git a/fincept-terminal-desktop/src/services/nodeSystem/nodes/triggers/PriceAlertTriggerNode.ts b/fincept-terminal-desktop/src/services/nodeSystem/nodes/triggers/PriceAlertTriggerNode.ts
index e8bb87d11..eeb1c1631 100644
--- a/fincept-terminal-desktop/src/services/nodeSystem/nodes/triggers/PriceAlertTriggerNode.ts
+++ b/fincept-terminal-desktop/src/services/nodeSystem/nodes/triggers/PriceAlertTriggerNode.ts
@@ -166,7 +166,7 @@ export class PriceAlertTriggerNode implements INodeType {
const oneTime = this.getNodeParameter('oneTime', 0) as boolean;
// Build trigger configuration
- let triggerConfig: any = {
+ const triggerConfig: any = {
symbol,
condition,
provider,
diff --git a/fincept-terminal-desktop/src/services/nodeSystem/nodes/triggers/ScheduleTriggerNode.ts b/fincept-terminal-desktop/src/services/nodeSystem/nodes/triggers/ScheduleTriggerNode.ts
index 7dfb504bd..d592a9dfc 100644
--- a/fincept-terminal-desktop/src/services/nodeSystem/nodes/triggers/ScheduleTriggerNode.ts
+++ b/fincept-terminal-desktop/src/services/nodeSystem/nodes/triggers/ScheduleTriggerNode.ts
@@ -158,27 +158,31 @@ export class ScheduleTriggerNode implements INodeType {
cronExpression = '0 * * * *';
nextRun = new Date(now.getTime() + 3600000);
break;
- case 'everyDay':
+ case 'everyDay': {
const time = this.getNodeParameter('time', 0) as string;
const [hour, minute] = time.split(':').map(Number);
cronExpression = `${minute} ${hour} * * *`;
nextRun = ScheduleTriggerNode.getNextDailyRun(hour, minute, timezone);
break;
- case 'everyWeek':
+ }
+ case 'everyWeek': {
const daysOfWeek = this.getNodeParameter('daysOfWeek', 0) as string[];
cronExpression = `0 9 * * ${daysOfWeek.join(',')}`;
nextRun = ScheduleTriggerNode.getNextWeeklyRun(daysOfWeek, timezone);
break;
- case 'marketOpen':
+ }
+ case 'marketOpen': {
const openExchange = this.getNodeParameter('exchange', 0) as string;
cronExpression = ScheduleTriggerNode.getMarketOpenCron(openExchange);
nextRun = ScheduleTriggerNode.getNextMarketOpen(openExchange);
break;
- case 'marketClose':
+ }
+ case 'marketClose': {
const closeExchange = this.getNodeParameter('exchange', 0) as string;
cronExpression = ScheduleTriggerNode.getMarketCloseCron(closeExchange);
nextRun = ScheduleTriggerNode.getNextMarketClose(closeExchange);
break;
+ }
case 'cron':
cronExpression = this.getNodeParameter('cronExpression', 0) as string;
nextRun = new Date(now.getTime() + 60000); // Approximate
diff --git a/fincept-terminal-desktop/src/services/nodeSystem/nodes/utilities/CryptoNode.ts b/fincept-terminal-desktop/src/services/nodeSystem/nodes/utilities/CryptoNode.ts
index 64463463f..1b21d9db2 100644
--- a/fincept-terminal-desktop/src/services/nodeSystem/nodes/utilities/CryptoNode.ts
+++ b/fincept-terminal-desktop/src/services/nodeSystem/nodes/utilities/CryptoNode.ts
@@ -87,13 +87,14 @@ export class CryptoNode implements INodeType {
case 'uuid':
result = crypto.randomUUID();
break;
- case 'random':
+ case 'random': {
const array = new Uint8Array(32);
crypto.getRandomValues(array);
result = encoding === 'hex'
? Array.from(array).map(b => b.toString(16).padStart(2, '0')).join('')
: btoa(String.fromCharCode(...array));
break;
+ }
}
returnData.push({
diff --git a/fincept-terminal-desktop/src/services/nodeSystem/nodes/utilities/DateTimeNode.ts b/fincept-terminal-desktop/src/services/nodeSystem/nodes/utilities/DateTimeNode.ts
index 84dfa0b15..580390919 100644
--- a/fincept-terminal-desktop/src/services/nodeSystem/nodes/utilities/DateTimeNode.ts
+++ b/fincept-terminal-desktop/src/services/nodeSystem/nodes/utilities/DateTimeNode.ts
@@ -130,7 +130,7 @@ export class DateTimeNode implements INodeType {
};
break;
- case 'add':
+ case 'add': {
const added = this.addTime(inputDate, amount, unit);
result = {
original: inputDate.toISOString(),
@@ -138,8 +138,9 @@ export class DateTimeNode implements INodeType {
formatted: this.formatDate(added, format),
};
break;
+ }
- case 'subtract':
+ case 'subtract': {
const subtracted = this.addTime(inputDate, -amount, unit);
result = {
original: inputDate.toISOString(),
@@ -147,8 +148,9 @@ export class DateTimeNode implements INodeType {
formatted: this.formatDate(subtracted, format),
};
break;
+ }
- case 'diff':
+ case 'diff': {
const now = new Date();
const diffMs = now.getTime() - inputDate.getTime();
result = {
@@ -159,6 +161,7 @@ export class DateTimeNode implements INodeType {
days: Math.floor(diffMs / 86400000),
};
break;
+ }
case 'extract':
result = {
diff --git a/fincept-terminal-desktop/src/services/portfolio/customIndexService.ts b/fincept-terminal-desktop/src/services/portfolio/customIndexService.ts
index 263cb7f6d..22152ced1 100644
--- a/fincept-terminal-desktop/src/services/portfolio/customIndexService.ts
+++ b/fincept-terminal-desktop/src/services/portfolio/customIndexService.ts
@@ -422,10 +422,11 @@ class CustomIndexService {
const n = allConstituents.length;
switch (method) {
- case 'price_weighted':
+ case 'price_weighted': {
const totalPrices = allConstituents.reduce((sum, c) => sum + c.current_price, 0);
weight = totalPrices > 0 ? (constituent.current_price / totalPrices) * 100 : 0;
break;
+ }
case 'market_cap_weighted':
case 'float_adjusted':
@@ -442,10 +443,11 @@ class CustomIndexService {
}
break;
- case 'fundamental_weighted':
+ case 'fundamental_weighted': {
const totalScore = allConstituents.reduce((sum, c) => sum + (c.fundamentalScore || 0), 0);
weight = totalScore > 0 ? ((constituent.fundamentalScore || 0) / totalScore) * 100 : 100 / n;
break;
+ }
case 'capped_weighted':
// First calculate market cap weight
@@ -456,7 +458,7 @@ class CustomIndexService {
}
break;
- case 'risk_parity':
+ case 'risk_parity': {
// Using day change volatility as proxy for volatility
const volatilities = allConstituents.map(c => Math.abs(c.day_change_percent) || 1);
const inverseVols = volatilities.map(v => 1 / v);
@@ -464,6 +466,7 @@ class CustomIndexService {
const myInverseVol = 1 / (Math.abs(constituent.day_change_percent) || 1);
weight = totalInverseVol > 0 ? (myInverseVol / totalInverseVol) * 100 : 100 / n;
break;
+ }
case 'factor_weighted':
// Use custom weight if provided, else equal weight
@@ -597,7 +600,7 @@ class CustomIndexService {
break;
}
- default:
+ default: {
// Default to price-weighted
const sumPrices = constituents.reduce((sum, c) => sum + c.current_price, 0);
if (divisor === 1 && sumPrices > 0) {
@@ -605,6 +608,7 @@ class CustomIndexService {
}
indexValue = sumPrices / divisor;
totalMarketValue = constituents.reduce((sum, c) => sum + c.market_value, 0);
+ }
}
return { indexValue, totalMarketValue, divisor };
diff --git a/fincept-terminal-desktop/src/services/voice/ttsService.ts b/fincept-terminal-desktop/src/services/voice/ttsService.ts
index 5347cddef..a464635e1 100644
--- a/fincept-terminal-desktop/src/services/voice/ttsService.ts
+++ b/fincept-terminal-desktop/src/services/voice/ttsService.ts
@@ -176,7 +176,7 @@ class TTSService {
});
// Inline formulas: \( ... \) or $ ... $
- text = text.replace(/\\\((.*?)\\\)|\$([^\$\n]+?)\$/g, (_, i1, i2) => {
+ text = text.replace(/\\\((.*?)\\\)|\$([^$\n]+?)\$/g, (_, i1, i2) => {
const formula = i1 || i2;
return ' ' + this.latexToSpeech(formula) + ' ';
});
diff --git a/fincept-terminal-desktop/src/store/keplerStore.ts b/fincept-terminal-desktop/src/store/keplerStore.ts
index 564b21958..3c97cf7ec 100644
--- a/fincept-terminal-desktop/src/store/keplerStore.ts
+++ b/fincept-terminal-desktop/src/store/keplerStore.ts
@@ -1,8 +1,8 @@
// Redux store configuration for Kepler.gl
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
-// @ts-ignore
+// @ts-expect-error no types for react-palm
import { taskMiddleware } from 'react-palm/tasks';
-// @ts-ignore
+// @ts-expect-error no types for kepler.gl
import keplerGlReducer from 'kepler.gl/reducers';
const customizedKeplerGlReducer = keplerGlReducer.initialState({
diff --git a/fincept-terminal-desktop/src/tauri-cors-config.ts b/fincept-terminal-desktop/src/tauri-cors-config.ts
index a08ec5f4b..b1bad6833 100644
--- a/fincept-terminal-desktop/src/tauri-cors-config.ts
+++ b/fincept-terminal-desktop/src/tauri-cors-config.ts
@@ -39,6 +39,7 @@ export function initTauriCORS() {
});
} else {
+ // Non-Tauri environment: no CORS config needed
}
}
diff --git a/fincept-terminal-desktop/src/types/html-to-docx.d.ts b/fincept-terminal-desktop/src/types/html-to-docx.d.ts
new file mode 100644
index 000000000..83209051f
--- /dev/null
+++ b/fincept-terminal-desktop/src/types/html-to-docx.d.ts
@@ -0,0 +1,22 @@
+declare module 'html-to-docx' {
+ interface HTMLtoDOCXOptions {
+ table?: { row?: { cantSplit?: boolean } };
+ footer?: boolean;
+ pageNumber?: boolean;
+ title?: string;
+ creator?: string;
+ description?: string;
+ margins?: {
+ top?: number;
+ right?: number;
+ bottom?: number;
+ left?: number;
+ };
+ }
+
+ export default function HTMLtoDOCX(
+ htmlString: string,
+ headerHTMLString: string | null,
+ options?: HTMLtoDOCXOptions
+ ): Promise<Blob>;
+}
diff --git a/fincept-terminal-desktop/vite.config.ts b/fincept-terminal-desktop/vite.config.ts
index 442229d77..4e4af4ea1 100644
--- a/fincept-terminal-desktop/vite.config.ts
+++ b/fincept-terminal-desktop/vite.config.ts
@@ -1,5 +1,5 @@
import { defineConfig, Plugin } from 'vite'
-import react from '@vitejs/plugin-react'
+import react from '@vitejs/plugin-react-swc'
import tailwindcss from '@tailwindcss/vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import path from 'path'
diff --git a/portfolio-analyst-agent.json b/portfolio-analyst-agent.json
deleted file mode 100644
index 7547473d2..000000000
--- a/portfolio-analyst-agent.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "name": "Portfolio Analyst",
- "description": "Analyzes portfolio holdings, macro conditions, and provides rebalancing recommendations with CFA-level insights.",
- "category": "finance",
- "config_json": {
- "model": {
- "provider": "fincept",
- "model_id": "fincept-llm",
- "temperature": 0.3
- },
- "instructions": "You are a CFA-level portfolio analyst with deep expertise in asset allocation, risk management, and macroeconomic analysis.\n\nWhen given a portfolio, you MUST:\n1. Call get_my_stocks to fetch current holdings and live prices\n2. Call calculate_advanced_metrics to get Sharpe ratio, volatility, beta, VaR\n3. Call analyze_diversification to assess sector/geographic concentration\n4. Call economics_central_bank_rates to get current central bank rates globally\n5. Call economics_inverted_yields to check yield curve inversion signals\n6. Call economics_bond_spreads to assess credit risk environment\n7. Call economics_calendar to identify upcoming market-moving events\n8. Call economics_ceic_series with country='united-states' and indicator='GDP' for growth context\n9. Call economics_ceic_series with country='united-states' and indicator='CPI' for inflation context\n\nAfter gathering ALL data, produce a structured report with:\n\n## Portfolio Overview\n- Current NAV, number of holdings, top positions\n\n## Performance Metrics\n- Sharpe ratio, volatility, beta, max drawdown, VaR\n- Compare to benchmarks where possible\n\n## Macro Environment\n- Fed/central bank stance and rate outlook\n- Inflation trajectory (CPI trend)\n- GDP growth signals\n- Yield curve status (normal/inverted/flat)\n- Credit spreads (risk-on vs risk-off)\n- Key upcoming events that could move markets\n\n## Risk Assessment\n- Concentration risks (sector, geography, single-name)\n- Correlation analysis\n- Tail risk exposures\n- Current macro headwinds/tailwinds for each position\n\n## Rebalancing Recommendations\nFor each recommendation provide:\n- Action: REDUCE / INCREASE / HOLD / EXIT / INITIATE\n- Asset: ticker and name\n- Current weight vs target weight\n- Rationale: cite specific numbers from the data you collected\n- Risk/Reward: expected outcome\n\n## Priority Actions\nRank top 3 most urgent changes with clear reasoning.\n\nAlways cite specific numbers. Never make vague statements. Be direct and actionable.",
- "tools": [],
- "markdown": true,
- "max_iterations": 15
- }
-}