跳到主要内容

Common Enums

Common enums used across Sparky's Perpetual Contracts FAPI.

Order side

ValueMeaning
BUYBuy / long.
SELLSell / short.

Order type

ValueStatus
LIMITImplemented.
MARKETImplemented.
STOPImplemented — trigger order, becomes a LIMIT at price when stopPrice is hit. Alias STOP_LIMIT accepted.
STOP_MARKETImplemented — trigger order, becomes a MARKET when hit.
TAKE_PROFITImplemented. Alias TAKE_PROFIT_LIMIT accepted.
TAKE_PROFIT_MARKETImplemented.
TRAILING_STOP_MARKETOnly on POST /fapi/v1/algoOrder (callbackRate 0.1–10 %). Rejected on POST /fapi/v1/order.

Trigger types are written to the trigger-order table, not the order book, and a keeper submits the derived order when mark price crosses stopPrice. A trigger that would fire immediately is rejected with -2021.

Time in force

ValueMeaning
GTCGood till cancel (default).
IOCImmediate or cancel.
FOKFill or kill.
GTXPost-only. Must be LIMIT with price; rejected with -2010 if it would match immediately. Stored as GTC after acceptance.
GTDAlgo orders only, with goodTillDate (≥ 600 s in the future).

Order status

ValueMeaning
NEWAccepted, no fills.
PARTIALLY_FILLEDSome quantity filled.
FILLEDFully filled.
CANCELEDCancelled (also the value returned by DELETE /fapi/v1/order).
REJECTEDRejected.

Algo orders use algoStatus: NEW, TRIGGERED, FINISHED, CANCELED, EXPIRED, FAILED.

Working type

ValueMeaning
CONTRACT_PRICEEchoed in responses.
MARK_PRICEAccepted and echoed, but all triggers evaluate against mark price regardless of this field.

Margin type

ValueMeaning
CROSSEDThe only mode on the FAPI surface. POST /fapi/v1/marginType with CROSSED is an idempotent success.
ISOLATEDRejected with -4046. Isolated / unified margin can be switched on the native API (POST /api/v1/account/margin-mode, JWT) but is not exposed through /fapi.

positionRisk reports marginType: "cross" (lowercase, Binance response form).

Position side

ValueMeaning
BOTHOne-way mode. The only mode Sparky supports.
LONG, SHORTAccepted on POST /fapi/v1/order but treated as BOTH; POST /fapi/v1/positionSide/dual with true-4059.

positionRisk and fundingFeeHistory report the direction of the open position as LONG / SHORT in positionSide.

Income type

ValueSource
REALIZED_PNLRealised PnL on position close.
FUNDING_FEEFunding settlements (signed).
COMMISSIONTrading fees (negative).

Other Binance income types (TRANSFER, WELCOME_BONUS, INSURANCE_CLEAR, …) are not produced.

Kline intervals

Requested interval → underlying bucket:

RequestedServed from
1m, 5m, 15m, 1h, 4h, 1d, 1w, 1Mnative bucket
3m5m
30m15m
2h1h
6h, 8h, 12h4h
3d1d

Aliased intervals are re-labelled with the requested openTime/closeTime, so several requested candles can share one underlying bucket's OHLCV.

Symbols

Canonical form is BTCUSDT. BTC-USDT, BTC-USD, BTC/USDT, BTC_USDT and lower-case are normalized on input. The tradable list is deployment-specific: read GET /fapi/v1/exchangeInfo. status per symbol is TRADING, HALT or CLOSE; underlyingType is COIN, INDEX (RWA / equities) or DEFI.