Custom Algorithms - Ireland Lotto
Available API
Your algorithm receives an api object with these methods:
Data
const info = await api.GetInfo(); // Lottery info
const ultima = await api.GetLastDraw(); // Last draw
const estrazione = await api.GetDrawByDate('2026-03-10'); // Draw by date
const archivio = await api.GetDraws({ offset: 0, limit: 10 }); // Paginated archive
Statistics
const ritardi = await api.GetDelays('draws'); // Current delays
const frequenze = await api.GetFrequencies('draws'); // Frequencies
const max_rit = await api.GetMaxDelays('draws', { combination: 2 }); // Max Delays
const max_freq = await api.GetMaxFreqs('draws', { combination: 2 }); // Max Frequencies
Output
api.Log('messaggio'); // Normal log line
api.LogInfo('informazione'); // Info (blue)
api.LogError('errore'); // Error (red)
api.SetTable(
['Numero', 'Ritardo'],
[[1, 45], [2, 12], [3, 78]]
); // Formatted table
api.SetResult({ chiave: 'valore' }); // Final result
Properties
api.section // 'irish-lotto' - Current section api.lottery // 'irish-lotto' - API lottery name
Notes
- All API methods are asynchronous - use
await - The algorithm runs in a Web Worker with no DOM access
- Maximum execution time: 30 seconds
- API calls have a small delay to prevent overload
- Only read-only endpoints are available
What are Custom Algorithms?
Custom Algorithms allow you to write small JavaScript programs that analyze lottery data using our REST API. You can create your own analysis strategies, search for patterns, or build personalized statistical reports.
How it works
- Write JavaScript code in the Editor tab
- Use the
apiobject to fetch lottery data - Output results with
api.Log(),api.SetTable(), orapi.SetResult() - Click Run to execute - results appear in the output area below the editor
- Save your algorithm to reuse it later
Privacy and security
- Your code runs entirely in your browser (Web Worker)
- No code is uploaded to any server
- Algorithms are stored in your browser's localStorage
- The execution sandbox has no access to the page, cookies, or other data
- A computation budget limits execution to 30 seconds maximum
Limitations
- Only the current lottery's data is accessible
- Only read-only API endpoints are available (no writes)
- No access to external URLs, DOM, or browser APIs
- Each API call has a small delay (~200ms) to prevent overload
- Maximum 30 seconds of execution time per run
API Reference
api.GetInfo()
Returns general information about the current lottery (name, draw types, schedule, etc.).
const info = await api.GetInfo();
api.Log('Lotteria: ' + info.name);
api.Log('Numero massimo estraibile: ' + info.max_number);
api.GetLastDraw()
Returns the most recent draw with all drawn numbers.
const ultima = await api.GetLastDraw();
const numeri = ultima.draw.numbers[0].values;
api.Log('Ultima estrazione: ' + numeri.join('.'));
api.Log('Data: ' + ultima.draw.date.day + '/' + ultima.draw.date.month + '/' + ultima.draw.date.year);
api.GetDrawByDate(data)
Returns all draws for a specific date. The date must be in YYYY-MM-DD format. For intraday lotteries, returns all draws of that day.
const risultato = await api.GetDrawByDate('2026-03-10');
const estrazioni = risultato.draws || [];
api.Log('Estrazioni trovate: ' + estrazioni.length);
for (const e of estrazioni)
api.Log(e.numbers[0].values.join('.'));
api.GetDraws({ offset, limit })
Returns a paginated list of draws from the archive. offset: 0 = most recent, offset: 1 = second most recent, etc.
const archivio = await api.GetDraws({ offset: 0, limit: 5 });
const estrazioni = archivio.draws || [];
api.Log('Ultime 5 estrazioni:');
for (const e of estrazioni)
{
const dt = e.date;
const data = dt.day + '/' + dt.month + '/' + dt.year;
api.Log(data + ': ' + e.numbers[0].values.join('.'));
}
const penultima = await api.GetDraws({ offset: 1, limit: 1 });
api.Log('Penultima: ' + penultima.draws[0].numbers[0].values.join('.'));
api.GetDelays(tipo_estrazione)
Returns the current delay (number of draws since last appearance) for each number. The result contains items: an array of { number, value }.
const ritardi = await api.GetDelays('draws');
const ordinati = ritardi.items.slice().sort((a, b) => b.value - a.value);
const top3 = ordinati.slice(0, 3);
api.Log('I 3 numeri piu in ritardo:');
for (const r of top3)
api.Log('Numero ' + r.number + ' -> ritardo ' + r.value);
api.GetFrequencies(tipo_estrazione)
Returns the total frequency (number of times drawn) for each number. The result contains items: an array of { number, value }.
const frequenze = await api.GetFrequencies('draws');
const ordinati = frequenze.items.slice().sort((a, b) => b.value - a.value);
const top3 = ordinati.slice(0, 3);
api.Log('I 3 numeri piu frequenti:');
for (const f of top3)
api.Log('Numero ' + f.number + ' -> uscito ' + f.value + ' volte');
api.GetMaxDelays(tipo_estrazione, { combination, group })
Returns the maximum historical delays. Use combination to specify how many numbers per group (1=singoli, 2=coppie, 3=terzine). Use group to limit results.
const max_singoli = await api.GetMaxDelays('draws', { combination: 1, group: 1 });
api.Log('Ritardi massimi storici (singoli):');
api.SetTable(
['Numero', 'Ritardo max storico'],
max_singoli.items.slice(0, 10).map(r => [r.number, r.value])
);
const max_coppie = await api.GetMaxDelays('draws', { combination: 2, group: 5 });
api.Log('Ritardi massimi storici (coppie, top 5):');
api.SetTable(
['Coppia', 'Ritardo max'],
max_coppie.items.slice(0, 5).map(r => [r.number, r.value])
);
api.GetMaxFreqs(tipo_estrazione, { combination, group })
Returns the maximum historical frequencies. Same parameters as GetMaxDelays.
const max_freq = await api.GetMaxFreqs('draws', { combination: 1, group: 1 });
api.Log('Frequenze massime storiche (singoli):');
api.SetTable(
['Numero', 'Frequenza max storica'],
max_freq.items.slice(0, 10).map(f => [f.number, f.value])
);
Output Methods
api.Log(messaggio)
Writes a normal text line in the output area.
api.Log('Questo e un messaggio normale');
api.Log('Risultato: ' + 42);
api.LogInfo(messaggio)
Writes a highlighted info line (blue).
api.LogInfo('Analisi completata con successo');
api.LogError(messaggio)
Writes an error line (red).
api.LogError('Dati non disponibili');
api.SetTable(intestazioni, righe)
Displays data as a formatted table. intestazioni is an array of column names, righe is an array of arrays (one per row).
api.SetTable(
['Posizione', 'Numero', 'Ritardo'],
[
[1, 45, 120],
[2, 12, 98],
[3, 78, 85]
]
);
api.SetResult(dati)
Sets a final result object, displayed as formatted JSON in the output area.
api.SetResult({
numeri_consigliati: [12, 45, 78],
strategia: 'ritardatari',
affidabilita: 'bassa'
});
Properties
api.section
The current lottery section name. Value: 'irish-lotto'
api.lottery
The internal API lottery identifier. Value: 'irish-lotto'
Complete example
This algorithm compares current delays with historical frequencies to find numbers that are both delayed and historically frequent (potentially \"due\" numbers).
const ritardi = await api.GetDelays('draws');
const frequenze = await api.GetFrequencies('draws');
if (!ritardi || !ritardi.items || !frequenze || !frequenze.items)
{
api.LogError('Dati non disponibili');
return;
}
const mappa_freq = {};
frequenze.items.forEach(f => mappa_freq[f.number] = f.value);
const mediana_freq = frequenze.items
.map(f => f.value)
.sort((a, b) => a - b)[Math.floor(frequenze.items.length / 2)];
const candidati = ritardi.items
.filter(r => (mappa_freq[r.number] || 0) > mediana_freq)
.sort((a, b) => b.value - a.value)
.slice(0, 10);
api.LogInfo('Numeri in ritardo con alta frequenza storica:');
api.SetTable(
['Numero', 'Ritardo attuale', 'Frequenza storica'],
candidati.map(c => [c.number, c.value, mappa_freq[c.number] || 0])
);
api.Log('Trovati ' + candidati.length + ' candidati');