Skip to content

Conversation

@CRF1408
Copy link

@CRF1408 CRF1408 commented Dec 27, 2025

Adds a simple example demonstrating a DCA trading loop, showing how to use the client to select a market and repeatedly place small orders.


Note

Introduces a minimal DCA strategy example demonstrating periodic order placement flow.

  • New agents/examples/dca_strategy.py uses Polymarket client to fetch markets and pick the target via min(..., key=lambda m: m.spread)
  • Configurable amount_per_purchase and interval_seconds; runs an infinite loop printing intended buys (placeholder for client.place_order(...))

Written by Cursor Bugbot for commit a7f444a. This will update automatically on new commits. Configure here.

Adds a simple example demonstrating a DCA trading loop, showing how to use the client to select a market and repeatedly place small orders.

print(f"Starting DCA on market {target.ticker}...")
while True:
print(f"Buying {amount_per_purchase} shares of {target.ticker}")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessing non-existent ticker attribute on SimpleMarket

The SimpleMarket class returned by get_all_markets() doesn't have a ticker attribute. The class has id, question, spread, outcomes, etc., but no ticker field. Accessing target.ticker will raise an AttributeError at runtime, preventing the script from executing. A valid identifier like question or id should be used instead.

Fix in Cursor Fix in Web

def main() -> None:
client = Polymarket()
markets = client.get_all_markets()
target = min(markets, key=lambda m: m.spread)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling min() on potentially empty markets list

The get_all_markets() method can return an empty list if the API call fails (non-200 status code) or if all market parsing fails. Calling min() on an empty sequence raises a ValueError. The code lacks a check for this scenario before selecting the target market.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant