-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschema.graphql
More file actions
365 lines (256 loc) · 8.3 KB
/
schema.graphql
File metadata and controls
365 lines (256 loc) · 8.3 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
type Tradegen @entity {
# CandlestickDataFeedRegistry contract address.
id: ID!
# Total number of candlestick data feeds.
candlestickDataFeedCount: Int!
# Total number of bot performance data feeds.
botPerformanceDataFeedCount: Int!
# Total number of VTE data feeds.
VTEDataFeedCount: Int!
# Total number of candlestick data feed updates.
candlestickDataFeedUpdateCount: Int!
# Total number of bot performance data feed updates.
botPerformanceDataFeedUpdateCount: Int!
# Total number of VTE data feed updates.
VTEDataFeedUpdateCount: Int!
# Total number of data requests for trading bot data.
# This value gets incremented whenever BotPerformanceDataFeed.getTokenPrice() is called.
botDataRequestCount: Int!
# Total number of data requests for VTE data.
# This value gets incremented whenever VTEDataFeed.getTokenPrice() is called.
VTEDataRequestCount: Int!
# Total revenue (in protocol's governance token).
# This value tracks the total amount of usage fees paid.
totalRevenue: BigInt!
}
type CandlestickDataFeed @entity {
# CandlestickDataFeed contract address
id: ID!
# Timestamp at which the data feed was created.
createdOn: BigInt!
# Whether the data feed is halted.
isHalted: Boolean!
# Address of the data feed's dedicated data provider.
dataProvider: String!
# Symbol of the data feed's asset.
symbol: String!
# Timeframe of the asset.
timeframe: BigInt!
# Timestamp at which the data feed was last updated.
lastUpdated: BigInt!
# The current price of the data feed.
# This value is the 'close' of the latest candlestick.
currentPrice: BigInt!
# Total number of updates to this data feed.
numberOfUpdates: Int!
# Derived fields.
candlesticks: [Candlestick!]! @derivedFrom(field: "candlestickDataFeed")
}
type BotPerformanceDataFeed @entity {
# BotPerformanceDataFeed address
id: ID!
# Timestamp at which the data feed was created.
createdOn: BigInt!
# Whether the data feed is halted.
isHalted: Boolean!
# Address of the data feed's dedicated data provider.
dataProvider: String!
# Address of the trading bot.
tradingBot: String!
# The fee that a contract pays when requesting data.
# Measured in protocol's governance token.
usageFee: BigInt!
# Total number of updates to this data feed.
numberOfUpdates: Int!
# Timestamp at which the data feed was last updated.
lastUpdated: BigInt!
# Total number of requests made to this data feed.
numberOfDataRequests: Int!
# Total revenue generated by this data feed.
revenue: BigInt!
# Derived fields.
tradingBotDayData: [TradingBotDayData!]! @derivedFrom(field: "botPerformanceDataFeed")
orders: [Order!]! @derivedFrom(field: "botPerformanceDataFeed")
dataRequests: [DataRequest!]! @derivedFrom(field: "botPerformanceDataFeed")
}
type VTEDataFeed @entity {
# VTEDataFeed address
id: ID!
# Timestamp at which the data feed was created.
createdOn: BigInt!
# Address of the data feed's dedicated data provider.
dataProvider: String!
# Address of the VTE.
VTE: String!
# The fee that a contract pays when requesting data.
# Measured in the protocol's governance token.
usageFee: BigInt!
# Total number of updates to this data feed.
numberOfUpdates: Int!
# Timestamp at which the data feed was last updated.
lastUpdated: BigInt!
# Total number of requests made to this data feed.
numberOfDataRequests: Int!
# Total revenue generated by this data feed.
revenue: BigInt!
# Derived fields.
VTEDayData: [VTEDayData!]! @derivedFrom(field: "VTEDataFeed")
orders: [VTEOrder!]! @derivedFrom(field: "VTEDataFeed")
dataRequests: [DataRequest!]! @derivedFrom(field: "VTEDataFeed")
}
type Candlestick @entity {
# <symbol>-<timeframe>-<timestamp>
id: ID!
# Timestamp at which the candlestick was registered.
timestamp: BigInt!
# A reference to this candlestick's data feed.
candlestickDataFeed: CandlestickDataFeed!
# Asset's symbol.
symbol: String!
# High price.
high: BigInt!
# Low price.
low: BigInt!
# Starting price of the candlestick.
open: BigInt!
# Ending price of the candlestick.
close: BigInt!
# Number of tokens traded.
volume: BigInt!
# Timestamp at which the candlestick started.
startingTimestamp: BigInt!
# Index in the data feed's list of updates.
index: BigInt!
}
type Order @entity {
# <trading bot address>-<order number>
id: ID!
# Timestamp at which the order was registered.
timestamp: BigInt!
# A reference to this order's data feed.
botPerformanceDataFeed: BotPerformanceDataFeed!
# Asset's symbol.
symbol: String!
# Whether this is a 'buy' order.
isBuy: Boolean!
# Timestamp at which the order was placed.
orderTimestamp: BigInt!
# Price of the asset when the order was placed.
assetPrice: BigInt!
# The new trading bot price.
botPrice: BigInt!
# Index in the data feed's list of updates.
index: BigInt!
}
type VTEOrder @entity {
# <VTE address>-<order number>
id: ID!
# Timestamp at which the order was registered.
timestamp: BigInt!
# A reference to this order's data feed.
VTEDataFeed: VTEDataFeed!
# Asset's symbol.
symbol: String!
# Whether this is a 'buy' order.
isBuy: Boolean!
# Timestamp at which the order was placed.
orderTimestamp: BigInt!
# Price of the asset when the order was placed.
assetPrice: BigInt!
# The amount of leverage used.
leverageFactor: BigInt!
# Index in the data feed's list of updates.
index: BigInt!
}
type DataRequest @entity {
# <trading bot address>-<caller>-<timestamp>
id: ID!
# Timestamp at which the data request was made.
timestamp: BigInt!
botPerformanceDataFeed: BotPerformanceDataFeed
VTEDataFeed: VTEDataFeed
# Address of the contract that made the data request.
requestor: String!
# Number of tokens paid.
feePaid: BigInt!
# The price of the trading bot at the time the data request was made.
botPrice: BigInt
# The price of the VTE at the time the data request was made.
VTEPrice: BigInt
}
# Data accumulated and condensed into day stats for all of Tradegen.
type TradegenDayData @entity {
# Timestamp rounded to current day by dividing by 86400.
id: ID!
date: Int!
# Number of candlestick data feed updates made for this day.
candlestickDataFeedUpdateCount: Int!
# Number of bot performance data feed updates made for this day.
botPerformanceDataFeedUpdateCount: Int!
# Number of VTE data feed updates made for this day.
VTEDataFeedUpdateCount: Int!
# Number of data requests for bot data made for this day.
botDataRequestCount: Int!
# Number of data requests for VTE data made for this day.
VTEDataRequestCount: Int!
# Total revenue for the day.
revenue: BigInt!
}
type TradingBotHourData @entity {
id: ID!
# Unix timestamp for start of hour.
hourStartUnix: Int!
# A reference to the data feed.
botPerformanceDataFeed: BotPerformanceDataFeed!
# Number of updates to the data feed for this hour.
numberOfUpdates: Int!
# Bot price at the end of the hour.
botPrice: BigInt!
# Number of data requests made for this hour.
numberOfDataRequests: Int!
# Total revenue for this hour.
revenue: BigInt!
}
type TradingBotDayData @entity {
id: ID!
date: Int!
# A reference to the data feed.
botPerformanceDataFeed: BotPerformanceDataFeed!
# Number of updates to the data feed for this day.
numberOfUpdates: Int!
# Bot price at the end of the day.
botPrice: BigInt!
# Number of data requests made for this day.
numberOfDataRequests: Int!
# Total revenue for this day.
revenue: BigInt!
}
type VTEHourData @entity {
id: ID!
# Unix timestamp for start of hour.
hourStartUnix: Int!
# A reference to the data feed.
VTEDataFeed: VTEDataFeed!
# Number of updates to the data feed for this hour.
numberOfUpdates: Int!
# VTE price at the end of the hour.
VTEPrice: BigInt!
# Number of data requests made for this hour.
numberOfDataRequests: Int!
# Total revenue for this hour.
revenue: BigInt!
}
type VTEDayData @entity {
id: ID!
date: Int!
# A reference to the data feed.
VTEDataFeed: VTEDataFeed!
# Number of updates to the data feed for this day.
numberOfUpdates: Int!
# VTE price at the end of the day.
VTEPrice: BigInt!
# Number of data requests made for this day.
numberOfDataRequests: Int!
# Total revenue for this day.
revenue: BigInt!
}