wickra-exchange-wasm 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -40
- package/package.json +1 -1
- package/wickra_exchange_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -1,36 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://wickra.org"><img src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/wickra-banner.webp?v=514-7" alt="Wickra Exchange — streaming-native crypto-exchange connectivity: one typed API over the ten largest exchanges, across ten languages" width="100%"></a>
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
[](https://github.com/wickra-lib/wickra-exchange/actions/workflows/ci.yml)
|
|
6
|
+
[](https://codecov.io/gh/wickra-lib/wickra-exchange)
|
|
7
|
+
[](https://www.npmjs.com/package/wickra-exchange-wasm)
|
|
8
|
+
[](https://github.com/wickra-lib/wickra-exchange#license)
|
|
5
9
|
|
|
6
|
-
|
|
10
|
+
# Wickra Exchange — WASM
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
This one cannot, and that is a property of the target rather than a gap in the
|
|
10
|
-
work: `wasm32-unknown-unknown` has no TCP sockets and no TLS stack, and the
|
|
11
|
-
transport crate is built on tokio, reqwest and tokio-tungstenite, none of which
|
|
12
|
-
target the browser. A `connect()` here would compile and then fail at the first
|
|
13
|
-
request.
|
|
12
|
+
---
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
therefore genuinely runs in a page:
|
|
14
|
+
> **▶ Live demo:** all 514 indicators over real Binance market data, computed live in your browser — **[live.wickra.org](https://live.wickra.org)** · zero backend, powered by `wickra-wasm`.
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
| --- | --- |
|
|
20
|
-
| `Exchange.paper` — offline account with fees and slippage | `connect` — needs sockets |
|
|
21
|
-
| `Exchange.replayTrades` — recorded price tape | user-data streams, WebSocket execution |
|
|
22
|
-
| `placeOrder`, `cancelOrder`, `queryOrder`, `openOrders` | derivatives (live-only) |
|
|
23
|
-
| `balances`, `ticker`, `setPrice`, `pollEvents` | `klines` (needs a venue) |
|
|
24
|
-
| `OrderRequest` factories, `version()` | depth — see below |
|
|
25
|
-
|
|
26
|
-
There is no `orderBook`. The paper account has no depth feed and answers
|
|
27
|
-
`unsupported`; the replay backend delegates straight to it. On both backends
|
|
28
|
-
reachable from here the call cannot succeed, so exposing it would only add a
|
|
29
|
-
method that type-checks and always throws.
|
|
16
|
+
**One typed API. Ten exchanges. Eight languages — for WASM. `npm install wickra-exchange-wasm` — pure WebAssembly, runs anywhere a modern JS engine does.**
|
|
30
17
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
off the browser.
|
|
18
|
+
WebAssembly bindings for [`wickra-exchange`](https://github.com/wickra-lib/wickra-exchange):
|
|
19
|
+
the offline **paper** and **replay** simulators, in the browser.
|
|
34
20
|
|
|
35
21
|
## Install
|
|
36
22
|
|
|
@@ -38,7 +24,20 @@ off the browser.
|
|
|
38
24
|
npm install wickra-exchange-wasm
|
|
39
25
|
```
|
|
40
26
|
|
|
41
|
-
|
|
27
|
+
### Building from this repository (contributors)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
wasm-pack build bindings/wasm --target web --release --features panic-hook # browsers
|
|
31
|
+
wasm-pack build bindings/wasm --target nodejs --release --out-dir pkg # Node
|
|
32
|
+
node --test bindings/wasm/tests/
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The `panic-hook` feature routes Rust panics to `console.error` with a readable
|
|
36
|
+
stack; without it a panic surfaces as "unreachable executed" and nothing points
|
|
37
|
+
at the cause. It costs a little size, which is why it is off by default and on
|
|
38
|
+
for the browser build.
|
|
39
|
+
|
|
40
|
+
## Quick start
|
|
42
41
|
|
|
43
42
|
```js
|
|
44
43
|
import init, { Exchange, OrderRequest } from "wickra-exchange-wasm";
|
|
@@ -77,19 +76,74 @@ for (;;) {
|
|
|
77
76
|
}
|
|
78
77
|
```
|
|
79
78
|
|
|
80
|
-
|
|
79
|
+
### What this package is, and what it is not
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
The other bindings — Node, Python, C, C#, Go, Java, R — connect to live venues.
|
|
82
|
+
This one cannot, and that is a property of the target rather than a gap in the
|
|
83
|
+
work: `wasm32-unknown-unknown` has no TCP sockets and no TLS stack, and the
|
|
84
|
+
transport crate is built on tokio, reqwest and tokio-tungstenite, none of which
|
|
85
|
+
target the browser. A `connect()` here would compile and then fail at the first
|
|
86
|
+
request.
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
So this package carries the part of the library that is pure computation and
|
|
89
|
+
therefore genuinely runs in a page:
|
|
90
|
+
|
|
91
|
+
| exposed | absent |
|
|
92
|
+
| --- | --- |
|
|
93
|
+
| `Exchange.paper` — offline account with fees and slippage | `connect` — needs sockets |
|
|
94
|
+
| `Exchange.replayTrades` — recorded price tape | user-data streams, WebSocket execution |
|
|
95
|
+
| `placeOrder`, `cancelOrder`, `queryOrder`, `openOrders` | derivatives (live-only) |
|
|
96
|
+
| `balances`, `ticker`, `setPrice`, `pollEvents` | `klines` (needs a venue) |
|
|
97
|
+
| `OrderRequest` factories, `version()` | depth — see below |
|
|
98
|
+
|
|
99
|
+
There is no `orderBook`. The paper account has no depth feed and answers
|
|
100
|
+
`unsupported`; the replay backend delegates straight to it. On both backends
|
|
101
|
+
reachable from here the call cannot succeed, so exposing it would only add a
|
|
102
|
+
method that type-checks and always throws.
|
|
103
|
+
|
|
104
|
+
The surface that *is* here is the one a backtest uses, which is the point: a
|
|
105
|
+
strategy written against this runs unchanged against a live venue once it moves
|
|
106
|
+
off the browser.
|
|
107
|
+
|
|
108
|
+
## Benchmark
|
|
109
|
+
|
|
110
|
+
Every binding forwards to the same data-driven Rust core, so what this one adds is
|
|
111
|
+
the call overhead of wasm-bindgen, not a different result. The core's throughput is
|
|
112
|
+
measured by the repository's benchmark suite and the nightly `bench.yml` run; the
|
|
113
|
+
numbers, the machine and how to reproduce them are in the repository
|
|
114
|
+
[BENCHMARKS.md](https://github.com/wickra-lib/wickra-exchange/blob/main/BENCHMARKS.md).
|
|
115
|
+
|
|
116
|
+
## Documentation
|
|
117
|
+
|
|
118
|
+
The full guide, the spec reference and the API documentation live in the main
|
|
119
|
+
repository and the documentation site:
|
|
120
|
+
|
|
121
|
+
- **Repository:** <https://github.com/wickra-lib/wickra-exchange>
|
|
122
|
+
- **Docs** (guides, spec reference, cookbook): <https://exchange.wickra.org>
|
|
123
|
+
- **Runnable example:** [`examples/wasm/`](https://github.com/wickra-lib/wickra-exchange/tree/main/examples/wasm)
|
|
124
|
+
|
|
125
|
+
Wickra Exchange ships native bindings for Python, Node.js, WASM and Rust, plus a C ABI hub that any
|
|
126
|
+
C-capable language (C, C++, C#, Go, Java, R) links against — all forwarding to the
|
|
127
|
+
same data-driven, `unsafe`-forbidden Rust core.
|
|
128
|
+
|
|
129
|
+
## Security
|
|
130
|
+
|
|
131
|
+
Found a security issue? **Please don't open a public issue.** Report it privately
|
|
132
|
+
via the repository's *Security* tab (*"Report a vulnerability"*) or email
|
|
133
|
+
**support@wickra.org** with a subject line starting `[wickra security]`. Full
|
|
134
|
+
policy: <https://github.com/wickra-lib/wickra-exchange/blob/main/SECURITY.md>.
|
|
135
|
+
|
|
136
|
+
## Disclaimer
|
|
137
|
+
|
|
138
|
+
Not a trading system and not financial advice. This library connects to exchanges
|
|
139
|
+
and can place real orders that risk real capital; any such use is **entirely at
|
|
140
|
+
your own risk**. Authentication, order rounding, reconnect handling and rate
|
|
141
|
+
limiting can fail in ways that lose money — test against testnets, use
|
|
142
|
+
withdrawal-disabled keys, and review the code before trading. The software is
|
|
143
|
+
provided **as is**, without warranty of any kind; see the license files for the
|
|
144
|
+
full terms.
|
|
92
145
|
|
|
93
|
-
##
|
|
146
|
+
## License
|
|
94
147
|
|
|
95
|
-
|
|
148
|
+
Licensed under either of [Apache-2.0](https://github.com/wickra-lib/wickra-exchange/blob/main/LICENSE-APACHE)
|
|
149
|
+
or [MIT](https://github.com/wickra-lib/wickra-exchange/blob/main/LICENSE-MIT) at your option.
|
package/package.json
CHANGED
|
Binary file
|