<?php

header("Content-Type: application/json");

require_once __DIR__ . "/../config.php";

$sql = "
    SELECT 
        ticket,
        symbol,
        type,
        volume,
        open_price,
        profit,
        sl,
        tp
    FROM fxh_positions_live
    ORDER BY id DESC
";

$q = $conn->query($sql);

$rows = [];

if($q) {
    while($row = $q->fetch_assoc()){
        $rows[] = $row;
    }
}

echo json_encode($rows);
