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

fix: sync between Alpaca orders and trust orders #19

Merged
merged 14 commits into from
Jun 11, 2023

Conversation

matiasvillaverde
Copy link
Owner

  • refactor: Refactor trust-broker order mapper.
  • refactor: Optimize order mapping method with any() method.
  • feat: Refactor order mapping function for better testing and accuracy
  • refactor: Refactor order mapping logic in trust broker.
  • refactor: Refactor order mapping using extend and filter_map
  • refactor: Refactor order mapping into separate module
  • refactor: Refactor key management for async Alpaca trading.
  • refactor: Refactor trade syncing to improve efficiency.
  • refactor: Refactor sync module for increased readability and testing capabilities
  • refactor: Refactor Alpaca trade submission and synchronization.
  • refactor: Refactor sync_trade module for better organization.
  • refactor: Refactor trade logging and dependencies
  • refactor: Refactor and simplify trade submission and synchronization flow.
  • fix: Fix handling of leg prices in submit_trade function

- Refactor order mapping logic in trust-broker/src/order_mapper.rs
- Improve code readability and maintainability
- Optimize performance for large order sets
- Fix minor bugs and inconsistencies in the code
- Update documentation in affected files
Refactor `map_trade_status()` and remove unused for loop in `order_mapper.rs`

- Use `any()` instead of for loops and `clone()` method in `map_trade_status()`
- Remove unused for loop in `map_trade_status()`
- Ensure matching order IDs are checked before modifying orders
- Correctly map numeric values for `filled_quantity` and `average_fill_price`
- Map order status from Alpaca API status
- Add tests for key mapping functions
- Add `map_orders` function to convert `AlpacaOrder` to `Vec<Order>`
- Refactor order mapping functionality in trust-broker/src/order_mapper.rs
- Improve code readability and maintainability
- Update variable and function names to be more descriptive and consistent
- Fix edge case bugs related to order status handling
- Increase test coverage for the order mapper module
- Refactor mapping code in order_mapper.rs for target and stop orders
- Replace for loop and if-else statements with extend and filter_map methods
- Optimize code for enhanced performance and readability
- Refactor `map_orders` into a separate `order_mapper` module
- Update `sync_trade` to use new `order_mapper` module
- Add `map_trade_status` to `order_mapper`
- Remove `TODO` and `tests` modules
- No changes to the actual code logic
- Add `read_api_key` function to `keys` module for reading API keys
- Implement `AsyncBroker` trait for using async functions
- Remove unused `apca::ApiInfo` import
- Move `read_api_key` function to `keys` module
- Turn `submit` function into an async function
- Clean up unnecessary assertions in functions
- Add `find_entry` function for finding the entry order of a trade by id
- Refactor `sync_trade` to use `find_entry`
- Include unit tests for `find_entry`
- Other minor changes and improvements in `sync.rs`
…capabilities

Refactor `find_entry` function and improve test coverage

- Use `ok_or_else` in place of match for better error handling
- Remove unused import to clean up code
- Add 2 unit tests to improve coverage of `find_entry` function
- Copy `trust-broker/src/lib.rs` to `trust-broker/src/submit_trade.rs` with 78% similarity
- Remove `Broker` trait implementation and `submit_trade` function from `AlpacaBroker`
- Add `submit_sync` and `submit` functions to submit trades synchronously and asynchronously respectively
- Remove `sync_trade`, `setup_keys`, `read_keys`, and `delete_keys` functions from `AlpacaBroker`
- Add functions to `sync.rs` for syncing with Alpaca and finding entry orders from closed orders.
- Refactor code for better naming consistency and clarity
- Remove unnecessary assertion check in sync_trade function
- Modularize Client initialization for easier maintenance
- Add API credentials retrieval function in sync_trade.rs
- Verify trade is for correct account in sync function
- Wrap sync_trade in a Runtime for non-blocking call
- Return updated Status and Vec<Order> from sync function
- Remove unnecessary pub keyword from sync_trade
- Add comment indicating excluded get_closed_orders function.
- Add `serde_json` dependency to project for JSON logging
- Refactor code to use entry order's ID for `client_order_id`
- Simplify and remove unused code in `LogView`
- Adjust error message in `find_entry` function for clarity
- Add and update tests for relevant functions
…flow.

- Refactor code in submit_trade.rs and sync_trade.rs
- Improve order object returned by default function
- Simplify tests by removing unnecessary orders
- Update id assignment to entry_order object
- Add assertion to test for correct error message in test_find_entry_does_not_exist
- Update `submit_trade.rs`
- Fix issue with incorrect handling of leg prices in `extract_ids` function
- Improve functionality and ensure correct pricing in all trade submissions
@matiasvillaverde matiasvillaverde merged commit 186892b into main Jun 11, 2023
@matiasvillaverde matiasvillaverde deleted the fix/alpaca-orders branch June 11, 2023 17:27
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