Base URL
All API endpoints are served from:Copy
https://api.strike.markets
Quick Start
1. Get Your API Key
- Visit strike.markets and connect your wallet
- Click your wallet address → API Keys tab → Generate API Key
- Save the key immediately - it won’t be shown again
2. Test Connection
Copy
curl -X GET "https://api.strike.markets/api-key/status" \
-H "X-API-Key: stk_your_api_key_here"
3. Make Your First Trade
Copy
curl -X POST "https://api.strike.markets/long" \
-H "X-API-Key: stk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"margin": "100.0",
"leverage": 10,
"symbol": "BTC-USD"
}'
Trading Examples
Copy
import requests
import os
from dotenv import load_dotenv
load_dotenv()
API_KEY = os.getenv('STRIKE_API_KEY')
BASE_URL = 'https://api.strike.markets'
headers = {'X-API-Key': API_KEY, 'Content-Type': 'application/json'}
def get_markets():
"""Get available markets and prices"""
response = requests.get(f'{BASE_URL}/markets')
if response.status_code == 200:
return response.json()['data']
return []
def open_position(side, margin, leverage, symbol='BTC-USD'):
"""Open a long or short position"""
endpoint = '/long' if side == 'long' else '/short'
response = requests.post(
f'{BASE_URL}{endpoint}',
json={'margin': str(margin), 'leverage': leverage, 'symbol': symbol},
headers=headers
)
if response.status_code == 200:
position = response.json()
print(f"✅ Position opened: ID {position['positionId']}")
print(f"Entry: ${position['position']['entry_price']}")
print(f"Liquidation: ${position['liquidation_price']}")
return position
else:
print(f"❌ Failed: {response.json()}")
return None
def get_positions(wallet_address):
"""Get all positions for a wallet"""
response = requests.get(
f'{BASE_URL}/positions/{wallet_address}',
headers=headers
)
if response.status_code == 200:
return response.json()
return None
def close_position(position_id):
"""Close a position"""
response = requests.post(
f'{BASE_URL}/close',
json={'positionId': position_id},
headers=headers
)
if response.status_code == 200:
result = response.json()
print(f"✅ Position closed")
return result
return None
# Example usage
markets = get_markets()
print(f"Available markets: {[m['symbol'] for m in markets]}")
# Open a 100 USD long with 10x leverage
position = open_position('long', 100, 10, 'BTC-USD')
# Check positions
wallet = "0x742d35cc6c6c7532b1140da4c8a2f6c8ecfc9b46"
positions = get_positions(wallet)
# Close position
if position:
close_position(position['positionId'])