A TypeScript SDK for interacting with the Futuur API. This SDK provides a simple and type-safe way to interact with all Futuur API endpoints.
npm install futuur
import { Futuur } from 'futuur-sdk';
const sdk = new Futuur({
publicKey: 'your_public_key',
privateKey: 'your_private_key',
timeout: 10000 // optional, defaults to 10000ms
});
Get list of markets:
const markets = await sdk.marketList({
page: 1,
per_page: 20
});
Get specific market:
const market = await sdk.marketDetail('market_id');
Get related markets:
const relatedMarkets = await sdk.relatedMarkets('market_id');
Suggest a market:
const suggestion = await sdk.suggestMarket({
title: 'Market Title',
description: 'Market Description'
});
Get all categories:
const categories = await sdk.categoryList();
Get specific category:
const category = await sdk.categoryDetail('category_id');
Get root categories:
const rootCategories = await sdk.rootCategories();
Get root categories with main children:
const categoriesWithChildren = await sdk.rootCategoriesAndMainChildren();
Place a bet:
const bet = await sdk.purchase({
outcome: 123456,
shares: 100
});
Get betting list:
const bets = await sdk.bettingList({
page: 1,
per_page: 20
});
Get specific bet:
const bet = await sdk.betDetail('bet_id');
Get partial amount on sell:
const amount = await sdk.getPartialAmountOnSell('bet_id', {
shares: 50
});
Get current rates:
const rates = await sdk.currentRates();
Get user information:
const userInfo = await sdk.me();
The SDK throws errors with detailed information about the failed request. It's recommended to wrap API calls in try-catch blocks:
try {
const result = await sdk.purchase({
outcome: 123456,
shares: 100
});
console.log('Success:', result);
} catch (error) {
console.error('Operation failed:', error);
}
Option | Type | Required | Default | Description |
---|---|---|---|---|
publicKey | string | Yes | - | Your Futuur API public key |
privateKey | string | Yes | - | Your Futuur API private key |
timeout | number | No | 10000 | Request timeout in milliseconds |
Method | Description |
---|---|
me() |
Get user information |
categoryList(params?) |
Get list of categories |
categoryDetail(id) |
Get specific category details |
rootCategories() |
Get root categories |
rootCategoriesAndMainChildren(params?) |
Get root categories with main children |
marketList(params?) |
Get list of markets |
marketDetail(id) |
Get specific market details |
relatedMarkets(id) |
Get related markets |
suggestMarket(params) |
Suggest a new market |
bettingList(params) |
Get list of bets |
betDetail(id) |
Get specific bet details |
getPartialAmountOnSell(id, params?) |
Get partial amount on sell |
currentRates() |
Get current rates |
purchase(body) |
Place a bet |
The SDK automatically handles authentication using HMAC signatures. Each request is signed using your private key and includes:
- Your public key
- A timestamp
- An HMAC signature
npm run build
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues or have questions, please file an issue on the GitHub repository.
Never commit or share your private key. Always use environment variables or secure secret management systems to handle sensitive credentials.
This is an unofficial SDK and is not affiliated with, maintained by, or in any way officially connected with Futuur.