GMX API
This section covers how to retrieve staking information on GMX.
You can read more about the GMX ecosystem in this blog.
Video Tutorial on GMX and esGMX​
New Positions by Trader​
The following query retrieves new positions created by a specific trader on the GMX DEX
{
EVM(dataset: archive, network: arbitrum) {
Events(
where: {
Log: {
SmartContract: { is: "0x489ee077994B6658eAfA855C308275EAd8097C4A" },
Signature: { Name: { is: "IncreasePosition" } }
},
Arguments: {
includes: {
Name: { is: "account" },
Value: { Address: { is: "0x92812499fF2c040f93121Aab684680a6e603C4A7" } }
}
}
}
orderBy: { descending: Block_Time }
) {
Log {
Signature {
Name
Parsed
Signature
}
}
Arguments {
Name
Type
Value {
... on EVM_ABI_Boolean_Value_Arg {
bool
}
... on EVM_ABI_Bytes_Value_Arg {
hex
}
... on EVM_ABI_BigInt_Value_Arg {
bigInteger
}
... on EVM_ABI_Address_Value_Arg {
address
}
... on EVM_ABI_String_Value_Arg {
string
}
... on EVM_ABI_Integer_Value_Arg {
integer
}
}
}
Block {
Time
}
}
}
}
Latest Liquidated Positions​
The following query retrieves the latest liquidated positions on the GMX DEX, providing information on the account, collateral token, index token, position, reserve amount, realised PnL, and mark price.
{
EVM(dataset: archive, network: arbitrum) {
Events(
where: {
Log: {
SmartContract: { is: "0x489ee077994B6658eAfA855C308275EAd8097C4A" },
Signature: { Name: { is: "LiquidatePosition" } }
}
}
limit: { count: 100 }
orderBy: { descending: Block_Time }
) {
Log {
Signature {
Name
Parsed
Signature
}
}
Block {
Time
}
Call {
Signature {
Name
}
}
Transaction {
Hash
}
Arguments {
Name
Type
Value {
... on EVM_ABI_Boolean_Value_Arg {
bool
}
... on EVM_ABI_Bytes_Value_Arg {
hex
}
... on EVM_ABI_BigInt_Value_Arg {
bigInteger
}
... on EVM_ABI_Address_Value_Arg {
address
}
... on EVM_ABI_String_Value_Arg {
string
}
... on EVM_ABI_Integer_Value_Arg {
integer
}
}
}
}
}
}
Latest GMX Events​
You can run the query here.
The following query retrieves the latest GMX events on the Arbitrum network:
{
EVM(network: arbitrum) {
Events(
where: {
Log: {
SmartContract: { is: "0x489ee077994B6658eAfA855C308275EAd8097C4A" }
}
}
orderBy: { descending: Block_Time }
limit: { count: 10 }
) {
Log {
Signature {
Name
Parsed
Signature
}
}
Arguments {
Name
Type
Value {
... on EVM_ABI_Boolean_Value_Arg {
bool
}
... on EVM_ABI_Bytes_Value_Arg {
hex
}
... on EVM_ABI_BigInt_Value_Arg {
bigInteger
}
... on EVM_ABI_Address_Value_Arg {
address
}
... on EVM_ABI_String_Value_Arg {
string
}
... on EVM_ABI_Integer_Value_Arg {
integer
}
}
}
Block {
Time
}
}
}
}
These queries help you explore the latest activities and positions on the GMX protocol.