Tabla de ganancias
CuentaRequiere autenticaciónObtenga el historial de ganancias y pérdidas de contratos cerrados. El parámetro loginid y el campo app_id se eliminaron, y los valores de contract_type cambiaron.
3 Cambios Importantes
loginid y el campo app_id se eliminaron, y el filtro contract_type acepta valores diferentes.Comparación rápida
Cambios importantes
1. loginid parámetro eliminado
En la API heredada, loginid seleccionaba la cuenta cuando autorizaba varias cuentas. La nueva API no lo acepta.
Cambio obligatorio: Elimine loginid de sus solicitudes de profit_table . Su token selecciona la cuenta.
2. app_id eliminado de las transacciones
La Legacy API devolvía app_id, el ID de la aplicación mediante la cual se compró el contrato, en cada transacción. La New API no lo devuelve.
Cambio obligatorio: Deje de leer app_id de las transacciones de la tabla de ganancias.
3. contract_type valores cambiados
El filtro contract_type ya no acepta CALLSPREAD, PUTSPREAD, LBFLOATCALL, LBFLOATPUT ni LBHIGHLOW, y añade HIGHER y LOWER.
Cambio obligatorio: Elimine de contract_typelos valores que la nueva API ya no acepta.
Estructura de solicitud
{
"profit_table": 1,
"contract_type": [
"CALL",
"CALLSPREAD"
],
"description": 1,
"limit": 25,
"loginid": "CR123456",
"req_id": 1
}{
"profit_table": 1,
"contract_type": [
"CALL",
"HIGHER"
],
"description": 1,
"limit": 25,
"req_id": 1
}Estructura de respuesta
{
"echo_req": {
"profit_table": 1,
"contract_type": [
"CALL",
"CALLSPREAD"
],
"description": 1,
"limit": 25,
"loginid": "CR123456",
"req_id": 1
},
"msg_type": "profit_table",
"profit_table": {
"count": 1,
"transactions": [
{
"buy_price": 10,
"contract_id": 11542203588,
"contract_type": "CALL",
"duration_type": "minutes",
"longcode": "Win payout if Volatility 100 Index is strictly higher than entry spot at 5 minutes after contract start time.",
"payout": 19.55,
"purchase_time": 1760000000,
"sell_price": 19.55,
"sell_time": 1760000300,
"shortcode": "CALL_R_100_19.55_1760000000_1760000300_S0P_0",
"transaction_id": 11542203587,
"underlying_symbol": "R_100",
"app_id": 1089
}
]
},
"req_id": 1
}{
"echo_req": {
"profit_table": 1,
"contract_type": [
"CALL",
"HIGHER"
],
"description": 1,
"limit": 25,
"req_id": 1
},
"msg_type": "profit_table",
"profit_table": {
"count": 1,
"transactions": [
{
"buy_price": 10,
"contract_id": 11542203588,
"contract_type": "CALL",
"duration_type": "minutes",
"longcode": "Win payout if Volatility 100 Index is strictly higher than entry spot at 5 minutes after contract start time.",
"payout": 19.55,
"purchase_time": 1760000000,
"sell_price": 19.55,
"sell_time": 1760000300,
"shortcode": "CALL_R_100_19.55_1760000000_1760000300_S0P_0",
"transaction_id": 11542203587,
"underlying_symbol": "R_100"
}
]
},
"req_id": 1
}Ejemplos de código
function getProfitTable(loginId) {
ws.send(JSON.stringify({ profit_table: 1, description: 1, limit: 25, loginid: loginId }));
ws.onmessage = (event) => {
const response = JSON.parse(event.data);
if (response.msg_type !== "profit_table") return;
if (response.profit_table) {
response.profit_table.transactions?.forEach((tx) => {
console.log(tx.contract_id, tx.sell_price - tx.buy_price, tx.app_id);
});
}
};
}¿Alguna otra pregunta? Póngase en contacto