Skip to content

Commit

Permalink
Adjusted notification wording if money was lost
Browse files Browse the repository at this point in the history
  • Loading branch information
coltoneshaw committed Sep 16, 2021
1 parent b55e4c2 commit bc63d4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/Features/3Commas/API/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { update, run, query } from '@/app/Features/Database/database';
const { bots, getAccountDetail, deals, getAccountSummary } = require('./api');
const { getProfileConfigAll } = require('@/utils/config')
import { findAndNotifyNewDeals } from '@/app/Features/Notifications/notifications'
import { findAndNotifyNewDeals } from '@/electron/Notifications/notifications'

import { Type_Deals_API, Type_Query_Accounts, Type_API_bots, Type_UpdateFunction } from '@/types/3Commas'
import { Type_Profile } from '@/types/config'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ function findAndNotifyNewDeals(data: Type_Deals_API[], lastSyncTime: number, sum
const totalProfit = data.map(deal => deal.final_profit).reduce((sum, profit) => sum + profit);
const pairs = data.map(deal => deal.pair)
const moneyBags = ("💰".repeat(data.length))
const ifRich = (+totalProfit > 0) ? "rich" : "poor"
try {

showNotification(`${data.length} Deals Closed, you're rich`, `Profit: ${parseNumber(totalProfit, 5)} - Pairs: ${pairs.join(', ')}. ${moneyBags} `);
showNotification(`${data.length} Deals Closed, you're ${ifRich}`, `Profit: ${parseNumber(totalProfit, 5)} - Pairs: ${pairs.join(', ')}. ${moneyBags} `);

// add the deal IDs to the notified deal array
dealsNotified.push(...data.map(deal => deal.id))
Expand All @@ -101,9 +102,11 @@ function findAndNotifyNewDeals(data: Type_Deals_API[], lastSyncTime: number, sum
}

for (let deal of data) {
const notificationTitle = 'Deal Closed, profit was had.';


const {bot_name, pair, final_profit, final_profit_percentage, from_currency, id, created_at, closed_at} = deal;
const ifRich = (+final_profit > 0) ? "had" : "lost"
const notificationTitle = `Deal Closed, profit was ${ifRich}.`;

// deal length:

Expand Down

0 comments on commit bc63d4b

Please sign in to comment.