Improve posting trades to OANDA and make everything more robust
This commit is contained in:
@@ -352,3 +352,84 @@ AccountInstrumentsSchema = {
|
||||
],
|
||||
)
|
||||
}
|
||||
|
||||
class OrderTransaction(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
|
||||
|
||||
class OrderCreate(BaseModel):
|
||||
orderCreateTransaction: OrderTransaction
|
||||
|
||||
OrderCreateSchema = {
|
||||
"id": "orderCreateTransaction.id",
|
||||
"accountID": "orderCreateTransaction.accountID",
|
||||
"userID": "orderCreateTransaction.userID",
|
||||
"batchID": "orderCreateTransaction.batchID",
|
||||
"requestID": "orderCreateTransaction.requestID",
|
||||
"time": "orderCreateTransaction.time",
|
||||
"type": "orderCreateTransaction.type",
|
||||
"symbol": "orderCreateTransaction.instrument",
|
||||
"units": "orderCreateTransaction.units",
|
||||
"timeInForce": "orderCreateTransaction.timeInForce",
|
||||
"positionFill": "orderCreateTransaction.positionFill",
|
||||
"reason": "orderCreateTransaction.reason",
|
||||
}
|
||||
|
||||
class PriceBid(BaseModel):
|
||||
price: str
|
||||
liquidity: int
|
||||
|
||||
class PriceAsk(BaseModel):
|
||||
price: str
|
||||
liquidity: int
|
||||
|
||||
class PriceQuoteHomeConversionFactors(BaseModel):
|
||||
positiveUnits: str
|
||||
negativeUnits: str
|
||||
|
||||
class Price(BaseModel):
|
||||
type: str
|
||||
time: str
|
||||
bids: list[PriceBid]
|
||||
asks: list[PriceAsk]
|
||||
closeoutBid: str
|
||||
closeoutAsk: str
|
||||
status: str
|
||||
tradeable: bool
|
||||
quoteHomeConversionFactors: PriceQuoteHomeConversionFactors
|
||||
instrument: str
|
||||
|
||||
class PricingInfo(BaseModel):
|
||||
time: str
|
||||
prices: list[Price]
|
||||
|
||||
PricingInfoSchema = {
|
||||
"time": "time",
|
||||
"prices": (
|
||||
"prices",
|
||||
[
|
||||
{
|
||||
"type": "type",
|
||||
"time": "time",
|
||||
"bids": "bids",
|
||||
"asks": "asks",
|
||||
"closeoutBid": "closeoutBid",
|
||||
"closeoutAsk": "closeoutAsk",
|
||||
"status": "status",
|
||||
"tradeable": "tradeable",
|
||||
"quoteHomeConversionFactors": "quoteHomeConversionFactors",
|
||||
"symbol": "instrument",
|
||||
}
|
||||
],
|
||||
),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user