Initialize crypto_monitor_user (user edition) from monitor codebase.
Retarget git remote, install path, and deploy docs from crypto_monitor to crypto_monitor_user. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import unittest
|
||||
|
||||
from lib.hub.price_snapshot_lib import resolve_order_snapshot_price
|
||||
|
||||
|
||||
class TestPriceSnapshotLib(unittest.TestCase):
|
||||
def test_resolve_from_cached_prices(self):
|
||||
px = resolve_order_snapshot_price("ETH/USDT", {"ETH/USDT": 1750.5})
|
||||
self.assertEqual(px, 1750.5)
|
||||
|
||||
def test_resolve_from_position_mark(self):
|
||||
prow = {"info": {"mark_price": 1760.0}, "contracts": 1}
|
||||
px = resolve_order_snapshot_price("ETH/USDT", {}, position_row=prow)
|
||||
self.assertEqual(px, 1760.0)
|
||||
|
||||
def test_resolve_mark_fn_before_entry(self):
|
||||
px = resolve_order_snapshot_price(
|
||||
"ETH/USDT",
|
||||
{},
|
||||
get_mark_price_fn=lambda s: 1755.0,
|
||||
fallback_entry=1700.0,
|
||||
)
|
||||
self.assertEqual(px, 1755.0)
|
||||
|
||||
def test_resolve_fallback_entry(self):
|
||||
px = resolve_order_snapshot_price(
|
||||
"ETH/USDT",
|
||||
{},
|
||||
fallback_entry=1700.0,
|
||||
)
|
||||
self.assertEqual(px, 1700.0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user