Skip to content

Commit e4f5463

Browse files
fix: resolve duplicate field names in Candle model causing lowercase OHLCV fields to be dropped
The OpenAPI codegen mapped both lowercase (o,h,l,c,v) and uppercase (O,H,L,C,V) JSON properties to the same Python attribute names using aliases. In Python, each redefinition clobbers the previous attribute, so only the uppercase-alias versions survived. Fix: give each uppercase field a unique Python attribute name (open_raw, high_raw, low_raw, close_raw, volume_raw) with alias= to preserve the JSON key mapping. This matches the naming convention used in DetailedCandlestick and the original Candlestick model before the v1.0.3 API key shortening. Co-Authored-By: kutay <kutaybuy@gmail.com>
1 parent d576ed1 commit e4f5463

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

lighter/models/candle.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ class Candle(BaseModel):
3131
h: Union[StrictFloat, StrictInt] = Field(description=" high")
3232
l: Union[StrictFloat, StrictInt] = Field(description=" low")
3333
c: Union[StrictFloat, StrictInt] = Field(description=" close")
34-
o: Union[StrictFloat, StrictInt] = Field(description=" open_raw", alias="O")
35-
h: Union[StrictFloat, StrictInt] = Field(description=" high_raw", alias="H")
36-
l: Union[StrictFloat, StrictInt] = Field(description=" low_raw", alias="L")
37-
c: Union[StrictFloat, StrictInt] = Field(description=" close_raw", alias="C")
34+
open_raw: Union[StrictFloat, StrictInt] = Field(description=" open_raw", alias="O")
35+
high_raw: Union[StrictFloat, StrictInt] = Field(description=" high_raw", alias="H")
36+
low_raw: Union[StrictFloat, StrictInt] = Field(description=" low_raw", alias="L")
37+
close_raw: Union[StrictFloat, StrictInt] = Field(description=" close_raw", alias="C")
3838
v: Union[StrictFloat, StrictInt] = Field(description=" volume0")
39-
v: Union[StrictFloat, StrictInt] = Field(description=" volume1", alias="V")
39+
volume_raw: Union[StrictFloat, StrictInt] = Field(description=" volume1", alias="V")
4040
i: StrictInt = Field(description=" last_trade_id")
4141
additional_properties: Dict[str, Any] = {}
4242
__properties: ClassVar[List[str]] = ["t", "o", "h", "l", "c", "O", "H", "L", "C", "v", "V", "i"]
@@ -104,12 +104,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
104104
"h": obj.get("h"),
105105
"l": obj.get("l"),
106106
"c": obj.get("c"),
107-
"O": obj.get("O"),
108-
"H": obj.get("H"),
109-
"L": obj.get("L"),
110-
"C": obj.get("C"),
107+
"open_raw": obj.get("O"),
108+
"high_raw": obj.get("H"),
109+
"low_raw": obj.get("L"),
110+
"close_raw": obj.get("C"),
111111
"v": obj.get("v"),
112-
"V": obj.get("V"),
112+
"volume_raw": obj.get("V"),
113113
"i": obj.get("i")
114114
})
115115
# store additional fields in additional_properties

0 commit comments

Comments
 (0)