Skip to content
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

feat: cancel trade if it is open in the market or funded #26

Merged
merged 18 commits into from
Jun 21, 2023

Conversation

matiasvillaverde
Copy link
Owner

  • feat: Refactor trade commands for manual cancellation and renaming.
  • Refactor trade closing logic across multiple files
  • feat: Add trade-related functions and improve validators
  • feat: Add support for new trade statuses and fee payment in worker
  • feat: Add trade functionality and logging updates
  • refactor: Refactor trade handling and order mapping.
  • feat: Add sync_manually_closed_trade method to Broker trait
  • Refactor and optimize trust broker synchronization.
  • refactor: Refactor AlpacaBroker to use order_mapper module.
  • refactor: Refactor trade status updates and trade worker methods
  • refactor: Remove obsolete sync_manually_closed_trade method from Broker trait.
  • test: Improve code quality and maintenance.
  • feat: Improve trade order display and search in dialogs
  • Add ability to cancel funded trades and update UI.
  • feat: Implement new methods and modify existing ones in trust-core.
  • refactor: Improve TradeWorker functions and database fields.
  • feat: Refactor and add functions to trust-core library.

- Renamed trade methods in `trade_command.rs` to `manually_fill`, `manually_stop`, and `manually_target`
- Added `manually-close` subcommand for manual trade closure
- Implemented `cancel_trade` method (unimplemented) in `TrustFacade` in `lib.rs`
- Added `trade_cancel_dialog` module in `dialogs.rs` and implemented `CancelDialogBuilder` for trade cancelation
- Created new file `trade_cancel_dialog.rs` and implemented trade cancelation logic
- Renamed trade methods in `main.rs` to match changes in `trade_command.rs`
- Changed trade creation commands to begin with `manually-` and added `manually-cancel` trade cancellation command in `dispatcher.rs`
- Add `close_trade` function to `Broker` trait in `trust-model/src/broker.rs`
- Refactor `create_transaction` function in `trust-core/src/lib.rs` to use `TransactionWorker`
- Implement trade closing logic in new `close_trade` function in `trust-core/src/lib.rs`
- Define `close` and supporting functions in new `close_trade.rs` file in `trust-broker/src/`
- Add `close_trade` method to `AlpacaBroker` struct in `trust-broker/src/lib.rs`
- Add public `map_order` function to `order_mapper.rs` file in `trust-broker/src/order_mapper.rs`
- Make `side` function in `trust-broker/src/submit_trade.rs` public
- Update `cancel_trade` to `close_trade` and improve error handling in `trust-cli/src/dialogs/trade_cancel_dialog.rs`
- Add `close_trade` function to `MockBroker` struct and `Broker` trait in `trust-cli/tests/integration_test_account.rs` and `trust-cli/tests/integration_test_trade.rs` respectively.
- Add trading vehicle search and trade sync/close functions to trust-core library
- Enhance several trust-core functions to return trade and account overviews
- Refactor trade cancel dialog to improve readability and remove unused code
- Update rule validator to add new validation functions and tests
- Add new tests to integration_test_trade for trade_target_filled and trade_stop_filled
- Assert filled statuses and account overview in new trade tests
- Update TradeWorker to support closed stop loss and closed target statuses
- Refactor TradeWorker functions for fee payment support and timestamp recording
- Refactor trade_cancel_dialog to include `BrokerLog` in `CancelDialogBuilderResult`
- Display broker log and error message during trade search and cancellation
- Add `stop_price` and `entry_price` params to `calculate_maximum_quantity()`
- Update trade-related functions to record order submission, sync with broker, and update order/trade/account status
- Change `close_trade()` to submit market order and return broker log
- Rename `TransactionCategory` to `OrderCategory` in `Order` struct
- Refactor `trade.target` with `OrderStatus` and `OrderCategory`
- Add `create_trading_vehicle` and `search_all_overviews` methods in `lib.rs`
- Change return type of `close_trade` method in `lib.rs`
- Cancel target order before submitting market order in `close_trade.rs`
- Remove unnecessary code and improve error messages in `dialogs/trade_cancel_dialog.rs`
- Update `order_mapper.rs` with `map_close_order` function and `OrderCategory` dependency
- Improve function parameters ordering in `WorkerOrder` in `worker_order.rs`
- Implement new method `sync_manually_closed_trade` for `AlpacaBroker` and `MockBroker`
- Pass new argument to `sync_trade` method in `AlpacaBroker`
- Add `sync_manually_closed_trade` method to `Broker` trait in `trust-model/src/broker.rs`
- Allow for manually syncing closed trades with broker in `sync_manually_closed_trade`
- Refactor and optimize code in sync_trade.rs file
- Improve efficiency of data synchronization methods
- Update error handling for better user feedback
- Remove obsolete and duplicate code
- Ensure compatibility with latest version of dependencies
- Use `order_mapper` module for `sync_trade` and `sync_manually_closed_trade` functions in `AlpacaBroker`
- Changes made to multiple files for increased efficiency and organization
- File diffs may not show all changes due to large code modifications
- Refactored trade status updates to use a single function across all files
- Created new function "update_trade_status" in WriteTradeDB trait to handle all trade status updates
- Renamed trade status update methods in various files for consistency
- Added new methods and refactored existing ones in trust-core/src/lib.rs for better trade management
- Added "close_trade" method to Broker trait in trust-model/src/broker.rs for manual trade closure.
…er trait.

