be7896cc25
Co-authored-by: Cursor <cursoragent@cursor.com>
16 lines
434 B
Python
16 lines
434 B
Python
from lib.hub.hub_position_metrics import position_contracts
|
|
|
|
|
|
def test_position_contracts_prefers_okx_info_pos_over_stale_ccxt():
|
|
p = {
|
|
"contracts": 0.81,
|
|
"side": "short",
|
|
"info": {"pos": "-1.62", "posSide": "short"},
|
|
}
|
|
assert position_contracts(p) == 1.62
|
|
|
|
|
|
def test_position_contracts_falls_back_to_ccxt_contracts():
|
|
p = {"contracts": 2.5, "info": {}}
|
|
assert position_contracts(p) == 2.5
|