Add trading improvements: history logging, strategies framework, and bug fix#6
Open
alogotron wants to merge 1 commit intoCreator-Bid:mainfrom
Open
Add trading improvements: history logging, strategies framework, and bug fix#6alogotron wants to merge 1 commit intoCreator-Bid:mainfrom
alogotron wants to merge 1 commit intoCreator-Bid:mainfrom
Conversation
…bug fix Changes: - Fix: Import VERIFIED_TOKENS from tokens.js in balance.js (DRY) - Feature: Add history.js for trade logging and PnL tracking - Feature: Add STRATEGIES.md with trading strategy framework and examples The balance.js fix removes duplicate token definitions and imports from the canonical tokens.js source. This ensures consistency and makes token list updates easier to maintain. The history module provides trade logging with filtering and basic PnL calculation for strategy performance analysis. STRATEGIES.md documents common trading patterns (DCA, rebalancing, grid trading) and best practices for running automated strategies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds trading utilities and fixes a code duplication issue.
Changes
🐛 Bug Fix: DRY Token Definitions
File:
clawlett/scripts/balance.jsVERIFIED_TOKENSandERC20_ABIdefinitionstokens.js(single source of truth)✨ Feature: Trade History Logging
File:
clawlett/scripts/history.jsNew module for tracking trades:
logTrade()- Record completed trades with timestampsgetHistory()- Query trade history with filters (token, date, limit)getPnL()- Calculate net position changes across all tradesclearHistory()- Reset trade logUseful for:
📚 Feature: Trading Strategies Documentation
File:
clawlett/STRATEGIES.mdComprehensive guide covering:
Testing
balance.jsimports work correctlyRelated
Addresses contribution ideas from CONTRIBUTING.md: