WSS Listen to new Trades
import solcoin.listen_pf_trades as lt
if __name__ == "__main__":
try:
lt.start_websocket("wss://solana-api.instantnodes.io/API_KEY", "")
except Exception as e:
print(f"Unexpected error in main event loop: {e}")listen_pf_trades.start_websocket("wss://solana-api.instantnodes.io/API_KEY", "9tGpPyY8Je18pgTidgJ1jpzA7ywuk1RpLpryJT9Gpump") # filters to only show trades on the token 9tGpPyY8Je18pgTidgJ1jpzA7ywuk1RpLpryJT9Gpump
Example Output
{
'mint': mint pubkey,
'sol_amount': Amount of sol transacted,
'token_amount': Amount of tokens transacted,
'is_buy': If the transaction is buying an user buying a token,
'user': user who conducted the transaction,
'timestamp': time of transaction,
'virtual_sol_reserves': bonding curve's current virtural sol reserves in lamports,
'virtual_token_reserves': bonding curve's virtural token reserves x 10^6,
'txn_sig': transaction signature
}Last updated