-
Notifications
You must be signed in to change notification settings - Fork 10
/
query_insights.ts
121 lines (94 loc) · 4.25 KB
/
query_insights.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import { PositionViewOptions } from "../lib/insights";
import * as BIP39 from "bip39";
import { CarbonSDK } from "./_sdk";
(async () => {
const mnemonics = process.env.MNEMONICS ?? BIP39.generateMnemonic();
const sdk = await CarbonSDK.instance({
network: CarbonSDK.Network.DevNet,
config: {
tmRpcUrl: process.env.TRPC_ENDPOINT,
},
});
const connectedSDK = await sdk.connectWithMnemonic(mnemonics);
// chain api
const stakeResponse = await sdk.insights.Stake();
console.log("stake", stakeResponse);
const txResponse = await sdk.insights.Transaction();
console.log("tx", txResponse);
// user api
const activeAccountsResponse = await sdk.insights.ActiveAccounts();
console.log("activeAccounts", activeAccountsResponse);
const userGrowthResponse = await sdk.insights.UserGrowth();
console.log("userGrowth", userGrowthResponse);
const totalUsersResponse = await sdk.insights.TotalUsers();
console.log("totalUsers", totalUsersResponse);
// pool api
const poolsResponse = await sdk.insights.Pools();
console.log("pools", poolsResponse);
const poolsVolumeResponse = await sdk.insights.PoolsVolume();
console.log("poolsVolume", poolsVolumeResponse);
const poolsLiquidityResponse = await sdk.insights.PoolsLiquidity();
console.log("poolsLiquidity", poolsLiquidityResponse);
const userRewardsClaimHistoryResponse = await sdk.insights.UserRewardsClaimHistory({
address: connectedSDK.wallet.bech32Address
});
console.log("userRewardsClaimHistory", userRewardsClaimHistoryResponse)
// market api
const marketsVolumeResponse = await sdk.insights.MarketsVolume();
console.log("marketsVolume", marketsVolumeResponse);
// node api
const nodeResponse = await sdk.insights.Nodes();
console.log("nodes", nodeResponse);
// balance api
const balanceSupplyResponse = await sdk.insights.BalanceSupply();
console.log("balanceSupply", balanceSupplyResponse);
// list competitions
const competitionList = await sdk.insights.CompetitionList({});
console.log("competitionList", competitionList);
// trading volume leaderboard for legacy Demex Trading volume Competition (circa. 2021-2022)
const volumeLeaderboard = await sdk.insights.VolumeCompetitionLeaderboard({
competitionId: "comp1",
});
console.log("volumeLeaderboard", volumeLeaderboard);
// pnl leaderboard (competition)
const pnlLeaderboard = await sdk.insights.PNLCompetitionLeaderboard({
competitionId: "comp1",
});
console.log("pnlLeaderboard", pnlLeaderboard);
// trading volume ranking for Perps Trading Competition on Demex (14 Nov 2023 - 28 Nov 2023)
const perpTradingVolume = await sdk.insights.PerpsTradingCompetitionVolume({
competitionId: "tradingcomp17",
});
console.log("perpTradingVolume", perpTradingVolume);
// lottery leaderboard (competition)
const lotteryLeaderboard = await sdk.insights.LotteryCompetitionLeaderboard({
competitionId: "tradingcomp7",
});
console.log("lotteryLeaderboard", lotteryLeaderboard);
// lottery leaderboard (competition)
const leagueLeaderboard = await sdk.insights.LeagueCompetitionLeaderboard({
competitionId: "tradingcomp8",
});
console.log("leagueLeaderboard", leagueLeaderboard);
//Position Views
const positionViews = await sdk.insights.PositionsView({ view: "risk" as PositionViewOptions }, {})
console.log("PositionsView", positionViews)
//Liquidation
const liquidationAndADL = await sdk.insights.LiquidationAndADL({ limit: 10 })
console.log("Liquidation and ADL", liquidationAndADL)
//Liquidation Engine
const liquidation = await sdk.insights.LiquidationEngine({ limit: 10 })
console.log("Liquidation", liquidation)
//AvgBlocktime
const avgBlocktime = await sdk.insights.AvgBlockTime({ hours: 24 })
console.log("Avg Blocktime", avgBlocktime)
//Pool History
const PoolHistory = await sdk.insights.PoolHistory({ poolId: 42 })
console.log("PoolHistory", PoolHistory)
//Funding History
const fundingHistory = await sdk.insights.FundingHistory({})
console.log("fundingHistory", fundingHistory)
// Funding History Graph Data
const fundingHistoryGraphData = await sdk.insights.FundingHistoryGraphData({ market: 'cmkt/117' })
console.log("fundingHistoryGraphData", fundingHistoryGraphData)
})().catch(console.error).finally(() => process.exit(0));