LeoYeAI/agent-master-skills / skills/1m-trade/skills/1m-trade-dex
1m-trade-dex
VerifiedHyperliquid DEX/Perps entrypoint via `hl1m`: market queries, order placement. Wallet creation/management at https://www.1m-trade.com; local `hl1m init-wallet` with address + proxy (API) private key — never the main wallet key. No in-skill private-key messaging.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.9 KB |
| reference.md | markdown | 4.3 KB |
| scripts/exchange.py | script | 3.6 KB |
| scripts/hl.py | script | 6.3 KB |
| scripts/info.py | script | 2.4 KB |
| scripts/requirements.txt | manifest | 59 B |
scripts/exchange.py
View on GitHubimport json
import os
import sys
from hyperliquid.info import Info
from hyperliquid.exchange import Exchange
from hyperliquid.utils import constants
from eth_account.signers.local import LocalAccount
import eth_account
def get_exchange(testnet=False):
print("Testnet" if testnet else "Mainnet")
# Private key is required (proxy key or main wallet key)
private_key = os.getenv("HYPERLIQUID_PRIVATE_KEY")
if not private_key:
print(json.dumps({"error": "HYPERLIQUID_PRIVATE_KEY environment variable is not set"}))
sys.exit(1)
if not private_key.startswith("0x"):
private_key = "0x" + private_key
api_url = constants.TESTNET_API_URL if testnet else constants.MAINNET_API_URL
wallet: LocalAccount = eth_account.Account.from_key(private_key)
env_address = os.getenv("HYPERLIQUID_WALLET_ADDRESS")
if env_address:
address = env_address
else:
account = eth_account.Account.from_key(private_key)
address = account.address
return Exchange(wallet=wallet, account_address=address, base_url=api_url, perp_dexs=["", "xyz"]), address
# Compute trading precision
def query_decimals(exchange:Exchange, name):
asset = exchange.info.name_to_asset(name)
sz_decimal = exchange.info.asset_to_sz_decimals[asset]
px_decimal = 6 - exchange.info.asset_to_sz_decimals[asset]
return sz_decimal, px_decimal
def exchange_order(parser):
args = parser.parse_args()
# Trading requires a private key
exchange, address = get_exchange(args.testnet)
# Enable xyz abstraction
exchange.user_dex_abstraction(address, True)
exchange.set_referrer("HYPERCLAW")
result = []
if args.command == "place-order":
sz_decimal, px_decimal = query_decimals(exchange, args.coin)
limit_px = round(args.limit_px, px_decimal)
result = exchange.order(
name=args.coin,
is_buy=args.is_buy,
sz=round(args.qty, sz_decimal),
limit_px=limit_px,
order_type={"limit": {"tif": args.tif}},
reduce_only=args.reduce_only
)
elif args.command == "market-order":
sz_decimal, px_decimal = query_decimals(exchange, args.coin)
result = exchange.market_open(
name=args.coin,
is_buy=args.is_buy,
sz=round(args.qty, sz_decimal),
slippage=args.slippage
)
elif args.command == "cancel-order":
info = Info(skip_ws=True, perp_dexs=["", "xyz"])
orders = info.open_orders(address)
oid = args.oid
coin = args.coin
for item in orders:
tmp_oid = item.get("oid")
tmp_coin = item.get("coin")
rst = []
if oid is None and coin is None:
rst = exchange.cancel(tmp_coin, tmp_oid)
elif coin and coin == tmp_coin:
rst = exchange.cancel(tmp_coin, tmp_oid)
elif oid and oid == tmp_oid:
rst = exchange.cancel(tmp_coin, tmp_oid)
if rst:
result.append(rst)
elif args.command == "update-leverage":
result = exchange.update_leverage(args.leverage, args.coin, args.is_cross)
elif args.command == "market-close":
sz_decimal, px_decimal = query_decimals(exchange, args.coin)
result = exchange.market_close(
coin=args.coin,
sz=round(args.qty, sz_decimal),
slippage=args.slippage
)
elif args.command == "update-isolated-margin":
result = exchange.update_isolated_margin(
amount=args.amount,
name=args.coin
)
return resultRelated skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |