|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
from decimal import Decimal as D
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -62,9 +64,9 @@ def parse_units(x):
|
|
|
|
|
|
|
|
|
|
def parse_value(x):
|
|
|
|
|
if float(x["long"]["units"]) > 0:
|
|
|
|
|
return float(x["long"]["units"]) * float(x["long"]["averagePrice"])
|
|
|
|
|
return D(x["long"]["units"]) * D(x["long"]["averagePrice"])
|
|
|
|
|
elif float(x["short"]["units"]) > 0:
|
|
|
|
|
return float(x["short"]["units"]) * float(x["short"]["averagePrice"])
|
|
|
|
|
return D(x["short"]["units"]) * D(x["short"]["averagePrice"])
|
|
|
|
|
else:
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|