-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_maker.py
More file actions
60 lines (51 loc) · 1.96 KB
/
simple_maker.py
File metadata and controls
60 lines (51 loc) · 1.96 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
import time
import traceback
from poly_data.polymarket_client import PolymarketClient
from poly_data.sheets import get_market_configs
from poly_data.strategy import Strategy
def main():
print("Starting PolyMaker Passive Maker...")
try:
client = PolymarketClient()
except Exception as e:
print(f"Failed to initialize Polymarket Client: {e}")
traceback.print_exc()
return
strategies = []
# Load configs
try:
df = get_market_configs()
print(f"Loaded {len(df)} market configurations.")
for _, row in df.iterrows():
try:
# Convert row to dict
config = row.to_dict()
strategy = Strategy(client, config)
strategies.append(strategy)
except Exception as e:
print(f"Failed to init strategy for {row.get('token_id', 'unknown')}: {e}")
print(f"Initialized {len(strategies)} strategies.")
except Exception as e:
print(f"Error loading configs: {e}")
traceback.print_exc()
return
# Main Loop
while True:
cycle_start = time.time()
for strategy in strategies:
try:
# Check cycle delay
if time.time() - strategy.last_tick_time >= strategy.cycle_delay:
strategy.run_tick()
# Small sleep to yield CPU if needed, but not blocking others significantly
# Actually TSe says "Sequential processing ... potential delays".
# If we don't sleep here, we might hit rate limits if many strategies run instantly.
# But cycle_delay handles per-market delay.
pass
except Exception as e:
print(f"Error in strategy {strategy.token_id}: {e}")
traceback.print_exc()
# Avoid tight loop if all strategies are waiting
time.sleep(0.1)
if __name__ == "__main__":
main()