NFT trading introduction.


NFTs or Non Fungible tokens are blockchain based assets that are supposed to be unique and cannot be surrogate. NFT technology guarantie ownership on a digital ledger system and are bought and sold online in specific marketplaces. NFTs value is based on demand and they can be considered to be profitable but risky assets for investment.

During last several years we witness increadible groth of NFT market, followed by rather predictable breakdown. There are some conspiracy theories that NFT is used for money laundry process, but we will not concentrate on that topic here. We can only guess how stable this market will be in the future, but many proffesiional investors consider to include NFT assetets in their investment portfolio along with other modern trading instruments like crypto.

trading nft with python.



How to get NFT trading data ?


Original NFT trading information is provided by BINANCE cryptocurrency exchange which at this moment is the largest exchange in the world in terms of daily trading volume of cryptocurrencies.

But in our case we will use Python to access free NFT APIs from rapidapi.com, you need to get "your-api-key". Free API key will allow certain amount of requests per day and per month, in case of wider commercial use you can chose sutable paid subscription.

Output data is in JSON format which can be easily converted to any suitable form for further visualisation and analysis, NFT trading data will give you a new way to divercify your portfolio and hopefully gain stable market profits.



Python code to get NFT top collections data:



import requests

url = "https://binance-nft.p.rapidapi.com/top-collections/"

querystring = {"day":"7"}

headers = {
"X-RapidAPI-Key": "your-api-key",
"X-RapidAPI-Host": "binance-nft.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)

NFT top collections data output (shown partly):



{"code":"000000","message":null,"messageDetail":null,"data":{"list":[{"collectionId":"602078823622049792","coverUrl":"https:\/\/public.nftstatic.com\/static\/nft\/res\/8a48cfdc825c445b9a71878737d85ffa.png","title":"BULL BTC CLUB","network":null,"volume":"268041.51270579","growthRate":-26.47,"salesCount":517,"itemsCount":43395,"floorPrice":"4.17","currency":"BUSD","rank":1,"assetType":1,"verified":1}...


Python code to get NFT top creators data:



import requests

url = "https://binance-nft.p.rapidapi.com/top-creators/"

querystring = {"day":"0"}

headers = {
"X-RapidAPI-Key": "your-api-key",
"X-RapidAPI-Host": "binance-nft.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)

NFT top creators data output (shown partly):



{"code":"000000","message":null,"messageDetail":null,"data":{"list":[{"volume":"15085953.42975092","salesCount":4874,"itemsCount":3000,"creatorId":"c19522ee08f014f8b98d7f3ce4309f64","creatorIdOrig":null,"nickName":"Mytheria","avatarUrl":"https:\/\/public.nftstatic.com\/static\/nft\/res\/72fa11dc46ba4fcc982130448e45a196.png","rank":1,"fansCount":2567,"followRelation":0}...

Python code to get NFT top sales data:



import requests

url = "https://binance-nft.p.rapidapi.com/top-sales/"

querystring = {"day":"0"}

headers = {
"X-RapidAPI-Key": "your-api-key",
"X-RapidAPI-Host": "binance-nft.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)

NFT top sales data output (shown partly):



{"code":"000000","message":null,"messageDetail":null,"data":{"list":[{"nftId":10,"nftType":1,"coverUrl":"https:\/\/public.nftstatic.com\/static\/nft\/res\/38c1f092a4a448b297a93d9a67649d42.jpeg","title":"Three Self-Portraits","price":"2400000","currency":"BUSD","network":"BSC","tradeTime":1624788021000,"creatorId":"dbbd356aac203f9a5527826867c54be5","nickName":"Anonymous-User-bb266","avatarUrl":"","rank":1}...

Python code to get NFT top gainers data:



import requests

url = "https://binance-nft.p.rapidapi.com/top-gainers/"

headers = {
"X-RapidAPI-Key": "your-api-key",
"X-RapidAPI-Host": "binance-nft.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers)

print(response.text)

NFT top gainers data output (shown partly):



{"code":"000000","message":null,"messageDetail":null,"data":{"list":[{"collectionId":"279879349032264704","itemId":"0","coverUrl":"https:\/\/public.nftstatic.com\/static\/nft\/res\/3f66693009c5405e9f147565cdb479ec.png","title":"Spooktacular Scavenger Hunt","rarity":999,"growthRate":1150.2,"salesCount":1591,"highestPrice":"1151.2","floorPrice":"1.8","currency":"BUSD","serialsName":"Spooktacular Scavenger Hunt","rank":1,"averagePrice":"4.0095888"}...

Python code to get NFT market mystery recommend data:



import requests

url = "https://binance-nft.p.rapidapi.com/market-mystery-recommend/"

headers = {
"X-RapidAPI-Key": "your-api-key",
"X-RapidAPI-Host": "binance-nft.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers)

print(response.text)

NFT market mystery recommend data output:



{"code":"000000","message":null,"messageDetail":null,"data":[{"collectionId":"281336102949300224","collectionName":"Dvision Land Mystery Box","coverUrl":"https:\/\/public.nftstatic.com\/static\/nft\/res\/4b1e0bdcc51e41a7afc922a93dac81d7.png"},{"collectionId":"279879349032264704","collectionName":"Spooktacular Scavenger Hunt","coverUrl":"https:\/\/public.nftstatic.com\/static\/nft\/res\/3f66693009c5405e9f147565cdb479ec.png"},{"collectionId":"180885755495849984","collectionName":"Return of Legends S3","coverUrl":"https:\/\/public.nftstatic.com\/static\/nft\/res\/a1147ea050d949c0b3bb5719eac84524.png"},{"collectionId":"109191979564517376","collectionName":"Return of Legends S1","coverUrl":"https:\/\/public.nftstatic.com\/static\/nft\/res\/d3ef000b399d402bb8ea6e378b0c0f50.png"}],"success":true,"time_gen":1.81}




See also related topics: