Update handler.py
Browse files- handler.py +1 -1
handler.py
CHANGED
|
@@ -79,7 +79,7 @@ class EndpointHandler:
|
|
| 79 |
assert "timestamps" in inputs and "open" in inputs and "high" in inputs and "low" in inputs and "close" in inputs and "volume" in inputs, "Required keys: timestamps, open, high, low, close, volume"
|
| 80 |
assert isinstance(inputs["timestamps"], list) and isinstance(inputs["open"], list) and isinstance(inputs["high"], list) and isinstance(inputs["low"], list) and isinstance(inputs["close"], list) and isinstance(inputs["volume"], list), "Inputs must be lists"
|
| 81 |
assert len(inputs["timestamps"]) == len(inputs["open"]) == len(inputs["high"]) == len(inputs["low"]) == len(inputs["close"]) == len(inputs["volume"]), "Inputs must have the same length"
|
| 82 |
-
timestamps = torch.tensor(inputs["timestamps"])
|
| 83 |
samples = torch.tensor([inputs["open"], inputs["high"], inputs["low"], inputs["close"], inputs["volume"]], dtype=torch.float32).T.contiguous()
|
| 84 |
steps = data.pop("steps", 4)
|
| 85 |
n_scenarios = data.pop("n_scenarios", 32)
|
|
|
|
| 79 |
assert "timestamps" in inputs and "open" in inputs and "high" in inputs and "low" in inputs and "close" in inputs and "volume" in inputs, "Required keys: timestamps, open, high, low, close, volume"
|
| 80 |
assert isinstance(inputs["timestamps"], list) and isinstance(inputs["open"], list) and isinstance(inputs["high"], list) and isinstance(inputs["low"], list) and isinstance(inputs["close"], list) and isinstance(inputs["volume"], list), "Inputs must be lists"
|
| 81 |
assert len(inputs["timestamps"]) == len(inputs["open"]) == len(inputs["high"]) == len(inputs["low"]) == len(inputs["close"]) == len(inputs["volume"]), "Inputs must have the same length"
|
| 82 |
+
timestamps = torch.tensor(list(map(int, inputs["timestamps"])))
|
| 83 |
samples = torch.tensor([inputs["open"], inputs["high"], inputs["low"], inputs["close"], inputs["volume"]], dtype=torch.float32).T.contiguous()
|
| 84 |
steps = data.pop("steps", 4)
|
| 85 |
n_scenarios = data.pop("n_scenarios", 32)
|