-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: test transaction calculators #14
Merged
Merged
Conversation
This file contains 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
Owner
matiasvillaverde
commented
Jun 1, 2023
- refactor: Refactor transaction worker struct and category validation method
- refactor: Refactor capital calculations and add new calculator.
- refactor: Refactor trade capital calculations for approved trades
- refactor: Refactor transaction and capital calculation modules.
- test: trade calculators
- refactor: Refactor trade calculator to use UUIDs for database integration.
- refactor: Refactor capital calculation modules and functions.
- refactor: Simplify and optimize code by removing unused imports, functions, and whitespace.
- refactor: Refactor trade calculations and remove redundant funding function
- refactor: Refactor trade taxation with new module and function
- refactor: Refactor trade performance calculation logic.
- refactor: Refactor unused imports and remove transaction calculator.
- refactor: Refactor account calculators for better organization and readability
…method - Refactored `TransactionWorker` struct implementation - Extracted `match` block to its own method for transaction category validation - Added comments to improve code readability - No files other than `transaction_worker.rs` were modified in this commit
- Remove `capital_in_trades` function and modify `capital_out_of_market` and `capital_in_market` functions in `transactions_calculator.rs` - Add `CapitalInTradesCalculator` to public use in `calculators.rs` - Add `CapitalInTradesCalculator` and replace mentions of `TransactionsCalculator` in `overview_worker.rs` - Define `CapitalInTradesCalculator` and `capital_in_trades` function in `capital_in_trades_calculator.rs` with tests
- Refactor code for consistency and remove redundancy - Rename method and variable names for greater clarity - Update test cases to reflect changes in function names and outputs
- Add `CapitalTaxableCalculator` module for calculating capital taxable - Implement `capital_taxable` function to sum up tax transactions for an account - Remove unused method and add methods for calculating various trade-related metrics - Rename `TransactionsCalculator` to `CapitalTaxableCalculator` in `OverviewWorker` and remove unnecessary comments and whitespace
…tion. Refactor trade calculator performance module for improved database usage - Use `Uuid` instead of trade reference in `performance.rs` - Add `Uuid` to `TradePerformance` method for database usage - Implement `MockDatabase` tests for `TradePerformance`
- Refactored code to improve clarity and maintainability - Moved `TradeCapitalOutOfMarket` to a separate module and used it for calculating capital out of market in multiple modules - Renamed modules for better naming consistency - Simplified code in `transactions_calculator` and removed unnecessary match blocks and if statements - Fixed variable naming inconsistency in `TransactionWorker` module
…tions, and whitespace. - Simplify and refactor codebase for improved performance and readability - Remove unused imports, parameters, and functions - Rename and reorder variables and imports to match conventions - Fix formatting and remove unnecessary whitespace in import statements and comments
…nction - Refactor funding calculation in `OverviewWorker` - Extract `TradeCapitalInMarket` calculation to `trade_calculators` module - Rename `total_performance` function in `TradeTransactionsCalculator` to `total_performance` - Update calculation of `capital_out_market` using `TradeCapitalOutOfMarket` - Remove `funding` function from `TradeTransactionsCalculator` - Rename variable in `TransactionCategory` to `total_capital_not_at_risk` - Make `FeeOpen` and `FeeClose` negative in `total_performance` calculation
- Add `TradeCapitalTaxable` module to `trade_calculators` - Replace call to `TradeTransactionsCalculator::taxes` with `TradeCapitalTaxable::calculate` - Remove unused import of `TradeCapitalOutOfMarket` from `overview_worker.rs` - Remove `TradeTransactionsCalculator::taxes` function from `transactions_calculator.rs`
- Remove deprecated `TradeTransactionsCalculator` - Add `TradePerformance::calculate` function for improved trade performance calculation - Simplify code by removing `total_performance` function from `transactions_calculator.rs` - Improve code readability by reordering functions in `overview_worker.rs`
- Refactor and remove unused imports across multiple files - Remove the `transactions_calculator` module entirely - Improve edge case handling in the `RiskCalculator` module
…adability - Refactor and rename files related to account calculators - Rename `calculators` to `account_calculators` throughout the codebase - Refactor functions to improve readability and remove unused parameters/imports - Add new tests for improved test coverage - Modify trade calculations to ignore certain transaction categories in `trade_calculators/capital_in_market.rs`
…nd ReadTradeDB trait. - Add set_trade method and ReadTradeDB implementation to MockDatabase - Refactor capital calculation and use dec! macro in risk.rs - Reminder comment and trait refactoring in capital_not_at_risk.rs - Add Default trait and timestamp fields to TradeOverview and TradingVehicle structs - Add capital balance calculation tests to CapitalBalance calculator
…lators - Calculate total capital with trade risk taken into consideration in `TradeCapitalNotAtRisk` - Add tests for empty and non-zero value trades in `TradeCapitalNotAtRisk` - Simplify and optimize `RiskCalculator` module - Add tests for `calculate_capital_allowed_to_risk()` in `risk.rs` - Add `quantity` argument to `set_trade()` function in `MockDatabase` struct - Update `order()` function in `MockDatabase` to include `quantity` information - Update implementations for `ReadTransactionDB` and `ReadTradeDB` traits in `MockDatabase` with small changes.
- Add comprehensive test for `TradeCapitalNotAtRisk::calculate()` - Improvements to code efficiency and structure for better readability - Fixed minor bugs in file `capital_not_at_risk.rs` - Multiple file changes summarized for brevity in diff summary
- Add function to calculate total capital not at risk for an account and currency - Iterate over open trades for calculation - Improve inline documentation and remove commented out code in capital_not_at_risk.rs file
- Refactor and optimize test suite in worker_account.rs for improved readability and maintainability - Adjust MockDatabase functions to use Default trait and remove unused variables for consistency - Use MockDatabase::order in set_trade functions instead of Order::default for better accuracy - Use now parameter in Order function instead of declaring it again for improved efficiency
- Increase version numbers to `0.2.0` in various Cargo.toml files - Update dependencies across multiple projects to version `0.2.0` - Omitted large code changes in diff summary for readability
…for improved readability and code structure - Refactor `AccountCapitalAvailable::calculate` to use `match` instead of `if` statements. - Improve variable names in `AccountCapitalAvailable::calculate` for better readability. - Remove unused import statement in `trust-core/src/account_calculators/capital_available.rs`.
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.