Run Solana subscription in R and CURL

Hi everyone,

Any idea how to run this subscription in R and alternatively in CURL:

subscription{
  Solana {
    DEXTradeByTokens(
      orderBy: {descendingByField: "Block_Timefield"}
      where: {Trade: {Currency: {MintAddress: {is: "6D7NaB2xsLd7cauWu1wKk6KBsJohJmP2qZH9GEfVi5Ui"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}, Dex: {ProgramAddress: {is: "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"}}}}
    ) {
      Block {
        Timefield: Time(interval: {in: minutes, count: 1})
      }
      volume: sum(of: Trade_Amount)
      Trade {
        high: Price(maximum: Trade_Price)
        low: Price(minimum: Trade_Price)
        open: Price(minimum: Block_Slot)
        close: Price(maximum: Block_Slot)
      }
      count
    }
  }
}

@Divya could you help please?

Thank you

Hello,

You are running a subscription query which gives you real-time information. Aggregation does not work in this case. You cannot get OHLC via subscriptions. Use query instead.

Regarding the curl code, here’s an example ( I dont think wss is supported in curl, I could be wrong)

curl -X POST https://streaming.bitquery.io/eap \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ory_at_3J5Q...." \
-d '{
  "query": "query { Solana { Transactions(limit: {count: 10}) { Block { Time Hash } Transaction { BalanceUpdatesCount Accounts { Address IsWritable } Signer Signature Result { Success ErrorMessage } Index Fee TokenBalanceUpdatesCount InstructionsCount } } } }"
}'
1 Like

Thanks mate. That seems to work!