File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,5 +64,12 @@ def sign_hash(hash_hex):
6464
6565def get_mid (coin ):
6666 """Get the current mid price for a coin from Hyperliquid."""
67- r = requests .post ("https://api.hyperliquid.xyz/info" , json = {"type" : "allMids" })
67+ r = requests .post (HL_INFO_URL , json = {"type" : "allMids" })
68+ return float (r .json ().get (coin , 0 ))
69+
70+
71+ def get_hip3_mid (coin ):
72+ """Get mid price for a HIP-3 market (requires dex parameter)."""
73+ dex = coin .split (":" )[0 ]
74+ r = requests .post (HL_INFO_URL , json = {"type" : "allMids" , "dex" : dex })
6875 return float (r .json ().get (coin , 0 ))
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ async fn main() {
1313 mid = 78.0 ;
1414 }
1515
16- let sz = format ! ( "{:.2}" , 10 .0 / mid) ;
16+ let sz = format ! ( "{:.2}" , 11 .0 / mid) ;
1717 let buy_px = format ! ( "{:.2}" , mid * 1.03 ) ;
1818
1919 println ! ( "{COIN} mid: ${mid:.2}" ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ async function main() {
99 mid = 78.0 ;
1010 }
1111
12- const sz = ( 10 .0 / mid ) . toFixed ( 2 ) ;
12+ const sz = ( 11 .0 / mid ) . toFixed ( 2 ) ;
1313 const buyPx = ( mid * 1.03 ) . toFixed ( 2 ) ;
1414
1515 console . log ( `${ COIN } mid: $${ mid . toFixed ( 2 ) } ` ) ;
You can’t perform that action at this time.
0 commit comments