/api/submit_order |
POST | Отправить рыночную заявку Исполняется по текущей рыночной цене |
|
/api/trades |
GET | Получить свои сделки за сегодня | |
/api/positions |
GET | Получить свои открытые позиции | |
/api/bots |
GET | Получить список своих ботов |
Для использования API нужно получить токен:
Используй токен для отправки заявок
curl -X POST "https://arenago.ru/api/submit_order" \
-H "Content-Type: application/json" \
-H "Authorization: your_token" \
-d '{
"direction": "B",
"secid": "SBER",
"quantity": 10,
"bot": "MyTradingBot"
}'
import requests
url = "https://arenago.ru/api/submit_order"
payload = {
"direction": "B", # "B" for Buy, "S" for Sell
"secid": "SBER", # Stock ticker
"quantity": 10, # Number of shares
"bot": "MyTradingBot" # Your bot's name
}
headers = {
"Content-Type": "application/json",
"Authorization": "your_token"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
{
"success": true,
"message": "Trade submitted successfully",
"order_value": 1269.4,
"price": 126.94,
"quantity": 1,
"remaining_cash": 429371.46
}
{"error": "ERROR: MARKET CLOSED"} - Торговля: 00:00 - 23:40 MSK
{"error": "ERROR: NOT VALID SECID"} - Инструмент недоступен
{"error": "ERROR: INSUFFICIENT CASH"} - Недостаточно средств
{"error": "ERROR: BOT {bot_name} HAS REACHED DAILY TRADE LIMIT"} - Лимит 1000 сделок в день
import requests
url = "https://arenago.ru/api/trades"
headers = {"Authorization": "your_token"}
response = requests.get(url, headers=headers)
trades = response.json()
for trade in trades:
print(f"{trade['tradedate']} {trade['tradetime']}: "
f"{trade['direction']} {trade['secid']} "
f"x{trade['quantity']} @ {trade['price']} "
f"by {trade['bot']}")
import requests
url = "https://arenago.ru/api/positions"
headers = {"Authorization": "your_token"}
response = requests.get(url, headers=headers)
positions = response.json()
for pos in positions:
print(f"{pos['secid']}: {pos['position']} lots "
f"@ avg {pos['average_price']} "
f"(bot: {pos['bot']})")
import requests
url = "https://arenago.ru/api/bots"
headers = {"Authorization": "your_token"}
response = requests.get(url, headers=headers)
bots = response.json()
for bot in bots:
print(f"Bot: {bot['name']}")
print(f" Cash: {bot['cash_balance']:,.2f} RUB")
Для торговли доступны 36 ценных бумаг: