diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bc8d614..6fff6f8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## New Features - Save settings into a custom profile and fast swap between! Even supports multiple 3 Commas accounts. -- Auto-refresh bar has a built in loading indicator in seconds. +- Auto-refresh bar has a built-in loading indicator in seconds. - DCA calculator, order details, and order timeline built into every active deal. - Force paper or real account directly in the settings. - Documentation on docs.3cpm.io along with a link in the sidebar! @@ -12,7 +12,7 @@ ## Enhancements -- Enabled accounts are synced on every auto refresh, no more out of date data! +- Enabled accounts are synced on every auto-refresh, no more out-of-date data! - Update banner now differentiates between beta and general releases. - TTP has been added to the active deals bot name hover. - Active deals with an error have the `Active SO` and `# SO` in bold red with a tooltip hover to see the specific error message. @@ -20,10 +20,10 @@ - Reset all data is moved under Menu > Help > Delete All - Added a clear all local storage under Menu > Edit - Adjusted metrics to be ordered the same across stats. -- Dynamic chart height for bot / pair performance based on the number of data points. +- Dynamic chart height for bot/pair performance based on the number of data points. - Improved overall chart formatting (highlighting, colors, bar width, etc.) - Adjusted tooltips and headers for better clarity. -- Improved the Risk Monitor view for larger screens. Thanks @GD_NL. +- Improved the Risk Monitor view for larger screens. - Improved chart loading performance - Updating TradingView Icon @@ -38,7 +38,6 @@ ## Backend Changes - Entire data handling has been moved from React context API to Redux - # v0.4.1 ## New Features diff --git a/package.json b/package.json index 71bb17e6..bc4a034e 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,8 @@ "typescript": "^4.3.5", "webpack": "^5.47.1", "webpack-cli": "^4.7.2", - "webpack-dev-server": "^3.11.2" + "webpack-dev-server": "^3.11.2", + "electron-notarize": "^1.1.1" }, "dependencies": { "@date-io/date-fns": "^1.3.13", @@ -86,7 +87,6 @@ "dot-prop": "^6.0.1", "electron-fetch": "^1.7.4", "electron-log": "^4.4.1", - "electron-notarize": "^1.1.1", "electron-store": "^8.0.0", "material-ui-popup-state": "^1.9.3", "moment": "^2.29.1", diff --git a/package.old.json b/package.old.json deleted file mode 100644 index b745238e..00000000 --- a/package.old.json +++ /dev/null @@ -1,148 +0,0 @@ -{ - "name": "3c-portfolio-manager", - "productName": "3C Portfolio Manager", - "version": "v0.5.0", - "description": "An application to manage your 3Commas portfolio.", - "private": true, - "main": "./dist/main.js", - "scripts": { - "pack": "electron-builder --dir ", - "build:mac": "webpack && electron-builder --dir && electron-builder --mac", - "build:win": "electron-builder --win", - "build:linux": "electron-builder --linux", - "build": "webpack && electron-builder --dir && electron-builder --mac --win --linux", - "react:dev": "webpack serve --mode=development", - "electron:dev": "nodemon", - "webpack": "webpack", - "dev": "concurrently --kill-others \"npm run react:dev\" \"npm run electron:dev\"", - "wpanddev": "webpack && concurrently --kill-others \"npm run react:dev\" \"npm run electron:dev\"", - "start": "npm run build && electron dist/main.js", - "rebuild": "./node_modules/.bin/electron-rebuild -f -w better-sqlite3" - }, - "repository": { - "type": "git", - "url": "https://github.com/coltoneshaw/3c-portfolio-manager" - }, - "author": "Colton", - "license": "GPL", - "bugs": { - "url": "https://github.com/coltoneshaw/3c-portfolio-manager/issues" - }, - "homepage": "https://github.com/coltoneshaw/3c-portfolio-manager", - "devDependencies": { - "@babel/core": "^7.14.8", - "@babel/preset-env": "^7.14.8", - "@babel/preset-react": "^7.14.5", - "@electron/typescript-definitions": "^8.9.5", - "@material-ui/core": "^4.12.3", - "@material-ui/data-grid": "^4.0.0-alpha.35", - "@material-ui/icons": "^4.11.2", - "@material-ui/pickers": "^3.3.10", - "@types/better-sqlite3": "^5.4.3", - "@types/d3-scale-chromatic": "^3.0.0", - "@types/node-fetch": "^3.0.3", - "@types/react": "^17.0.15", - "@types/react-dom": "^17.0.9", - "@types/react-redux": "^7.1.18", - "@types/react-router-dom": "^5.1.8", - "@types/react-table": "^7.7.2", - "@types/styled-components": "^5.1.12", - "@types/uuid": "^8.3.1", - "babel-loader": "^8.2.2", - "concurrently": "^6.2.0", - "css-loader": "^6.2.0", - "d3-scale": "^3.3.0", - "d3-scale-chromatic": "^2.0.0", - "electron": "^13.1.7", - "electron-builder": "^22.11.7", - "electron-devtools-installer": "^3.2.0", - "electron-is-dev": "^2.0.0", - "electron-rebuild": "^2.3.5", - "html-webpack-plugin": "^5.3.2", - "nodemon": "^2.0.12", - "react": "^17.0.2", - "react-d3-speedometer": "^1.0.1", - "react-dom": "^17.0.2", - "react-gauge-chart": "^0.3.0", - "react-redux": "^7.2.5", - "react-router-dom": "^5.2.0", - "react-table": "^7.7.0", - "recharts": "^2.0.10", - "sass": "^1.35.2", - "sass-loader": "^12.1.0", - "style-loader": "^3.1.0", - "styled-components": "^5.3.0", - "ts-loader": "^9.2.4", - "typescript": "^4.3.5", - "webpack": "^5.47.1", - "webpack-cli": "^4.7.2", - "webpack-dev-server": "^3.11.2" - }, - "dependencies": { - "@date-io/date-fns": "^1.3.13", - "@material-ui/lab": "^4.0.0-alpha.60", - "@reduxjs/toolkit": "^1.6.1", - "3commas-api-node": "^1.0.9", - "better-sqlite3": "^7.4.1", - "date-fns": "^2.22.1", - "date-fns-tz": "^1.1.6", - "dot-prop": "^6.0.1", - "electron-fetch": "^1.7.4", - "electron-notarize": "^1.1.1", - "electron-store": "^8.0.0", - "material-ui-popup-state": "^1.9.3", - "node-fetch": "^2.6.1", - "query-string": "^7.0.1", - "uuid": "^8.3.2" - }, - "build": { - "appId": "com.savvytoolbelt.3cportfoliomanager", - "artifactName": "${name}-${version}-${os}-${arch}.${ext}", - "afterSign": "scripts/notarize.js", - "directories": { - "output": "release" - }, - "mac": { - "category": "public.app-category.finance", - "target": [ - "dmg", - "zip" - ], - "type": "distribution", - "darkModeSupport": true, - "hardenedRuntime": true, - "entitlements": "build/entitlements.mac.plist", - "entitlementsInherit": "build/entitlements.mac.plist", - "gatekeeperAssess": false, - "icon": "assets/icons/icon.icns", - "provisioningProfile": "build/embedded.provisionprofile" - }, - "dmg": { - "contents": [ - { - "x": 130, - "y": 220 - }, - { - "x": 410, - "y": 220, - "type": "link", - "path": "/Applications" - } - ], - "icon": "assets/icons/icon.icns" - }, - "win": { - "icon": "assets/icons/icon.ico", - "publisherName": "Colton Shaw", - "target": "NSIS" - }, - "nsis": { - "createDesktopShortcut": true, - "createStartMenuShortcut": true - }, - "linux": { - "icon": "assets/icons" - } - } -} diff --git a/src/app/Components/Charts/Bar/SoDealDistribution.tsx b/src/app/Components/Charts/Bar/SoDealDistribution.tsx index 66ccd2bf..ad87e813 100644 --- a/src/app/Components/Charts/Bar/SoDealDistribution.tsx +++ b/src/app/Components/Charts/Bar/SoDealDistribution.tsx @@ -18,15 +18,15 @@ import type{Type_SoDistributionArray} from '@/types/3Commas' // move the bot / pair data to be in the global state // add the query to the 3C table // -const SoDealDistribution = ({ defaultCurrency }: Type_SoDealDis) => { +const SoDealDistribution = ({data = [], defaultCurrency }: Type_SoDealDis) => { - const safety_order = useAppSelector(state => state.threeCommas.performanceData.safety_order) + // const safety_order = useAppSelector(state => state.threeCommas.performanceData.safety_order) const [soData, updateData] = useState([]); useEffect(() => { - updateData(safety_order ?? []) - }, [safety_order]) + updateData(data ?? []) + }, [data]) const renderChart = () => { if (soData.length === 0) { diff --git a/src/app/Features/3Commas/3Commas.ts b/src/app/Features/3Commas/3Commas.ts index 9eae9482..6d060284 100644 --- a/src/app/Features/3Commas/3Commas.ts +++ b/src/app/Features/3Commas/3Commas.ts @@ -504,6 +504,12 @@ const fetchSoData = async (currentProfile: Type_Profile, oDate?: DateRange) => { const filtersQueryString = await getFiltersQueryString(currentProfile); const { currencyString, accountIdString, startString, currentProfileID } = filtersQueryString; + + let date = initDate(startString, oDate); + const [fromDateStr, toDateStr] = DateRangeToSQLString(date) + const fromSQL = `and closed_at >= '${fromDateStr}'` + const toSQL = `and closed_at < '${toDateStr}'` + const query = ` select completed_safety_orders_count, @@ -516,6 +522,7 @@ const fetchSoData = async (currentProfile: Type_Profile, oDate?: DateRange) => { and currency in (${currencyString} ) and closed_at_iso_string > ${startString} and profile_id = '${currentProfileID}' + ${fromSQL} ${toSQL} group by completed_safety_orders_count;` diff --git a/src/app/Pages/Stats/Views/PerformanceMonitor.tsx b/src/app/Pages/Stats/Views/PerformanceMonitor.tsx index 54466976..f202c596 100644 --- a/src/app/Pages/Stats/Views/PerformanceMonitor.tsx +++ b/src/app/Pages/Stats/Views/PerformanceMonitor.tsx @@ -15,7 +15,8 @@ import { PairPerformanceByDate } from '@/app/Components/Charts/Line'; import { fetchBotPerformanceMetrics, fetchPairPerformanceMetrics, - fetchPerformanceDataFunction + fetchPerformanceDataFunction, + fetchSoData } from "@/app/Features/3Commas/3Commas"; import { DateRange as Type_DateRange } from "@/types/Date"; @@ -35,13 +36,16 @@ const PerformanceMonitor = () => { fetchPerformanceDataFunction(currentProfile, datePair), fetchBotPerformanceMetrics(currentProfile, datePair), fetchPairPerformanceMetrics(currentProfile, datePair), - ]).then(([perfData, botPerfData, pairPerfData]) => { + fetchSoData(currentProfile, datePair), + ]).then(([perfData, botPerfData, pairPerfData, safety_order]) => { updateLocalPerf((prevState) => { return { ...prevState, pair_bot: perfData, bot: botPerfData, - pair: pairPerfData + pair: pairPerfData, + safety_order + } }) }) @@ -99,7 +103,7 @@ const PerformanceMonitor = () => { - + diff --git a/src/types/Charts.ts b/src/types/Charts.ts index d7e3b9e8..50d5f402 100644 --- a/src/types/Charts.ts +++ b/src/types/Charts.ts @@ -1,4 +1,4 @@ -import { Type_Profit, Type_Query_PerfArray, Type_ActiveDeals, Type_MetricData, Type_Bot_Performance_Metrics, Type_Pair_Performance_Metrics } from '@/types/3Commas'; +import { Type_Profit, Type_Query_PerfArray, Type_ActiveDeals, Type_MetricData, Type_Bot_Performance_Metrics, Type_Pair_Performance_Metrics, Type_SoDistributionArray } from '@/types/3Commas'; import type {defaultCurrency} from '@/types/config' export interface Type_SoDistribution { @@ -7,8 +7,9 @@ export interface Type_SoDistribution { defaultCurrency: defaultCurrency } -export interface Type_SoDealDis { +export type Type_SoDealDis = { defaultCurrency: defaultCurrency + data: Type_SoDistributionArray[] | undefined }