import pandas as pd

df = pd.read_csv('cyb50_optimized_trades_2017-06-01_2026-01-19.csv')

print('资金连续性检查:')
print('='*80)

for i in range(min(10, len(df)-1)):
    prev_final = df.iloc[i]['平仓时总资金']
    curr_initial = df.iloc[i+1]['开仓时总资金']
    diff = abs(prev_final - curr_initial)
    status = 'ERROR' if diff > 100 else 'OK'
    print(f'{status} Trade#{i+1}->{i+2}: Prev Final {prev_final:,.0f} -> Curr Initial {curr_initial:,.0f} (Diff: {diff:,.0f})')

print(f'\nSummary:')
total_issues = sum(abs(df.iloc[i]['平仓时总资金'] - df.iloc[i+1]['开仓时总资金']) > 100 for i in range(len(df)-1))
print(f'Inconsistent trades: {total_issues}/{len(df)-1}')