Documentation
¶
Overview ¶
Package matching implements a minimalist deterministic intrabar OHLC matching engine for historical candlestick replay, limit/stop orders, inter-bar opening gaps, take-profit/stop-loss execution priority, and isolated/cross forced liquidation.
Live interactive historical candlestick replay trainers:
- https://holdwins.com/en/kline/ (English Kline Trainer)
- https://holdwins.com/kline/ (K 线盘感训练器)
- https://holdwins.com/en/futures-calculator/
Index ¶
Constants ¶
const ( MakerFee = 0.0002 TakerFee = 0.0005 MMR = 0.005 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
Wallet float64
Leverage float64
Mode string // "isolated" or "cross"
Pos *Position
Orders []Order
Fills []Fill
}
Account holds wallet balance, margin mode, open position, resting orders, and fill history.
func NewAccount ¶
NewAccount initializes a paper-trading perpetual account.
func (*Account) ExecuteFill ¶
ExecuteFill applies a maker or taker execution against the account's single-way position.
func (*Account) LiqPrice ¶
LiqPrice computes the estimated forced-liquidation price of the active position, or 0 if none.
func (*Account) ProcessBar ¶
ProcessBar advances the matching engine across one OHLC bar with deterministic intrabar pathing.