Python SDK for SILICO algorithmic trading platform
Project description
SILICO Python SDK
Dead simple Python SDK for building trading bots on SILICO.
Why SILICO?
- 🎯 Paper trading - Test strategies with fake money, real prices
- 📊 Learn from failures - We collect failure data to improve trading AI
- 🚀 5 minutes to deploy - From zero to trading in one command
- 💰 Completely free - No hidden costs, no real money at risk
Installation
pip install silico
Quick Start
from silico import SilicoBot
import time
# Initialize (API key from https://silico.fun/dashboard)
bot = SilicoBot(api_key="sk_xxx")
# Simple buy-low-sell-high
while True:
price = bot.get_price("SOL/USDC")
if price < 100:
bot.buy("SOL/USDC", amount_usdc=50)
elif price > 150:
bot.sell("SOL/USDC", amount_usdc=50)
time.sleep(10)
That's it. You're trading.
Examples
RSI Strategy
from silico import SilicoBot
from collections import deque
bot = SilicoBot(api_key="sk_xxx")
prices = deque(maxlen=50)
while True:
price = bot.get_price("SOL/USDC")
prices.append(price)
rsi = calculate_rsi(prices) # Your RSI function
if rsi < 30: # Oversold
bot.buy("SOL/USDC", amount_usdc=100, strategy_tag="RSI")
elif rsi > 70: # Overbought
bot.sell("SOL/USDC", amount_usdc=100, strategy_tag="RSI")
time.sleep(10)
Full examples in examples/:
quickstart.py- Your first botrsi_strategy.py- RSI mean reversionadvanced.py- All features
Features
Automatic Environment Detection
# Local development - auto-detects localhost:8000
bot = SilicoBot(api_key="sk_test")
# Production - auto-uses api.silico.fun
bot = SilicoBot(api_key="sk_prod")
# Or explicit
bot = SilicoBot(api_key="sk_xxx", base_url="http://custom:8000")
Error Handling
from silico import SilicoBot, RateLimitError, InsufficientBalanceError
bot = SilicoBot(api_key="sk_xxx")
try:
bot.buy("SOL/USDC", amount_usdc=1000)
except RateLimitError as e:
print(f"Rate limited - retry after {e.retry_after}s")
except InsufficientBalanceError as e:
print(f"Need ${e.required_balance}, have ${e.current_balance}")
Market Data
# Fetch current price
price = bot.get_price("SOL/USDC")
# Prices are cached automatically
cached = bot.market.get_price("SOL/USDC")
Trade Responses
result = bot.buy("SOL/USDC", amount_usdc=100)
if result.success:
print(f"Trade ID: {result.trade_id}")
print(f"Price: ${result.executed_price}")
else:
print(f"Failed: {result.error_message}")
API Reference
SilicoBot
Main client for interacting with SILICO.
Constructor:
SilicoBot(
api_key: str,
base_url: Optional[str] = None, # Auto-detected
timeout: int = 30
)
Methods:
buy(symbol, amount_usdc, strategy_tag=None, max_slippage_bps=50)
Execute a BUY trade.
Parameters:
symbol(str): Trading pair, e.g. "SOL/USDC"amount_usdc(float): Amount in USDC to buystrategy_tag(str, optional): Strategy identifiermax_slippage_bps(int): Max slippage in basis points (default: 50 = 0.5%)
Returns: TradeResponse
sell(symbol, amount_usdc, strategy_tag=None, max_slippage_bps=50)
Execute a SELL trade. Same parameters as buy().
get_price(symbol)
Get current market price.
Parameters:
symbol(str): Trading pair, e.g. "SOL/USDC"
Returns: float - Current price
Exceptions
All exceptions inherit from SilicoError:
AuthenticationError- Invalid API keyRateLimitError- Too many requests (has.retry_after)InsufficientBalanceError- Not enough balance (has.current_balance,.required_balance)InvalidSymbolError- Invalid trading pairNetworkError- Connection failed
Development
Setup
git clone https://github.com/silico/python-sdk
cd python-sdk
pip install -e ".[dev]"
Testing
# Unit tests
pytest
# With coverage
pytest --cov=silico
# Integration tests (requires API key)
export SILICO_API_KEY="sk_xxx"
pytest tests/test_integration.py
Code Quality
# Format
black silico/ tests/
# Lint
flake8 silico/ tests/
Contributing
See CONTRIBUTING.md
Changelog
See CHANGELOG.md
License
MIT - See LICENSE
Support
- 📖 Docs: docs.silico.fun
- 💬 Discord: discord.gg/silico
- 🐛 Issues: GitHub Issues
- 🌐 Website: silico.fun
Made with ❤️ by the SILICO team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file silico_sdk-0.1.0.tar.gz.
File metadata
- Download URL: silico_sdk-0.1.0.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
863b3cc2621a9ead77e60b798063b94b1dc8070028f304cb67872cd99234234d
|
|
| MD5 |
7cc89b7e86803e3d0884412391f829a4
|
|
| BLAKE2b-256 |
154c13e07e9a9adeb2fce4e0e8693660ce65005450c3e8c3b276d7dd99f139e5
|
File details
Details for the file silico_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: silico_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c7de6d4e47ccf9b15f8bcbf7cc10fbed72797708eeff7b72e573ad3b095b9e8
|
|
| MD5 |
b3781a88cca1aca1f8736e8a2fd0e170
|
|
| BLAKE2b-256 |
b02ef900849af86c7678a9053bd3f1d8373c67c2726b9b165937bbbbd495ecaa
|