Perps
The Perps Contract provides data for the Perpetual Futures platform. It returns all market states and is needed for the Credit Manager to be able to execute trigger orders.
Last updated
The Perps Contract provides data for the Perpetual Futures platform. It returns all market states and is needed for the Credit Manager to be able to execute trigger orders.
Last updated
Neutron:
The types of the Perps Contract can be found .
For reference on the Queries and Methods:
type Decimal = string
type Uint128 = string
type Int128 = string
type SignedDecimal = string
Returns the Contracts configuration.
{
config: {}
}
{
data: {
address_provider: string
base_denom: string
cooldown_period: number
deleverage_enabled: boolean
max_positions: number
max_unlocks: number
protocol_fee_rate: Decimal
target_vault_collateralization_ratio: Decimal
vault_withdraw_enabled: boolean
}
}
{
market: {
denom: string
}
}
{
data: {
current_funding_rate: SignedDecimal
denom: string
enabled: boolean
long_oi: Uint128
long_oi_value: Uint128
short_oi: Uint128
short_oi_value: Uint128
}
}
{
market_accounting: {
denom: string
}
}
{
data: {
accounting: {
balance: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
price_pnl: Int128
total: Int128
}
cash_flow: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
price_pnl: Int128
protocol_fee: Uint128
}
withdrawal_balance: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
price_pnl: Int128
total: Int128
}
}
unrealized_pnl: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
pnl: Int128
price_pnl: Int128
}
}
}
{
market_state: {
denom: string
}
}
{
data: {
cash_flow: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
price_pnl: Int128
protocol_fee: Uint128
}
denom: string
enabled: boolean
funding: {
last_funding_accrued_per_unit_in_base_denom: SignedDecimal
last_funding_rate: SignedDecimal
max_funding_velocity: Decimal
skew_scale: Uint128
}
last_updated: number
long_oi: Uint128
short_oi: Uint128
total_abs_multiplied_positions: Int256
total_entry_cost: Int128
total_entry_funding: Int128
total_squared_positions: Uint256
}
}
{
markets: {
limit?: number | null
start_after?: string | null
}
}
{
data: {
data: [
{
denom: string
enabled: boolean
long_oi: Uint128
long_oi_value: Uint128
short_oi: Uint128
short_oi_value: Uint128
current_funding_rate: SignedDecimal
},
...
]
}
}
{
opening_fee: {
denom: string
size: Int128
}
}
{
data: {
rate: SignedDecimal
fee: {
denom: string
amount: Uint128
}
}
}
{
owner: {}
}
{
data: {
abolished: boolean
emergency_owner?: string | null
initialized: boolean
owner?: string | null
proposed?: string | null
}
}
{
position: {
account_id: string
denom: string
order_size?: Int128 | null
reduce_only?: boolean | null
}
}
{
data: {
account_id: string
position?: {
base_denom: string
current_exec_price: Decimal
current_price: Decimal
denom: string
entry_exec_price: Decimal
entry_price: Decimal
realized_pnl: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
pnl: Int128
price_pnl: Int128
}
size: Int128
unrealized_pnl: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
pnl: Int128
price_pnl: Int128
}
}
}
}
{
position_fees: {
account_id: string
denom: string
new_size: Int128
}
}
{
data: {
base_denom: string
closing_exec_price?: Decimal | null
closing_fee: Uint128
opening_exec_price?: Decimal | null
opening_fee: Uint128
}
}
{
positions: {
limit?: number | null
start_after?: [string, string] | null
}
}
{
data: [
{
account_id: string
position?: {
base_denom: string
current_exec_price: Decimal
current_price: Decimal
denom: string
entry_exec_price: Decimal
entry_price: Decimal
realized_pnl: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
pnl: Int128
price_pnl: Int128
}
size: Int128
unrealized_pnl: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
pnl: Int128
price_pnl: Int128
}
}
},
...
]
}
{
positions_by_account: {
account_id: string
action?: 'default' | 'liquidation' | null
}
}
{
data: {
account_id: string
positions: [
{
base_denom: string
current_exec_price: Decimal
current_price: Decimal
denom: string
entry_exec_price: Decimal
entry_price: Decimal
realized_pnl: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
pnl: Int128
price_pnl: Int128
}
size: Int128
unrealized_pnl: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
pnl: Int128
price_pnl: Int128
}
},
...
]
}
}
{
realized_pnl_by_account_and_market: {
account_id: string
denom: string
}
}
{
data: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
pnl: Int128
price_pnl: Int128
}
}
{
total_accounting: {}
}
{
data: {
accounting: {
balance: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
price_pnl: Int128
total: Int128
}
cash_flow: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
price_pnl: Int128
protocol_fee: Uint128
}
withdrawal_balance: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
price_pnl: Int128
total: Int128
}
}
unrealized_pnl: {
accrued_funding: Int128
closing_fee: Int128
opening_fee: Int128
pnl: Int128
price_pnl: Int128
}
}
}
{
vault: {
action?: 'default' | 'liquidation' | null
}
}
{
data: {
collateralization_ratio?: Decimal | null
share_price?: Decimal | null
total_balance: Int128
total_debt: Uint128
total_liquidity: Uint128
total_shares: Uint128
total_unlocking_or_unlocked_amount: Uint128
total_unlocking_or_unlocked_shares: Uint128
total_withdrawal_balance: Uint128
}
}
{
vault_position: {
account_id?: string | null
user_address: string
}
}
{
data: {
denom: string
deposit: {
amount: Uint128
shares: Uint128
}
unlocks: [
{
amount: Uint128
cooldown_end: number
created_at: number
shares: Uint128
},
...
]
}
}
{
close_all_positions: {
account_id: string
action?: 'default' | 'liquidation' | null
}
}
{
deleverage: {
account_id: string
denom: string
}
}
{
deposit: {
account_id?: string | null
max_shares_receivable?: Uint128 | null
}
}
{
execute_order: {
account_id: string
denom: string
reduce_only?: boolean | null
size: Int128
}
}
{
unlock: {
account_id?: string | null
shares: Uint128
}
}
{
withdraw: {
account_id?: string | null
min_receive?: Uint128 | null
}
}