Skip to content
Discussion options

You must be logged in to vote

To get the best price on a live market, you should not rely on a single price feed.

Instead, you need to use a real-time orderbook-based pricing source, depending on your execution style:

  1. Use exchange WebSocket orderbook (best option)
  • Subscribe to level 2 orderbook (best bid/ask)
  • This gives true executable prices, not delayed last-trade price
  • Example sources: Coinbase WebSocket / Binance depth stream
  1. Use mid-price only as reference (not execution)
  • mid = (best bid + best ask) / 2
  • Useful for strategy logic, NOT for trading decisions
  1. Avoid REST price polling for execution
  • REST APIs are too slow (stale by 500ms–2s+)
  • Leads to bad fills and slippage
  1. Best practice (what pro bots do)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by 0xpolyD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug GitHub or a GitHub feature is not working as intended Codespaces Your development environment, in the cloud. Run VS Code and code on GitHub's cloud platform, Welcome 🎉 Used to greet and highlight first-time discussion participants. Welcome to the community! source:ui Discussions created via Community GitHub templates
2 participants