Python을 사용하여 FTX에서 NFT 가격 추적

10694 단어
최근에 솔라나 블록체인에서 런칭하는 동안 저는 어떤 NFT에 흥미를 느꼈습니다. TV를 보거나 애드블로커가 없다면 어디에서나 FTX 광고를 본 적이 있을 것입니다. 제 생각에 FTX는 암호화폐를 위한 최고의 거래 플랫폼입니다. 나는 그것을 coinbase보다 선호하고 그것의 관련성은 커질 것이라고 생각합니다. 그들은 방금 69명의 투자자로부터 4억 2천만 달러에 fundraising round을 완료했습니다.



이 기간 동안 ChickenTribe #0가 판매 목록에 있었지만 구매를 클릭하면 오류가 반환되었습니다. 프로그래밍 방식으로 판매하고 구매할 수 있을 때까지 핑하는 API를 만들어 보자고 생각했습니다. 제가 놀랐던 점은 API을 통해 FTX에 전화를 걸고 받은 데이터에 따라 조치를 취하는 것이 얼마나 쉬운지였습니다.

특정 NFT에 대한 정보를 얻으려면 다음 파이썬 프로그램을 작성하고 실행하기만 하면 됩니다.

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}')


이것은 다음을 반환합니다.

{
  "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
}


nft/nft/{$id}는 처음에는 혼란스러울 수 있습니다. 모든 nft를 가져오려면 nft/nfts를 호출하고 결과를 반복하면 됩니다.

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}')


컴퓨터에서 파이썬 코드를 실행한 적이 없다면 Google Collab을 추천합니다. 다음은 위의 코드가 있는 link to a worksheet입니다. 각 셀을 순서대로 개별적으로 실행해야 합니다.

여기에서 FTX에 가입하세요



향후 튜토리얼에서 보고 싶은 내용을 알려주세요. 다음 자습서에서는 검색한 데이터에 대해 조치를 취하는 인증을 다룰 것입니다.

If you found this helpful, consider sending a tip to the author. 
2vta8S9QJEeZSRTXxR5eL3tfpFVbHhRAKMnQmQeCBKAV

좋은 웹페이지 즐겨찾기