API Reference
Types
- class avantis_trader_sdk.types.Depth(**data)[source]
Bases:
BaseModel
- Parameters:
above (Dict[str, float] | None)
below (Dict[str, float] | None)
-
above:
Optional
[Dict
[str
,float
]]
-
below:
Optional
[Dict
[str
,float
]]
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'above': FieldInfo(annotation=Union[Dict[str, float], NoneType], required=False, default=None), 'below': FieldInfo(annotation=Union[Dict[str, float], NoneType], required=False, default=None)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class avantis_trader_sdk.types.DepthSingle(**data)[source]
Bases:
BaseModel
- Parameters:
above (float)
below (float)
-
above:
float
-
below:
float
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'above': FieldInfo(annotation=float, required=True), 'below': FieldInfo(annotation=float, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class avantis_trader_sdk.types.Fee(**data)[source]
Bases:
BaseModel
- Parameters:
long (Dict[str, float] | None)
short (Dict[str, float] | None)
-
long:
Optional
[Dict
[str
,float
]]
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'long': FieldInfo(annotation=Union[Dict[str, float], NoneType], required=False, default=None), 'short': FieldInfo(annotation=Union[Dict[str, float], NoneType], required=False, default=None)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
short:
Optional
[Dict
[str
,float
]]
- class avantis_trader_sdk.types.LossProtectionInfo(**data)[source]
Bases:
BaseModel
- Parameters:
percentage (float)
amount (float)
-
amount:
float
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'amount': FieldInfo(annotation=float, required=True), 'percentage': FieldInfo(annotation=float, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
percentage:
float
- class avantis_trader_sdk.types.MarginFee(**data)[source]
Bases:
BaseModel
- Parameters:
hourly_base_fee_parameter (Dict[str, float])
hourly_margin_fee_long_bps (Dict[str, float])
hourly_margin_fee_short_bps (Dict[str, float])
-
hourly_base_fee_parameter:
Dict
[str
,float
]
-
hourly_margin_fee_long_bps:
Dict
[str
,float
]
-
hourly_margin_fee_short_bps:
Dict
[str
,float
]
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'hourly_base_fee_parameter': FieldInfo(annotation=Dict[str, float], required=True), 'hourly_margin_fee_long_bps': FieldInfo(annotation=Dict[str, float], required=True), 'hourly_margin_fee_short_bps': FieldInfo(annotation=Dict[str, float], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class avantis_trader_sdk.types.MarginFeeSingle(**data)[source]
Bases:
BaseModel
- Parameters:
hourly_base_fee_parameter (float)
hourly_margin_fee_long_bps (float)
hourly_margin_fee_short_bps (float)
-
hourly_base_fee_parameter:
float
-
hourly_margin_fee_long_bps:
float
-
hourly_margin_fee_short_bps:
float
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'hourly_base_fee_parameter': FieldInfo(annotation=float, required=True), 'hourly_margin_fee_long_bps': FieldInfo(annotation=float, required=True), 'hourly_margin_fee_short_bps': FieldInfo(annotation=float, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class avantis_trader_sdk.types.MarginUpdateType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
- DEPOSIT = 0
- WITHDRAW = 1
- class avantis_trader_sdk.types.OpenInterest(**data)[source]
Bases:
BaseModel
- Parameters:
long (Dict[str, float])
short (Dict[str, float])
-
long:
Dict
[str
,float
]
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'long': FieldInfo(annotation=Dict[str, float], required=True), 'short': FieldInfo(annotation=Dict[str, float], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
short:
Dict
[str
,float
]
- class avantis_trader_sdk.types.OpenInterestLimits(**data)[source]
Bases:
BaseModel
- Parameters:
limits (Dict[str, float])
-
limits:
Dict
[str
,float
]
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'limits': FieldInfo(annotation=Dict[str, float], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class avantis_trader_sdk.types.PairInfo(**data)[source]
Bases:
BaseModel
- Parameters:
from_ (str)
to (str)
feed (PairInfoFeed)
backupFeed (PairInfoFeed)
spreadP (float)
priceImpactMultiplier (float)
skewImpactMultiplier (float)
groupIndex (int)
feeIndex (int)
groupOpenInterestPecentage (float)
maxWalletOI (float)
-
backup_feed:
PairInfoFeed
-
constant_spread_bps:
float
-
fee_index:
int
-
feed:
PairInfoFeed
-
from_:
str
-
group_index:
int
-
group_open_interest_percentage:
float
-
max_wallet_oi:
float
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'backup_feed': FieldInfo(annotation=PairInfoFeed, required=True, alias='backupFeed', alias_priority=2), 'constant_spread_bps': FieldInfo(annotation=float, required=True, alias='spreadP', alias_priority=2), 'fee_index': FieldInfo(annotation=int, required=True, alias='feeIndex', alias_priority=2), 'feed': FieldInfo(annotation=PairInfoFeed, required=True), 'from_': FieldInfo(annotation=str, required=True, alias='from', alias_priority=2), 'group_index': FieldInfo(annotation=int, required=True, alias='groupIndex', alias_priority=2), 'group_open_interest_percentage': FieldInfo(annotation=float, required=True, alias='groupOpenInterestPecentage', alias_priority=2), 'max_wallet_oi': FieldInfo(annotation=float, required=True, alias='maxWalletOI', alias_priority=2), 'price_impact_parameter': FieldInfo(annotation=float, required=True, alias='priceImpactMultiplier', alias_priority=2), 'skew_impact_parameter': FieldInfo(annotation=float, required=True, alias='skewImpactMultiplier', alias_priority=2), 'to': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
price_impact_parameter:
float
-
skew_impact_parameter:
float
-
to:
str
- class avantis_trader_sdk.types.PairInfoExtended(**data)[source]
Bases:
PairInfo
- Parameters:
from_ (str)
to (str)
feed (PairInfoFeed)
backupFeed (PairInfoFeed)
spreadP (float)
priceImpactMultiplier (float)
skewImpactMultiplier (float)
groupIndex (int)
feeIndex (int)
groupOpenInterestPecentage (float)
maxWalletOI (float)
asset_open_interest_limit (float)
asset_open_interest (Dict[str, float])
asset_utilization (float)
asset_skew (float)
blended_utilization (float)
blended_skew (float)
margin_fee (MarginFeeSingle)
one_percent_depth (DepthSingle)
new_1k_long_opening_fee_bps (float)
new_1k_short_opening_fee_bps (float)
new_1k_long_opening_spread_bps (float)
new_1k_short_opening_spread_bps (float)
price_impact_spread_long_bps (float)
price_impact_spread_short_bps (float)
skew_impact_spread_long_bps (float)
skew_impact_spread_short_bps (float)
-
asset_open_interest:
Dict
[str
,float
]
-
asset_open_interest_limit:
float
-
asset_skew:
float
-
asset_utilization:
float
-
blended_skew:
float
-
blended_utilization:
float
-
margin_fee:
MarginFeeSingle
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'asset_open_interest': FieldInfo(annotation=Dict[str, float], required=True), 'asset_open_interest_limit': FieldInfo(annotation=float, required=True), 'asset_skew': FieldInfo(annotation=float, required=True), 'asset_utilization': FieldInfo(annotation=float, required=True), 'backup_feed': FieldInfo(annotation=PairInfoFeed, required=True, alias='backupFeed', alias_priority=2), 'blended_skew': FieldInfo(annotation=float, required=True), 'blended_utilization': FieldInfo(annotation=float, required=True), 'constant_spread_bps': FieldInfo(annotation=float, required=True, alias='spreadP', alias_priority=2), 'fee_index': FieldInfo(annotation=int, required=True, alias='feeIndex', alias_priority=2), 'feed': FieldInfo(annotation=PairInfoFeed, required=True), 'from_': FieldInfo(annotation=str, required=True, alias='from', alias_priority=2), 'group_index': FieldInfo(annotation=int, required=True, alias='groupIndex', alias_priority=2), 'group_open_interest_percentage': FieldInfo(annotation=float, required=True, alias='groupOpenInterestPecentage', alias_priority=2), 'margin_fee': FieldInfo(annotation=MarginFeeSingle, required=True), 'max_wallet_oi': FieldInfo(annotation=float, required=True, alias='maxWalletOI', alias_priority=2), 'new_1k_long_opening_fee_bps': FieldInfo(annotation=float, required=True), 'new_1k_long_opening_spread_bps': FieldInfo(annotation=float, required=True), 'new_1k_short_opening_fee_bps': FieldInfo(annotation=float, required=True), 'new_1k_short_opening_spread_bps': FieldInfo(annotation=float, required=True), 'one_percent_depth': FieldInfo(annotation=DepthSingle, required=True), 'price_impact_parameter': FieldInfo(annotation=float, required=True, alias='priceImpactMultiplier', alias_priority=2), 'price_impact_spread_long_bps': FieldInfo(annotation=float, required=True), 'price_impact_spread_short_bps': FieldInfo(annotation=float, required=True), 'skew_impact_parameter': FieldInfo(annotation=float, required=True, alias='skewImpactMultiplier', alias_priority=2), 'skew_impact_spread_long_bps': FieldInfo(annotation=float, required=True), 'skew_impact_spread_short_bps': FieldInfo(annotation=float, required=True), 'to': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
new_1k_long_opening_fee_bps:
float
-
new_1k_long_opening_spread_bps:
float
-
new_1k_short_opening_fee_bps:
float
-
new_1k_short_opening_spread_bps:
float
-
one_percent_depth:
DepthSingle
-
price_impact_spread_long_bps:
float
-
price_impact_spread_short_bps:
float
-
skew_impact_spread_long_bps:
float
-
skew_impact_spread_short_bps:
float
- class avantis_trader_sdk.types.PairInfoFeed(**data)[source]
Bases:
BaseModel
- Parameters:
maxDeviationP (float)
feedId (str)
-
feed_id:
str
-
max_deviation_percentage:
float
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'feed_id': FieldInfo(annotation=str, required=True, alias='feedId', alias_priority=2), 'max_deviation_percentage': FieldInfo(annotation=float, required=True, alias='maxDeviationP', alias_priority=2)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class avantis_trader_sdk.types.PairSpread(**data)[source]
Bases:
BaseModel
- Parameters:
spread (Dict[str, float])
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'spread': FieldInfo(annotation=Dict[str, float], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
spread:
Dict
[str
,float
]
- class avantis_trader_sdk.types.PendingLimitOrderExtendedResponse(**data)[source]
Bases:
PendingLimitOrderResponse
- Parameters:
trader (str)
pairIndex (int)
index (int)
positionSize (float)
buy (bool)
leverage (int)
tp (float)
sl (float)
price (float)
slippageP (float)
block (int)
liquidation_price (float)
-
liquidation_price:
float
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'block': FieldInfo(annotation=int, required=True), 'buy': FieldInfo(annotation=bool, required=True), 'leverage': FieldInfo(annotation=int, required=True), 'liquidation_price': FieldInfo(annotation=float, required=True), 'open_collateral': FieldInfo(annotation=float, required=True, alias='positionSize', alias_priority=2), 'pair_index': FieldInfo(annotation=int, required=True, alias='pairIndex', alias_priority=2), 'price': FieldInfo(annotation=float, required=True), 'sl': FieldInfo(annotation=float, required=True), 'slippage_percentage': FieldInfo(annotation=float, required=True, alias='slippageP', alias_priority=2), 'tp': FieldInfo(annotation=float, required=True), 'trade_index': FieldInfo(annotation=int, required=False, default=0, alias='index', alias_priority=2), 'trader': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class avantis_trader_sdk.types.PendingLimitOrderResponse(**data)[source]
Bases:
BaseModel
- Parameters:
trader (str)
pairIndex (int)
index (int)
positionSize (float)
buy (bool)
leverage (int)
tp (float)
sl (float)
price (float)
slippageP (float)
block (int)
-
block:
int
-
buy:
bool
-
leverage:
int
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'block': FieldInfo(annotation=int, required=True), 'buy': FieldInfo(annotation=bool, required=True), 'leverage': FieldInfo(annotation=int, required=True), 'open_collateral': FieldInfo(annotation=float, required=True, alias='positionSize', alias_priority=2), 'pair_index': FieldInfo(annotation=int, required=True, alias='pairIndex', alias_priority=2), 'price': FieldInfo(annotation=float, required=True), 'sl': FieldInfo(annotation=float, required=True), 'slippage_percentage': FieldInfo(annotation=float, required=True, alias='slippageP', alias_priority=2), 'tp': FieldInfo(annotation=float, required=True), 'trade_index': FieldInfo(annotation=int, required=False, default=0, alias='index', alias_priority=2), 'trader': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
open_collateral:
float
-
pair_index:
int
-
price:
float
-
sl:
float
-
slippage_percentage:
float
-
tp:
float
-
trade_index:
int
-
trader:
str
- class avantis_trader_sdk.types.PriceFeedResponse(**data)[source]
Bases:
BaseModel
- Parameters:
id (str)
price (Dict[str, str] | Dict[str, float] | None)
ema_price (Dict[str, str] | Dict[str, float] | None)
pair (str | None)
metadata (Dict[str, str] | Dict[str, float] | None)
converted_price (float)
converted_ema_price (float)
-
converted_ema_price:
float
-
converted_price:
float
-
ema_price:
Union
[Dict
[str
,str
],Dict
[str
,float
],None
]
-
id:
str
-
metadata:
Union
[Dict
[str
,str
],Dict
[str
,float
],None
]
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'converted_ema_price': FieldInfo(annotation=float, required=False, default=0.0), 'converted_price': FieldInfo(annotation=float, required=False, default=0.0), 'ema_price': FieldInfo(annotation=Union[Dict[str, str], Dict[str, float], NoneType], required=False, default=None), 'id': FieldInfo(annotation=str, required=True), 'metadata': FieldInfo(annotation=Union[Dict[str, str], Dict[str, float], NoneType], required=False, default=None), 'pair': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'price': FieldInfo(annotation=Union[Dict[str, str], Dict[str, float], NoneType], required=False, default=None)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
pair:
Optional
[str
]
-
price:
Union
[Dict
[str
,str
],Dict
[str
,float
],None
]
- class avantis_trader_sdk.types.PriceFeedUpdatesResponse(**data)[source]
Bases:
BaseModel
- Parameters:
binary (PriceFeesUpdateBinary)
parsed (List[PriceFeedResponse])
-
binary:
PriceFeesUpdateBinary
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'binary': FieldInfo(annotation=PriceFeesUpdateBinary, required=True), 'parsed': FieldInfo(annotation=List[PriceFeedResponse], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
parsed:
List
[PriceFeedResponse
]
- class avantis_trader_sdk.types.PriceFeesUpdateBinary(**data)[source]
Bases:
BaseModel
- Parameters:
encoding (str)
data (List[str])
-
data:
List
[str
]
-
encoding:
str
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'data': FieldInfo(annotation=List[str], required=True), 'encoding': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class avantis_trader_sdk.types.Skew(**data)[source]
Bases:
BaseModel
- Parameters:
skew (Dict[str, float])
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'skew': FieldInfo(annotation=Dict[str, float], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
skew:
Dict
[str
,float
]
- class avantis_trader_sdk.types.Snapshot(**data)[source]
Bases:
BaseModel
- Parameters:
groups (Dict[Annotated[int, None, Interval(gt=None, ge=0, lt=None, le=None), None], SnapshotGroup])
-
groups:
Dict
[Annotated
[int
],SnapshotGroup
]
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'groups': FieldInfo(annotation=Dict[Annotated[int, NoneType, Interval, NoneType], SnapshotGroup], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class avantis_trader_sdk.types.SnapshotGroup(**data)[source]
Bases:
BaseModel
- Parameters:
group_open_interest_limit (float)
group_open_interest (SnapshotOpenInterest)
group_utilization (float)
group_skew (float)
pairs (Dict[str, PairInfoExtended])
-
group_open_interest:
SnapshotOpenInterest
-
group_open_interest_limit:
float
-
group_skew:
float
-
group_utilization:
float
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'group_open_interest': FieldInfo(annotation=SnapshotOpenInterest, required=True), 'group_open_interest_limit': FieldInfo(annotation=float, required=True), 'group_skew': FieldInfo(annotation=float, required=True), 'group_utilization': FieldInfo(annotation=float, required=True), 'pairs': FieldInfo(annotation=Dict[str, PairInfoExtended], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
pairs:
Dict
[str
,PairInfoExtended
]
- class avantis_trader_sdk.types.SnapshotOpenInterest(**data)[source]
Bases:
BaseModel
- Parameters:
long (float)
short (float)
-
long:
float
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'long': FieldInfo(annotation=float, required=True), 'short': FieldInfo(annotation=float, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
short:
float
- class avantis_trader_sdk.types.Spread(**data)[source]
Bases:
BaseModel
- Parameters:
long (Dict[str, float] | None)
short (Dict[str, float] | None)
-
long:
Optional
[Dict
[str
,float
]]
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'long': FieldInfo(annotation=Union[Dict[str, float], NoneType], required=False, default=None), 'short': FieldInfo(annotation=Union[Dict[str, float], NoneType], required=False, default=None)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
short:
Optional
[Dict
[str
,float
]]
- class avantis_trader_sdk.types.TradeExtendedResponse(**data)[source]
Bases:
BaseModel
- Parameters:
trade (TradeResponse)
additional_info (TradeInfo)
margin_fee (float)
liquidation_price (float)
-
liquidation_price:
float
-
margin_fee:
float
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'additional_info': FieldInfo(annotation=TradeInfo, required=True), 'liquidation_price': FieldInfo(annotation=float, required=True), 'margin_fee': FieldInfo(annotation=float, required=True), 'trade': FieldInfo(annotation=TradeResponse, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
trade:
TradeResponse
- class avantis_trader_sdk.types.TradeInfo(**data)[source]
Bases:
BaseModel
- Parameters:
openInterestUSDC (float)
tpLastUpdated (float)
slLastUpdated (float)
beingMarketClosed (bool)
lossProtectionPercentage (float)
-
being_market_closed:
bool
-
loss_protection_percentage:
float
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'being_market_closed': FieldInfo(annotation=bool, required=True, alias='beingMarketClosed', alias_priority=2), 'loss_protection_percentage': FieldInfo(annotation=float, required=True, alias='lossProtectionPercentage', alias_priority=2), 'open_interest_usdc': FieldInfo(annotation=float, required=True, alias='openInterestUSDC', alias_priority=2), 'sl_last_updated': FieldInfo(annotation=float, required=True, alias='slLastUpdated', alias_priority=2), 'tp_last_updated': FieldInfo(annotation=float, required=True, alias='tpLastUpdated', alias_priority=2)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
open_interest_usdc:
float
-
sl_last_updated:
float
-
tp_last_updated:
float
- class avantis_trader_sdk.types.TradeInput(**data)[source]
Bases:
BaseModel
- Parameters:
trader (str)
pair_index (int)
trade_index (int)
open_collateral (int | None)
collateral_in_trade (int | None)
open_price (int)
is_long (bool)
leverage (int)
tp (int | None)
sl (int | None)
timestamp (int | None)
-
buy:
bool
-
index:
int
-
initialPosToken:
Optional
[int
]
-
leverage:
int
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'buy': FieldInfo(annotation=bool, required=True, alias='is_long', alias_priority=2), 'index': FieldInfo(annotation=int, required=False, default=0, alias='trade_index', alias_priority=2), 'initialPosToken': FieldInfo(annotation=Union[int, NoneType], required=False, default=None, alias='open_collateral', alias_priority=2), 'leverage': FieldInfo(annotation=int, required=True), 'openPrice': FieldInfo(annotation=int, required=False, default=0, alias='open_price', alias_priority=2), 'pairIndex': FieldInfo(annotation=int, required=True, alias='pair_index', alias_priority=2), 'positionSizeUSDC': FieldInfo(annotation=Union[int, NoneType], required=False, default=None, alias='collateral_in_trade', alias_priority=2), 'sl': FieldInfo(annotation=Union[int, NoneType], required=False, default=0), 'timestamp': FieldInfo(annotation=Union[int, NoneType], required=False, default=0), 'tp': FieldInfo(annotation=Union[int, NoneType], required=False, default=0), 'trader': FieldInfo(annotation=str, required=False, default='0x1234567890123456789012345678901234567890')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
openPrice:
int
-
pairIndex:
int
-
positionSizeUSDC:
Optional
[int
]
-
sl:
Optional
[int
]
-
timestamp:
Optional
[int
]
-
tp:
Optional
[int
]
-
trader:
str
- class avantis_trader_sdk.types.TradeInputOrderType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
- LIMIT = 2
- MARKET = 0
- STOP_LIMIT = 1
- class avantis_trader_sdk.types.TradeResponse(**data)[source]
Bases:
BaseModel
- Parameters:
trader (str)
pairIndex (int)
index (int)
initialPosToken (float)
positionSizeUSDC (float)
openPrice (float)
buy (bool)
leverage (float)
tp (float)
sl (float)
timestamp (int)
-
collateral_in_trade:
float
-
is_long:
bool
-
leverage:
float
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'collateral_in_trade': FieldInfo(annotation=float, required=False, default=None, alias='positionSizeUSDC', alias_priority=2), 'is_long': FieldInfo(annotation=bool, required=True, alias='buy', alias_priority=2), 'leverage': FieldInfo(annotation=float, required=True), 'open_collateral': FieldInfo(annotation=float, required=False, default=None, alias='initialPosToken', alias_priority=2), 'open_price': FieldInfo(annotation=float, required=False, default=0, alias='openPrice', alias_priority=2), 'pair_index': FieldInfo(annotation=int, required=True, alias='pairIndex', alias_priority=2), 'sl': FieldInfo(annotation=float, required=True), 'timestamp': FieldInfo(annotation=int, required=True), 'tp': FieldInfo(annotation=float, required=True), 'trade_index': FieldInfo(annotation=int, required=False, default=0, alias='index', alias_priority=2), 'trader': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
open_collateral:
float
-
open_price:
float
-
pair_index:
int
-
sl:
float
-
timestamp:
int
-
tp:
float
-
trade_index:
int
-
trader:
str
- class avantis_trader_sdk.types.Utilization(**data)[source]
Bases:
BaseModel
- Parameters:
utilization (Dict[str, float])
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'utilization': FieldInfo(annotation=Dict[str, float], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
-
utilization:
Dict
[str
,float
]
Clients
- class avantis_trader_sdk.client.TraderClient(provider_url, l1_provider_url='https://eth.llamarpc.com', signer=None)[source]
Bases:
object
This class provides methods to interact with the Avantis smart contracts.
- Parameters:
signer (BaseSigner)
- async approve_usdc_for_trading(amount=100000)[source]
Approves the USDC amount for the Trading Storage contract.
- Parameters:
amount (optional) – The amount to approve. Defaults to $100,000.
- Returns:
The transaction hash.
- async get_balance(address=None)[source]
Gets the balance.
- Parameters:
address (optional) – The address.
- Returns:
The balance.
- async get_gas_estimate(transaction)[source]
Gets the gas estimate.
- Parameters:
transaction – The transaction object.
- Returns:
The gas estimate.
- async get_transaction_count(address=None)[source]
Gets the transaction count.
- Parameters:
address (optional) – The address.
- Returns:
The transaction count.
- async get_transaction_hex(transaction)[source]
Gets the transaction hex.
- Parameters:
transaction – The transaction object.
- Returns:
The transaction hex.
- async get_usdc_allowance_for_trading(address=None)[source]
Gets the USDC allowance for the Trading Storage contract.
- Parameters:
address (optional) – The address.
- Returns:
The USDC allowance.
- async get_usdc_balance(address=None)[source]
Gets the USDC balance.
- Parameters:
address (optional) – The address.
- Returns:
The USDC balance.
- load_contract(name)[source]
Loads the contract ABI and address from the local filesystem.
- Parameters:
name – The name of the contract.
- Returns:
A Contract object.
- load_contracts()[source]
Loads all the contracts mentioned in the config from the local filesystem.
- Returns:
A dictionary containing the contract names as keys and the Contract objects as values.
- async read_contract(contract_name, function_name, *args, decode=True)[source]
Calls a read-only function of a contract.
- Parameters:
contract_name – The name of the contract.
function_name – The name of the function.
args – The arguments to the function.
- Returns:
The result of the function call.
- async send_and_get_transaction_hash(signed_txn)[source]
Gets the transaction hash.
- Parameters:
signed_txn – The signed transaction object.
- Returns:
The transaction hash.
- set_signer(signer)[source]
Sets the signer.
- Parameters:
signer (BaseSigner)
- async sign_and_get_receipt(transaction)[source]
Signs a transaction and waits for it to be mined.
- Parameters:
transaction – The transaction object.
- Returns:
The transaction receipt.
- async sign_transaction(transaction)[source]
Signs a transaction.
- Parameters:
transaction – The transaction object.
- Returns:
The signed transaction object.
- async wait_for_transaction_receipt(tx_hash)[source]
Waits for the transaction to be mined.
- Parameters:
tx_hash – The transaction hash.
- Returns:
The transaction receipt.
- async write_contract(contract_name, function_name, *args, **kwargs)[source]
Calls a write function of a contract.
- Parameters:
contract_name – The name of the contract.
function_name – The name of the function.
args – The arguments to the function.
- Returns:
The transaction hash or the transaction object if signer is None.
- class avantis_trader_sdk.feed.feed_client.FeedClient(ws_url='wss://hermes.pyth.network/ws', on_error=None, on_close=None, hermes_url='https://hermes.pyth.network/v2/updates/price/latest')[source]
Bases:
object
Client for interacting with the Pyth price feed websocket.
- async get_latest_price_updates(identifiers)[source]
Retrieves the latest price updates for the specified feed ids.
- Parameters:
feedIds – The list of feed ids to retrieve the latest price updates for.
identifiers (List[str])
- Returns:
A PriceFeedUpdatesResponse object containing the latest price updates.
- get_pair_from_feed_id(feed_id)[source]
Retrieves the pair string from the feed id.
- Parameters:
feed_id – The feed id to retrieve the pair string for.
- Returns:
The pair string.
- async listen_for_price_updates()[source]
Listens for price updates from the Pyth price feed websocket. When a price update is received, the registered callbacks will be called with the updated price feed data.
- Raises:
Exception – If an error occurs while listening for price updates.