Common Enums
Common enums used across Sparky's Perpetual Contracts FAPI.
Order side
| Value | Meaning |
|---|---|
BUY | Buy / long. |
SELL | Sell / short. |
Order type
| Value | Status |
|---|---|
LIMIT | Implemented. |
MARKET | Implemented. |
STOP | Implemented — trigger order, becomes a LIMIT at price when stopPrice is hit. Alias STOP_LIMIT accepted. |
STOP_MARKET | Implemented — trigger order, becomes a MARKET when hit. |
TAKE_PROFIT | Implemented. Alias TAKE_PROFIT_LIMIT accepted. |
TAKE_PROFIT_MARKET | Implemented. |
TRAILING_STOP_MARKET | Only 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
| Value | Meaning |
|---|---|
GTC | Good till cancel (default). |
IOC | Immediate or cancel. |
FOK | Fill or kill. |
GTX | Post-only. Must be LIMIT with price; rejected with -2010 if it would match immediately. Stored as GTC after acceptance. |
GTD | Algo orders only, with goodTillDate (≥ 600 s in the future). |
Order status
| Value | Meaning |
|---|---|
NEW | Accepted, no fills. |
PARTIALLY_FILLED | Some quantity filled. |
FILLED | Fully filled. |
CANCELED | Cancelled (also the value returned by DELETE /fapi/v1/order). |
REJECTED | Rejected. |
Algo orders use algoStatus: NEW, TRIGGERED, FINISHED, CANCELED, EXPIRED, FAILED.
Working type
| Value | Meaning |
|---|---|
CONTRACT_PRICE | Echoed in responses. |
MARK_PRICE | Accepted and echoed, but all triggers evaluate against mark price regardless of this field. |
Margin type
| Value | Meaning |
|---|---|
CROSSED | The only mode on the FAPI surface. POST /fapi/v1/marginType with CROSSED is an idempotent success. |
ISOLATED | Rejected 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
| Value | Meaning |
|---|---|
BOTH | One-way mode. The only mode Sparky supports. |
LONG, SHORT | Accepted 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
| Value | Source |
|---|---|
REALIZED_PNL | Realised PnL on position close. |
FUNDING_FEE | Funding settlements (signed). |
COMMISSION | Trading fees (negative). |
Other Binance income types (TRANSFER, WELCOME_BONUS, INSURANCE_CLEAR, …) are not produced.
Kline intervals
Requested interval → underlying bucket:
| Requested | Served from |
|---|---|
1m, 5m, 15m, 1h, 4h, 1d, 1w, 1M | native bucket |
3m | 5m |
30m | 15m |
2h | 1h |
6h, 8h, 12h | 4h |
3d | 1d |
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.