
Aicoin Freqtrade
Wire AiCoin Open API v3 aggregated exchange data into Freqtrade strategies via helper signals like whale flow, funding, and liquidation bias.
Overview
Aicoin-freqtrade is an agent skill for the Build phase that integrates AiCoin Open API v3 market data helpers into Freqtrade trading strategies.
Install
npx skills add https://github.com/aicoincom/coinos-skills --skill aicoin-freqtradeWhat is this skill?
- AiCoinData helper import for Freqtrade strategies with Open API v3 catalog
- High-level numeric helpers: whale_signal, ls_ratio_norm, funding_rate_pct, liq_bias
- CCXT exchange name to AiCoin market slug mapping for multi-exchange feeds
- Built-in 5-minute cache to limit live API churn during strategy loops
- Explicit backtest limitation—helpers raise; strategies should fall back to standard indicators
- 200+ exchanges referenced in aggregated market data positioning
- 5-minute built-in API response cache
Adoption & trust: 539 installs on skills.sh; 42 GitHub stars; 1/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your Freqtrade bot only sees single-exchange candles and you want aggregated AiCoin signals without hand-rolling auth, caching, and exchange slug mapping.
Who is it for?
Indie algo traders already running Freqtrade who hold an AiCoin API key and want richer cross-exchange context in live mode.
Skip if: Builders who only backtest offline without live keys, or anyone expecting guaranteed alpha—this is data plumbing, not a finished strategy.
When should I use this skill?
You are implementing or updating a Freqtrade strategy that should consume AiCoin live market metrics with documented backtest fallbacks.
What do I get? / Deliverables
Your strategy imports AiCoinData helpers for live signals with sane caching and documented fallbacks when backtests cannot reach real-time AiCoin endpoints.
- Strategy code importing AiCoinData helpers
- Cached live data calls with exchange slug mapping
Recommended Skills
Journey fit
External market-data SDK integration is a Build task: you embed vendor APIs inside strategy code before you run live bots. Integrations subphase fits third-party API clients, env-based keys, and CCXT exchange slug mapping—not launch marketing or post-trade analytics alone.
How it compares
Freqtrade-side AiCoin SDK integration—not a standalone exchange MCP server or discretionary trading playbook.
Common Questions / FAQ
Who is aicoin-freqtrade for?
Developers operating personal or small-team Freqtrade bots who want AiCoin aggregated metrics in strategy code via Open API v3.
When should I use aicoin-freqtrade?
During Build while authoring or refactoring strategy modules that need live whale, funding, or liquidation bias inputs from AiCoin.
Is aicoin-freqtrade safe to install?
It involves API keys and live market requests—store secrets outside the repo, review AiCoin terms and the Security Audits panel on this Prism page before running with real funds.
SKILL.md
READMESKILL.md - Aicoin Freqtrade
"""AiCoin Data SDK for Freqtrade Strategies (AiCoin Open API v3) ================================================================ Import this in your Freqtrade strategy to pull AiCoin's aggregated market data from 200+ exchanges: from aicoin_data import AiCoinData ac = AiCoinData() # auto-loads API key from .env signal = ac.whale_signal('BTC/USDT:USDT', 'binance') # -1..+1 ls = ac.ls_ratio_norm() # 0..1 funding = ac.funding_rate_pct('BTC/USDT:USDT', 'binance') # percent bias = ac.liq_bias('BTC/USDT:USDT', 'binance') # -1..+1 The high-level helpers above return plain numbers ready to drop into a strategy. For raw responses use ac.get('<endpoint>', {...}) — see catalog at https://open.aicoin.com/api/v3/_catalog. Built-in 5-min cache avoids hammering the API in live mode. In backtest mode AiCoin real-time data is not available — strategies should fall back to standard indicators (the helpers raise, strategies catch and use defaults). Some endpoints need a paid AiCoin subscription — see https://www.aicoin.com/opendata. """ import hmac import hashlib import base64 import json import os import time import random import logging from pathlib import Path from urllib.request import urlopen, Request from urllib.error import HTTPError from urllib.parse import urlencode logger = logging.getLogger(__name__) # Freqtrade/CCXT exchange name -> AiCoin market slug (v3 normalizes okx internally). EXCHANGE_MAP = { 'binance': 'binance', 'okx': 'okx', 'bybit': 'bybit', 'bitget': 'bitget', 'gate': 'gate', 'gateio': 'gate', 'htx': 'huobipro', 'huobi': 'huobipro', 'kucoin': 'kucoin', } # Common base ticker -> AiCoin coin_key slug. Anything else is resolved live # via /coins/search and cached. COIN_KEY_MAP = { 'btc': 'bitcoin', 'eth': 'ethereum', 'sol': 'solana', 'xrp': 'ripple', 'doge': 'dogecoin', 'bnb': 'binancecoin', 'ada': 'cardano', 'ltc': 'litecoin', 'link': 'chainlink', 'dot': 'polkadot', 'trx': 'tron', 'avax': 'avalanche', 'sui': 'sui', 'apt': 'aptos', 'ton': 'toncoin', 'near': 'near', 'op': 'optimism', 'arb': 'arbitrum', 'uni': 'uniswap', 'aave': 'aave', 'pepe': 'pepe', 'hype': 'hyperliquid', 'wld': 'worldcoin', } class AiCoinError(Exception): """Raised when the AiCoin API returns an error or is unreachable.""" def ccxt_to_v3(pair: str, exchange: str = 'binance') -> dict: """CCXT pair + exchange -> partial v3 identity {market, contract_type, base}. 'BTC/USDT:USDT' -> {'market': 'binance', 'contract_type': 'perpetual', 'base': 'btc'} 'BTC/USDT' -> {'market': 'binance', 'contract_type': 'spot', 'base': 'btc'} The coin_key still needs resolving — use AiCoinData._pair() which does both. """ return { 'market': EXCHANGE_MAP.get(exchange.lower(), exchange.lower()), 'contract_type': 'perpetual' if ':' in pair else 'spot', 'base': pair.split('/')[0].lower(), } class AiCoinData: """AiCoin Open API v3 client for use inside Freqtrade strategies. - HMAC-SHA1 signed requests, 4 X-Aic-* headers (v3 auth). - Auto-loads the API key from .env files. - Built-in TTL cache (default 5 min) to avoid hammering the API. """ _cache: dict = {} # shared across instances def __init__(self, cache_ttl: int = 300): self.cache_ttl = cache_ttl self._load_env() self._setup_proxy() defaults = self._load_defaults() self.base = os.environ.get('AICOIN_BASE_URL', 'https://open.aicoin.com') self.key = os.environ.get('AICOIN_ACCESS_KEY_ID', defaults.get('accessKeyId', '')) self.secret = os.environ.get('AICOIN_ACCESS_SECRET', defaults.get('accessSecret', '')) # ── Setup helpers ── @staticmethod def _load_env(): for f in (Path.cwd() / '.env', Path.home() / '.openclaw' / 'workspace' / '.env', Path.home() / '.openclaw' / '.env'):