@lacspace/patterns 0.0.0-stage → 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,51 @@
1
+ Lacspace Free Licence
2
+ Version 1.0, August 2026
3
+
4
+ Copyright (c) 2026 Lacspace
5
+
6
+ PREAMBLE
7
+
8
+ This software is published by Lacspace under the Lacspace Free Licence — a free,
9
+ permissive licence that lets you use this software for any purpose, including in
10
+ commercial products and services, at no cost. It grants the same freedoms as
11
+ common permissive open-source licences; the only condition is that this notice
12
+ travels with the software. The canonical, always-current text of this licence is
13
+ maintained at https://lacspace.com/licenses/lacspace-free-1.0
14
+
15
+ GRANT OF RIGHTS
16
+
17
+ Permission is hereby granted, free of charge, to any person or organisation
18
+ obtaining a copy of this software and its associated documentation and data files
19
+ (the "Software"), to deal in the Software without restriction, including without
20
+ limitation the rights to use, copy, modify, merge, publish, distribute,
21
+ sublicense, and/or sell copies of the Software, and to permit persons to whom the
22
+ Software is furnished to do so, subject to the conditions below. These rights are
23
+ granted for any purpose, personal or commercial, and are perpetual, worldwide,
24
+ non-exclusive, and royalty-free.
25
+
26
+ CONDITIONS
27
+
28
+ The above copyright notice, this permission notice, and the name of this licence
29
+ ("Lacspace Free Licence") shall be included in all copies or substantial portions
30
+ of the Software.
31
+
32
+ TRADEMARKS
33
+
34
+ This licence does not grant permission to use the trade names, trademarks, service
35
+ marks, logos, or product names of Lacspace, except as required to reproduce the
36
+ notice above or to describe the origin of the Software in a truthful manner.
37
+
38
+ DISCLAIMER OF WARRANTY AND LIMITATION OF LIABILITY
39
+
40
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
42
+ FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
43
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN
44
+ AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
45
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46
+
47
+ ---
48
+
49
+ The Lacspace Free Licence is a source-available, permissive licence and is not (as
50
+ of this version) an OSI-approved licence. In substance it grants the same freedoms
51
+ as the MIT Licence. Learn more at https://lacspace.com/licenses
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # Temporary Holding Version
1
+ # @lacspace/patterns
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Rule-based chart-pattern detection on OHLCV bars, with no AI. Every detector works from **ATR-sized swings**, so the same settings suit a 5-minute chart and a weekly one. Results come back drawing-ready (`paths`, `zones`, `profiles`, using bar indices and prices) and as plain data (`hits`, `found`).
4
+
5
+ The patterns describe geometry already on the chart; they are not forecasts or advice. An Elliott count in particular is subjective: this shows one count that obeys the rules.
6
+
7
+ ```ts
8
+ import { swings, chartPatterns, harmonics, elliott, tpoProfiles } from "@lacspace/patterns";
9
+
10
+ // bars: { time (unix seconds), open, high, low, close, volume }[]
11
+ swings(bars, 2); // { piv: [{ i, p, hi }], tail, atr }: zigzag confirmed at k × ATR(14)
12
+ chartPatterns(bars).found; // ["Double bottom", "Double bottom", "Range (rectangle)"]
13
+ harmonics(bars).hits; // [{ name: "Gartley", bull, pts: [X,A,B,C,D], forming }]
14
+ elliott(bars).paths; // labelled impulse (0)…(5), then (a)(b)(c); wave-5 target zone
15
+ tpoProfiles(bars, 24, 5); // market profile per session: rows with letters, POC, 70% value area, initial balance
16
+ ```
17
+
18
+ | Function | Finds |
19
+ |---|---|
20
+ | `swings(bars, k = 2)` | Alternating swing highs and lows, confirmed once price moves `k × ATR(14)`. The still-forming extreme is returned as `tail`. |
21
+ | `harmonics(bars, k, tolPct = 6, show = 3)` | Gartley, Bat, Alt Bat, Butterfly, Crab, Deep Crab, Cypher and AB=CD. A pattern still waiting for D gets a potential-reversal **D zone**. |
22
+ | `elliott(bars, k)` | The latest five-wave impulse obeying the three hard rules (wave 2 doesn't retrace past wave 1's start, wave 3 isn't the shortest, wave 4 doesn't overlap wave 1), then a-b-c. A wave-5 target zone is added when waves 1–4 are in place. |
23
+ | `chartPatterns(bars, k = 1.5, look = 200, …, show = 2)` | Double tops and bottoms, head & shoulders (and inverse) with necklines, confirmation and measured moves. Also the latest structure: ascending, descending or symmetrical triangle, rising or falling wedge, range, rising or falling channel, or broadening formation. |
24
+ | `tpoProfiles(bars, rows, sessions)` | TPO market profile per session: 30-minute letters (hourly letters on hourly bars), POC, value area, initial balance. |
25
+ | `sessionVolumeProfiles(bars, rows, sessions)` | Volume-by-price per session, with up and down volume, POC and value area. |
26
+ | `kagi(bars, rev)`, `pointFigure(bars, box, rev = 3)` | Time-independent chart transforms. They return ordinary bars plus the shape data. |
27
+
28
+ Sessions are split by UTC calendar day. That fits exchanges whose trading day doesn't cross UTC midnight; NEPSE's 11:00–15:00 NPT is 05:15–09:15 UTC. Colours are optional trailing parameters.
29
+
30
+ Watch out for unadjusted corporate-action gaps (bonus or rights issues) in the input. The detectors treat them as real price moves, so adjust your candles first (for example with `@lacspace/market`).
31
+
32
+ Contributed by the ShareRocketPro team from their production chart. The tests pin its behaviour on a real NABIL 15-minute snapshot.
33
+
34
+ ## Licence
35
+ [Lacspace Free Licence v1.0](https://developer.lacspace.com/licenses/lacspace-free-1.0): free for personal and commercial use.