Im running this python code here to query and print all tokens & balance of my address:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
###GET ALL TOKENS OF BSC AND ETHEREUM ADDRESS
import requests
import config
print('#BSC BALANCES')
print('')
print('')
addressM = ''
def run_query(query): # A simple function to use requests.post to make the API call.
headers = {'X-API-KEY': config.bitquery}
request = requests.post('https://graphql.bitquery.io/',
json={'query': query}, headers=headers)
if request.status_code == 200:
return request.json()
else:
raise Exception('Query failed and return code is {}. {}'.format(request.status_code,
query))
# The GraphQL query
query = """
{
ethereum(network: bsc) {
address(address: {is: "0x7f64dD54E1637bFAdbF767e03809495fC9fBffeC"}) {
balances {
currency {
symbol
address
}
value
}
}
}
}
"""
result = run_query(query) # Execute the query
#print('Result - {}'.format(result))
assets = result['data']['ethereum']['address']
#print(assets)
balances = assets[0]['balances']
for i in balances:
if int(i['value']) > 0:
print("Symbol: " + str(i['currency']['symbol']) + " || " + "Value: " + str(i['value']) + " || " + str(i['currency']['address']))
and here is the output i get
#BSC BALANCES
Symbol: SHIBABANK || Value: 174999820085.73782 || 0x5198fe8bdb671d3c82b900e14ed69698f40fea81
Symbol: MM || Value: 6444754422.349387 || 0x54d35d08f9b57c822f6705c3efda9f6d75b2bc85
Symbol: $ASTRO || Value: 4714076656.192579 || 0xf14e098bed18475d62f8789244d3d5e1a9a30aaa
Symbol: START || Value: 23173537975.000004 || 0x49eefbe1b72fe9aa1835f198eb87d0df05d6e533
Symbol: SAFEMOON || Value: 5866944.30876162 || 0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3
Symbol: CHAD || Value: 1065046775.6407356 || 0xea8eacce22bbb89709482c0100e75e7ab90f53f4
Symbol: ANON || Value: 793515.72365283 || 0xfd78aaed1e3f2d06dbde9510c6dc14112eca896d
Symbol: JIND || Value: 48583101.95182792 || 0x22d6363949e295873d261b812a281d014367e8f9
Symbol: SAKURA || Value: 2921525509.396641 || 0x6f0dc06c4d843f7819783f9db7495c219da4a135
Symbol: SCORGI || Value: 438275432.7630438 || 0x5a81b31b4a5f2d2a36bbd4d755dab378de735565
Symbol: NFTPUNK || Value: 226727578269.37314 || 0x31de61d9a39cb9f479570bd3dc3ac93bc0402cdb
Symbol: TONE || Value: 8290133148.071136 || 0xbcdfd50ead6b6da1970464985fab894fb83d17c0
Symbol: Cake-LP || Value: 360.65234525 || 0xe154be38dd932a1a0e5c567e083c51750edd24d4
Symbol: Mammoth || Value: 185540.09603949 || 0x86694906bdfe7cf66ba4959b9f7761034fd72f3c
Symbol: GPA || Value: 12007329.18481322 || 0xa10b40df94e310ee21af05827659ffe718dfbc6e
Symbol: BOG || Value: 398773155809.0361 || 0xfaf004298e3fe9a17505415d942ece03cf219bd2
Symbol: ELONSTOP || Value: 3341448.89741386 || 0x20ec37d55490d415287eedf6784673762c90f717
Symbol: PINK || Value: 1451442.56541767 || 0xfb316959e3fa8a9b425aced4afe0b5ee2d0e82e3
Symbol: SBUN || Value: 510475564884.3776 || 0xf0aecfb528b090c2dff6a835bcf396123e8ca654
Symbol: FEG || Value: 286440572.609194 || 0xacfc95585d80ab62f67a14c566c1b7a49fe91167
Symbol: MOON.Co || Value: 740893368.7402625 || 0xf87dfb5214db6da5f75d752ba428d29791d6ca67
Symbol: MEME || Value: 532308883131.3624 || 0x0f94e143532f8e469ca2122d48533312e759587b
Symbol: HDOGE || Value: 172307.23414496 || 0xa8f9e2377f545f7b711be7d8c88d5cee43f639c1
Symbol: SAFEPUMP || Value: 21365804694.605923 || 0xb6e9bd8a4856bfc3025f85c7643131b9c78aee2a
Symbol: DLPHN || Value: 307831972436573.0 || 0xded029d565451ea72ab2de9e847289e8147901a1
Symbol: CC || Value: 220188565747.5789 || 0xb000e9f1f08c75136b6ffcf3157fd2357676810c
Symbol: MEME || Value: 34100853268317.688 || 0xcfa5f8d18dea1f82b7837f7422561f497ec43012
Symbol: UMS || Value: 121338.03657182 || 0x26ff87835dfef4b0f9bb18cc8125429da91fb4f4
Symbol: ELEPHANT || Value: 2531329008.3794904 || 0xe283d0e3b8c102badf5e8166b73e02d96d92f688
Symbol: SW || Value: 15684525281.423628 || 0x9eb3ec6bb46fb4b48ec2bb7f3599f23ef671a62b
Symbol: POG || Value: 10990076.0 || 0x1bcccd1aac451df2ce62eae7ad9b235bbdecd2e5
Symbol: ?GUAC || Value: 69563528.63749385 || 0xc97ebaeb72ce6e95ca890c9f15058e15a2fd0bfe
Symbol: QShiba || Value: 36104030476.7954 || 0x722a9b4274ecd033f79747e506b9b3a754ebf914
Symbol: FAIRC || Value: 108380813603.6753 || 0xe1e8d182a4322dc0072734e158bf5189924cabe4
Symbol: boock || Value: 1e+16 || 0x702f71abcfbdb185c7c3b98976cf135698ab8bf5
The token match but the balance of the token dont match with what i get from bscscan or in my metamask.
the results from bitquery are way off