Welcome to the Trading Hackathon
Enter your team code to connect:
Register your team to participate:
✓ Registration Successful!
Your team has been registered.
Team Name:
Team Code:
⚠️ Save your team code! You'll need it to login.
Data & API Access
Download historical market data to train your models.
Instrument Volatility
| Symbol | Volatility (Training) |
|---|
API Client Examples
import requests
import websocket # pip install websocket-client
import threading
import json
BASE_URL = "https://hkt25.codeontime.fr"
WS_URL = "wss://hkt25.codeontime.fr/ws/simulation"
TEAM_CODE = "TEST"
HEADERS = {"X-Team-Code": TEAM_CODE}
def on_message(ws, message):
data = json.loads(message)
if data['type'] == 'TICK':
print(f"Date: {data['date']}")
print(f"Cash: {data['portfolio']['cash']}")
print(f"Margin Deposit: {data['portfolio']['marginDeposit']}")
print(f"Valuation: {data['valuation']}")
print(f"Positions: {data['portfolio']['positions']}")
# Get Market Data for MERI
for item in data['marketData']:
if item['symbol'] == 'MERI':
print(f"MERI - Close: {item['close']}, Volume: {item['volume']}")
elif data['type'] == 'FINISHED':
score = data['score']
print(f"Final Score: {score['correctedPerformance']:.2f}%")
print(f"Return: {score['totalReturn']:.2f}%, Risk Penalty: {score['riskPenalty']:.2f}%")
# Start WebSocket listener
ws = websocket.WebSocketApp(f"{WS_URL}?code={TEAM_CODE}", on_message=on_message)
threading.Thread(target=ws.run_forever).start()
# Start Simulation
requests.post(f"{BASE_URL}/api/simulation/start", headers=HEADERS)
# Place Order
order = {"symbol": "MERI", "action": "BUY", "quantity": 10}
requests.post(f"{BASE_URL}/api/order", json=order, headers=HEADERS)
const BASE_URL = "https://hkt25.codeontime.fr";
const WS_URL = "wss://hkt25.codeontime.fr/ws/simulation";
const TEAM_CODE = "TEST";
const HEADERS = {"X-Team-Code": TEAM_CODE, "Content-Type": "application/json"};
// Connect to WebSocket
const socket = new WebSocket(`${WS_URL}?code=${TEAM_CODE}`);
socket.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'TICK') {
console.log("Date:", data.date);
console.log("Cash:", data.portfolio.cash);
console.log("Margin Deposit:", data.portfolio.marginDeposit);
console.log("Valuation:", data.valuation);
console.log("Positions:", data.portfolio.positions);
// Get Market Data for MERI
const meri = data.marketData.find(m => m.symbol === 'MERI');
if (meri) {
console.log(`MERI - Close: ${meri.close}, Volume: ${meri.volume}`);
}
} else if (data.type === 'FINISHED') {
const score = data.score;
console.log(`Final Score: ${score.correctedPerformance.toFixed(2)}%`);
console.log(`Return: ${score.totalReturn.toFixed(2)}%, Risk Penalty: ${score.riskPenalty.toFixed(2)}%`);
}
};
// Start Simulation
fetch(`${BASE_URL}/api/simulation/start`, { method: "POST", headers: HEADERS });
// Place Order
const order = { symbol: "MERI", action: "BUY", quantity: 10 };
fetch(`${BASE_URL}/api/order`, {
method: "POST",
headers: HEADERS,
body: JSON.stringify(order)
});
HttpClient client = HttpClient.newHttpClient();
String baseUrl = "https://hkt25.codeontime.fr";
String wsUrl = "wss://hkt25.codeontime.fr/ws/simulation";
String teamCode = "TEST";
// Connect to WebSocket
WebSocket ws = client.newWebSocketBuilder()
.buildAsync(URI.create(wsUrl + "?code=" + teamCode), new WebSocket.Listener() {
@Override
public CompletionStage> onText(WebSocket webSocket, CharSequence data, boolean last) {
System.out.println("Received JSON: " + data);
// Parse JSON to get portfolio:
// double cash = jsonObject.get("portfolio").get("cash").asDouble();
// double marginDeposit = jsonObject.get("portfolio").get("marginDeposit").asDouble();
// double valuation = jsonObject.get("valuation").asDouble();
// Parse market data for MERI:
// JsonNode marketData = jsonObject.get("marketData");
// for (JsonNode item : marketData) {
// if ("MERI".equals(item.get("symbol").asText())) {
// double close = item.get("close").asDouble();
// long volume = item.get("volume").asLong();
// System.out.println("MERI: " + close + " / " + volume);
// }
// }
// On FINISHED event, get the score:
// if ("FINISHED".equals(jsonObject.get("type").asText())) {
// JsonNode score = jsonObject.get("score");
// double finalScore = score.get("correctedPerformance").asDouble();
// double totalReturn = score.get("totalReturn").asDouble();
// System.out.println("Final Score: " + finalScore + "%");
// }
return WebSocket.Listener.super.onText(webSocket, data, last);
}
}).join();
// Start Simulation
HttpRequest startReq = HttpRequest.newBuilder()
.uri(URI.create(baseUrl + "/api/simulation/start"))
.header("X-Team-Code", teamCode)
.POST(HttpRequest.BodyPublishers.noBody())
.build();
client.send(startReq, HttpResponse.BodyHandlers.ofString());
// Place Order
String json = "{\"symbol\":\"MERI\",\"action\":\"BUY\",\"quantity\":10}";
HttpRequest orderReq = HttpRequest.newBuilder()
.uri(URI.create(baseUrl + "/api/order"))
.header("X-Team-Code", teamCode)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
client.send(orderReq, HttpResponse.BodyHandlers.ofString());
Controls
Place Order
Portfolio Status
Date: -
Cash: -
Valuation: -
Positions
Performance Score
Current Score
-
Return
-
Downside Risk
-
⚠️ Provisional - calculated on available data
🏆 Final Score
-
Initial Capital:
-
Final Valuation:
-
Total Return:
-
Downside Volatility:
-
Risk Penalty:
-
Corrected Performance:
-
Score will be calculated during simulation
Score Formula
Performance = Return% - 0.5 × Downside σ%
- High return + low risk = Best score
- Only downside volatility is penalized
- Upside volatility is rewarded