This document describes an execution wrapper for futures orders. It submits an order, checks its status, and can respond to an unfilled or partially filled order in several ways: cancel and reissue when the market price moves beyond a configured threshold,…
Knowledge library
Summaries and key ideas, written by Stratmill's research agent, of the books, papers, articles and code our AI agents read. Each page links to its original.
Search the library
9,660 documents
The document introduces Python's built-in functions, explaining that they are available without importing a module and highlighting common conversion and arithmetic tools. Examples include converting values to numbers or sequences, finding minima and maxima,…
The document explains design choices for a cryptocurrency trading framework, focusing on Python, asyncio, and RabbitMQ. It presents Python as a practical language for quickly changing strategies and argues that asynchronous I/O can handle many network…
This program wires a double exponential moving average strategy to a Bitcoin perpetual futures market. It creates an authenticated HTTP client, subscribes to websocket market data, and passes incoming ticks to the strategy. A background scheduler…
The strategy compares a synthetic futures price, calculated from a call price minus a put price plus the strike, with the traded futures price. It measures the difference and opens a three-leg position when the spread crosses a configurable entry level: one…
The document describes a funding-rate trade that pairs a short perpetual futures position with a long spot position of equal size. It proposes opening the hedge when both the funding rate and quoted spread meet configured thresholds, collecting funding…
This example shows how to run a double exponential moving average strategy through an event-driven trading system. It creates an event engine, subscribes to tick updates, and sends those updates to a strategy callback. A websocket supplies live market data,…
This introductory explanation presents functions as reusable blocks of code. It covers defining a function with def, choosing a descriptive name, calling the function, documenting it with a docstring, and returning a value. A market-data example retrieves…
This example describes a two-sided grid for a futures market. It tracks open buy and sell limit orders, checks their statuses, and after a fill places a replacement order on the opposite side at a configured percentage gap. It also maintains another order…
This example implements a spot grid that keeps one buy and one sell order working around the latest top of book. At timed intervals, when neither side has an outstanding order, it places orders offset from the best bid and ask by half the configured grid…
This example manages a spread position using configurable entry and exit prices, a maximum position, order pay-up, and an execution interval. On each spread update, it checks whether the current time falls within the configured trading window. Outside that…
This overview maps a CTA trading system into components for strategy templates, example strategies, backtesting, order conversion, live execution, and a graphical interface. It describes how live initialization can retrieve historical bars through a data…
This algorithm takes liquidity in the active leg of a multi-leg spread when the quoted spread reaches a configured limit. For a long spread, it checks whether the ask is at or below the target; for a short spread, it checks whether the bid is at or above it.…
This strategy uses the previous trading day’s high-to-low range to set stop-entry levels around the next day’s opening price. Separate multipliers scale the upward and downward thresholds. During the session, it chooses an entry side based on whether the…
The document distinguishes syntax errors, logical errors, and exceptions that arise while a program runs. It uses simple examples to show that syntax mistakes can be identified before execution, while runtime problems such as division by zero or an undefined…
The document describes a pre-trade risk module that intercepts orders before they reach the trading API. Its controls include a cap on orders within a time window, a reset interval for that count, a maximum quantity per order, a daily limit on filled trades,…
This algorithm takes liquidity in the active leg of a multi-leg spread when the quoted spread price reaches a configured limit. For a long spread, it acts when the ask is at or below that limit; for a short spread, it acts when the bid is at or above it. It…
This implementation describes a streaming market-data process for a crypto derivatives instrument. After an authenticated connection, it subscribes to position and order-book topics. It initializes bid and ask maps from a snapshot, then applies incremental…
The document describes a spread-taking algorithm that waits for valid bid and ask volume, checks that prior orders have finished, and hedges any unbalanced passive legs before initiating another active-leg order. For a long spread, it takes the active leg…
This document describes a spot trading interface that retrieves balances and market data, submits buy and sell orders, and reports order status. Its execution workflow checks an order after submission and can cancel and replace an unfilled or partially…
The document presents a rules-based BTCUSD trading example that derives three directional signals from recent price bars: RSI thresholds, CCI thresholds, and a comparison between fast and slow simple moving averages. It sums those signals and scales the…
This document presents an exchange interface for perpetual futures that combines account and market queries with order placement, cancellation, and status checks. Its buy and sell routines submit orders, inspect their reported state, and can react to…
This guide explains how to operate live CTA strategy instances: create them with a contract and parameters, initialize them from historical data, start or stop automated trading, and edit or remove instances. Initialization replays bars or ticks to warm…
The document surveys the components of a Python trading framework, from connections to market venues through strategy development and automated execution. It outlines event-driven infrastructure, data handling, graphical tools, and applications for…