Skip to content
All library documents

A Crypto Library Template for Spot and Futures Order Management

Article FMZ forum · Author: 发明者量化-小小梦

Summary

This document introduces a digital-asset trading library that combines an existing spot-trading template with futures support for OKCoin and BitVC. Its main teaching is operational: futures orders require contract selection and position-aware handling that differs from spot trading, so the library provides a position manager for opening long or short positions and covering them later.

The examples demonstrate selecting weekly or current-week contracts, reading account positions and order-book depth, then submitting limit orders based on the best bid with price offsets. They also show partial closes and separate handling for long and short positions. A further loop illustrates alternating entries and checking existing positions before closing them. These are usage examples, not a tested trading strategy: the document supplies no performance evidence, execution analysis, or risk controls, and its snippets depend on exchange-specific APIs and contract conventions.

Key ideas

  • Futures trading requires contract selection and position management beyond the spot template.
  • A position manager can open long or short contracts and cover specified quantities.
  • The examples use order-book prices with offsets to submit entries and exits.
  • Exchange-specific contract names and APIs shape how the template must be used.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.