Navi (/ˈnævi/) is a high-performance programming and stream computing language developed in Rust, originally designed for complex and high-performance computing tasks. It is also suited as a glue language embedded within heterogeneous services in financial systems.
In addition to its capabilities as a statically-typed, compiled language, Navi offers the convenience of script-like execution. It can compile source code into Bytecode (without JIT) or Machine Code (with JIT), providing a flexible development workflow. Theoretically, Navi delivering competitive performance on par with Go, Rust, and C.
-
Simple and Clean Syntax
Designed with a straightforward and clean syntax.
-
Modern Optional Type and Error Handling
With modern optional type and error handling, Navi allows developers to gracefully manage exceptional cases and abnormal data.
-
No NULL Pointer Panic, Safe Runtime
No NULL pointer exceptions. Once your code compiles, you can expect consistent and reliable execution.
-
Scripted or Compilied Execution
Supports script-like execution, but offering same performance comparable to compiled languages like Go.
curl -sSL https://navi-lang.org/install | sh
This script is also used for upgrading.
Or install a specific version:
# Install the latest nightly version
curl -sSL https://navi-lang.org/install | sh -s -- nightly
# Install a specific version
curl -sSL https://navi-lang.org/install | sh -s -- v0.9.0-nightly
Run navi -h
to get help.
$ navi -h
Usage: navi [OPTIONS] [COMMAND]
Commands:
run Run a navi script
test Test a navi script
compile Compile a navi script and show the bytecode
help Print this message or the help of the given subcommand(s)
Options:
-p, --path <PATH> Module path
-h, --help Print help information
-V, --version Print version information
You can create a file named with .nv
extension, and write some code in it, for example:
// main.nv
use std.io;
fn main() throws {
io.println("Hello World.");
}
test "Hello World" {
assert 1 == 1;
}
Then run it by:
$ navi run
Hello world, this is Navi.
$ navi test
In examples
directory, we provide some examples, you can run it by:
$ navi run
Provides a Language Server Protocol(LSP) for Navi and Navi Stream, supporting most IDEs like VS Code, VIM, etc.
You can visit VS Code Marketplace and install it.
https://marketplace.visualstudio.com/items?itemName=huacnlee.navi
With the MACD indicator (about 2000 times indicator calculation), Navi takes 300 µs to calculate MACD once, and due to the characteristics of stream computing, in the server-side scenario where a large number of real-time calculations are required, Navi can rely on the calculation data of history to improve the efficiency of calculation, and Navi will get hundreds of times performance improvement.
Currently, we test that the memory occupied by 1.2 million targets in the server-side is only 1G.
- As a market monitoring, by writing complex calculation logic, you can implement various market monitoring functions (alarm, decision, data construction).
- As a market monitoring client, by integrating SDK, write a real-time observation market data program, and make complex decisions (such as alarm, trading, etc.).
- Used in market charts, can be used as real-time market computing and draw on charts.
There still have a lot of works need to do (Performance, Programming Features, Documents, Development Tools ...).
We may open source this project in future when we completed all of that.