v1.8.1 GA Release
- New Net Profit calculation. Net Profit (Net Profit = Total Profit - Order Differences) where Order Difference is the total difference between each order price and the current crypto pair price for all threads. Another way to understand Net Profit is to look at is as the total profit if all orders were to be closed at that moment in time. Net profit is important because CryptoPump will use Profits to buy orders if the crypto pair goes down in price. More info in the documentation.
- New Net ROI calculation. While ROI is defined by Profit / Invested Amount, the Net ROI is defined by (Net Thread Profit = Total Thread Profit - Order Thread Differences) divided by Invested Amount. More info in the documentation.
- New Telegram information when requesting /report, including Net Profit and Net ROI (Return on Investment).
- HTML UI changes to accommodate the new information in the display.
- The documentation has been updated to reflect the changes.
- Additional Binance error handling was added to the system.
This release requires a database update if you are already running Cryptopump in production, or if you are deploying for the first time, simply use cryptopump.sql.
ALTER TABLE `cryptopump`.`session`
ADD COLUMN `DiffTotal` FLOAT NOT NULL AFTER `FiatFunds`;
USE `cryptopump`;
DROP procedure IF EXISTS `SaveSession`;
USE `cryptopump`;
DROP procedure IF EXISTS `cryptopump`.`SaveSession`;
;
DELIMITER $$
USE `cryptopump`$$
CREATE DEFINER=`root`@`%` PROCEDURE `SaveSession`(in_ThreadID varchar(45), in_ThreadIDSession varchar(45), in_Exchange varchar(45), in_FiatSymbol varchar(45), in_FiatFunds float, in_DiffTotal float, in_Status tinyint(1))
BEGIN
INSERT INTO session (ThreadID, ThreadIDSession, Exchange, FiatSymbol, FiatFunds, DiffTotal, Status)
VALUES (in_ThreadID, in_ThreadIDSession, in_Exchange, in_FiatSymbol, in_FiatFunds, in_DiffTotal, in_Status);
END$$
DELIMITER ;
;
USE `cryptopump`;
DROP procedure IF EXISTS `UpdateSession`;
USE `cryptopump`;
DROP procedure IF EXISTS `cryptopump`.`UpdateSession`;
;
DELIMITER $$
USE `cryptopump`$$
CREATE DEFINER=`root`@`%` PROCEDURE `UpdateSession`(in_ThreadID varchar(45), in_ThreadIDSession varchar(45), in_Exchange varchar(45), in_FiatSymbol varchar(45), in_FiatFunds float, in_DiffTotal float, in_Status tinyint(1))
BEGIN
SET SQL_SAFE_UPDATES = 0;
UPDATE `session`
SET
`session`.`FiatFunds` = in_FiatFunds,
`session`.`DiffTotal` = in_DiffTotal,
`session`.`Status` = in_Status
WHERE
`session`.`ThreadID` = in_ThreadID;
SET SQL_SAFE_UPDATES = 1;
END$$
DELIMITER ;
;
USE `cryptopump`;
DROP procedure IF EXISTS `GetProfit`;
USE `cryptopump`;
DROP procedure IF EXISTS `cryptopump`.`GetProfit`;
;
DELIMITER $$
USE `cryptopump`$$
CREATE DEFINER=`root`@`%` PROCEDURE `GetProfit`()
BEGIN
SELECT
SUM(`source`.`Profit`) + (`source`.`Diff`) AS `sum`,
AVG(`source`.`Percentage`) AS `avg`
FROM
(SELECT
`orders`.`Side` AS `Side`,
`Orders`.`Side` AS `Orders__Side`,
`orders`.`Status` AS `Status`,
`Orders`.`Status` AS `Orders__Status`,
`orders`.`ThreadID` AS `ThreadID`,
`Orders`.`CummulativeQuoteQty` AS `Orders__CummulativeQuoteQty`,
`orders`.`CummulativeQuoteQty` AS `CummulativeQuoteQty`,
(`Orders`.`CummulativeQuoteQty` - `orders`.`CummulativeQuoteQty`) AS `Profit`,
((`Orders`.`CummulativeQuoteQty` - `orders`.`CummulativeQuoteQty`) / CASE
WHEN `Orders`.`CummulativeQuoteQty` = 0 THEN NULL
ELSE `Orders`.`CummulativeQuoteQty`
END) AS `Percentage`,
(SELECT sum(`session`.`DiffTotal`) AS `sum` FROM `session`) AS `Diff`
FROM
`orders`
INNER JOIN `orders` `Orders` ON `orders`.`OrderID` = `Orders`.`OrderIDSource`) `source`
WHERE
(`source`.`Side` = 'BUY'
AND `source`.`Orders__Side` = 'SELL'
AND `source`.`Status` = 'FILLED'
AND `source`.`Orders__Status` = 'FILLED');
END$$
DELIMITER ;
;
USE `cryptopump`;
DROP procedure IF EXISTS `GetProfit`;
USE `cryptopump`;
DROP procedure IF EXISTS `cryptopump`.`GetProfit`;
;
DELIMITER $$
USE `cryptopump`$$
CREATE DEFINER=`root`@`%` PROCEDURE `GetProfit`()
BEGIN
SELECT
SUM(`source`.`Profit`) AS `profit`,
SUM(`source`.`Profit`) + (`source`.`Diff`) AS `netprofit`,
AVG(`source`.`Percentage`) AS `avg`
FROM
(SELECT
`orders`.`Side` AS `Side`,
`Orders`.`Side` AS `Orders__Side`,
`orders`.`Status` AS `Status`,
`Orders`.`Status` AS `Orders__Status`,
`orders`.`ThreadID` AS `ThreadID`,
`Orders`.`CummulativeQuoteQty` AS `Orders__CummulativeQuoteQty`,
`orders`.`CummulativeQuoteQty` AS `CummulativeQuoteQty`,
(`Orders`.`CummulativeQuoteQty` - `orders`.`CummulativeQuoteQty`) AS `Profit`,
((`Orders`.`CummulativeQuoteQty` - `orders`.`CummulativeQuoteQty`) / CASE
WHEN `Orders`.`CummulativeQuoteQty` = 0 THEN NULL
ELSE `Orders`.`CummulativeQuoteQty`
END) AS `Percentage`,
(SELECT sum(`session`.`DiffTotal`) AS `sum` FROM `session`) AS `Diff`
FROM
`orders`
INNER JOIN `orders` `Orders` ON `orders`.`OrderID` = `Orders`.`OrderIDSource`) `source`
WHERE
(`source`.`Side` = 'BUY'
AND `source`.`Orders__Side` = 'SELL'
AND `source`.`Status` = 'FILLED'
AND `source`.`Orders__Status` = 'FILLED');
END$$
DELIMITER ;
;
ALTER TABLE `cryptopump`.`global`
ADD COLUMN `ProfitNet` FLOAT NOT NULL AFTER `Profit`;
USE `cryptopump`;
DROP procedure IF EXISTS `SaveGlobal`;
USE `cryptopump`;
DROP procedure IF EXISTS `cryptopump`.`SaveGlobal`;
;
DELIMITER $$
USE `cryptopump`$$
CREATE DEFINER=`root`@`%` PROCEDURE `SaveGlobal`(in_Profit float, in_ProfitNet float, in_ProfitPct float, in_TransactTime bigint)
BEGIN
INSERT INTO global (Profit, ProfitNet, ProfitPct, TransactTime)
VALUES (in_Profit, in_ProfitNet, in_ProfitPct, in_TransactTime);
END$$
DELIMITER ;
;
USE `cryptopump`;
DROP procedure IF EXISTS `UpdateGlobal`;
USE `cryptopump`;
DROP procedure IF EXISTS `cryptopump`.`UpdateGlobal`;
;
DELIMITER $$
USE `cryptopump`$$
CREATE DEFINER=`root`@`%` PROCEDURE `UpdateGlobal`(in_Profit float, in_ProfitNet float, in_ProfitPct float, in_TransactTime bigint)
BEGIN
SET SQL_SAFE_UPDATES = 0;
UPDATE global
SET
Profit = in_Profit,
ProfitNet = in_ProfitNet,
ProfitPct = in_ProfitPct,
TransactTime = in_TransactTime
WHERE
ID = 1;
SET SQL_SAFE_UPDATES = 1;
END$$
DELIMITER ;
;
USE `cryptopump`;
DROP procedure IF EXISTS `GetGlobal`;
USE `cryptopump`;
DROP procedure IF EXISTS `cryptopump`.`GetGlobal`;
;
DELIMITER $$
USE `cryptopump`$$
CREATE DEFINER=`root`@`%` PROCEDURE `GetGlobal`()
BEGIN
SELECT
`global`.`Profit` AS `Profit`,
`global`.`ProfitNet` AS `ProfitNet`,
`global`.`ProfitPct` AS `ProfitPct`,
`global`.`TransactTime` AS `TransactTime`
FROM
`global`
WHERE
`global`.`ID` = 1
LIMIT 1;
END$$
DELIMITER ;
;