Sandbox API
REST API для работы с песочницей ALPHA. Все запросы требуют заголовок X-API-Key. Каждый трейдер может открыть до 5 аккаунтов песочницы.
AUTH
АутентификацияВсе запросы требуют заголовок X-API-Key с вашим API ключом
Headers
X-API-Key: your_api_key_here
POST
/api/v1/accountsОткрытие нового счёта песочницы (макс. 5 на трейдера)
Response
{
"id": "uuid",
"virtual_account_id": "sandbox_id",
"created_at": "2024-01-20T10:30:00Z"
}DELETE
/api/v1/accounts/{account_id}Закрытие счёта песочницы
Response
204 No Content
GET
/api/v1/accountsПолучение списка всех счетов трейдера
Response
{
"accounts": [
{
"id": "uuid",
"virtual_account_id": "sandbox_id",
"created_at": "2024-01-20T10:30:00Z"
}
],
"count": 1
}GET
/api/v1/instruments/sharesПолучение списка всех доступных акций
Response
{
"shares": [
{
"ticker": "SBER",
"name": "Сбер Банк",
"lot": 10,
"currency": "rub",
"exchange": "ALPHA"
}
],
"count": 100
}GET
/api/v1/instruments/shares/searchПоиск акций по тикеру или названию
Query params
query: string (required) - поисковый запрос
GET
/api/v1/instruments/shares/{ticker}Получение информации об акции по тикеру
Response
{
"ticker": "SBER",
"name": "Сбер Банк",
"lot": 10,
"currency": "rub",
"exchange": "ALPHA"
}POST
/api/v1/accounts/{account_id}/ordersРазмещение ордера на покупку/продажу
Request
{
"ticker": "SBER",
"quantity": 10,
"direction": "buy" | "sell",
"order_type": "market" | "limit",
"price": 280.00 // для limit
}Response
{
"order_id": "ord_123abc",
"ticker": "SBER",
"direction": "buy",
"order_type": "market",
"quantity": 10,
"status": "fill",
"created_at": "2024-01-20T10:30:00Z"
}DELETE
/api/v1/accounts/{account_id}/orders/{order_id}Отмена активного ордера
Response
204 No Content
GET
/api/v1/accounts/{account_id}/ordersПолучение списка активных ордеров
Response
{
"orders": [...],
"count": 5
}GET
/api/v1/accounts/{account_id}/orders/{order_id}Получение статуса ордера
Response
{
"order_id": "ord_123",
"status": "fill",
"lots_requested": 10,
"lots_executed": 10,
"executed_order_price": 280.50,
"currency": "rub"
}GET
/api/v1/accounts/{account_id}/orders/{order_id}/tradesПолучение сделок по ордеру
Response
{
"trades": [
{
"trade_id": "t_123",
"order_id": "ord_123",
"ticker": "SBER",
"quantity": 10,
"price": 280.50,
"datetime": "2024-01-20T10:30:00Z"
}
],
"count": 1
}GET
/api/v1/accounts/{account_id}/portfolioПолучение портфеля счёта
Response
{
"total_amount": 1000000.00,
"expected_yield": 470.00,
"positions": [
{
"ticker": "SBER",
"quantity": 100,
"average_price": 280.50,
"current_price": 285.20,
"expected_yield": 470.00,
"currency": "rub"
}
]
}GET
/api/v1/accounts/{account_id}/positionsПолучение позиций счёта
Response
{
"positions": [
{
"ticker": "SBER",
"quantity": 100
}
],
"count": 1
}GET
/api/v1/accounts/{account_id}/operationsПолучение операций за период
Query params
from: datetime (required) - начало периода to: datetime (required) - конец периода
Response
{
"operations": [
{
"id": "op_123",
"ticker": "SBER",
"type": "buy",
"quantity": 10,
"price": 280.50,
"payment": -2805.00,
"currency": "rub",
"datetime": "2024-01-20T10:30:00Z",
"state": "executed"
}
],
"count": 1
}