BlockChain區塊鏈
  • 本書簡介
  • 區塊鏈運作原理
  • Bitcoin介紹
    • 簡介
    • Bitcoin其他知識
  • Bitcoin原理與實作
  • BitcoinJS
    • BTC 地址格式種類
    • 從 Mnemonic 轉為地址
  • Serverless 架構實作
  • Docker常用指令
  • ethereum初探
    • ethereum歷史
    • EVM
  • ethereum PoS 節點架設
  • ethereum(Docker)
  • ethereum(Geth)
    • Parity
  • ethereum(智能合約)
    • 合約測試 Unit Test
    • DAO
    • 可升級合約
    • 使用合約進行 multiswap
    • 合約安全
    • 開發工具
    • Hardhat 教學
      • Hardhat 寫測試
    • ERC-721 範例
      • 白名單機制
    • OpenZeppelin 合約 library
    • Truffle
    • 合約部屬
    • solidity 教學
  • ethereum(Dapp)
    • 相關 SDK
    • Multicall
    • Ethers.js 使用
    • Remix IDE
    • web3.js 使用
    • 在網頁上使用 web3 並操作區塊鏈
      • solidity筆記
  • Hyperledger Fabric
  • blockchainDB
  • 挖礦程式使用教學
    • 門羅幣/Monero (XMR)
  • Bitfinex API 使用
  • FTX API
  • CCXT 通用交易所 API
  • Solana 教學
  • Ethereum BigQuery
  • The Graph
    • yaml 定義
    • mapping 語法
    • Schema 定義
    • Query 範例
    • Unit test
  • DeFi 筆記
    • MEV 相關
    • Dex 聚合
    • Yearn
    • Curve
    • Uniswap
      • Swap 互動
    • AAVE、Compound
      • Compound 原理
      • AAVE 合約開發
Powered by GitBook
On this page
  • Authentication
  • GET /account
  • POST /orders

Was this helpful?

FTX API

PreviousBitfinex API 使用NextCCXT 通用交易所 API

Last updated 5 years ago

Was this helpful?

Authentication

只要是需要認證的API,都必須要帶有以下Header: FTX-KEY, FTX-SIGN, FTX-TS

GET /account

const crypto = require("crypto");
const https = require("https");
const FTX_API_KEY = process.env.ftx_api_key;
const FTX_API_SECRET = process.env.ftx_api_secret;

const hostname = "ftx.com";
const endpoint = "/api/account";
const method = "GET";
const nonce = Date.now();

const hmac = crypto.createHmac("sha256", FTX_API_SECRET);
const signature_payload = `${nonce}${method}${endpoint}`;
hmac.update(signature_payload);
const digestHex = hmac.digest("hex");

const options = {
  host: hostname,
  port: 443,
  path: endpoint,
  method,
  headers: {
    "FTX-KEY": FTX_API_KEY,
    "FTX-SIGN": digestHex,
    "FTX-TS": nonce.toString()
  }
};

var req = https.request(options, function(res) {
  res.on("data", function(data) {
    console.log(data.toString());
  });
});

req.end();

POST /orders

https://docs.ftx.com/?csharp#rest-api
https://docs.ftx.com/?javascript#account