SDKs Disponibles
Proporcionamos ejemplos oficiales y librerias auxiliares para lenguajes populares:
Python
SDK completo con soporte async. Perfecto para estrategias de ML/AI.
JavaScript
Funciona en Node.js y navegadores. Ideal para herramientas web.
Comparacion Rapida
| Caracteristica | Python | JavaScript |
|---|
| Soporte Async | asyncio | async/await |
| Type Hints | Soportado | TypeScript |
| Analisis de Datos | pandas, numpy | Limitado |
| Librerias ML | sklearn, tensorflow | tensorflow.js |
| Actualizaciones Tiempo Real | Soportado | Soportado |
Instalacion
pip install requests pandas
# No requiere instalacion - usa fetch API
Uso Basico
Todos los SDKs siguen el mismo patron:
1. Inicializar con API Key
API_KEY = "tu_api_key"
BASE_URL = "https://api.innova-trading.com"
headers = {"Authorization": f"Bearer {API_KEY}"}
const API_KEY = "tu_api_key";
const BASE_URL = "https://api.innova-trading.com";
const headers = { Authorization: `Bearer ${API_KEY}` };
2. Obtener Datos de Mercado
import requests
response = requests.get(
f"{BASE_URL}/api/external/bars/EURUSD/60",
params={"limit": 100},
headers=headers
)
barras = response.json()["bars"]
const response = await fetch(
`${BASE_URL}/api/external/bars/EURUSD/60?limit=100`,
{ headers }
);
const { bars: barras } = await response.json();
3. Enviar Indicador
senal = {
"symbol": "EURUSD",
"timeframe": 60,
"indicator_name": "Mis Senales",
"points": [
{
"time": barras[-1]["time"],
"type": "low",
"price": 1.1725,
"label": "COMPRA",
"color": "#3b82f6",
"shape": "arrowUp",
"size": 2
}
]
}
response = requests.post(
f"{BASE_URL}/api/external/indicators/mis_senales",
json=senal,
headers=headers
)
print(response.json())
const senal = {
symbol: "EURUSD",
timeframe: 60,
indicator_name: "Mis Senales",
points: [
{
time: barras[barras.length - 1].time,
type: "low",
price: 1.1725,
label: "COMPRA",
color: "#3b82f6",
shape: "arrowUp",
size: 2
}
]
};
const response = await fetch(
`${BASE_URL}/api/external/indicators/mis_senales`,
{
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify(senal)
}
);
console.log(await response.json());
Manejo de Errores
Todos los SDKs deben manejar errores comunes:
| Codigo | Significado | Accion |
|---|
| 401 | API key invalida | Verifica tus credenciales |
| 403 | Simbolo no permitido | Solicita acceso al simbolo |
| 404 | Recurso no encontrado | Verifica la URL del endpoint |
| 429 | Limite de tasa | Espera y reintenta |
| 500 | Error del servidor | Reintenta con backoff |
try:
response = requests.post(url, json=data, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.HTTPError as e:
if e.response.status_code == 429:
time.sleep(60) # Esperar 1 minuto
return reintentar_solicitud()
raise
try {
const response = await fetch(url, options);
if (!response.ok) {
if (response.status === 429) {
await new Promise(r => setTimeout(r, 60000)); // Esperar 1 minuto
return reintentarSolicitud();
}
throw new Error(`HTTP ${response.status}`);
}
return await response.json();
} catch (error) {
console.error('Solicitud fallida:', error);
throw error;
}
SDKs de la Comunidad
SDKs mantenidos por la comunidad (no soportados oficialmente):
| Lenguaje | Repositorio | Mantenedor |
|---|
| Go | Proximamente | - |
| Rust | Proximamente | - |
| C# | Proximamente | - |
Quieres crear un SDK para otro lenguaje? Contactanos para listarlo aqui!
Siguientes Pasos
SDK Python
Referencia completa de Python
SDK JavaScript
Referencia completa de JavaScript