// G-Exchange minimal Node client. Demo: node client.js const BASE = "https://gexchange.website"; const get = async (p) => (await fetch(BASE + p)).json(); const post = async (p, d) => (await fetch(BASE + p, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(d) })).json(); (async () => { const ix = await get("/v1/futures/index"); console.log("index:", ix.index, "spread:", ix.spread_pct); const u = "jsclient_" + Math.floor(Math.random() * 900000 + 100000); const acct = await post("/v1/futures/register", { username: u, password: "demo1234" }); console.log("account:", acct.username, "balance:", acct.balance_usdc); const order = await post("/v1/futures/trade", { token: acct.token, side: "long", size_usdc: 50, leverage: 20 }); console.log("order:", order); })();