|
| 1 | +--- |
| 2 | +title: "Bitcoin Up or Down Polymarket API - Stream Trades" |
| 3 | +description: "Query and stream Polymarket Bitcoin Up or Down prediction market trades via GraphQL. Real-time subscriptions and historical queries on Polygon. Filter by question title for Bitcoin price direction markets." |
| 4 | +keywords: |
| 5 | + - Bitcoin Polymarket API |
| 6 | + - Bitcoin Up or Down prediction market |
| 7 | + - Polymarket Bitcoin trades |
| 8 | + - Bitcoin prediction market GraphQL |
| 9 | + - stream Bitcoin Polymarket trades |
| 10 | + - Polygon prediction market Bitcoin |
| 11 | + - Bitcoin price direction market API |
| 12 | + - PredictionTrades Bitcoin |
| 13 | +--- |
| 14 | + |
| 15 | +# Bitcoin Up or Down Polymarket API |
| 16 | + |
| 17 | +Query and stream **Bitcoin Up or Down** prediction market trades on Polymarket. These markets ask whether Bitcoin will be **up** or **down** at a specific time (e.g. daily or weekly settlement). |
| 18 | + |
| 19 | + |
| 20 | +## How Bitcoin Up or Down markets are identified |
| 21 | + |
| 22 | +Trades are filtered by **Question.Title** containing **"Bitcoin Up or Down"**. |
| 23 | + |
| 24 | +| Filter | Use case | Where to apply | |
| 25 | +| ---------------- | --------------------------------- | -------------------------------------------- | |
| 26 | +| **Question.Title** | Bitcoin Up or Down markets only | `Trade.Prediction.Question.Title.includes` | |
| 27 | +| **ProtocolName** | Polymarket only (optional) | `Trade.Prediction.Marketplace.ProtocolName` | |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Real-time: Subscriptions and Kafka |
| 32 | + |
| 33 | +### GraphQL subscriptions |
| 34 | + |
| 35 | +The **subscription** below streams live Bitcoin Up or Down trades as they occur on Polygon. Change `subscription` to `query` and add `limit` / `orderBy` for historical results. |
| 36 | + |
| 37 | +### Kafka streams |
| 38 | + |
| 39 | +For **ultra-low-latency** consumption, prediction market data (including Bitcoin Up/Down) is available via **Kafka**: |
| 40 | + |
| 41 | +- **`matic.predictions.proto`** — Raw prediction market events (trades, creations, resolutions) |
| 42 | +- **`matic.broadcasted.predictions.proto`** — Mempool prediction market data |
| 43 | + |
| 44 | +Kafka requires **separate credentials**. See [Kafka Streaming Concepts](https://docs.bitquery.io/docs/streams/kafka-streaming-concepts/). For access, [contact support](https://t.me/bloxy_info) or email support@bitquery.io. |
| 45 | + |
| 46 | +--- |
| 47 | + |
| 48 | +## Stream Bitcoin Up or Down trades (real-time) |
| 49 | + |
| 50 | +Subscribe to live Polymarket trades for markets whose question title includes **"Bitcoin Up or Down"**. Includes block time, call/log signatures, full outcome trade details (buyer, seller, amount, price, USD values), and prediction metadata (question, outcomes, collateral token, marketplace). |
| 51 | + |
| 52 | +[Run in Bitquery IDE](https://ide.bitquery.io/Bitcoin-Up-or-Down-Trades-Stream) |
| 53 | + |
| 54 | +```graphql |
| 55 | +subscription { |
| 56 | + EVM(network: matic) { |
| 57 | + PredictionTrades( |
| 58 | + where: { |
| 59 | + Trade: { |
| 60 | + Prediction: { |
| 61 | + Marketplace: { ProtocolName: { is: "polymarket" } } |
| 62 | + Question: { Title: { includes: "Bitcoin Up or Down" } } |
| 63 | + } |
| 64 | + } |
| 65 | + } |
| 66 | + ) { |
| 67 | + Block { |
| 68 | + Time |
| 69 | + } |
| 70 | + Call { |
| 71 | + Signature { |
| 72 | + Name |
| 73 | + } |
| 74 | + } |
| 75 | + Log { |
| 76 | + Signature { |
| 77 | + Name |
| 78 | + } |
| 79 | + SmartContract |
| 80 | + } |
| 81 | + Trade { |
| 82 | + OutcomeTrade { |
| 83 | + Buyer |
| 84 | + Seller |
| 85 | + Amount |
| 86 | + CollateralAmount |
| 87 | + CollateralAmountInUSD |
| 88 | + OrderId |
| 89 | + Price |
| 90 | + PriceInUSD |
| 91 | + IsOutcomeBuy |
| 92 | + } |
| 93 | + Prediction { |
| 94 | + CollateralToken { |
| 95 | + Name |
| 96 | + Symbol |
| 97 | + SmartContract |
| 98 | + AssetId |
| 99 | + } |
| 100 | + ConditionId |
| 101 | + OutcomeToken { |
| 102 | + Name |
| 103 | + Symbol |
| 104 | + SmartContract |
| 105 | + AssetId |
| 106 | + } |
| 107 | + Marketplace { |
| 108 | + SmartContract |
| 109 | + ProtocolVersion |
| 110 | + ProtocolName |
| 111 | + ProtocolFamily |
| 112 | + } |
| 113 | + Question { |
| 114 | + Title |
| 115 | + ResolutionSource |
| 116 | + Image |
| 117 | + MarketId |
| 118 | + Id |
| 119 | + CreatedAt |
| 120 | + } |
| 121 | + Outcome { |
| 122 | + Id |
| 123 | + Index |
| 124 | + Label |
| 125 | + } |
| 126 | + } |
| 127 | + } |
| 128 | + Transaction { |
| 129 | + From |
| 130 | + Hash |
| 131 | + } |
| 132 | + } |
| 133 | + } |
| 134 | +} |
| 135 | +``` |
| 136 | + |
| 137 | +## Top Traders of Bitcoin Up or Down Market by Volume |
| 138 | + |
| 139 | +This **query** returns the top 10 **buyers** and top 10 **sellers** by traded volume in Bitcoin Up or Down markets on Polymarket over the last 24 hours. Results are aggregated by trader address and ordered by `buy_amount` (buyers) or `sell_amount` (sellers). |
| 140 | + |
| 141 | +[Run in Bitquery IDE](https://ide.bitquery.io/Top-BuyersSellers-of-Bitcoin-up-down-market) |
| 142 | + |
| 143 | +```graphql |
| 144 | +{ |
| 145 | + EVM(network: matic) { |
| 146 | + Top_buyers: PredictionTrades( |
| 147 | + where: {Trade: {Prediction: {Marketplace: {ProtocolName: {is: "polymarket"}}, Question: {Title: {includes: "Bitcoin Up or Down"}}}, OutcomeTrade: {IsOutcomeBuy: true}}, Block: {Time: {since_relative: {hours_ago: 24}}}} |
| 148 | + limit: {count: 10} |
| 149 | + orderBy: {descendingByField: "buy_amount"} |
| 150 | + ) { |
| 151 | + Trade { |
| 152 | + OutcomeTrade { |
| 153 | + Buyer |
| 154 | + } |
| 155 | + } |
| 156 | + buy_amount: sum(of: Trade_OutcomeTrade_Amount) |
| 157 | + } |
| 158 | + Top_sellers: PredictionTrades( |
| 159 | + where: {Trade: {Prediction: {Marketplace: {ProtocolName: {is: "polymarket"}}, Question: {Title: {includes: "Bitcoin Up or Down"}}}, OutcomeTrade: {IsOutcomeBuy: false}}, Block: {Time: {since_relative: {hours_ago: 24}}}} |
| 160 | + limit: {count: 10} |
| 161 | + orderBy: {descendingByField: "sell_amount"} |
| 162 | + ) { |
| 163 | + Trade { |
| 164 | + OutcomeTrade { |
| 165 | + Buyer |
| 166 | + } |
| 167 | + } |
| 168 | + sell_amount: sum(of: Trade_OutcomeTrade_Amount) |
| 169 | + } |
| 170 | + } |
| 171 | +} |
| 172 | +``` |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | +## Related APIs |
| 177 | + |
| 178 | +| Need | API | |
| 179 | +| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | |
| 180 | +| **All Polymarket trades & prices** | [Polymarket API](https://docs.bitquery.io/docs/examples/polymarket-api/polymarket-api/) / [Prediction Trades API](https://docs.bitquery.io/docs/examples/prediction-market/prediction-trades-api/) | |
| 181 | +| **Filter by slug, condition, token** | [Polymarket Markets API](https://docs.bitquery.io/docs/examples/polymarket-api/polymarket-markets-api/) | |
| 182 | +| **Settlements & redemptions** | [Prediction Settlements API](https://docs.bitquery.io/docs/examples/prediction-market/prediction-settlements-api/) | |
| 183 | +| **Market creation & resolution** | [Prediction Market API](https://docs.bitquery.io/docs/examples/prediction-market/prediction-market-api/) | |
| 184 | +| **User & wallet activity** | [Polymarket Wallet & User Activity API](https://docs.bitquery.io/docs/examples/polymarket-api/polymarket-wallet-api/) | |
| 185 | +| **Real-time: Kafka streams** | [Kafka Streaming Concepts](https://docs.bitquery.io/docs/streams/kafka-streaming-concepts/) | |
| 186 | + |
| 187 | +--- |
| 188 | + |
| 189 | +## Support |
| 190 | + |
| 191 | +- [Bitquery Telegram](https://t.me/bloxy_info) |
0 commit comments