Types and Enums
GraphQL Types and Enums used in Queries, Mutations, and Subscriptions
enum BaseCurrency {
ETH
USDC
}
type AssetV2 {
id: ID!
baseCurrency: BaseCurrency!
supportedInstrumentTypes: [InstrumentType!]!
name: String!
symbol: String!
image: SizedImage
openInterest: BigInt!
preferredSubaccount: Int!
marketHash: String!
mmBips: Int!
imBips: Int!
minOrderSize: BigInt!
maxOrderSize: BigInt!
minOrderSizeIncrement: BigInt!
minPriceIncrement: BigInt!
}
enum OrderDirection {
BUY
SELL
}
enum OrderType {
MARKET
LIMIT
VOLATILITY
}
enum TimeInForce {
GTC # Good Till Cancelled
GTD # Good Till Date
}
input PlaceOrderInput {
marketHash: String!
"""
The instrument hash of the instrument being traded.
This hash may be retrieved by subscribing to the BBO subscription
to see the current valid instruments in the market.
"""
instrumentHash: String!
"""
The string-encoded subaccount placing the order. This subaccount may not have
a position in an instrument in another market.
"""
subaccount: BigInt!
"""
Market or Limit order. If order is MARKET, it should have a Time in Force of IOC.
"""
orderType: OrderType!
"""
BUY to long the instrument, SHORT to sell the instrument.
"""
direction: OrderDirection!
"""
Number of contracts to buy/sell, using 1e18 decimals.
"""
size: BigInt!
"""
If a limit order, the price expressed in the market's BaseCurrency
null if a market order.
"""
limitPrice: BigInt
volatilityBips: Int
"""
GoodTilCanceled or GoodTilDate. If GoodTilDate, the expiration field must be set.
"""
timeInForce: TimeInForce!
"""
Expiration UNIX timestamp of the order.
"""
expiration: DateTime
"""
Cryptographic nonce for the order, user-specified.
"""
nonce: BigInt!
"""
If true, the order cannot be a taker when matched, even if it crossed
another limit order when added to the orderbook.
"""
postOnly: Boolean
"""
If true, this order cannot increase the magnitude of the subaccount's position.
"""
reduceOnly: Boolean
}
input TransferInput {
asset: String!
fromSubaccount: BigInt!
toSubaccount: BigInt!
amount: BigInt!
nonce: BigInt!
}
enum SignatureType {
DIRECT
SIGNING_KEY
SIGNING_KEY_CACHED
EIP1271
}
input SigningKeyInput {
signer: Address!
authorizer: Address!
expiration: DateTime!
chainID: Int!
}
input SignatureInput {
signatureType: SignatureType!
signature: String!
signingKeyID: ID
}
enum PriceHistoryInterval {
ONE_MINUTE
ONE_HOUR
ONE_DAY
ONE_WEEK
ONE_MONTH
}
type OHLC {
timestamp: DateTime!
open: BigInt
high: BigInt
low: BigInt
close: BigInt
}
type PriceHistory {
data: [OHLC!]!
cursor: String
}
enum TransferType {
TRANSFER
TRADE
FUNDING
SETTLEMENT
LIQUIDATION
}
type TransferHistoryItem {
transactionHash: String!
name: String!
symbol: String!
type: TransferType!
subaccount: BigInt!
amount: BigInt!
price: BigInt
fees: BigInt
baseCurrency: BaseCurrency!
fundingRate: BigInt
isShort: Boolean
timestamp: DateTime!
}
type TransferHistory {
data: [TransferHistoryItem!]!
cursor: String
}
type BalanceInCurrency {
baseCurrency: BaseCurrency!
balance: BigInt!
}
type SubaccountOverview {
subaccount: BigInt!
subaccountID: Int!
name: String!
equity: BigInt!
baseCurrency: BaseCurrency!
marginUsageBips: Int!
liquidationPrice: BigInt!
unrealizedPnl: BigInt!
realizedPnl: BigInt!
marginMode: MarginMode!
}
type AccountOverview {
subaccounts: [SubaccountOverview!]!
totalBalance: [BalanceInCurrency!]!
totalEquity: [BalanceInCurrency!]!
totalUnrealizedPnl: [BalanceInCurrency!]!
totalRealizedPnl: [BalanceInCurrency!]!
}
type AccountDetails {
tier: RewardsTier!
nextNonce: Int!
makerFeeBips: Int!
takerFeeBips: Int!
}
type PositionOverview {
id: ID!
openTimestamp: DateTime!
closeTimestamp: DateTime
marketHash: String!
instrument: InstrumentInfo!
isLong: Boolean!
sizeHeld: BigInt!
sizeClosed: BigInt!
averagePrice: BigInt!
unrealizedPnl: BigInt!
realizedPnl: BigInt!
fundingPaid: BigInt!
}
type FundingRate {
periodEnd: DateTime!
"""
Funding rate in 10^18 decimals
"""
fundingRate: BigInt!
"""
If negative (true) shorts pay the longs, if positive (false) longs pay the shorts
"""
negative: Boolean!
}
type FundingHistory {
data: [FundingRate!]!
cursor: String
}
enum RewardsTier {
"""
Iron tier
"""
TIER_BASE
"""
Bronze tier
"""
TIER_1
"""
Silver tier
"""
TIER_2
"""
Gold tier
"""
TIER_3
"""
Future tier
"""
TIER_4
}
type PerpetualPair {
marketHash: String!
instrumentHash: String!
symbol: String!
baseCurrency: BaseCurrency!
minOrderSize: BigInt!
maxOrderSize: BigInt!
minOrderSizeIncrement: BigInt!
minPriceIncrement: BigInt!
initialMarginBips: Int!
preferredSubaccount: Int!
"""
This optional field is omitted when perpetualPair is queried without auth.
When included this will get the subaccount for the authenticated address
and preferred subaccount (id)
"""
subaccount: BigInt
}
enum EquityLookback {
MINUTE_60
HOUR_24
DAY_7
DAY_30
DAY_90
}
type EquityHistoryItem {
timestamp: DateTime!
equity: BigInt!
pnl: BigInt!
}
type AssetQuote {
symbol: String!
price: BigInt!
change24hBips: Int!
}
enum InstrumentType {
OPTION
PERPETUAL
}
enum EventType {
SNAPSHOT
UPDATE
}
enum TickerSource {
OPENSEA
BLUR
NFTX
UNISWAP
CURVE
ZEROEX
OTHER
}
type TickerEvent {
price: BigInt!
timestamp: DateTime!
bidPrice: BigInt!
bidSource: TickerSource!
askPrice: BigInt!
askSource: TickerSource!
}
type OrderInfo {
price: BigInt!
size: BigInt!
}
type Instrument {
"""
The hash for the instument used within the protocol.
"""
id: ID!
"""
The display name for the instrument
"""
name: String!
"""
The type of instrument (option or perp)
"""
instrumentType: InstrumentType!
"""
Current mark price for the instrument, as used by the margin system. If it is null, the instrument is not currently marked.
"""
markPrice: BigInt
"""
Current highest offer for the instrument.
"""
bid: OrderInfo
"""
Current lowest asking price for the instrument. Must be fillable.
"""
ask: OrderInfo
"""
The outstanding notional value of all of the instruments.
"""
openInterest: BigInt!
"""
Option only. The strike price of the option instrument.
"""
optionStrike: BigInt
"""
Option only. The expiration date of the option instrument.
"""
optionExpiration: DateTime
"""
Option only. The option type of the option instrument (CALL or PUT).
"""
optionType: OptionType
}
type InstrumentInfo {
"""
The hash for the instument used within the protocol.
"""
id: ID!
"""
The display name for the instrument
"""
name: String!
"""
The type of instrument (option or perp)
"""
instrumentType: InstrumentType!
"""
Option only. The strike price of the option instrument.
"""
optionStrike: BigInt
"""
Option only. The expiration date of the option instrument.
"""
optionExpiration: DateTime
"""
Option only. The option type of the option instrument (CALL or PUT).
"""
optionType: OptionType
}
type BBOEvent {
eventType: EventType!
timestamp: DateTime!
instruments: [Instrument!]!
}
enum PriceLevelDirection {
BID
ASK
}
type PriceLevel {
direction: PriceLevelDirection!
"""
The size of total orders for the instrument at this price level is expressed in 1e18 decimals. If 0, then price level should be removed from the cache
"""
size: BigInt!
"""
Price in terms of the instrument base currency in the instrument decimals
"""
price: BigInt!
}
type OrderbookEvent {
eventType: EventType!
timestamp: DateTime!
bidLevels: [PriceLevel!]!
askLevels: [PriceLevel!]!
}
type StatisticsEvent {
eventType: EventType!
timestamp: DateTime!
indexChange24hBips: Int!
indexChange7dBips: Int!
markPrice: BigInt!
markChange24hBips: Int!
callOpenInterest: BigInt!
putOpenInterest: BigInt!
perpetualOpenInterest: BigInt!
totalOpenInterest: BigInt!
dailyVolume: BigInt!
fundingRateBips: Int!
fundingRateDecimal: BigInt!
nextFundingEpoch: DateTime!
totalTrades24h: Int!
volatilityBips: Int!
}
enum OrderStatusOdyssey {
OPEN
PARTIALLY_MATCHED
MATCHED
PARTIALLY_FILLED
FILLED
CANCELED
UNFILLABLE
EXPIRED
REJECTED
FAILED
}
type SubaccountOrder {
createdAt: DateTime!
instrument: InstrumentInfo!
orderType: OrderType!
direction: OrderDirection!
size: BigInt!
remainingSize: BigInt!
limitPrice: BigInt
timeInForce: TimeInForce!
expiration: DateTime
orderHash: String!
status: OrderStatusOdyssey!
errorReason: String
}
type SubaccountOrderEvent {
eventType: EventType!
orders: [SubaccountOrder!]!
}
enum MarginMode {
STANDARD
PORTFOLIO
}
type SubaccountBalance {
assetName: String!
assetHash: String!
subaccount: BigInt!
subaccountID: Int!
balance: BigInt!
marginMode: MarginMode!
}
type SubaccountBalanceEvent {
eventType: EventType!
balances: [SubaccountBalance!]!
}
type SubaccountPosition {
id: ID!
openTimestamp: DateTime!
subaccount: BigInt!
subaccountID: Int!
marketHash: String!
instrument: InstrumentInfo!
isLong: Boolean!
sizeHeld: BigInt!
sizeClosed: BigInt!
realizedProceeds: BigInt!
averageCost: BigInt!
fundingPaid: BigInt!
}
type SubaccountPositionEvent {
eventType: EventType!
positions: [SubaccountPosition!]!
}
enum SystemStatus {
OPERATIONAL
DEGRADED
MAINTENANCE
OFFLINE
}
type SystemStatusEvent {
eventType: EventType!
"""
The current block number
"""
blockNumber: Int!
"""
The current system status
"""
status: SystemStatus!
"""
Additional information about the system status. Only present if the status is not OPERATIONAL
"""
message: String
"""
The system status update timestamp
"""
timestamp: DateTime!
}
type TradeHistoryItem {
size: BigInt!
price: BigInt!
timestamp: DateTime!
direction: OrderDirection!
}
type TradeHistoryEvent {
eventType: EventType!
history: [TradeHistoryItem!]!
}
Last updated