07.11.2025
pairs_trading/configuration <---- directory for config
equity_lg.cfg <-------- copy of equity.cfg
How to run a Program: TRIANGLEsquare ----> triangle EQUITY backtest
Results are in  > results (timestamp table for all runs)
table "...timestamp... .pt_backtest_results.equity.db"
going to table  using sqlite
> sqlite3 '/home/coder/results/20250721_175750.pt_backtest_results.equity.db'

sqlite> .databases
main: /home/coder/results/20250717_180122.pt_backtest_results.equity.db r/w
sqlite> .tables
config                 outstanding_positions  pt_bt_results   

sqlite> PRAGMA table_info('pt_bt_results');
0|date|DATE|0||0
1|pair|TEXT|0||0
2|symbol|TEXT|0||0
3|open_time|DATETIME|0||0
4|open_side|TEXT|0||0
5|open_price|REAL|0||0
6|open_quantity|INTEGER|0||0
7|open_disequilibrium|REAL|0||0
8|close_time|DATETIME|0||0
9|close_side|TEXT|0||0
10|close_price|REAL|0||0
11|close_quantity|INTEGER|0||0
12|close_disequilibrium|REAL|0||0
13|symbol_return|REAL|0||0
14|pair_return|REAL|0||0

select count(*) as cnt from pt_bt_results;
8

select * from pt_bt_results;

select 
date, close_time, pair, symbol, symbol_return, pair_return
from pt_bt_results ;

select date, sum(symbol_return) as daily_return 
from pt_bt_results where date = '2025-06-18' group by date;

.quit

sqlite3 '/home/coder/results/20250717_172435.pt_backtest_results.equity.db'

sqlite> select date, sum(symbol_return) as daily_return 
from pt_bt_results group by date;

2025-06-02|1.29845390060828
...
2025-06-18|-43.5084977104115 <========== ????? ==========>
2025-06-20|11.8605547517183


select 
date, close_time, pair, symbol, symbol_return, pair_return
from pt_bt_results ;

select date, close_time, pair, symbol, symbol_return, pair_return
from pt_bt_results where date = '2025-06-18';


./scripts/load_equity_pair_intraday.sh -A NVDA -B QQQ -d 20250701  -T ./intraday_md

to inspect exactly what sources, formats, and processing steps you can open the script with:
head -n 50 ./scripts/load_equity_pair_intraday.sh



✓ Data file found: /home/coder/pairs_trading/data/crypto/20250605.mktdata.ohlcv.db

sqlite3 '/home/coder/results/20250722_201930.pt_backtest_results.crypto.db'

sqlite3 '/home/coder/results/xxxxxxxx_yyyyyy.pt_backtest_results.pseudo.db'

11111111
=== At your terminal, run these commands:
sqlite3 '/home/coder/results/20250722_201930.pt_backtest_results.crypto.db'
=== Then inside the SQLite prompt:
.mode csv
.headers on
.output results_20250722.csv
SELECT * FROM pt_bt_results;
.output stdout
.quit

cd /home/coder/

# === mode csv formats output as CSV
# === headers on includes column names
# === output my_table.csv directs output to that file
# === Run your SELECT query, then revert output
# === Open my_table.csv in Excel directly

# ======== Using scp (Secure Copy)
# === On your local machine, open a terminal and run:
scp cvtt@953f6e8df266:/home/coder/results_20250722.csv ~/Downloads/


# ===== convert cvs pandas dataframe ====== -->
import pandas as pd
# Replace with the actual path to your CSV file
file_path = '/home/coder/results_20250722.csv'
# Read the CSV file into a DataFrame
df = pd.read_csv(file_path)
# Show the first few rows
print(df.head())






