Live Scripting
A native scripting language purpose-built for finance , combining Python, SQL, Java, and string templates into a single runtime embedded across the entire 3forge platform.
Purpose-built for finance
Logic close to the data,
consistent across the stack
In financial institutions, business logic must sit close to the data, evolve continuously, and remain intelligible across teams. Hard boundaries between data access, computation, and presentation introduce friction and duplication. The 3forge scripting language addresses this directly by combining Java, Python, SQL, and string templates into a single coherent runtime enriched with a comprehensive library of finance-specific functions. Logic defined once flows seamlessly from the data model to the user interface, supporting reusable, transparent, and production-grade computation aligned with how financial systems actually operate.
Four languages, one runtime
AmiScript unifies what financial workflows actually need
Data structures
Python-inspired maps, lists, and nested objects for representing financial data naturally , instruments, curves, pricing ladders, and scenarios , without verbose class definitions.
Data access
SQL-like queries against named data sources, with parameterized placeholders resolved at runtime. Governed access without leaving the scripting environment.
Function definitions
Strongly typed, overloadable function definitions that encapsulate business logic , notional value, exposure, margin, PnL , consistently across risk, trading, reporting, and compliance.
Output & formatting
String templating for formatting computed results into alerts, messages, reports, and visual components , directly from within the scripting layer, without a separate UI pipeline.
Python-style syntax
Represent complex financial objects naturally
AmiScript adopts Python-inspired syntax for maps, lists, and nested structures, letting developers express hierarchical financial data compactly. Market snapshots, pricing ladders, risk buckets, and configuration objects can be defined inline , no verbose class definitions, no external schemas. Because these structures are first-class citizens, the same object can feed pricing logic, populate a table, or drive a chart, eliminating glue code between modeling and execution. JSON is also fully supported throughout the App Engine.
Map pricingSummary = {
"ZXZZT": {
"Open": 489.10,
"prices": [492.10, 492.10]
}
};
Java-style definitions
Encapsulate business logic as reusable functions
AmiScript supports strongly typed, overloadable function definitions that encapsulate business logic in a deterministic way. Define once, reuse across scripts, queries, models, and visuals. This is especially important for calculations like notional value, exposure, margin, or PnL, which must be identical across risk, trading, reporting, and compliance workflows. Functions are lightweight and composable, chained and nested with built-in libraries, and executed within the platform governed runtime , making them observable, auditable, and subject to the same controls as the rest of the system.
double NOTIONAL_VALUE(
Number quantity,
Number price,
Number fx
) {
quantity * price * fx
};
SQL-like execution
Governed data access without leaving the script
AmiScript integrates tightly with AmiSQL to provide direct, governed access to live and historical data sources using familiar SQL constructs. Parameterized placeholders are resolved at runtime, allowing the same script to adapt automatically to different users or sessions , essential for multi-tenant applications, client-specific views, and role-based access control. Because data access is embedded in the scripting layer, there is no artificial separation between querying data and operating on it: results feed immediately into downstream computation, visualization, or persistence.
create table mycopy AS use DS="ACCOUNT_DATA" execute
Select * from Accounts
where Account=="${USERACCOUNT}";
String templates
Compute, aggregate, and format in the same script
AmiScript allows computation and presentation logic to coexist cleanly. Aggregations and transformations can be expressed declaratively, and their results injected immediately into formatted output using built-in templating. Previously defined business functions are reusable inside aggregate queries, reinforcing consistency across the calculation stack. The same pattern extends beyond alerts: computed values can be embedded directly into tables, charts, tooltips, and reports, ensuring that what users see is directly derived from governed, traceable logic rather than post-processed in a separate layer.
double totalNotional =
select sum(NOTIONAL_VALUE(
qty, px, fxrate))
from mycopy;
Session.alert(
"Total value for account ${USERACCOUNT}
is ${totalNotional}"
);
Built-in library
Over 1,500 functions organized by domain
AmiScript includes a comprehensive library of built-in functions organized into domain-specific modules. They cover data access, aggregation, time-series analysis, financial calculations, formatting, entitlements, session control, and system interaction , letting developers assemble sophisticated workflows without re-implementing common primitives.
| Category | Example function | Financial use |
|---|---|---|
| Trigonometric: | acos(value) | Seasonality modelling and wave-form analysis in price series |
| Binary: | bitShiftLeft(n, shiftAmount) | Encoding and decoding bitmask entitlement flags per user or desk |
| Colorimetric: | clrGetAlpha(color) | Generating risk heatmap colour scales by PnL magnitude or exposure level |
| Date and time: | datePart(unixEpochMillis, part, timezone) | Settlement date calculations and market-hours filtering across time zones |
| Encoding: | decodeDouble64(value) | Decoding binary price fields from low-latency tick and FIX protocol feeds |
| Mathematic: | exp(x) | Continuous compounding, discount factors, and yield curve construction |
| Parsing: | jsonExtract(json, xpath) | Extracting fields from pricing API responses and reference data payloads |
| Operational: | logWarn(message) | Audit-trail logging for compliance-sensitive workflow steps and threshold breaches |
| Data parsing: | parseXlsx(data, firstLineIsHeader) | Ingesting trade blotters, fund NAV reports, and static data files from Excel |
| Delta: | percentChange(old, nuw) | Daily return, intraday price move, and benchmark deviation calculations |
| Formatting: | quote(text) | Formatting instrument identifiers, currencies, and dynamic SQL query strings |
| Random: | randGaussian() | Monte Carlo scenario generation for VaR and stress testing |
| Rounding: | roundNearest(value, bucketSize) | Snapping prices to minimum tick sizes and quantities to lot size constraints |
| Cryptographic: | signDataMac(data, key, algorithm) | Signing outbound order messages and authenticating exchange API requests |
| String manipulation: | strAfter(text, toFind, origIfNotFound) | Parsing instrument codes, extracting ISIN or ticker from composite identifiers |
| Timekeeping: | timestampNano() | Nanosecond-precision latency measurement for execution quality analysis |
| Address management: | urlDecode(url) | Constructing and decoding REST calls to market data and reference data APIs |
| Averages: | avgGauss(value, variance) | Weighted average pricing, VWAP, and noise-smoothed position aggregation |
| Greeks: | beta(value1, value2) | Portfolio beta vs benchmark, factor sensitivity, and hedging ratio calculation |
| Concatenation: | catUniqueLimit(value, delim, limit) | Aggregating unique counterparty or venue lists per trade or order bucket |
| Statistics: | percentileDisc(value, percent) | Value at Risk at defined confidence intervals across a position population |
| Clustering: | kmeansCluster(nClusters, seed, values) | Segmenting portfolios by risk profile, sector exposure, or client behaviour |
| Resampling: | resample(x, y, xq, linearOrSpline) | Normalising tick data to uniform OHLC bars for charting and backtesting |
Get started
See AmiScript running against your own data.
Book a 30-minute session with a 3forge solutions engineer and see Live Scripting applied to your workflows, data sources, and business logic.