Skip to content

v1.9

Compare
Choose a tag to compare
@aleibovici aleibovici released this 26 Dec 23:12
· 8 commits to main since this release
  • New Sell button for each order, enabling you to choose which order to sell. Previously, only the order closest to the profit margin would sell when the 'Sell' button was manually triggered. This enables granular selection of which orders to sell when they are underwater. The 'Sell MArket' button still operates selling the order closest to the profit margin.

  • New DryRun logging now logs every simulated buy and sell transaction for post-audit (cryptopump.log)
  • MySQL query and index optimization, reducing the load on MySQL server and increasing the system scalability. (DB schema update required)
  • Documentation update for the new capabilities.
  • Various internal code improvements for performance

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 `orders` ADD INDEX `orders_idx_side_status` (`Side`,`Status`);


DELIMITER $$
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` 
WHERE
(
    `orders`.`Side` = 'BUY'
) 
AND (
    `orders`.`Status` = 'FILLED'
)
) `source` 
WHERE
(
1 = 1 
AND `source`.`Orders__Side` = 'SELL' 
AND 1 = 1 
AND `source`.`Orders__Status` = 'FILLED'
);
END$$
DELIMITER ;



DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `GetOrderByOrderID`(IN in_param_OrderID bigint, IN in_param_ThreadID varchar(45))
BEGIN
DECLARE declared_in_param_orderid BIGINT; 
DECLARE declared_in_param_threadid CHAR(50); 
SET declared_in_param_orderid = in_param_orderid; 
SET declared_in_param_threadid = in_param_threadid;
SELECT 
    `orders`.`orderid` AS `OrderID`,
    `orders`.`price` AS `Price`,
    `orders`.`executedquantity` AS `ExecutedQuantity`,
    `orders`.`cummulativequoteqty` AS `CummulativeQuoteQty`,
    `orders`.`transacttime` AS `TransactTime`
FROM
    `orders`
WHERE
    (`orders`.`orderid` = declared_in_param_orderid
        AND `orders`.`threadid` = declared_in_param_threadid)
LIMIT 1; 
END$$
DELIMITER ;