Features
Cryptohopper Integration
Connect a Cryptohopper account so your FloopFloop trading bot can list hoppers and place live orders via the platform's OAuth2 REST API.
Última atualização:
What it is
Cryptohopper (cryptohopper.com) is the execution backend for FloopFloop crypto trading bots. You keep your strategy logic, scheduling, and dashboard on FloopFloop; Cryptohopper runs the hopper against your exchange accounts with paper-trading modes, risk controls, and always-on infrastructure that the generated tenant Lambda can't provide on its own.
FloopFloop talks to Cryptohopper's authenticated REST API — not the per-hopper TradingView webhook URL, which only accepts calls from TradingView's own servers.
Connecting your account
You only see the Cryptohopper card once your project actually reads a CRYPTOHOPPER_* environment variable — a plain website project never shows it. When it does appear:
- Open your project, go to Settings → Secrets.
- Scroll to the Cryptohopper card (below the secrets table) and click Connect Cryptohopper.
- You'll be redirected to Cryptohopper to approve the OAuth2 scopes (
read,notifications,manage,trade). Approve and you'll land back on the Secrets tab with a success banner.
Tokens are stored per project and refreshed automatically in the background — FloopFloop rotates them every ~30 minutes so the bot never sees a 401.
Picking which hopper to trade
Cryptohopper accounts can hold multiple hoppers (one per exchange, or per strategy). After connecting, set CRYPTOHOPPER_HOPPER_IDas a project secret with the hopper id you want to trade on. You can find the id in Cryptohopper → My Hoppers, or — if you generated from the cryptohopper-signal-bot or cryptohopper-dca-bot templates — the dashboard will list your connected hoppers with their ids once the integration is connected but CRYPTOHOPPER_HOPPER_ID is still empty.
Starter templates
Two templates ship with Cryptohopper wired up by default — describe your bot in natural language and FloopFloop picks the right one:
- cryptohopper-signal-bot — evaluates an RSI strategy against market data every 5 minutes and places a
buyorsellwhen the signal crosses a threshold. Good match for prompts mentioning indicators (RSI,MACD) or exchange names. - cryptohopper-dca-bot— places a fixed-amount recurring buy on a daily schedule, regardless of price (the canonical dollar-cost-averaging strategy). Good match for prompts like “DCA into BTC daily”, “weekly bitcoin buy”, or “stack sats”.
Both templates default to paper mode and use the same SDK call shape, so you can switch your strategy later by editing the cron handler without re-wiring the integration.
Calling Cryptohopper from tenant code
All Cryptohopper interaction goes through the platform SDK, @floopfloop/cryptohopper, which is pre-installed in generated projects. The SDK vends a live access token from FloopFloop on every request — your tenant code never handles OAuth tokens or client secrets directly.
import { CryptohopperClient } from "@floopfloop/cryptohopper";
const client = new CryptohopperClient();
// Auto-reads FLOOP_APP_URL + FLOOP_CRON_TOKEN; no configuration needed.
const hoppers = await client.listHoppers();
const hopper = await client.getHopper(process.env.CRYPTOHOPPER_HOPPER_ID!);
await client.updateHopper(hopper.id, { enabled: true });
await client.placeOrder(hopper.id, {
side: "buy",
coin: "BTC",
amount: 0.001,
});Importing the SDK under any other name (plain cryptohopper, @cryptohopper/*), calling api.cryptohopper.com directly, or reading CRYPTOHOPPER_ACCESS_TOKEN/CRYPTOHOPPER_CLIENT_SECRET from process.envis rejected by the code scanner at build time — those values don't exist in the tenant environment, and the SDK is the only way to reach the API safely.
Paper trading vs live trading
The cryptohopper-signal-bot template defaults to paper mode. Set LIVE_TRADING=true as a project secret to let the strategy actually place orders. While in paper mode the strategy still evaluates and records decisions — it just skips placeOrder calls, so you can watch the signal for a few cycles before committing real funds.
Running the strategy on a schedule
Strategy evaluation runs via FloopFloop's cron primitive — the template ships a floop.crons.json that auto-registers a 5-minute evaluation job on first deploy. See Scheduled Jobs for how schedules are registered, authenticated, and monitored.
Retry & error behavior
- The SDK retries transient 5xx errors on idempotent methods (
GET,PATCH) but never onPOST—placeOrderis only sent once per call to prevent double-submission on an ambiguous failure. - On 429 (rate limit) the SDK honors the
Retry-Afterheader, or falls back to exponential backoff, up tomaxRetries(default 2). - On a 401 the SDK force-refreshes the access token once and retries; if the retry also 401s you get a
CryptohopperAuthErrorand will need to reconnect the integration (someone may have revoked access from the Cryptohopper side). - Requests that exceed the per-call
timeoutMsbudget (default 20s) abort and throwCryptohopperTimeoutError— typed so a tenant cron handler can distinguish a slow Cryptohopper response from a real network failure and decide whether to retry on the next fire.
Disconnecting
Use the Disconnect button on the Cryptohopper card to revoke the stored tokens. Your bot will stop placing new orders until you reconnect — existing hopper configs on Cryptohopper are untouched.