- Remove obsolete `sync_manually_closed_trade` methods from `Broker` trait
- Updated `MockBroker` and `AlpacaBroker` implementations accordingly
- Simplify codebase by removing unnecessary function calls
- Improve code readability and maintainability
- Update integration test for trade function
- Remove unnecessary TODO comment
- Make minor code improvements in undisclosed files
- Add `OrderView` to display trade orders in `TradeSearchDialog`
- Display `entry`, `target`, and `stop` orders for each trade in `TradeSearchDialog`
- Refactor `TradeView::display_trades` to receive account name as argument
- Added search for trades with `Status::Canceled` in `trade_sync_dialog.rs`
- Improved error messages in `trade_sync_dialog.rs`
- Omitted some large changes in file diffs for brevity and readability.
- Add functionality to cancel funded trades in the CLI
- Implement validation and testing for cancelling trades based on their funding status
- Update various dialog builders and function signatures for better error handling
- Minor improvements and bug fixes for existing validation functions
- Add new cancel trade command to CLI and provide descriptions for existing trade commands
- Update method calls and printed messages for more accurate trade cancellation messaging
- Add new functions for cancelling funded trades and returning funds to the account
- Add new methods to `lib.rs` for creating and managing trades
- Rename and modify existing methods for better clarity
- Include new integration tests for canceling trades in the `trust-cli`
- Add new field to `OrderView` and make minor formatting changes
- Update `TradeWorker` to handle more cases and record timestamps for trades
- Change error message in `sync_trade.rs`
- Add new fields to `orders` table and improve error logging in `worker_order.rs`
- Remove unused imports and variables in `close_trade.rs`
- Add `println!` statement for trade status in `sync_trade` function
- Refactored transaction functions in trust-db-sqlite worker
- Added new functions to trust-core lib.rs file: `fund_trade`, `cancel_funded_trade`, and `target_acquired`
- Updated `sync_trade` function in trust-core to take an `account` parameter and removed `println!` statement
- Improved code cleanliness by removing unnecessary imports and variables
- Rename `MockBroker` parameter to `closed_order_fn` in integration test
- Modify `search_all_rules` to exclude `account_id` parameter in `trust-core`
- Add `DraftTrade` parameter to `create_trade` function in `trust-core`
- Update `transfer_payment_from` function to accept `&Trade` object in `trust-core`
- Rename `make_rule_inactive` to `update_rule_status` in `trust-core`
- Add `sync_trade` function to sync trades with broker in `trust-core`
- Add new trade steps in `trust-core`: `fund_trade`, `fill_trade`, `stop_trade`, `cancel_funded_trade`, and `target_acquired`
@matiasvillaverde matiasvillaverde merged commit 60089fa into main Jun 21, 2023
@matiasvillaverde matiasvillaverde deleted the feature/cancel-order branch June 21, 2023 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant