test_db_mark_price.py 734 B

123456789101112131415161718192021
  1. import sys
  2. import os
  3. from datetime import datetime
  4. # Adjust path if needed to import TradingStats
  5. sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
  6. from src.stats.trading_stats import TradingStats
  7. def print_open_positions_mark_prices():
  8. stats = TradingStats()
  9. open_positions = stats.get_open_positions()
  10. print(f"Found {len(open_positions)} open positions:")
  11. for pos in open_positions:
  12. symbol = pos.get('symbol', 'N/A')
  13. entry_price = pos.get('entry_price', 'N/A')
  14. mark_price = pos.get('mark_price', 'N/A')
  15. print(f"Symbol: {symbol}, Entry Price: {entry_price}, Mark Price: {mark_price}")
  16. if __name__ == "__main__":
  17. print_open_positions_mark_prices()