@tradejs/strategy-trading-patterns 0.0.0-stage → 0.1.1
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 +96 -0
- package/README.md +92 -2
- package/dist/index.cjs +560 -0
- package/dist/index.d.cts +72 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.js +532 -0
- package/package.json +82 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: TradeJS-Dev
|
|
6
|
+
|
|
7
|
+
Licensed Work: @tradejs/strategy-trading-patterns version 0.1.0 and later.
|
|
8
|
+
|
|
9
|
+
Additional Use Grant: You may make production use of the Licensed Work,
|
|
10
|
+
provided that you do not use the Licensed Work to offer a Competing Offering
|
|
11
|
+
to third parties.
|
|
12
|
+
|
|
13
|
+
A "Competing Offering" is a product or hosted or managed service whose primary
|
|
14
|
+
purpose is to provide a substantial portion of the functionality of TradeJS,
|
|
15
|
+
including strategy authoring, backtesting, live signal generation, automated
|
|
16
|
+
trading, or machine-learning training and inference workflows.
|
|
17
|
+
|
|
18
|
+
Internal use by you or your organization, including use for your own trading,
|
|
19
|
+
research, analytics, or operations, is not a Competing Offering.
|
|
20
|
+
|
|
21
|
+
Change Date: 2030-09-14
|
|
22
|
+
|
|
23
|
+
Change License: GNU Affero General Public License Version 3
|
|
24
|
+
|
|
25
|
+
For commercial licensing of a Competing Offering, contact the TradeJS-Dev
|
|
26
|
+
maintainers through https://github.com/TradeJS-Dev/TradeJS.
|
|
27
|
+
|
|
28
|
+
License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
29
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
30
|
+
|
|
31
|
+
Terms
|
|
32
|
+
|
|
33
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
34
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
35
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
36
|
+
production use.
|
|
37
|
+
|
|
38
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
39
|
+
available distribution of a specific version of the Licensed Work under this
|
|
40
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
41
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
42
|
+
above terminate.
|
|
43
|
+
|
|
44
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
45
|
+
currently in effect as described in this License, you must purchase a
|
|
46
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
47
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
48
|
+
|
|
49
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
50
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
51
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
52
|
+
for each version of the Licensed Work released by Licensor.
|
|
53
|
+
|
|
54
|
+
You must conspicuously display this License on each original or modified copy
|
|
55
|
+
of the Licensed Work. If you receive the Licensed Work in original or modified
|
|
56
|
+
form from a third party, the terms and conditions set forth in this License
|
|
57
|
+
apply to your use of that work.
|
|
58
|
+
|
|
59
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
60
|
+
terminate your rights under this License for the current and all other
|
|
61
|
+
versions of the Licensed Work.
|
|
62
|
+
|
|
63
|
+
This License does not grant you any right in any trademark or logo of Licensor
|
|
64
|
+
or its affiliates (provided that you may use a trademark or logo of Licensor
|
|
65
|
+
as expressly required by this License).
|
|
66
|
+
|
|
67
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
68
|
+
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
69
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
70
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
71
|
+
TITLE.
|
|
72
|
+
|
|
73
|
+
MariaDB hereby grants you permission to use this License’s text to license your
|
|
74
|
+
works, and to refer to it using the trademark “Business Source License”, as
|
|
75
|
+
long as you comply with the Covenants of Licensor below.
|
|
76
|
+
|
|
77
|
+
Covenants of Licensor
|
|
78
|
+
|
|
79
|
+
In consideration of the right to use this License’s text and the “Business
|
|
80
|
+
Source License” name and trademark, Licensor covenants to MariaDB, and to all
|
|
81
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
82
|
+
|
|
83
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
84
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
85
|
+
where “compatible” means that software provided under the Change License can
|
|
86
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
87
|
+
later version. Licensor may specify additional Change Licenses without
|
|
88
|
+
limitation.
|
|
89
|
+
|
|
90
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
91
|
+
impose any additional restriction on the right granted in this License, as
|
|
92
|
+
the Additional Use Grant; or (b) insert the text “None”.
|
|
93
|
+
|
|
94
|
+
3. To specify a Change Date.
|
|
95
|
+
|
|
96
|
+
4. Not to modify this License in any other way.
|
package/README.md
CHANGED
|
@@ -1,3 +1,93 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @tradejs/strategy-trading-patterns
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TradeJS strategy plugin providing `TradingPatterns` on the fixed `1h`
|
|
4
|
+
timeframe (`INTERVAL: "60"`).
|
|
5
|
+
|
|
6
|
+
## Included patterns
|
|
7
|
+
|
|
8
|
+
- `Diamond`
|
|
9
|
+
- `Flag`
|
|
10
|
+
- `Gartley`
|
|
11
|
+
- `HeadAndShoulders`
|
|
12
|
+
|
|
13
|
+
Every detector is evaluated on every candle so its replay state stays current.
|
|
14
|
+
When several patterns signal on the same candle, `TRADING_PATTERNS_PRIORITY`
|
|
15
|
+
selects one decision. The default order is the list above. The selected child
|
|
16
|
+
keeps ownership of the position and is the only child allowed to request an
|
|
17
|
+
early pattern exit. Stop-loss and take-profit handling remains with TradeJS.
|
|
18
|
+
|
|
19
|
+
The package imports each detector through its public strategy package. Pattern
|
|
20
|
+
geometry, risk plans, figures, and AI context therefore stay owned by their
|
|
21
|
+
source packages instead of being copied into this repository.
|
|
22
|
+
|
|
23
|
+
Disabled patterns and Bat were removed from the composition. Existing configs
|
|
24
|
+
must remove their toggle entries, priority entries and pattern-specific fields.
|
|
25
|
+
The parser rejects removed patterns rather than silently ignoring them.
|
|
26
|
+
The standalone child packages are unchanged by this composition cleanup.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
yarn add @tradejs/strategy-trading-patterns \
|
|
32
|
+
@tradejs/strategy-diamond \
|
|
33
|
+
@tradejs/strategy-flag \
|
|
34
|
+
@tradejs/strategy-gartley \
|
|
35
|
+
@tradejs/strategy-head-and-shoulders
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Register the package in `tradejs.config.ts`:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { defineConfig } from "@tradejs/core/config";
|
|
42
|
+
|
|
43
|
+
export default defineConfig({
|
|
44
|
+
strategies: ["@tradejs/strategy-trading-patterns"],
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
All detectors are enabled by default. The default directional switches from
|
|
49
|
+
their source packages are preserved. For example, the current
|
|
50
|
+
`HeadAndShoulders` default keeps its experimental inverse direction disabled.
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
{
|
|
54
|
+
TradingPatterns: {
|
|
55
|
+
INTERVAL: "60",
|
|
56
|
+
TRADING_PATTERNS: {
|
|
57
|
+
Diamond: {
|
|
58
|
+
enable: true,
|
|
59
|
+
LONG: { enable: true, minRiskRatio: 1.15 },
|
|
60
|
+
SHORT: { enable: true, minRiskRatio: 1.15 }
|
|
61
|
+
},
|
|
62
|
+
Flag: {
|
|
63
|
+
enable: true,
|
|
64
|
+
LONG: { enable: true, minRiskRatio: 0.7 },
|
|
65
|
+
SHORT: { enable: true, minRiskRatio: 0.5 }
|
|
66
|
+
}
|
|
67
|
+
// Other pattern entries are materialized from defaults.
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Pattern-specific fields keep their existing names, such as
|
|
74
|
+
`DIAMOND_PIVOT_LENGTH`, `FLAG_PIVOT_RADIUS`, and
|
|
75
|
+
`GARTLEY_MIN_AD_RETRACEMENT_RATIO`. They can be tuned in the same `TradingPatterns`
|
|
76
|
+
config without changing the composition code.
|
|
77
|
+
|
|
78
|
+
Top-level `LONG.enable` and `SHORT.enable` are master switches. Their
|
|
79
|
+
`minRiskRatio` values are optional common floors; the default floor is `0`, so
|
|
80
|
+
each pattern's own directional threshold remains authoritative.
|
|
81
|
+
|
|
82
|
+
## Development
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
yarn install --immutable
|
|
86
|
+
yarn checks
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Runtime host contract
|
|
90
|
+
|
|
91
|
+
All `@tradejs/*` runtime packages are peer dependencies. The consuming TradeJS
|
|
92
|
+
Project owns their exact installed versions and package manifest, so this
|
|
93
|
+
package never loads hidden nested framework or strategy copies.
|