Convert API responses with Glom
This commit is contained in:
@@ -72,6 +72,44 @@ class GetAllPositions(BaseModel):
|
||||
itemlist: list[Position]
|
||||
|
||||
|
||||
{
|
||||
"itemlist": [
|
||||
{
|
||||
"asset_id": "64bbff51-59d6-4b3c-9351-13ad85e3c752",
|
||||
"symbol": "BTCUSD",
|
||||
"exchange": "FTXU",
|
||||
"asset_class": "crypto",
|
||||
"asset_marginable": False,
|
||||
"qty": "0.009975",
|
||||
"avg_entry_price": "20714",
|
||||
"side": "long",
|
||||
"market_value": "204.297975",
|
||||
"cost_basis": "206.62215",
|
||||
"unrealized_pl": "-2.324175",
|
||||
"unrealized_plpc": "-0.0112484310128416",
|
||||
"unrealized_intraday_pl": "-0.269325",
|
||||
"unrealized_intraday_plpc": "-0.001316559391457",
|
||||
"current_price": "20481",
|
||||
"lastday_price": "20508",
|
||||
"change_today": "-0.001316559391457",
|
||||
"qty_available": "0.009975",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
get_all_positions_schema = {
|
||||
"itemlist": (
|
||||
"itemlist",
|
||||
[
|
||||
{
|
||||
"symbol": "symbol",
|
||||
"unrealized_pl": "unrealized_pl",
|
||||
"price:": "current_price",
|
||||
}
|
||||
],
|
||||
)
|
||||
}
|
||||
|
||||
# get_account
|
||||
class GetAccount(BaseModel):
|
||||
id: str
|
||||
@@ -108,3 +146,6 @@ class GetAccount(BaseModel):
|
||||
sma: str
|
||||
daytrade_count: int
|
||||
balance_asof: str
|
||||
|
||||
|
||||
get_account_schema = {"": ""}
|
||||
|
||||
Reference in New Issue
Block a user