Spaces:
Sleeping
Sleeping
Upload adapters/custom_client.py with huggingface_hub
Browse files- adapters/custom_client.py +19 -0
adapters/custom_client.py
CHANGED
|
@@ -60,6 +60,25 @@ class LSTMPrediction(QuoteTick):
|
|
| 60 |
def __repr__(self):
|
| 61 |
return f"LSTMPrediction({self.instrument_id}, pred={self.prediction:.6f})"
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
class HyperliquidPollingDataClient(LiveDataClient):
|
| 65 |
"""
|
|
|
|
| 60 |
def __repr__(self):
|
| 61 |
return f"LSTMPrediction({self.instrument_id}, pred={self.prediction:.6f})"
|
| 62 |
|
| 63 |
+
class TRMPrediction(QuoteTick):
|
| 64 |
+
"""
|
| 65 |
+
Custom Data Type for TRM Predictions (Trend Probabilities).
|
| 66 |
+
Payload:
|
| 67 |
+
instrument_id: The instrument.
|
| 68 |
+
probs: List[float] -> [P(Down), P(Neutral), P(Up)]
|
| 69 |
+
ts_event: Timestamp.
|
| 70 |
+
"""
|
| 71 |
+
def __init__(self, instrument_id: InstrumentId, probs: List[float], ts_event: int):
|
| 72 |
+
super().__init__(instrument_id, 0, 0, 0, 0, ts_event, ts_event)
|
| 73 |
+
self.probs = probs
|
| 74 |
+
|
| 75 |
+
@property
|
| 76 |
+
def probabilities(self) -> List[float]:
|
| 77 |
+
return self.probs
|
| 78 |
+
|
| 79 |
+
def __repr__(self):
|
| 80 |
+
return f"TRMPrediction({self.instrument_id}, D={self.probs[0]:.2f} N={self.probs[1]:.2f} U={self.probs[2]:.2f})"
|
| 81 |
+
|
| 82 |
|
| 83 |
class HyperliquidPollingDataClient(LiveDataClient):
|
| 84 |
"""
|