CLI: Sandbox strategy testing
This SDK implementation provides a CLI tool for testing MINOS AI trading strategies, allowing traders to simulate ARIADNE, DEUCALION, and ANDROGEUS trades in a sandbox environment (strategy validation before deploying to vaults).
import click
import requests
from typing import Dict, Optional
class MinosAICLISDK:
"""CLI-based SDK for testing MINOS AI trading strategies."""
def __init__(self, api_key: str, base_url: str = "https://sandbox.minosai.net/v1"):
"""Initialize SDK with API key and sandbox URL."""
self.api_key = api_key
self.base_url = base_url
self.headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
def _make_request(self, endpoint: str, data: Optional[Dict] = None) -> Dict:
"""Helper method for sandbox API requests."""
url = f"{self.base_url}/{endpoint}"
try:
response = requests.post(url, headers=self.headers, json=data)
response.raise_for_status()
return response.json()
except requests.RequestException as e:
raise Exception(f"API request failed: {str(e)}")
def test_ariadne_strategy(self, strategy: str) -> Dict:
"""Test an ARIADNE strategy in sandbox mode."""
return self._make_request("ariadne/test", {"strategy": strategy})
def test_deucalion_copy(self, wallet: str, min_buy_size: float) -> Dict:
"""Test a DEUCALION copy trade in sandbox mode."""
return self._make_request("deucalion/test", {
"wallet_address": wallet,
"min_buy_size_sol": min_buy_size
})
def test_androgeus_rule(self, rule: str) -> Dict:
"""Test an ANDROGEUS rule-based trade in sandbox mode."""
return self._make_request("androgeus/test", {"rule": rule})
@click.group()
@click.option("--api-key", required=True, help="MINOS AI API key")
@click.pass_context
def cli(ctx, api_key):
"""MINOS AI CLI for testing trading strategies."""
ctx.obj = MinosAICLISDK(api_key)
@cli.command()
@click.argument("strategy")
@click.pass_obj
def test_ariadne(sdk, strategy):
"""Test an ARIADNE strategy."""
result = sdk.test_ariadne_strategy(strategy)
click.echo(f"ARIADNE Test Result: {result}")
@cli.command()
@click.argument("wallet")
@click.option("--min-buy-size", type=float, default=10.0, help="Minimum buy size in SOL")
@click.pass_obj
def test_deucalion(sdk, wallet, min_buy_size):
"""Test a DEUCALION copy trade."""
result = sdk.test_deucalion_copy(wallet, min_buy_size)
click.echo(f"DEUCALION Test Result: {result}")
@cli.command()
@click.argument("rule")
@click.pass_obj
def test_androgeus(sdk, rule):
"""Test an ANDROGEUS rule-based trade."""
result = sdk.test_androgeus_rule(rule)
click.echo(f"ANDROGEUS Test Result: {result}")
if __name__ == "__main__":
cli()
Last updated