Installation Setup
Overview of supported trading markets and installation prerequisites for using the API.
Supported Markets
This API provides information for the following trading markets:
Asset
Market ID
Description
APT/USDC
301
Aptos-based trading market.
BTC/USDC
302
Bitcoin-based trading market.
ETH/USDC
303
Ethereum-based trading market.
Prerequisites
Before using the API, ensure you have the following:
Node.js: Install version 16 or higher. Download here.
npm: Verify npm is installed to manage packages.
Install Required Packages
Run these commands to install the required dependencies:
Install
dotenv
andaxios
:npm install dotenv axios
Install the Aptos SDK for TypeScript:
npm install @aptos-labs/ts-sdk
Example Setup in TypeScript
Create a file, e.g., setup.ts
, and use the following code:
// Import required packages
import dotenv from 'dotenv';
import axios from 'axios';
import { AptosConfig, Aptos, Network, Account, Ed25519PrivateKey, PrivateKeyVariants } from "@aptos-labs/ts-sdk";
// Load environment variables from .env file
dotenv.config();
// Setup the client
const config = new AptosConfig({ network: Network.TESTNET });
const aptos = new Aptos(config);
const formattedPrivateKey = PrivateKey.formatPrivateKey(
process.env.APTOS_PRIVATEKEY || '',
'ed25519' as PrivateKeyVariants
);
const account = Account.fromPrivateKey({
privateKey: new Ed25519PrivateKey(formattedPrivateKey),
});
Last updated