44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
import os
|
|
import sys
|
|
from dotenv import load_dotenv
|
|
|
|
# Add src to path
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), '../src'))
|
|
|
|
from strategies.hk_strategy import HK_Strategy
|
|
|
|
def test_hk_flow():
|
|
load_dotenv()
|
|
token = os.getenv("IFIND_REFRESH_TOKEN")
|
|
if not token:
|
|
print("Missing IFIND_REFRESH_TOKEN in .env")
|
|
return
|
|
|
|
# Use Tencent (00700.HK) as a test case
|
|
symbol = "00700"
|
|
print(f"--- Testing HK Flow for {symbol} ---")
|
|
|
|
strategy = HK_Strategy(symbol, token)
|
|
|
|
print("Step 1: Fetching data...")
|
|
strategy.fetch_data()
|
|
|
|
print("Step 2: Analyzing data...")
|
|
strategy.analyze_data()
|
|
|
|
# Check the latest row of analysis
|
|
if strategy.analysis_result is not None and not strategy.analysis_result.empty:
|
|
latest = strategy.analysis_result.iloc[0]
|
|
print(f"\nLatest Analysis Results:")
|
|
print(f"PE: {latest.get('PE')}")
|
|
print(f"PB: {latest.get('PB')}")
|
|
print(f"DividendYield: {latest.get('DividendYield')}")
|
|
|
|
print("\nStep 3: Generating report...")
|
|
strategy.generate_report()
|
|
|
|
print("--- Test Complete ---")
|
|
|
|
if __name__ == "__main__":
|
|
test_hk_flow()
|