Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
Fixed SO data being filtered by the perf date selector
Browse files Browse the repository at this point in the history
  • Loading branch information
coltoneshaw committed Oct 8, 2021
1 parent c33c1fd commit d73fcec
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 165 deletions.
9 changes: 4 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -12,18 +12,18 @@


## 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.
- Adjusted wording on deal notifications if you lost money.
- 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

Expand All @@ -38,7 +38,6 @@

## Backend Changes
- Entire data handling has been moved from React context API to Redux

# v0.4.1

## New Features
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
148 changes: 0 additions & 148 deletions package.old.json

This file was deleted.

8 changes: 4 additions & 4 deletions src/app/Components/Charts/Bar/SoDealDistribution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Type_SoDistributionArray[]>([]);

useEffect(() => {
updateData(safety_order ?? [])
}, [safety_order])
updateData(data ?? [])
}, [data])

const renderChart = () => {
if (soData.length === 0) {
Expand Down
7 changes: 7 additions & 0 deletions src/app/Features/3Commas/3Commas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;`

Expand Down
12 changes: 8 additions & 4 deletions src/app/Pages/Stats/Views/PerformanceMonitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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

}
})
})
Expand Down Expand Up @@ -99,7 +103,7 @@ const PerformanceMonitor = () => {
</Grid>

<Grid item xs={12}>
<SoDealDistribution key="soDealDistribution" defaultCurrency={currentProfile.general.defaultCurrency}/>
<SoDealDistribution data={localPerf.safety_order} key="soDealDistribution" defaultCurrency={currentProfile.general.defaultCurrency}/>
</Grid>
</Grid>
</>
Expand Down
5 changes: 3 additions & 2 deletions src/types/Charts.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -7,8 +7,9 @@ export interface Type_SoDistribution {
defaultCurrency: defaultCurrency
}

export interface Type_SoDealDis {
export type Type_SoDealDis = {
defaultCurrency: defaultCurrency
data: Type_SoDistributionArray[] | undefined
}


Expand Down

0 comments on commit d73fcec

Please sign in to comment.