@madgallery/rbs-pm-sdk 1.0.11 → 1.0.12
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/SKILL.md +24 -3
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -139,12 +139,12 @@ const markets = await client.getMarkets();
|
|
|
139
139
|
|
|
140
140
|
// Find highest volume market
|
|
141
141
|
const topMarket = markets.sort((a, b) =>
|
|
142
|
-
(b.
|
|
142
|
+
(b.totalVolume || 0) - (a.totalVolume || 0)
|
|
143
143
|
)[0];
|
|
144
144
|
|
|
145
145
|
console.log(`Top: ${topMarket.question}`);
|
|
146
|
-
console.log(`Volume: $${topMarket.
|
|
147
|
-
console.log(`YES: ${(topMarket.
|
|
146
|
+
console.log(`Volume: $${topMarket.totalVolume} USDC`);
|
|
147
|
+
console.log(`YES: ${(topMarket.yesPrice * 100).toFixed(1)}%`);
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
### 2. Get Real-Time Prices (0.0001 USDC)
|
|
@@ -438,6 +438,7 @@ interface HeartbeatStatus {
|
|
|
438
438
|
balances: { mon: string; usdc: string };
|
|
439
439
|
portfolio: { totalPositions: number; totalValue: string };
|
|
440
440
|
newMarkets: Array<{ address: string; question: string; yesPrice: number }>;
|
|
441
|
+
marketsToResolve: Array<{ address: string; question: string }>;
|
|
441
442
|
canTrade: boolean;
|
|
442
443
|
errors: string[];
|
|
443
444
|
}
|
|
@@ -472,6 +473,16 @@ async function heartbeat(): Promise<HeartbeatStatus> {
|
|
|
472
473
|
return { address: m.address, question: m.question, yesPrice: m.yesPrice };
|
|
473
474
|
});
|
|
474
475
|
|
|
476
|
+
// Check for markets you need to resolve (you are oracle + past resolution time)
|
|
477
|
+
const marketsToResolve: Array<{ address: string; question: string }> = [];
|
|
478
|
+
for (const market of allMarkets) {
|
|
479
|
+
const status = await client.canResolve(market.address);
|
|
480
|
+
if (status.canResolve) {
|
|
481
|
+
marketsToResolve.push({ address: market.address, question: market.question });
|
|
482
|
+
errors.push(`RESOLVE NEEDED: "${market.question}"`);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
475
486
|
return {
|
|
476
487
|
healthy: errors.length === 0,
|
|
477
488
|
wallet,
|
|
@@ -481,6 +492,7 @@ async function heartbeat(): Promise<HeartbeatStatus> {
|
|
|
481
492
|
totalValue: portfolio.summary.totalValue,
|
|
482
493
|
},
|
|
483
494
|
newMarkets,
|
|
495
|
+
marketsToResolve,
|
|
484
496
|
canTrade: hasGas && hasUsdc,
|
|
485
497
|
errors,
|
|
486
498
|
};
|
|
@@ -493,6 +505,15 @@ setInterval(async () => {
|
|
|
493
505
|
const status = await heartbeat();
|
|
494
506
|
console.log(`Heartbeat #${heartbeatCount}:`, status);
|
|
495
507
|
|
|
508
|
+
// Resolve any markets that need it — research the outcome first!
|
|
509
|
+
for (const market of status.marketsToResolve) {
|
|
510
|
+
console.log(`Market needs resolution: "${market.question}"`);
|
|
511
|
+
// IMPORTANT: Research the actual outcome before resolving.
|
|
512
|
+
// Use web search, news, data sources to determine if YES or NO won.
|
|
513
|
+
// const yesWins = await researchOutcome(market.question);
|
|
514
|
+
// await client.resolve(market.address, yesWins);
|
|
515
|
+
}
|
|
516
|
+
|
|
496
517
|
if (heartbeatCount % 10 === 0 && status.canTrade) {
|
|
497
518
|
await createInterestingMarket();
|
|
498
519
|
}
|