thales-data
v3.0.19
Published
[![npm version](https://badge.fury.io/js/thales-data.svg)](https://badge.fury.io/js/thales-data) [![Discord](https://img.shields.io/discord/906484044915687464.svg?color=768AD4&label=discord&logo=https%3A%2F%2Fdiscordapp.com%2Fassets%2F8c9701b98ad4372b58f
Downloads
652
Keywords
Readme
thales-data
This is a collection of utilities to query Thales data from Ethereum. This data has been indexed by The Graph via the subgraph the Thales team maintains (the subgraph code repo).
Supported queries
The below all return a Promise that resolves with the requested results.
Thales
Markets
binaryOptions.markets
Get all positional markets created.binaryOptions.optionTransactions
Get all transactions made to the positional markets.binaryOptions.trades
Get all trades made to the positional markets.binaryOptions.positionBalances({ account })
Get balances of positions for theaccount
.binaryOptions.rangedPositionBalances({ account })
Get balances of ranged positions for theaccount
.
Token
binaryOptions.tokenTransactions({ account })
Get all the transactions made with THALES token from theaccount
.binaryOptions.stakers
Get all THALES stakers.
Vaults
binaryOptions.vaultTransactions({ vault })
Get all the transactions made by thevault
.binaryOptions.vaultPnls({ vault })
Get all round PNLs for thevault
.binaryOptions.vaultUserTransactions({ vault })
Get all user transactions for thevault
.
Liquidity Pool
binaryOptions.vaultPnls({ liquidityPool })
Get all round PNLs for theliquidityPool
.binaryOptions.liquidityPoolUserTransactions({ liquidityPool })
Get all user transactions for theliquidityPool
.
Overtime
Markets
sportMarkets.markets
Get all sports markets created.sportMarkets.positionBalances({ account })
Get balances of positions for theaccount
.sportMarkets.marketTransactions
Get all transactions made to the sports markets.sportMarkets.overtimeVouchers({ account })
Get all Overtime vouchers for theaccount
.
Vaults
sportMarkets.vaultTransactions({ vault })
Get all the transactions made by thevault
.sportMarkets.vaultPnls({ vault })
Get all round PNLs for thevault
.sportMarkets.vaultUserTransactions({ vault })
Get all user transactions for thevault
.
Liquidity Pool
sportMarkets.vaultPnls({ liquidityPool })
Get all round PNLs for theliquidityPool
.sportMarkets.liquidityPoolUserTransactions({ liquidityPool })
Get all user transactions for theliquidityPool
.
Use this as a node or webpack dependency
const thalesData = require('thales-data'); // common js
// or
import thalesData from 'thales-data'; // es modules
// query and log resolved results
thalesData.binaryOptions
.markets({
network: 1, // mainnet
max: 1000, // return first 1000 records
})
.then(markets => console.log(markets));
Use in a browser
<script src="https://cdn.jsdelivr.net/npm/thales-data/browser.js"></script>
<script>
window.thalesData.binaryOptions
.markets({
network: 1, // mainnet
max: 1000, // return first 1000 records
})
.then(console.log);
</script>
How to query via the npm library (CLI)
# get markets ordered from latest to earliest
npx thales-data binaryOptions.markets