|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from string import Template |
|
|
|
FPMMS_FIELD = "fixedProductMarketMakers" |
|
QUERY_FIELD = "query" |
|
ERROR_FIELD = "errors" |
|
DATA_FIELD = "data" |
|
ID_FIELD = "id" |
|
ANSWER_FIELD = "currentAnswer" |
|
QUESTION_FIELD = "question" |
|
OUTCOMES_FIELD = "outcomes" |
|
TITLE_FIELD = "title" |
|
ANSWER_TIMESTAMP_FIELD = "currentAnswerTimestamp" |
|
OPENING_TIMESTAMP_FIELD = "openingTimestamp" |
|
RESOLUTION_TIMESTAMP_FIELD = "resolutionTimestamp" |
|
CREATION_TIMESTAMP_FIELD = "creationTimestamp" |
|
LIQUIDITY_FIELD = "liquidityParameter" |
|
LIQUIDIY_MEASURE_FIELD = "liquidityMeasure" |
|
TOKEN_AMOUNTS_FIELD = "outcomeTokenAmounts" |
|
|
|
FPMMS_WITH_TOKENS_QUERY = Template( |
|
""" |
|
{ |
|
${fpmms_field}( |
|
where: { |
|
creator: "${creator}", |
|
id_gt: "${fpmm_id}", |
|
isPendingArbitration: false, |
|
currentAnswer: null, |
|
openingTimestamp_gt:${current_timestamp}, |
|
outcomeTokenAmounts_not: ["0","0"] |
|
}, |
|
orderBy: ${id_field} |
|
orderDirection: asc |
|
first: ${first} |
|
){ |
|
${id_field} |
|
${question_field} { |
|
${outcomes_field} |
|
${answer_timestamp_field} |
|
answers{ |
|
answer |
|
} |
|
} |
|
${title_field} |
|
${opening_timestamp_field} |
|
${creation_timestamp_field} |
|
resolutionTimestamp |
|
${liquidity_field} |
|
${liquidity_measure_field} |
|
${token_amounts_field} |
|
} |
|
} |
|
""" |
|
) |
|
|
|
FPMMS_CLOSED_MARKETS_QUERY = Template( |
|
""" |
|
{ |
|
${fpmms_field}( |
|
where: { |
|
creator: "${creator}", |
|
id_gt: "${fpmm_id}", |
|
creationTimestamp_gt: ${start_timestamp} |
|
creationTimestamp_lt: ${end_timestamp} |
|
}, |
|
orderBy: ${id_field} |
|
orderDirection: asc |
|
first: 1000 |
|
){ |
|
${id_field} |
|
isPendingArbitration |
|
|
|
${title_field} |
|
${opening_timestamp_field} |
|
${creation_timestamp_field} |
|
${liquidity_field} |
|
${liquidity_measure_field} |
|
${token_amounts_field} |
|
} |
|
} |
|
""" |
|
) |
|
|
|
omen_market_trades_query = Template( |
|
""" |
|
{ |
|
fpmmTrades( |
|
where: { |
|
type: Buy, |
|
fpmm_: { |
|
creator: "${fpmm_creator}", |
|
id: "${fpmm_id}", |
|
}, |
|
id_gt: "${id_gt}" |
|
} |
|
first: ${first} |
|
orderBy: id |
|
orderDirection: asc |
|
) { |
|
id |
|
title |
|
collateralToken |
|
outcomeTokenMarginalPrice |
|
oldOutcomeTokenMarginalPrice |
|
type |
|
creator { |
|
id |
|
} |
|
creationTimestamp |
|
collateralAmount |
|
collateralAmountUSD |
|
feeAmount |
|
outcomeIndex |
|
outcomeTokensTraded |
|
transactionHash |
|
fpmm { |
|
id |
|
outcomes |
|
title |
|
condition { |
|
id |
|
} |
|
} |
|
} |
|
} |
|
""" |
|
) |
|
|
|
omen_market_sorted_trades_query = Template( |
|
""" |
|
{ |
|
fpmmTrades( |
|
where: { |
|
type: Buy, |
|
fpmm_: { |
|
creator: "${fpmm_creator}", |
|
id: "${fpmm_id}", |
|
}, |
|
id_gt: "${id_gt}" |
|
} |
|
first: 1000 |
|
orderBy: creationTimestamp |
|
orderDirection: asc |
|
) { |
|
id |
|
title |
|
collateralToken |
|
outcomeTokenMarginalPrice |
|
oldOutcomeTokenMarginalPrice |
|
creationTimestamp |
|
collateralAmount |
|
collateralAmountUSD |
|
feeAmount |
|
outcomeIndex |
|
outcomeTokensTraded |
|
transactionHash |
|
} |
|
} |
|
""" |
|
) |
|
|
|
get_initial_amount_tokens_query = Template( |
|
""" |
|
{ |
|
|
|
fpmmLiquidities( |
|
where: { |
|
fpmm_: { |
|
creator: "${fpmm_creator}", |
|
id: "${fpmm_id}", |
|
}, |
|
id_gt: "" |
|
} |
|
orderBy: creationTimestamp |
|
orderDirection: asc |
|
) |
|
{ |
|
id |
|
outcomeTokenAmounts |
|
creationTimestamp |
|
additionalLiquidityParameter |
|
} |
|
} |
|
""" |
|
) |
|
|