Add schemas for more commands

This commit is contained in:
Mark Veidemanis 2022-12-01 20:36:09 +00:00
parent 682d141b8a
commit c0c1ccde8b
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 132 additions and 1 deletions

View File

@ -270,7 +270,7 @@ class PositionDetailsNested(BaseModel):
dividendAdjustment: str dividendAdjustment: str
guaranteedExecutionFees: str guaranteedExecutionFees: str
unrealizedPL: str unrealizedPL: str
marginUsed: str marginUsed: str | None
class PositionDetails(BaseModel): class PositionDetails(BaseModel):
@ -459,3 +459,134 @@ PricingInfoSchema = {
], ],
), ),
} }
class LongPositionCloseout(BaseModel):
instrument: str
units: str
class Trade(BaseModel):
tradeID: str
clientTradeID: str
units: str
realizedPL: str
financing: str
baseFinancing: str
price: str
guaranteedExecutionFee: str
quoteGuaranteedExecutionFee: str
halfSpreadCost: str
class HomeConversionFactors(BaseModel):
gainQuoteHome: str
lossQuoteHome: str
gainBaseHome: str
lossBaseHome: str
class LongOrderFillTransaction(BaseModel):
id: str
accountID: str
userID: int
batchID: str
requestID: str
time: str
type: str
orderID: str
instrument: str
units: str
requestedUnits: str
price: str
pl: str
quotePL: str
financing: str
baseFinancing: str
commission: str
accountBalance: str
gainQuoteHomeConversionFactor: str
lossQuoteHomeConversionFactor: str
guaranteedExecutionFee: str
quoteGuaranteedExecutionFee: str
halfSpreadCost: str
fullVWAP: str
reason: str
tradesClosed: list[Trade]
fullPrice: Price
homeConversionFactors: HomeConversionFactors
longPositionCloseout: LongPositionCloseout
class OrderTransation(BaseModel):
id: str
accountID: str
userID: int
batchID: str
requestID: str
time: str
type: str
instrument: str
units: str
timeInForce: str
positionFill: str
reason: str
longPositionCloseout: LongPositionCloseout
longOrderFillTransaction: dict
class PositionClose(BaseModel):
longOrderCreateTransaction: OrderTransaction
longOrderFillTransaction: OrderTransaction
longOrderCancelTransaction: OrderTransaction
shortOrderCreateTransaction: OrderTransaction
shortOrderFillTransaction: OrderTransaction
shortOrderCancelTransaction: OrderTransaction
relatedTransactionIDs: list[str]
lastTransactionID: str
PositionCloseSchema = {
"longOrderCreateTransaction": "longOrderCreateTransaction",
"longOrderFillTransaction": "longOrderFillTransaction",
"longOrderCancelTransaction": "longOrderCancelTransaction",
"shortOrderCreateTransaction": "shortOrderCreateTransaction",
"shortOrderFillTransaction": "shortOrderFillTransaction",
"shortOrderCancelTransaction": "shortOrderCancelTransaction",
"relatedTransactionIDs": "relatedTransactionIDs",
"lastTransactionID": "lastTransactionID",
}
class ClientExtensions(BaseModel):
id: str
tag: str
class TradeDetailsTrade(BaseModel):
id: str
instrument: str
price: str
openTime: str
initialUnits: str
initialMarginRequired: str
state: str
currentUnits: str
realizedPL: str
closingTransactionIDs: list[str]
financing: str
dividendAdjustment: str
closeTime: str
averageClosePrice: str
clientExtensions: ClientExtensions
class TradeDetails(BaseModel):
trade: TradeDetailsTrade
lastTransactionID: str
TradeDetailsSchema = {
"trade": "trade",
"lastTransactionID": "lastTransactionID",
}