-
Notifications
You must be signed in to change notification settings - Fork 8
/
schema.graphql
123 lines (79 loc) · 1.98 KB
/
schema.graphql
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
122
123
type Data @entity {
id: ID! # currency string
cumulativeFees: BigInt
cumulativePnl: BigInt
cumulativeVolume: BigInt
cumulativeMargin: BigInt
openInterest: BigInt
openInterestLong: BigInt
openInterestShort: BigInt
positionCount: BigInt
tradeCount: BigInt
}
type DayData @entity {
id: ID! # day id = currency - event.block.timestamp / 86400 see https://github.com/Uniswap/uniswap-v3-subgraph/blob/1593a62059589bb1266d19bf18c5fa08fb68fe63/src/utils/intervalUpdates.ts#L43
date: BigInt! # dayStartTimestamp = dayID * 86400
cumulativeFees: BigInt
cumulativePnl: BigInt
cumulativeVolume: BigInt
cumulativeMargin: BigInt
openInterest: BigInt
openInterestLong: BigInt
openInterestShort: BigInt
positionCount: BigInt
tradeCount: BigInt
}
type Product @entity {
id: ID! # product id - currency
cumulativeFees: BigInt
cumulativePnl: BigInt
cumulativeVolume: BigInt
cumulativeMargin: BigInt
positionCount: BigInt
tradeCount: BigInt
openInterest: BigInt
openInterestLong: BigInt
openInterestShort: BigInt
}
type Position @entity { # open position
id: ID! # position key
productId: Bytes!
leverage: BigInt!
price: BigInt!
margin: BigInt!
fee: BigInt!
size: BigInt!
liquidationPrice: BigInt
user: Bytes!
currency: Bytes!
isLong: Boolean!
createdAtTimestamp: BigInt!
createdAtBlockNumber: BigInt!
updatedAtTimestamp: BigInt
updatedAtBlockNumber: BigInt
}
type Trade @entity { # closed position
id: ID! # unique: vault.tradeCount.toString()
txHash: String! # event.transaction.hash.toHexString()
positionKey: String!
user: Bytes!
currency: Bytes!
productId: Bytes!
margin: BigInt!
leverage: BigInt!
size: BigInt
entryPrice: BigInt!
closePrice: BigInt!
isLong: Boolean!
fee: BigInt!
pnl: BigInt
wasLiquidated: Boolean!
isFullClose: Boolean!
duration: BigInt!
timestamp: BigInt!
blockNumber: BigInt!
}
type Pool @entity {
id: ID! # 1
cumulativeFees: BigInt
}