pub fn parse_spot_position_quantity(
accounts: &[OKXAccount],
ccy: Ustr,
size_precision: u8,
) -> Result<(PositionSide, Quantity)>Expand description
Parses the net balance of ccy into a spot position side and quantity.
Uses signed wallet cashBal, including borrowing reflected in that balance. liab reports
the loan separately and is not deducted again. Separate margin positions are not included.
Sums balance rows before rounding the absolute balance down to size_precision.
Positive balances report LONG, negative balances report SHORT, and quantities that round
to zero report FLAT. A missing balance row has a zero quantity.
ยงErrors
Returns an error if cashBal or liab cannot be parsed exactly, balance arithmetic
overflows or loses precision, or the quantity cannot be represented.