Recently during the launch of ChickenTribe on the Solana blockchain, I became intrigued by a certain NFT. If you watch TV or don't have adblocker you've probably seen ads for FTX everywhere. FTX, in my opinion, is the premier trading platform for cryptocurrencies. I prefer it to coinbase and I think its relevance will only grow. They just completed a fundraising round for $420 million dollar from 69 investors.
During this time, ChickenTribe #0 was listed for sale, but returned an error when I clicked purchase. I thought, let me try to create an api to ping this until it's able to sell and buy it programmatically. What I was surprised by was just how easy it is to call FTX via its API and act on the data you receive.
To get info about a particular NFT all we need to do is write and run this python program:
import requests
import json
while True:
try:
data = requests.get('https://ftx.us/api/nft/nft/485223445421518089').json()
result = data['result']
result_formatted = json.dumps(result, indent=2)
print(result_formatted)
break
except Exception as e:
print(f'Error obtaining NFT data: {e}')
This returns:
{
"id": "485223445421518089",
"name": "ChickenTribe #0",
"description": null,
"issuer": "ChickenTribe",
"collection": "ChickenTribe",
"series": "ChickenTribe",
"solMintAddress": "Du7roiVM8VzX6GFiQLYePcp1fLnkDhxWdFeQN4GMpAQF",
"ethContractAddress": null,
"imageUrl": "https://www.arweave.net/FnSVZj95IP0uYpU0mcHVr3TPUvCewxwTNgCQ1Ff6Xjc?ext=png",
"videoUrl": null,
"animationUrl": null,
"thumbnailUrl": null,
"attributes": {
"Backgrounds": "Rust Red",
"Bodies": "Fall",
"Heads": "Ruby",
"Faces": "Lava",
"Combs": "Basic Purple",
"Eyes": "None",
"Accessories": "None",
"Smokes": "None"
},
"attributesList": [
{
"value": "Rust Red",
"trait_type": "Backgrounds"
},
],
"number": "0",
"totalQuantity": null,
"redeemable": false,
"redeemed": false,
"offerPrice": null,
"donation": false,
"status": "approved",
"needsListingFee": false,
"featured": false,
"created_at": "2021-10-29T15:42:44.431599+00:00",
"createdAt": "2021-10-29T15:42:44.431599+00:00",
"quoteCurrency": "SOL",
"auction": null,
"depositMethods": [],
"withdrawalMethods": [
"sol"
],
"totalSellerFeeRate": 0.07,
"royaltyFeeRate": 0.05
}
While nft/nft/{$id} might be confusing at first. To grab all nfts you would simply call nft/nfts and iterate through the result.
while True:
try:
data = requests.get('https://ftx.us/api/nft/nfts').json()
result = data['result']
for nft in result:
result_formatted = json.dumps(nft, indent=2)
print(result_formatted)
break
except Exception as e:
print(f'Error obtaining NFT data: {e}')
If you have never run python code on your computer I recommend Google Collab. Here is a link to a worksheet with the above code. You need to run each cell individually, in order.
Sign up for FTX Here
Let me know what you would like to see in future tutorials. Next tutorial I will be covering authentication to act on the data we retrieved.
If you found this helpful, consider sending a tip to the author.
2vta8S9QJEeZSRTXxR5eL3tfpFVbHhRAKMnQmQeCBKAV

Top comments (2)
I fell victim to some scam forex trading platform and I lost a lot of my funds up to $160,000 but thanks to Bernie Doran for his help in getting my funds recovered. he work with a recovery company called INNOVATIONS ANALYSIS recovery. I got all my funds recovered after reporting to Mr. Bernie Doran via his Telegram - IEBINARYFX If you need help in getting your lost funds back as well, he will surely assist you
I'd love a code to approve and swap a token using Solana and Raydium's router.