SDKs & Libraries
Official StockAPI SDKs and client libraries for JavaScript, Python, Java, and C#. Get started quickly with our comprehensive SDKs.
🚀 Official SDKs
JavaScript/Node.js SDK
Installation
npm install stockapi
Quick Start
// const StockAPI = require('stockapi');
// const client = new StockAPI({
apiKey: 'YOUR_API_KEY'
});
// Get current price
// const price = await client.getPrice('BTC', 'binance');
// console.log(`BTC Price: $${price}`);
// Get historical data
// const history = await client.getHistory('AAPL', '1d', '30d');
// console.log('Historical data:', history);
Features
- Full TypeScript support
- Promise-based API
- WebSocket streaming
- Automatic retry logic
- Comprehensive error handling
Python SDK
Installation
pip install stockapi
Quick Start
import stockapi
client = stockapi.Client(api_key='YOUR_API_KEY')
# Get current price
price = client.get_price('BTC', 'binance')
print(f"BTC Price: ${price}")
# Get historical data
history = client.get_history('AAPL', '1d', '30d')
print("Historical data:", history)
Features
- Async/await support
- Pandas integration
- Comprehensive documentation
- Type hints included
- Jupyter notebook support
Java SDK
Installation
<dependency>
<groupId>com.stockapi</groupId>
<artifactId>stockapi-java</artifactId>
<version>1.2.0</version>
</dependency>
Quick Start
import com.stockapi.StockAPI;
StockAPI client = new StockAPI.Builder()
.apiKey("YOUR_API_KEY")
.build();
// Get current price
double price = client.getPrice("BTC", "binance");
System.out.println("BTC Price: $" + price);
// Get historical data
List<PriceData> history = client.getHistory("AAPL", "1d", "30d");
System.out.println("Historical data: " + history);
Features
- Spring Boot integration
- Builder pattern
- Comprehensive JavaDocs
- Async support
- Maven/Gradle support
C# SDK
Installation
dotnet add package StockAPI
Quick Start
using StockAPI;
// var client = new StockAPIClient("YOUR_API_KEY");
// Get current price
// var price = await client.GetPriceAsync("BTC", "binance");
Console.WriteLine($"BTC Price: ${price}");
// Get historical data
// var history = await client.GetHistoryAsync("AAPL", "1d", "30d");
Console.WriteLine($"Historical data: {history}");
Features
- .NET Core support
- Async/await patterns
- Strong typing
- NuGet package
- Visual Studio integration
📊 SDK Comparison
Feature | JavaScript | Python | Java | C# |
---|---|---|---|---|
Installation | npm | pip | Maven | NuGet |
TypeScript | ✅ | Type hints | JavaDocs | Strong typing |
Async Support | ✅ | ✅ | ✅ | ✅ |
WebSocket | ✅ | ✅ | ✅ | ✅ |
Pandas Integration | ❌ | ✅ | ❌ | ❌ |
Spring Boot | ❌ | ❌ | ✅ | ❌ |
Documentation | Comprehensive | Comprehensive | JavaDocs | XML docs |
🔧 Advanced Features
WebSocket Streaming
JavaScript
// const stream = client.createWebSocket({
channels: ['price', 'volume', 'trades'],
symbols: ['BTC', 'ETH', 'AAPL']
});
// stream.on('data', (data) => {
// console.log('Real-time update:', data);
});
Python
async def handle_stream():
async with client.websocket() as ws:
await ws.subscribe(['price', 'volume'], ['BTC', 'ETH'])
async for data in ws:
print(f"Real-time update: {data}")
asyncio.run(handle_stream())
Batch Requests
JavaScript
// const batchData = await client.getBatchData({
symbols: ['BTC', 'ETH', 'AAPL', 'GOOGL'],
platforms: ['binance', 'coinbase', 'nyse']
});
Python
batch_data = client.get_batch_data(
symbols=['BTC', 'ETH', 'AAPL', 'GOOGL'],
platforms=['binance', 'coinbase', 'nyse']
)
Error Handling
JavaScript
try {
// const data = await client.getPrice('INVALID', 'binance');
} catch (error) {
if (error.code === 'RATE_LIMIT_EXCEEDED') {
// Handle rate limiting
} else if (error.code === 'INVALID_SYMBOL') {
// Handle invalid symbol
}
}
Python
try:
data = client.get_price('INVALID', 'binance')
except stockapi.RateLimitError:
# Handle rate limiting
except stockapi.InvalidSymbolError:
# Handle invalid symbol
📚 Documentation
API Reference
- JavaScript SDK - Complete JavaScript documentation (Coming Soon)
- Python SDK - Complete Python documentation (Coming Soon)
- Java SDK - Complete Java documentation (Coming Soon)
- C# SDK - Complete C# documentation (Coming Soon)
Examples
- Getting Started - Basic usage examples (Coming Soon)
- WebSocket Examples - Real-time data examples (Coming Soon)
- Error Handling - Error handling patterns (Coming Soon)
- Best Practices - SDK best practices (Coming Soon)
Tutorials
- Building a Trading Bot - Complete trading bot tutorial (Coming Soon)
- Portfolio Tracker - Portfolio tracking application (Coming Soon)
- Market Analysis - Market analysis examples (Coming Soon)
- Data Visualization - Data visualization examples (Coming Soon)
🔗 Community Libraries
Go
go get github.com/stockapi/go-stockapi
Rust
[dependencies]
stockapi = "1.0.0"
PHP
composer require stockapi/php-sdk
Ruby
gem 'stockapi'
🛠️ Development
Contributing
We welcome contributions to our SDKs:
- GitHub Repositories - Open source SDKs
- Issue Reporting - Report bugs and request features
- Pull Requests - Submit improvements
- Documentation - Help improve documentation
Testing
All SDKs include comprehensive tests:
- Unit Tests - Individual function testing
- Integration Tests - API integration testing
- Performance Tests - Performance benchmarking
- Compatibility Tests - Version compatibility
Versioning
SDKs follow semantic versioning:
- Major - Breaking changes
- Minor - New features
- Patch - Bug fixes
📞 Support
SDK Support
- Documentation - Comprehensive SDK guides
- Examples - Code examples and tutorials
- Community - Community support on Discord
- GitHub Issues - Technical support and bug reports
Getting Help
- SDK Documentation - Complete SDK documentation
- API Reference - API endpoint documentation
- Community Discord - Real-time help
- Contact Support - Direct support
Ready to get started? Choose your SDK and begin building with StockAPI.