agentleFS
QuantConnectQuantConnect/Documentation/skills/csharp/crypto/SKILL.md

crypto

Skill268 starsChanged 48 days agoApache-2.0View on GitHub

Use whenever building a CRYPTO universe (a dynamic set of coins on an exchange), ranking coins by dollar volume, or trading crypto long/short — including short-selling crypto and which venues support margin.

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

Crypto universes and crypto long/short — use the exchange's own tradable set

Build the universe from the venue's NATIVE crypto universe

To select a dynamic set of cryptocurrencies, use the exchange-native CryptoUniverse for the venue you trade on. Do NOT pull a coin list from an external dataset (e.g. CoinGecko market cap) and then build tradable symbols with Symbol.Create — that mapping fails for any coin the venue does not list (symbol could not be found ... for <market> market runtime error). Every symbol CryptoUniverse returns is tradable on that venue.

UniverseSettings.Resolution = Resolution.Daily;
SetBrokerageModel(BrokerageName.Bitfinex, AccountType.Margin);
_universe = AddUniverse(CryptoUniverse.Bitfinex(SelectAssets));

private IEnumerable<Symbol> SelectAssets(IEnumerable<CryptoUniverse> data)
{
    return data
        .Where(x => x.VolumeInUsd != null)          // each x: .Symbol .Close .Volume .VolumeInUsd
        .OrderByDescending(x => x.VolumeInUsd)
        .Select(x => x.Symbol)
        .ToList();                                  // all qualifying coins (see breadth note below)
}
  • Per-venue helpers: CryptoUniverse.Binance / .BinanceUS / .Bitfinex / .Kraken / .Bybit / .Coinbase. Use the one that matches your brokerage model so the universe and the orders are on the same exchange.
  • Breadth is the STRATEGY's call, not a default. How many coins to keep depends on the spec: a broad cross-section strategy returns them all (as above); a "top-N most liquid" strategy slices .Take(N). Do NOT impose a top-N cap (e.g. .Take(50)) unless the spec explicitly asks for one — silently capping a broad-universe strategy to the most-liquid handful changes the method.

Dollar volume — use VolumeInUsd

A crypto bar's Volume is in base-asset units and is not comparable across coins. The CryptoUniverse element exposes USD volume directly as x.VolumeInUsd — rank and weight by that, not raw unit volume. (Outside the universe callback, dollar volume = bar Volume × Price.)

Short-selling crypto needs a MARGIN venue

A spot/cash crypto account cannot short. To hold short crypto positions, set a Margin account on a venue whose QC brokerage model supports it (verified against the Lean brokerage models):

  • Margin / can short: Binance, BinanceUS, Bitfinex, Kraken, Bybit — SetBrokerageModel(BrokerageName.<venue>, AccountType.Margin). Bitfinex defaults to margin.
  • Cash-only, CANNOT short: Coinbase, GDAX (the model rejects a margin account).

Match the venue you short on to the CryptoUniverse helper you select with (e.g. BrokerageName.Bitfinex + CryptoUniverse.Bitfinex).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.