Skip to content

added websocket to fetch bitcoin price#1

Open
Nsreddy18 wants to merge 3 commits intomainfrom
polymarket_15min_websocket
Open

added websocket to fetch bitcoin price#1
Nsreddy18 wants to merge 3 commits intomainfrom
polymarket_15min_websocket

Conversation

@Nsreddy18
Copy link
Copy Markdown
Collaborator

image

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds WebSocket functionality to monitor live Bitcoin prices from Polymarket's Chainlink price feed in real-time. The implementation tracks 15-minute price windows and calculates price differences from a baseline "price to beat."

Changes:

  • Added new PolymarketLiveMonitor class for WebSocket-based live Bitcoin price streaming
  • Added websockets dependency to requirements.txt

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 10 comments.

File Description
utils/fetchPolymarketLivePrice.py New monitoring class that connects to Polymarket WebSocket API to stream real-time Bitcoin prices and track 15-minute price windows
requirements.txt Added websockets library dependency with version constraint >=12.0,<13.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread utils/fetchPolymarketLivePrice.py Outdated
Comment thread utils/fetchPolymarketLivePrice.py Outdated
Comment thread utils/fetchPolymarketLivePrice.py Outdated
Comment thread utils/fetchPolymarketLivePrice.py Outdated
Comment thread utils/fetchPolymarketLivePrice.py Outdated
Comment thread utils/fetchPolymarketLivePrice.py Outdated
Comment thread utils/fetchPolymarketLivePrice.py Outdated
Comment thread utils/fetchPolymarketLivePrice.py Outdated
Comment thread utils/fetchPolymarketLivePrice.py Outdated
Comment thread utils/fetchPolymarketLivePrice.py Outdated
@Nsreddy18
Copy link
Copy Markdown
Collaborator Author

implemented all the review comments and resolved them

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +91 to +92
ts_str = str(ts_raw)
print(f"[Warning] Bad timestamp received: {ts_raw!r} ({e})")
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

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

When timestamp parsing fails and dt is None, the code continues to calculate and display price information. However, this means price updates without valid timestamps are still printed, which could be confusing and makes it impossible to track when these prices occurred. Consider skipping messages with invalid timestamps.

Suggested change
ts_str = str(ts_raw)
print(f"[Warning] Bad timestamp received: {ts_raw!r} ({e})")
print(f"[Warning] Bad timestamp received: {ts_raw!r} ({e})")
# Skip this message since we cannot reliably determine when it occurred
continue

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

we are getting time stamp from and using that in case of any exception, ref "ts_raw"

Comment thread utils/fetchPolymarketLivePrice.py Outdated
Comment thread utils/fetchPolymarketLivePrice.py Outdated
Comment thread utils/fetchPolymarketLivePrice.py
Comment thread utils/fetchPolymarketLivePrice.py Outdated
Comment thread utils/fetchPolymarketLivePrice.py Outdated
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.

2 participants