@reyaxyz/strategy-format 0.3.1 → 0.4.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/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/lines.json +2 -1
- package/dist/sentences.d.ts +2 -0
- package/dist/sentences.js +9 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1808,7 +1808,7 @@ export declare const schemaSource: {
|
|
|
1808
1808
|
"schema/workflow-v3.accepted-kinds.json": string;
|
|
1809
1809
|
};
|
|
1810
1810
|
};
|
|
1811
|
-
export { sentences } from './sentences';
|
|
1811
|
+
export { marketName, sentences } from './sentences';
|
|
1812
1812
|
export type { Mode, SentenceKey, Translations } from './sentences';
|
|
1813
1813
|
export { line, lineId, LINES, FOLLOW_ONS, needsYouLine, NEEDS_YOU_CODES, activityLine, ACTIVITY_CODES, ACTIVITY_NOT_LISTED, ENTRY_DROPPED, endedLine, PAPER_LINES, END_REASONS, READ_OUTS, gradedFigure, whatIfLine, WHAT_IF_RESPONSES, } from './lines';
|
|
1814
1814
|
export type { LineKey, LineTranslations, LineVars, SayLine, RunStatus, NeedsYouItem, ActivityEntry, Grade, WhatIfRow, } from './lines';
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.WHAT_IF_RESPONSES = exports.whatIfLine = exports.gradedFigure = exports.READ_OUTS = exports.END_REASONS = exports.PAPER_LINES = exports.endedLine = exports.ENTRY_DROPPED = exports.ACTIVITY_NOT_LISTED = exports.ACTIVITY_CODES = exports.activityLine = exports.NEEDS_YOU_CODES = exports.needsYouLine = exports.FOLLOW_ONS = exports.LINES = exports.lineId = exports.line = exports.sentences = exports.schemaSource = exports.acceptedKinds = exports.workflowV3Schema = exports.versionHash = exports.canonical = exports.MAX_DOCUMENT_BYTES = exports.readStrategy = void 0;
|
|
20
|
+
exports.WHAT_IF_RESPONSES = exports.whatIfLine = exports.gradedFigure = exports.READ_OUTS = exports.END_REASONS = exports.PAPER_LINES = exports.endedLine = exports.ENTRY_DROPPED = exports.ACTIVITY_NOT_LISTED = exports.ACTIVITY_CODES = exports.activityLine = exports.NEEDS_YOU_CODES = exports.needsYouLine = exports.FOLLOW_ONS = exports.LINES = exports.lineId = exports.line = exports.sentences = exports.marketName = exports.schemaSource = exports.acceptedKinds = exports.workflowV3Schema = exports.versionHash = exports.canonical = exports.MAX_DOCUMENT_BYTES = exports.readStrategy = void 0;
|
|
21
21
|
const workflow_v3_schema_json_1 = __importDefault(require("./schema/workflow-v3.schema.json"));
|
|
22
22
|
const workflow_v3_accepted_kinds_json_1 = __importDefault(require("./schema/workflow-v3.accepted-kinds.json"));
|
|
23
23
|
const source_json_1 = __importDefault(require("./schema/source.json"));
|
|
@@ -34,6 +34,7 @@ exports.workflowV3Schema = workflow_v3_schema_json_1.default;
|
|
|
34
34
|
exports.acceptedKinds = workflow_v3_accepted_kinds_json_1.default;
|
|
35
35
|
exports.schemaSource = source_json_1.default;
|
|
36
36
|
var sentences_1 = require("./sentences");
|
|
37
|
+
Object.defineProperty(exports, "marketName", { enumerable: true, get: function () { return sentences_1.marketName; } });
|
|
37
38
|
Object.defineProperty(exports, "sentences", { enumerable: true, get: function () { return sentences_1.sentences; } });
|
|
38
39
|
var lines_1 = require("./lines");
|
|
39
40
|
Object.defineProperty(exports, "line", { enumerable: true, get: function () { return lines_1.line; } });
|
package/dist/lines.json
CHANGED
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"why-nothing": "The strategy's record has no event that explains it. The stop is at {level}; the mark is {mark} as of {time}.",
|
|
43
43
|
"size-from-share": "{pct}% of your balance is {amount} USDC today, so each order is {amount} USDC.",
|
|
44
44
|
"feature-unavailable": "{asked} is not available in strategies.",
|
|
45
|
-
"pin-question": "
|
|
45
|
+
"pin-question": "I found {count} questions on Polymarket. Pick the one you mean.",
|
|
46
|
+
"pin-question.one": "I found the question on Polymarket. Check it is the one you mean.",
|
|
46
47
|
"pin-source": "Polymarket, as of {time} UTC",
|
|
47
48
|
"pin-option": "{outcome} · {pct}% now · listed end {date}",
|
|
48
49
|
"pin-thin": " · thin market: ${volume} traded in 24h, ${depth} near the price",
|
package/dist/sentences.d.ts
CHANGED
|
@@ -21,3 +21,5 @@ export type Translations = Record<SentenceKey, string> & Record<string, string>;
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function sentences(doc: StrategyV3, t?: Translations, locale?: string, mode?: Mode): Record<string, string>;
|
|
23
23
|
export type Mode = 'live' | 'paper';
|
|
24
|
+
/** A perp market as the app names it: `BTCRUSDPERP` is `BTC-PERP`; any other code as written. */
|
|
25
|
+
export declare const marketName: (market: string) => string;
|
package/dist/sentences.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.sentences = void 0;
|
|
6
|
+
exports.marketName = exports.sentences = void 0;
|
|
7
7
|
const en_json_1 = __importDefault(require("./en.json"));
|
|
8
8
|
/**
|
|
9
9
|
* One line per block, keyed by block id: every state, rule, action, pin and list, and every block
|
|
@@ -136,7 +136,7 @@ class Builder {
|
|
|
136
136
|
return s.kind === 'loop_head' ? 'loop' : 'wait';
|
|
137
137
|
}
|
|
138
138
|
market(market) {
|
|
139
|
-
return market
|
|
139
|
+
return market === undefined ? this.f('market.row') : (0, exports.marketName)(market);
|
|
140
140
|
}
|
|
141
141
|
pinById(id) {
|
|
142
142
|
const pin = this.doc.series?.[id];
|
|
@@ -402,7 +402,7 @@ class Builder {
|
|
|
402
402
|
if (l.kind === 'fixed') {
|
|
403
403
|
const rows = l.members.map((m) => {
|
|
404
404
|
const line = this.f('row', {
|
|
405
|
-
market: m.market,
|
|
405
|
+
market: (0, exports.marketName)(m.market),
|
|
406
406
|
side: m.side ? this.f('row.side', { side: this.side(m.side) }) : '',
|
|
407
407
|
size: m.size ? this.f('row.size', { size: this.size(m.size) }) : '',
|
|
408
408
|
reads: m.reads
|
|
@@ -419,7 +419,9 @@ class Builder {
|
|
|
419
419
|
rows: this.join(rows, 'rows.join'),
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
|
-
const from = l.from
|
|
422
|
+
const from = l.from
|
|
423
|
+
? this.join(l.from.map(exports.marketName))
|
|
424
|
+
: this.f('list.from.all');
|
|
423
425
|
return l.kind === 'filter'
|
|
424
426
|
? this.f('list.filter', {
|
|
425
427
|
...base,
|
|
@@ -586,6 +588,9 @@ const WINDOWED = new Set([
|
|
|
586
588
|
]); // prettier-ignore
|
|
587
589
|
/** The window functions that take an `anchor` (the engine's `WindowFn`); others ignore it. */
|
|
588
590
|
const ANCHORED = new Set(['sma', 'ema', 'high', 'low', 'stdev', 'pct_change']);
|
|
591
|
+
/** A perp market as the app names it: `BTCRUSDPERP` is `BTC-PERP`; any other code as written. */
|
|
592
|
+
const marketName = (market) => market.replace(/^([A-Z0-9]+)RUSDPERP$/, '$1-PERP');
|
|
593
|
+
exports.marketName = marketName;
|
|
589
594
|
/** User text shown inside quotes: a quote in it cannot end the quote early. */
|
|
590
595
|
const quoted = (text) => text.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
591
596
|
const COMPARISONS = new Set(['gt', 'ge', 'lt', 'le', 'eq', 'ne']);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/strategy-format",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The v3 strategy format for TypeScript: reya-chain's schema and accepted kinds, the reader, the version hash, the block sentences and the line table",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"typescript": "5.3.3"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "074c2ae1d2a37acf60104771b7c22904a959e37b"
|
|
45
45
|
}
|