brighter-trading/tests
rob d3bbb36dc2 Fix live trade P/L bugs, improve UI refresh, add balance toggle
Key fixes:
- Add price validation to detect/correct doubled filled_price from broker
- Emit position_closed socket event to refresh UI after closing positions
- Fix statistics not updating when positions are closed
- Filter out zero-size positions from display
- Add USD/USDT toggle for balance display (click to switch)

Trade system improvements:
- Refactor Trade class P/L calculation with realized/unrealized tracking
- Add settle() method for proper position closing
- Improve trade_filled() to use current filled qty for averaging
- Add fallback to exchange balances when broker balance unavailable

Paper broker enhancements:
- Add exchange-qualified price storage for multi-exchange support
- Add price_source tracking for positions
- Improve state persistence

Tests:
- Add comprehensive tests for trade P/L calculations
- Add tests for paper broker price source tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-12 12:15:56 -03:00
..
__pycache__ Updated project structure and staged modified files 2024-07-25 08:21:15 -03:00
BrighterTrading.db Updated project structure and staged modified files 2024-07-25 08:21:15 -03:00
Brng.db Updated project structure and staged modified files 2024-07-25 08:21:15 -03:00
__init__.py Classes implemented in python and javascript. UML class diagram. Rough sequence uml. TODO: local file getting dirty from refresh. Signals implemented. Strategies implemented. Trades implemented but still needs some testing. 2023-02-17 22:47:13 -04:00
config.yml Many improvements. 2023-05-14 17:33:13 -03:00
conftest.py Phase 0: Stabilize baseline 2026-02-28 16:44:11 -04:00
test_BrighterTrades.py Add exchange validation, fix indicators bug, and improve balance display 2026-03-08 19:41:41 -03:00
test_DataCache.py Fix backtest data source and chart view detection bugs 2026-03-06 00:05:31 -04:00
test_Exchange.py Fix KuCoin balance fetching and add balance refresh functionality 2026-03-06 06:10:31 -04:00
test_Users.py Fix backtest data source and chart view detection bugs 2026-03-06 00:05:31 -04:00
test_app.py Fix backtest data source and chart view detection bugs 2026-03-06 00:05:31 -04:00
test_backtest_determinism.py Fix high-severity issues identified by Codex 2026-02-28 17:23:58 -04:00
test_brokers.py Fix live trade P/L bugs, improve UI refresh, add balance toggle 2026-03-12 12:15:56 -03:00
test_candles.py Fix backtest data source and chart view detection bugs 2026-03-06 00:05:31 -04:00
test_database.py Fix backtest data source and chart view detection bugs 2026-03-06 00:05:31 -04:00
test_edm_client.py Integrate EDM for candle data and improve UI dialogs 2026-03-04 11:42:06 -04:00
test_exchange_validation.py Add exchange validation, fix indicators bug, and improve balance display 2026-03-08 19:41:41 -03:00
test_exchangeinterface.py Fix backtest data source and chart view detection bugs 2026-03-06 00:05:31 -04:00
test_execution_loop.py Implement execution loop, paper persistence, and CI pipeline 2026-02-28 19:48:50 -04:00
test_indicators.py Phase 0: Stabilize baseline 2026-02-28 16:44:11 -04:00
test_live_broker.py Live trading infrastructure functional on testnet 2026-03-01 15:23:34 -04:00
test_live_exchange_integration.py Fix backtest data source and chart view detection bugs 2026-03-06 00:05:31 -04:00
test_live_integration.py Live trading infrastructure functional on testnet 2026-03-01 15:23:34 -04:00
test_live_strategy_instance.py Live trading infrastructure functional on testnet 2026-03-01 15:23:34 -04:00
test_paper_persistence.py Implement execution loop, paper persistence, and CI pipeline 2026-02-28 19:48:50 -04:00
test_paper_trading.py Phase 4: Paper trading implementation 2026-02-28 17:07:34 -04:00
test_shared_utilities.py Fix backtest data source and chart view detection bugs 2026-03-06 00:05:31 -04:00
test_strategy_execution.py Add Bitcoin wallet system with configurable strategy fees 2026-03-09 12:45:25 -03:00
test_strategy_generation.py Fix backtest data source and chart view detection bugs 2026-03-06 00:05:31 -04:00
test_trade.py Fix live trade P/L bugs, improve UI refresh, add balance toggle 2026-03-12 12:15:56 -03:00
test_trade2.py Fix live trade P/L bugs, improve UI refresh, add balance toggle 2026-03-12 12:15:56 -03:00
test_wallet.py Add Bitcoin wallet system with configurable strategy fees 2026-03-09 12:45:25 -03:00