This is a collection of utilities to query Oikos data from Ethereum. This data has been indexed by The Graph via the various subgraphs the oikos team maintains (the subgraph code repo).
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 ofBNB
forsUSD
) either from a givenfromAddress
or (and as well as) to a giventoAddress
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 is3600
). 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 orderoks.holders
Get the list of wallets that have ever sent or receivedoks
.oks.rewards
Get the list of reward escrow holders and their latest balance at vesting entry add or vest.oks.total
Get the total count of uniqueissuers
andoksHolders
oks.transfers
Get oks transfers in reverse chronological order
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).rates.observe()
Get an observable tosubscribe
to that willnext
the latest rates in real time (replays the most recent exchange immediately).
const oksData = require('oikos-data'); // common js
// or
import oksData from 'oikos-data'; // es modules
// query and log resolved results
oksData.exchanges
.since({
minTimestamp: Math.floor(Date.now() / 1e3) - 3600 * 24, // one day ago
})
.then(exchanges => console.log(exchanges));
// subscribe and log streaming results
oksData.exchanges.observe().subscribe({
next(val) {
console.log(val);
},
error: console.error,
complete() {
console.log('done');
},
});
<script src="//cdn.jsdelivr.net/npm/oikos-data/browser.js"></script>
<script>
window.oksData.exchanges
.since({
minTimestamp: Math.floor(Date.now() / 1e3) - 3600 * 24, // one day ago
})
.then(console.log);
window.oksData.exchanges.observe().subscribe({ next: console.log });
</script>
# get last 24 hours of exchange activity, ordered from latest to earliest
npx oikos-data exchanges.since
# get exchanges on oikos as they occur in real time (replays the last exchange first)
npx oikos-data exchanges.subscribe