-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcommon.py
31 lines (28 loc) · 961 Bytes
/
common.py
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
import smartpy as sp
#####################################################################
# This file defines global types which are used across the Oracle
# and Normalizer contracts.
#####################################################################
# The type of the Oracle's data.
OracleDataType = sp.TPair(
sp.TTimestamp, # Start
sp.TPair(
sp.TTimestamp, # End
sp.TPair(
sp.TNat, # Open
sp.TPair(
sp.TNat, # High
sp.TPair(
sp.TNat, # Low
sp.TPair(
sp.TNat, # Close
sp.TNat # Volume
)
)
)
)
)
)
# Compute a VWAP with the given inputs
def computeVWAP(high, low, close, volume):
return ((high + low + close) // 3) * volume