80 lines
1.9 KiB
Python
80 lines
1.9 KiB
Python
from pydantic import BaseModel
|
|
|
|
a = {
|
|
"positions": [
|
|
{
|
|
"instrument": "EUR_USD",
|
|
"long": {
|
|
"units": "1",
|
|
"averagePrice": "0.99361",
|
|
"pl": "-0.1014",
|
|
"resettablePL": "-0.1014",
|
|
"financing": "0.0000",
|
|
"dividendAdjustment": "0.0000",
|
|
"guaranteedExecutionFees": "0.0000",
|
|
"tradeIDs": ["71"],
|
|
"unrealizedPL": "-0.0002",
|
|
},
|
|
"short": {
|
|
"units": "0",
|
|
"pl": "0.0932",
|
|
"resettablePL": "0.0932",
|
|
"financing": "0.0000",
|
|
"dividendAdjustment": "0.0000",
|
|
"guaranteedExecutionFees": "0.0000",
|
|
"unrealizedPL": "0.0000",
|
|
},
|
|
"pl": "-0.0082",
|
|
"resettablePL": "-0.0082",
|
|
"financing": "0.0000",
|
|
"commission": "0.0000",
|
|
"dividendAdjustment": "0.0000",
|
|
"guaranteedExecutionFees": "0.0000",
|
|
"unrealizedPL": "-0.0002",
|
|
"marginUsed": "0.0286",
|
|
}
|
|
],
|
|
"lastTransactionID": "71",
|
|
}
|
|
|
|
|
|
class PositionLong(BaseModel):
|
|
units: str
|
|
averagePrice: str
|
|
pl: str
|
|
resettablePL: str
|
|
financing: str
|
|
dividendAdjustment: str
|
|
guaranteedExecutionFees: str
|
|
tradeIDs: list[str]
|
|
unrealizedPL: str
|
|
|
|
|
|
class PositionShort(BaseModel):
|
|
units: str
|
|
pl: str
|
|
resettablePL: str
|
|
financing: str
|
|
dividendAdjustment: str
|
|
guaranteedExecutionFees: str
|
|
unrealizedPL: str
|
|
|
|
|
|
class Position(BaseModel):
|
|
instrument: str
|
|
long: PositionLong
|
|
short: PositionShort
|
|
pl: str
|
|
resettablePL: str
|
|
financing: str
|
|
commission: str
|
|
dividendAdjustment: str
|
|
guaranteedExecutionFees: str
|
|
unrealizedPL: str
|
|
marginUsed: str
|
|
|
|
|
|
class OpenPositions(BaseModel):
|
|
positions: list[Position]
|
|
lastTransactionID: str
|