Skip to content
All library documents

Deribit Futures API Example: Orders, Positions, and Over-Closing

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

Summary

The document demonstrates use of a trading platform integration with Deribit futures. Its examples select a contract, retrieve account and ticker information, set trade direction, place buy and sell orders, inspect positions and open orders, and cancel outstanding orders. It distinguishes account queries, which do not require a contract code, from market data and order operations that do. It also identifies a perpetual contract naming convention and stresses setting direction before submitting an order.

The central operational lesson comes from an observed over-close: selling more contracts to close a long position than were held produced a negative position. A later buy order offset that negative position. The examples and logs are presented as a practical demonstration, not a systematic test. Behavior may depend on the exchange API, platform wrapper, contract, and account settings, so the observed position handling should be verified before live trading. The document gives no trading strategy or performance analysis.

Key ideas

  • Account retrieval and contract-specific market or order operations have different contract-code requirements.
  • Trade direction must be set before submitting orders through the demonstrated interface.
  • Closing more contracts than the held position can create a negative position in the observed setup.
  • A subsequent buy order offset that negative position in the example, but the behavior should be verified for the applicable setup.

Tags

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