simmer-automaton 0.6.7 → 0.6.8

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/api.d.ts CHANGED
@@ -46,6 +46,21 @@ export interface BriefingPosition {
46
46
  resolves_at: string | null;
47
47
  source: string | null;
48
48
  }
49
+ export interface PositionsPosition {
50
+ market_id: string;
51
+ question: string;
52
+ shares_yes: number;
53
+ shares_no: number;
54
+ current_price: number;
55
+ avg_cost: number;
56
+ pnl: number;
57
+ cost_basis: number;
58
+ status: string;
59
+ resolves_at: string | null;
60
+ venue: string;
61
+ currency: string;
62
+ sources: string[];
63
+ }
49
64
  export interface BriefingVenue {
50
65
  currency: string;
51
66
  balance: number | null;
@@ -142,7 +157,7 @@ export declare class SimmerApi {
142
157
  }>;
143
158
  getBriefing(): Promise<BriefingResponse>;
144
159
  getPositions(): Promise<{
145
- positions: BriefingPosition[];
160
+ positions: PositionsPosition[];
146
161
  }>;
147
162
  postCycle(data: {
148
163
  active_skills: string[];
package/dist/api.js CHANGED
@@ -74,7 +74,7 @@ export class SimmerApi {
74
74
  return this.request("/api/sdk/briefing");
75
75
  }
76
76
  async getPositions() {
77
- return this.request("/api/sdk/positions");
77
+ return this.request("/api/sdk/positions?status=active");
78
78
  }
79
79
  async postCycle(data) {
80
80
  return this.request("/api/sdk/automaton/cycle", {
package/dist/index.js CHANGED
@@ -629,8 +629,11 @@ export default function register(pluginApi) {
629
629
  return { text: "No open positions." };
630
630
  }
631
631
  const lines = positions.map((p) => {
632
+ const shares = p.shares_yes + p.shares_no;
633
+ const side = p.shares_yes > 0 && p.shares_no > 0 ? "both" : (p.shares_yes > 0 ? "yes" : "no");
632
634
  const pnlStr = p.pnl >= 0 ? `+${fmtCurrency(p.pnl)}` : fmtCurrency(p.pnl);
633
- return `${p.question.slice(0, 55)} | ${p.side} ${p.shares}sh @ ${p.avg_entry.toFixed(2)} → ${p.current_price.toFixed(2)} | ${pnlStr}${p.source ? ` [${p.source}]` : ""}`;
635
+ const src = p.sources?.length ? ` [${p.sources[0]}]` : "";
636
+ return `${p.question.slice(0, 55)} | ${side} ${shares.toFixed(1)}sh @ ${p.avg_cost.toFixed(2)} → ${p.current_price.toFixed(2)} | ${pnlStr}${src}`;
634
637
  });
635
638
  const totalPnl = positions.reduce((sum, p) => sum + p.pnl, 0);
636
639
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simmer-automaton",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "Simmer Automaton plugin for OpenClaw — autonomous trading skill orchestration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/api.ts CHANGED
@@ -51,6 +51,22 @@ export interface BriefingPosition {
51
51
  source: string | null;
52
52
  }
53
53
 
54
+ export interface PositionsPosition {
55
+ market_id: string;
56
+ question: string;
57
+ shares_yes: number;
58
+ shares_no: number;
59
+ current_price: number;
60
+ avg_cost: number;
61
+ pnl: number;
62
+ cost_basis: number;
63
+ status: string;
64
+ resolves_at: string | null;
65
+ venue: string;
66
+ currency: string;
67
+ sources: string[];
68
+ }
69
+
54
70
  export interface BriefingVenue {
55
71
  currency: string;
56
72
  balance: number | null;
@@ -189,8 +205,8 @@ export class SimmerApi {
189
205
  return this.request("/api/sdk/briefing");
190
206
  }
191
207
 
192
- async getPositions(): Promise<{ positions: BriefingPosition[] }> {
193
- return this.request("/api/sdk/positions");
208
+ async getPositions(): Promise<{ positions: PositionsPosition[] }> {
209
+ return this.request("/api/sdk/positions?status=active");
194
210
  }
195
211
 
196
212
  async postCycle(data: {
package/src/index.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import { SimmerApi } from "./api.js";
11
- import type { AutomatonState, Skill, SkillOutcome, BriefingPosition } from "./api.js";
11
+ import type { AutomatonState, Skill, SkillOutcome, BriefingPosition, PositionsPosition } from "./api.js";
12
12
  import { selectSkills, tierMaxSkills, type SkillState } from "./bandit.js";
13
13
  import { computeTier, type Tier } from "./tiers.js";
14
14
  import { generateTuningHints, computeTuningChanges, type ConfigChange } from "./tuning.js";
@@ -708,11 +708,14 @@ export default function register(pluginApi: PluginApi) {
708
708
  if (positions.length === 0) {
709
709
  return { text: "No open positions." };
710
710
  }
711
- const lines = positions.map((p: BriefingPosition) => {
711
+ const lines = positions.map((p: PositionsPosition) => {
712
+ const shares = p.shares_yes + p.shares_no;
713
+ const side = p.shares_yes > 0 && p.shares_no > 0 ? "both" : (p.shares_yes > 0 ? "yes" : "no");
712
714
  const pnlStr = p.pnl >= 0 ? `+${fmtCurrency(p.pnl)}` : fmtCurrency(p.pnl);
713
- return `${p.question.slice(0, 55)} | ${p.side} ${p.shares}sh @ ${p.avg_entry.toFixed(2)} → ${p.current_price.toFixed(2)} | ${pnlStr}${p.source ? ` [${p.source}]` : ""}`;
715
+ const src = p.sources?.length ? ` [${p.sources[0]}]` : "";
716
+ return `${p.question.slice(0, 55)} | ${side} ${shares.toFixed(1)}sh @ ${p.avg_cost.toFixed(2)} → ${p.current_price.toFixed(2)} | ${pnlStr}${src}`;
714
717
  });
715
- const totalPnl = positions.reduce((sum: number, p: BriefingPosition) => sum + p.pnl, 0);
718
+ const totalPnl = positions.reduce((sum: number, p: PositionsPosition) => sum + p.pnl, 0);
716
719
  return {
717
720
  text: `Positions (${positions.length}) | Total P&L: ${fmtCurrency(totalPnl)}\n\n${lines.join("\n")}`,
718
721
  };