Skip to content

v3.0.0 Release

Latest
Compare
Choose a tag to compare
@josh-wjp josh-wjp released this 15 Feb 22:14
· 4 commits to main since this release

Fixed handleApplyStrategy Function:

Removed duplicated and malformed code (e.g., nst handleApplyStrategy and repeated logic).
Cleaned up the structure to define a valid strategy object and pass it to the applyStrategy function prop.
Added logic to store the strategy in the setAutoTradingStrategies state for the selected cryptocurrency.
Validated and Kept handleResetToDefault:

Confirmed that the function resets all trading strategy parameters to default values.
Added an alert to notify the user when defaults are applied.
Checked Prop Passing:

Verified that applyStrategy and setAutoTradingStrategies are correctly passed as props from the parent component (App.jsx).
Ensured the function signatures matched their usage in the FrontEndDesign component.
Removed Redundant or Corrupted Code:

Cleaned up unnecessary and misaligned code, such as resetStrategy={resetStrategy}, which could cause issues if resetStrategy isn't properly defined.
Improved indentation, removed duplicate lines, and resolved all syntax errors.
Tested Integration:

Ensured the following functionality works seamlessly:
Applying a trading strategy with the "Apply Strategy" button.
Resetting strategy values to defaults with the "Reset to Default" button.

Buy Logic:
The auto trader calculates the quantity to buy so that at least $10 is spent (using Math.ceil(10 / decision.price)).

Sell Logic:
For sells, the code checks the current holdings (stored in your holdings state) and the average cost. It will only execute a sell if the current price is at least 5% above the average cost (you can adjust this threshold as needed). When this condition is met, it sells 20% of your holdings (with a minimum of 1 coin).

State Dependencies:
The polling effect now depends on both autoTrading and holdings so that when holdings update, the sell decision re-evaluates.

Full Changelog: v2.1...v3.0.0