Objects

class services.perpetual.api.gateway.objects.AssetOraclePrice

AssetOraclePrices

Represents a collection of signed oracle prices of a single synthetic asset and their median price value. The median price is stored in the base class.

The definition of a legal median value x: half the values are <= x and half of them are >= x.

Parameters
  • price (int) – The median price value. The definition of a legal median value x: half the values are <= x and half of them are >= x.

  • signed_prices (Mapping[int, SignedOraclePrice]) – A dictionary from the public key of the signer to a signed oracle price object.

class services.perpetual.api.gateway.objects.FundingIndicesState

FundingIndicesState

Represents a collection of timestamped global funding indices for all assets.

Parameters
  • indices (Mapping[int, int]) – Map of synthetic asset to its global funding index.

  • timestamp (int) – The timestamp for which the funding indices are valid for.

class services.perpetual.api.gateway.objects.Order

Order

Parameters
  • order_type (OrderType) – order type.

  • nonce (int) – Unique nonce issued by the caller.

  • public_key (int) – Public key of the party as registered on the StarkEx contract.

  • amount_synthetic (int) – Amount of synthetic asset in the order

  • amount_collateral (int) – Amount of collateral asset in the order.

  • amount_fee (int) – The fee limit for this order.

  • asset_id_synthetic (int) – The synthetic asset ID (as registered on the contract) participating in this order.

  • asset_id_collateral (int) – The collateral asset ID (as registered on the contract) participating in this order.

  • position_id (int) – Position ID used for the trade.

  • is_buying_synthetic (int) – A flag to indicate whether the order is for buying the synthetic amount or selling the synthetic amount.

  • expiration_timestamp (int) – The timestamp after which this request is no longer valid.

  • signature (Signature) – Signature of the party which issued this order.

class services.perpetual.api.gateway.objects.OrderType

OrderType

The types of orders supported in the system.

class services.perpetual.api.gateway.objects.Signature

Signature

Represents a STARK-friendly ECDSA signature.

Parameters
  • r (int) – 1st ECDSA signature component.

  • s (int) – 2nd ECDSA signature component.

class services.perpetual.api.gateway.objects.SignedOraclePrice

SignedOraclePrice

Represents a single signed Oracle Price per unit.

Parameters
  • price (int) – The signed price.

  • timestamped_signature (TimestampedSignature) – Represents a timestamped STARK-friendly ECDSA signature.

  • external_asset_id (int) – Concatenation of the asset name and the oracle name (both in hex encoding).

class services.perpetual.api.gateway.objects.TimestampedSignature

TimestampedSignature

Represents a STARK-friendly ECDSA signature which was signed at a certain timestamp.

Parameters
  • signature (Signature) – Represents a STARK-friendly ECDSA signature.

  • timestamp (int) – The time the signature was created.