Developers

Fanta-Trade API

Connect your program or bot to your virtual portfolio: buy and sell, place orders and stop losses, read your portfolio and moves. Same game rules, no real money.

1. Create a key

Sign in and go to Profile › API: name the key and copy it right away, because it is shown only once. You can have up to 3 and revoke them at any time.

2. Authentication

Send the key with every request in the Authorization header (or X-API-Key). Responses are JSON: data in «data», errors in «error» with a code and a message.

curl -H "Authorization: Bearer ft_la_tua_chiave" https://www.fanta-trade.eu/api/v1/account

Base URL: https://www.fanta-trade.eu/api/v1 · amounts and prices in euro, dates in ISO 8601 format

3. Endpoints

GET /api/v1/account

Your account: cash, invested value, total value, return since the start, number of positions and pending orders.

Example response
{"data":{"id":42,"name":"Marco Rossi","currency":"EUR","cash":22226.49,"invested":77870.2,"total":100096.69,"performance_pct":0.1,"positions":8,"open_orders":2,"starting_capital":100000.0}}

GET /api/v1/portfolio

Open positions with quantity, average cost, latest price, value, gain or loss and portfolio weight.

Example response
{"data":{"currency":"EUR","cash":22226.49,"total":100096.69,"positions":[{"symbol":"ENI.MI","name":"Eni","quantity":400.0,"avg_price":15.12,"price":15.48,"currency":"EUR","value":6192.0,"pl":144.0,"pl_pct":2.38,"weight_pct":6.19}]}}

GET /api/v1/transactions?limit=50&offset=0

Your moves, most recent first (up to 100 per request).

Example response
{"data":{"total":37,"limit":50,"offset":0,"items":[{"id":901,"date":"2026-10-14T10:02:11+02:00","symbol":"ENI.MI","name":"Eni","side":"buy","quantity":100.0,"price":15.48,"currency":"EUR","amount":1548.0,"realized_pl":null,"cash_after":22226.49}]}}

POST /api/v1/trades

Buy or sell at the current price. Fields: symbol (Yahoo format, e.g. ENI.MI, AAPL), side (buy or sell), quantity.

curl -X POST -H "Authorization: Bearer ft_la_tua_chiave" -H "Content-Type: application/json" \
  -d '{"symbol":"ENI.MI","side":"buy","quantity":100}' https://www.fanta-trade.eu/api/v1/trades
Example response
{"data":{"message":"…","transaction":{"id":902,"symbol":"ENI.MI","side":"buy","quantity":100.0,"price":15.48,"amount":1548.0}}}

GET /api/v1/orders

Pending orders. type is buy_limit (buy if it falls), buy_stop (buy if it rises), stop_loss (sell if it falls) or take_profit (sell if it rises).

Example response
{"data":[{"id":55,"symbol":"ENI.MI","side":"sell","type":"stop_loss","quantity":100.0,"price":14.5,"currency":"EUR","status":"open","created_at":"…","expires_at":"…"}]}

POST /api/v1/orders

Places a «buy at / sell at» order: it executes when the price reaches price (in euro). A sell below the current price is a stop loss, above it a take profit. expiry: 1w, 1m (default) or 3m.

curl -X POST -H "Authorization: Bearer ft_la_tua_chiave" -H "Content-Type: application/json" \
  -d '{"symbol":"ENI.MI","side":"sell","quantity":100,"price":14.50,"expiry":"1m"}' https://www.fanta-trade.eu/api/v1/orders
Example response
{"data":{"id":56,"symbol":"ENI.MI","side":"sell","type":"stop_loss","quantity":100.0,"price":14.5,"status":"open"}}

DELETE /api/v1/orders/{id}

Cancels a pending order.

curl -X DELETE -H "Authorization: Bearer ft_la_tua_chiave" https://www.fanta-trade.eu/api/v1/orders/56
Example response
{"data":{"id":56,"status":"cancelled"}}

4. Errors

HTTPCodeWhen
400invalid_symbol · invalid_side · invalid_quantity · invalid_priceMissing or invalid fields.
401unauthorizedMissing, wrong or revoked key.
404not_foundUnknown endpoint, or order not found or already closed.
422trade_rejected · order_rejectedThe operation breaks the game rules (cash, limits, price unavailable): the message explains why.
429rate_limited · trade_limit · symbol_limitOne of the limits below was exceeded. The Retry-After header tells how many seconds to wait.

5. Limits and fair use

  • 30 requests per minute and 1,000 per day per key (the X-RateLimit-* headers show how many are left).
  • 50 trades and orders per day, including rejected ones.
  • At most 10 different instruments per day that you don't already hold on which to buy, sell or place orders; you can trade freely on the instruments you hold.
  • All game rules apply: available cash, maximum weight of an instrument in the portfolio, daily volume limit and at most 50 pending orders.
  • The API only gives access to your own account. It provides no quotes, searches or price history: prices appear only for instruments you hold and are the latest stored by Fanta-Trade, which may be delayed.
  • Using the API to collect or redistribute market data is forbidden: in case of abuse keys are revoked and the account may be suspended.