Notice
Imported from Synthetixio/synthetix-data
synthetix-data¶
This is a collection of utilities to query Synthetix data from Ethereum. This data has been indexed by The Graph via the various subgraphs the Synthetix team maintains (the subgraph code repo).
Supported queries¶
The below all return a Promise that resolves with the requested results.
depot.userActions({ user })
Get all depot deposit (sUSD
) actions for the given user -deposit
,withdrawl
,unaccepted
,removed
.depot.clearedDeposits({ fromAddress, toAddress })
Get all cleared synth deposits (payments ofETH
forsUSD
) either from a givenfromAddress
or (and as well as) to a giventoAddress
depot.exchanges({ from })
Get all depot exchanges (buying sUSD with ETH) for a givenfrom
address.exchanges.total()
Get the total exchange volume, total fees and total number of unique exchange addresses.exchanges.rebates({ minTimestamp = 1 day ago })
Get the lastN
exchange rebates since the givenminTimestamp
in seconds. Ordered in reverse chronological order.exchanges.reclaims({ minTimestamp = 1 day ago })
Get the lastN
exchange reclaims since the givenminTimestamp
in seconds. Ordered in reverse chronological order.exchanges.since({ minTimestamp = 1 day ago })
Get the lastN
exchanges since the givenminTimestamp
(in seconds, so one hour ago isMath.round(new Date().getTime()/1000) - 3600
). These are ordered in reverse chronological order.rate.updates
Get all rate updates for synths in reverse chronological ordersynths.issuers
Get all wallets that have invokedIssue
onsUSD
(other synths to come)synths.transfers
Get synth transfers in reverse chronological ordersynths.holders
Get all potential synth holderssnx.holders
Get the list of wallets that have ever sent or receivedSNX
.snx.rewards
Get the list of reward escrow holders and their latest balance at vesting entry add or vest.snx.total
Get the total count of uniqueissuers
andsnxHolders
snx.transfers
Get SNX transfers in reverse chronological ordersnx.issued
Get theIssued
events in reverse chronological order.snx.burned
Get theBurned
events in reverse chronological order.snx.feesClaimed
Get theFeesClaimed
events in reverse chronological order, showing fees in sUSD and rewards in SNX.snx.debtSnapshot
Get the historical debt balance for any wallet address.binaryOptions.markets
Get all the binary options markets created.binaryOptions.optionTransactions
Get all the Bid and Refund transactions made to the binary options markets.binaryOptions.historicalOptionPrice
Get historical records of every option price for every market.etherCollateral.loans
Get the list of all EtherCollateral loans opened.exchanger.exchangeEntriesSettled({ max, from })
Get the list of all settled exchanges.exchanges.aggregate({ max, timeSeries })
Get the total amount of exchanges aggregated across various time series.rate.snxAggregate({ max, timeSeries })
Get the price of snx aggregated across various time series.snx.aggregateActiveStakers({ max, timeSeries })
Get the number of active stakers across various time series.snx.totalActiveStakers()
Get the current number of active stakers.rate.dailyRateChange({ synths })
get the rate change over the past 24 hours for any synth. Can pass in a list to retrieve multiple synths.snx.accountsRemovedFromLiquidation({ maxTime, minTime, account, max })
finds all the accounts that have fixed their c-ratio to avoid being at risk of liquidation after being flagged.snx.accountsFlaggedForLiquidation({ minTime, maxTime, account, max })
finds all the accounts that have been flagged for liquidation.snx.accountsLiquidated({ maxTime, minTime, account, max })
finds all the accounts that have been liquidated after being flagged for liquidation.snx.getActiveLiquidations({ max, account, minTime, maxTime })
finds all the accounts that have been flagged and are still pending liquidation or in a waiting state. Can also just check for a specific account if desired.
Supported subscriptions¶
The below all return an Observable that when subscribed to with an object.
exchanges.observe()
Get an observable tosubscribe
to that willnext
the latest exchanges in real time (replays the most recent exchange immediately).rate.observe()
Get an observable tosubscribe
to that willnext
the latest rates in real time (replays the most recent exchange immediately).
Use this as a node or webpack dependency¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Use in a browser¶
1 2 3 4 5 6 7 8 9 10 |
|
How to query via the npm library (CLI)¶
1 2 3 4 5 |
|