Skip to main content

BotConfig

Struct BotConfig 

Source
pub struct BotConfig {
Show 17 fields pub environment: String, pub private_key: String, pub address: String, pub vault_address: Option<String>, pub base_url_override: Option<String>, pub strategy_type: String, pub markets: Vec<Market>, pub poll_delay_ms: u64, pub grid: Option<GridConfigJson>, pub mm: Option<MMConfigJson>, pub dca: Option<DCAConfigJson>, pub arbitrage: Option<ArbitrageConfigJson>, pub orchestrator: Option<OrchestratorConfigJson>, pub builder_fee: Option<BuilderFeeConfig>, pub sync: Option<SyncConfigJson>, pub simulation: Option<SimulationConfig>, pub extra: HashMap<String, Value>,
}
Expand description

Bot configuration - V2 format with markets array. This is the unified config format for all strategies.

Fields§

§environment: String

Environment: “testnet” or “mainnet”

§private_key: String

Private key (hex, with or without 0x prefix). Optional — resolved at runtime from ~/.supurr/credentials.json if absent.

§address: String

Wallet address. Optional — resolved at runtime from ~/.supurr/credentials.json if absent.

§vault_address: Option<String>

Optional vault address

§base_url_override: Option<String>

Optional Hyperliquid base URL override. When set, both /info and /exchange requests use this gateway.

§strategy_type: String

Strategy type: “grid”, “mm”, “dca”, or “arbitrage”

§markets: Vec<Market>

Markets to trade on (V2 format - uses bot_core::Market enum)

§poll_delay_ms: u64

Polling delay in milliseconds

§grid: Option<GridConfigJson>

Grid strategy configuration

§mm: Option<MMConfigJson>

Market Maker strategy configuration

§dca: Option<DCAConfigJson>

DCA strategy configuration

§arbitrage: Option<ArbitrageConfigJson>

Arbitrage strategy configuration

§orchestrator: Option<OrchestratorConfigJson>

Parent strategy configuration for grouped child strategies.

§builder_fee: Option<BuilderFeeConfig>

Builder fee configuration

§sync: Option<SyncConfigJson>

Trade sync configuration for upstream API PnL tracking

§simulation: Option<SimulationConfig>

Simulation configuration (paper/backtest) Optional — uses sensible defaults if absent.

§extra: HashMap<String, Value>

Catch-all for custom strategy configuration sections. Any JSON key that doesn’t match a named field above lands here. Custom strategies read their config via config.custom_config("mystrategy").

Implementations§

Source§

impl BotConfig

Source

pub fn primary_market(&self) -> &Market

Get the primary market from the markets array

Source

pub fn is_spot(&self) -> bool

Check if this is a spot market

Source

pub fn is_spot_like(&self) -> bool

Check if the primary market settles like spot with no margin/leverage.

Source

pub fn primary_market_uses_margin(&self) -> bool

Check if the primary market uses margin/leverage.

Source

pub fn is_outcome(&self) -> bool

Check if this is a prediction market outcome

Source

pub fn instrument_id(&self) -> InstrumentId

Get instrument ID from primary market

Source

pub fn market_index(&self) -> MarketIndex

Get market index from primary market

Source

pub fn hip3_config(&self) -> Option<Hip3MarketConfig>

Get HIP-3 config if this is a HIP-3 market

Source

pub fn custom_config<T: DeserializeOwned>( &self, strategy_name: &str, ) -> Result<T>

Get custom strategy config as typed struct. Looks up the strategy name in the extra catch-all map and deserializes.

§Example
let my_config: MyConfig = config.custom_config("mystrategy")?;
Source

pub fn from_env() -> Result<Self>

Load config from environment variables. V2 configs require a JSON file, so this returns an error.

Source

pub fn resolve_credentials(&self) -> Result<(String, String)>

Resolve wallet credentials: use fields from config if present, otherwise fall back to ~/.supurr/credentials.json.

Returns (private_key, address).

Source

pub fn from_file(path: &PathBuf) -> Result<Self>

Load config from a JSON file

Source

pub fn parse_environment(&self) -> Environment

Parse environment from string

Source

pub fn strategy_leverage(&self) -> Option<(Decimal, Decimal)>

Extract strategy leverage and max_leverage from whichever strategy config is active. Returns Some((leverage, max_leverage)) if the active strategy has leverage settings.

Source

pub fn strategy_allocated_capital_usdc(&self) -> Option<Decimal>

Capital allocated to the active strategy, used as the performance metric base.

This is deliberately strategy-scoped. Wallet/account equity is not used here because unrelated idle wallet capital would dilute APR, Sharpe, and drawdown percentages.

Source

pub fn effective_simulation_config(&self) -> SimulationConfig

Get the effective simulation config, falling back to defaults if absent.

Trait Implementations§

Source§

impl Clone for BotConfig

Source§

fn clone(&self) -> BotConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BotConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for BotConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for BotConfig

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for BotConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more