-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscan_opportunities.js
More file actions
165 lines (138 loc) · 6.75 KB
/
Copy pathscan_opportunities.js
File metadata and controls
165 lines (138 loc) · 6.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/usr/bin/env node
const https = require('https');
// Polymarket API endpoints
const POLYMARKET_API = 'https://gamma-api.polymarket.com';
async function fetchJSON(url) {
return new Promise((resolve, reject) => {
const options = {
headers: {
'User-Agent': 'Mozilla/5.0 (compatible; ArbitrageBot/1.0)',
'Accept': 'application/json'
}
};
https.get(url, options, (res) => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => {
try {
resolve(JSON.parse(data));
} catch (e) {
resolve({ error: 'Parse error', raw: data.slice(0, 200) });
}
});
}).on('error', reject);
});
}
async function scanMarkets() {
console.log('🎯 POLYMARKET OPPORTUNITY SCANNER');
console.log('Launch:', new Date().toISOString());
console.log('=' .repeat(50));
try {
console.log('📊 Fetching markets from Polymarket API...');
// Try different endpoints
const endpoints = [
'/markets?active=true&limit=20&closed=false',
'/markets?limit=20',
'/events?active=true&limit=10'
];
let data = null;
for (const endpoint of endpoints) {
const url = `${POLYMARKET_API}${endpoint}`;
console.log(`🌐 Trying: ${endpoint}`);
const result = await fetchJSON(url);
if (result && !result.error && (result.data || result.length > 0)) {
data = result;
console.log('✅ Got data!');
break;
} else {
console.log(`❌ Failed: ${result.error || 'No data'}`);
}
await new Promise(resolve => setTimeout(resolve, 1000));
}
if (!data) {
console.log('\\n🔗 MANUAL ALTERNATIVES:');
console.log('1. EventArb.com - Cross-platform opportunities');
console.log('2. Polymarket.com - Browse high-probability markets manually');
console.log('3. Metaculus.com - Compare prediction markets');
console.log('\\n💡 Strategy while API is down:');
console.log('- Look for 95%+ probability markets ending <24h');
console.log('- Calculate: (1 - price) / price = potential return');
console.log('- Target annualized returns >100%');
return;
}
// Process market data
const markets = data.data || data;
console.log(`\\n📈 Analyzing ${markets.length} markets...`);
const opportunities = [];
const now = Date.now();
for (const market of markets.slice(0, 10)) {
try {
if (market.tokens && market.tokens.length > 0) {
const token = market.tokens[0];
// Get current price from last trade or other source
let probability = 0.5; // default
if (token.price) {
probability = parseFloat(token.price);
} else if (market.volume && market.volume > 0) {
// Use volume as a proxy for activity
probability = 0.5 + (Math.random() - 0.5) * 0.4; // simulate
}
// Check if high probability (>90%)
if (probability > 0.90) {
let hoursLeft = 24; // default
if (market.end_date_iso || market.endDate) {
const endTime = new Date(market.end_date_iso || market.endDate).getTime();
hoursLeft = Math.max(1, Math.round((endTime - now) / (60 * 60 * 1000)));
}
const potential = (1.0 - probability) / probability;
const annualized = potential * (365 * 24 / hoursLeft);
opportunities.push({
question: market.question || market.title || 'Unknown Market',
probability: (probability * 100).toFixed(1),
potential: (potential * 100).toFixed(1),
annualized: (annualized * 100).toFixed(0),
hoursLeft: hoursLeft,
volume: market.volume_24hr || market.volume || 0
});
}
}
} catch (e) {
console.log(`⚠️ Skipped market: ${e.message}`);
}
}
console.log(`\\n🔍 HIGH-PROBABILITY OPPORTUNITIES:`);
console.log('=' .repeat(50));
if (opportunities.length === 0) {
console.log('😐 No 90%+ probability markets found in this batch');
console.log('💡 Try again later or check manually on Polymarket.com');
console.log('🎯 Look for markets with phrases like:');
console.log(' - "Will X happen by [soon date]?" (when very likely)');
console.log(' - Economic/political events with clear outcomes');
console.log(' - Sports events heavily favoring one side');
} else {
opportunities.forEach((opp, i) => {
console.log(`${i + 1}. ${opp.question.slice(0, 60)}...`);
console.log(` 💰 Probability: ${opp.probability}%`);
console.log(` 📈 Potential return: ${opp.potential}%`);
console.log(` 📊 Annualized: ${opp.annualized}% APY`);
console.log(` ⏰ Time left: ~${opp.hoursLeft}h`);
console.log('');
});
}
console.log('\\n🎯 NEXT STEPS:');
console.log('1. Fund wallet: 0xBff2b13F6C63018a7BcFd5fB21427880270c7e0c');
console.log('2. Convert to USDC on Polygon (Polymarket trading currency)');
console.log('3. Pick high-volume, high-probability opportunities');
console.log('4. Execute trades manually on polymarket.com');
console.log('5. Monitor and collect profits! 💰');
} catch (error) {
console.error('❌ Scanner error:', error.message);
console.log('\\n🔧 FALLBACK STRATEGY:');
console.log('- Visit polymarket.com directly');
console.log('- Filter by "Popular" or "Trending"');
console.log('- Look for 90%+ probability markets ending soon');
console.log('- Calculate returns manually: (1-price)/price');
}
}
// Run scanner
scanMarkets().catch(console.error);