Skip to content

Commit

Permalink
move sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
deeleeramone committed Nov 7, 2023
1 parent 221725a commit 8669af6
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def contract_symbol(cls, v):

trade_type: str = Field(description="The type of unusual trade.", alias="type")
sentiment: str = Field(
description="""
Bullish, Bearish, or Neutral Sentiment is estimated based on whether
the trade was executed at the bid, ask, or mark price.
"""
description=(
"Bullish, Bearish, or Neutral Sentiment is estimated based on whether"
+ " the trade was executed at the bid, ask, or mark price."
)
)
total_value: Union[int, float] = Field(
description="The aggregated value of all option contract premiums included in the trade."
Expand Down Expand Up @@ -93,9 +93,11 @@ def extract_data(
response = get_data_one(url, **kwargs)

if "trades" in response:
data = response["trades"]
data = sorted(
response["trades"], key=lambda x: x["timestamp"], reverse=True
)

return sorted(data, key=lambda x: x["timestamp"], reverse=True)
return data

@staticmethod
def transform_data(
Expand Down

0 comments on commit 8669af6

Please sign in to comment.