@foxbit-group/rest-api
v0.1.3
Published
Foxbit's API client
Readme
Foxbit JavaScript/TypeScript SDK
This is the official SDK provided by Foxbit for interacting with our APIs using JavaScript or TypeScript.
Prerequisites
Ensure your environment meets the following requirements before using the SDK:
Environment
- Node.js (version 14 or higher recommended)
- NPM (comes bundled with Node.js)
Language Level
- ES5 (requires a Promises/A+ compatible library)
- ES6 or higher (recommended)
Module System Support
- CommonJS
- ES6 Modules
Installation
Install the SDK using NPM:
npm install @foxbit-group/rest-apiHow to Use
To start using the SDK, simply import the desired module and call its methods:
const { MarketDataApi } = require('@foxbit-group/rest-api');
// Create an instance of the API
const marketDataApi = new MarketDataApi();
// Make API calls
marketDataApi.listCurrencies()
.then(response => {
console.log('Currencies:', response.data);
})
.catch(error => {
console.error('Error:', error);
});Authentication
For authenticated endpoints, you must instantiate a Configuration object with your API credentials and pass it to the desired API module:
const { Configuration, TradingApi } = require('@foxbit-group/rest-api');
// Initialize the configuration with your API key and secret
const config = new Configuration({
apiKey: "YOUR_API_KEY",
apiSecret: "YOUR_API_SECRET",
});
// Create an instance of the Trading API
const tradingApi = new TradingApi(config);
// Make authenticated API calls
tradingApi.createOrder({
createOrderRequest: {
side: "BUY",
type: "MARKET",
market_symbol: "btcbrl",
quantity: "1",
},
})
.then((response) => {
console.log("Order created:", response.data);
})
.catch((error) => {
console.error("Error:", error);
});The SDK will automatically:
- Generate the current timestamp
- Create the request signature using your API secret
- Add the required headers to each request:
X-FB-ACCESS-KEY: Your API keyX-FB-ACCESS-TIMESTAMP: Current timestampX-FB-ACCESS-SIGNATURE: Signature generated from your API secret
Documentation for API Endpoints
You can find detailed documentation for each API endpoint in the Foxbit API Documentation.
About This SDK
This SDK was automatically generated using OpenAPI Generator.
Note: This SDK is actively maintained by the Foxbit team. For more information, visit https://foxbit.com.br.
