Fix changed OANDA API
This commit is contained in:
parent
a788a65ba6
commit
95a4a6930c
|
@ -1,29 +1,29 @@
|
||||||
from decimal import Decimal as D
|
from decimal import Decimal as D
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
class PositionLong(BaseModel):
|
class PositionLong(BaseModel):
|
||||||
units: str
|
units: str
|
||||||
averagePrice: str | None
|
averagePrice: Optional[str] = None
|
||||||
pl: str
|
pl: str
|
||||||
resettablePL: str
|
resettablePL: str
|
||||||
financing: str
|
financing: str
|
||||||
dividendAdjustment: str
|
dividendAdjustment: str
|
||||||
guaranteedExecutionFees: str
|
guaranteedExecutionFees: str
|
||||||
tradeIDs: list[str] | None
|
tradeIDs: Optional[list[str]] = []
|
||||||
unrealizedPL: str
|
unrealizedPL: str
|
||||||
|
|
||||||
|
|
||||||
class PositionShort(BaseModel):
|
class PositionShort(BaseModel):
|
||||||
units: str
|
units: str
|
||||||
averagePrice: str | None
|
averagePrice: Optional[str] = None
|
||||||
pl: str
|
pl: str
|
||||||
resettablePL: str
|
resettablePL: str
|
||||||
financing: str
|
financing: str
|
||||||
dividendAdjustment: str
|
dividendAdjustment: str
|
||||||
guaranteedExecutionFees: str
|
guaranteedExecutionFees: str
|
||||||
tradeIDs: list[str] | None
|
tradeIDs: Optional[list[str]] = []
|
||||||
unrealizedPL: str
|
unrealizedPL: str
|
||||||
|
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ class PositionDetailsNested(BaseModel):
|
||||||
dividendAdjustment: str
|
dividendAdjustment: str
|
||||||
guaranteedExecutionFees: str
|
guaranteedExecutionFees: str
|
||||||
unrealizedPL: str
|
unrealizedPL: str
|
||||||
marginUsed: str | None
|
marginUsed: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
class PositionDetails(BaseModel):
|
class PositionDetails(BaseModel):
|
||||||
|
@ -373,7 +373,7 @@ class Instrument(BaseModel):
|
||||||
guaranteedStopLossOrderMode: str
|
guaranteedStopLossOrderMode: str
|
||||||
tags: list[InstrumentTag]
|
tags: list[InstrumentTag]
|
||||||
financing: InstrumentFinancing
|
financing: InstrumentFinancing
|
||||||
guaranteedStopLossOrderLevelRestriction: InstrumentGuaranteedRestriction | None
|
guaranteedStopLossOrderLevelRestriction: Optional[InstrumentGuaranteedRestriction] = None
|
||||||
|
|
||||||
|
|
||||||
class AccountInstruments(BaseModel):
|
class AccountInstruments(BaseModel):
|
||||||
|
@ -474,33 +474,33 @@ class Trade(BaseModel):
|
||||||
quoteGuaranteedExecutionFee: str
|
quoteGuaranteedExecutionFee: str
|
||||||
halfSpreadCost: str
|
halfSpreadCost: str
|
||||||
# takeProfitOrder: TakeProfitOrder | None
|
# takeProfitOrder: TakeProfitOrder | None
|
||||||
takeProfitOrder: dict | None
|
takeProfitOrder: Optional[dict] = None
|
||||||
stopLossOrder: dict | None
|
stopLossOrder: Optional[dict] = None
|
||||||
trailingStopLossOrder: dict | None
|
trailingStopLossOrder: Optional[dict] = None
|
||||||
|
|
||||||
|
|
||||||
class SideCarOrder(BaseModel):
|
class SideCarOrder(BaseModel):
|
||||||
id: str
|
id: str
|
||||||
createTime: str
|
createTime: str
|
||||||
state: str
|
state: str
|
||||||
price: str | None
|
price: Optional[str] = None
|
||||||
timeInForce: str
|
timeInForce: str
|
||||||
gtdTime: str | None
|
gtdTime: Optional[str] = None
|
||||||
clientExtensions: dict | None
|
clientExtensions: Optional[dict] = None
|
||||||
tradeID: str
|
tradeID: str
|
||||||
clientTradeID: str | None
|
clientTradeID: Optional[str] = None
|
||||||
type: str
|
type: str
|
||||||
time: str | None
|
time: Optional[str] = None
|
||||||
priceBound: str | None
|
priceBound: Optional[str] = None
|
||||||
positionFill: str | None
|
positionFill: Optional[str] = None
|
||||||
reason: str | None
|
reason: Optional[str] = None
|
||||||
orderFillTransactionID: str | None
|
orderFillTransactionID: Optional[str] = None
|
||||||
tradeOpenedID: str | None
|
tradeOpenedID: Optional[str] = None
|
||||||
tradeReducedID: str | None
|
tradeReducedID: Optional[str] = None
|
||||||
tradeClosedIDs: list[str] | None
|
tradeClosedIDs: Optional[list[str]] = []
|
||||||
cancellingTransactionID: str | None
|
cancellingTransactionID: Optional[str] = None
|
||||||
replacesOrderID: str | None
|
replacesOrderID: Optional[str] = None
|
||||||
replacedByOrderID: str | None
|
replacedByOrderID: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
class OpenTradesTrade(BaseModel):
|
class OpenTradesTrade(BaseModel):
|
||||||
|
@ -517,10 +517,10 @@ class OpenTradesTrade(BaseModel):
|
||||||
dividendAdjustment: str
|
dividendAdjustment: str
|
||||||
unrealizedPL: str
|
unrealizedPL: str
|
||||||
marginUsed: str
|
marginUsed: str
|
||||||
takeProfitOrder: SideCarOrder | None
|
takeProfitOrder: Optional[SideCarOrder] = None
|
||||||
stopLossOrder: SideCarOrder | None
|
stopLossOrder: Optional[SideCarOrder] = None
|
||||||
trailingStopLossOrder: SideCarOrder | None
|
trailingStopLossOrder: Optional[SideCarOrder] = None
|
||||||
trailingStopValue: dict | None
|
trailingStopValue: Optional[dict] = None
|
||||||
|
|
||||||
|
|
||||||
class OpenTrades(BaseModel):
|
class OpenTrades(BaseModel):
|
||||||
|
@ -578,13 +578,13 @@ class OrderTransaction(BaseModel):
|
||||||
requestID: str
|
requestID: str
|
||||||
time: str
|
time: str
|
||||||
type: str
|
type: str
|
||||||
instrument: str | None
|
instrument: Optional[str] = None
|
||||||
units: str | None
|
units: Optional[str] = None
|
||||||
timeInForce: str | None
|
timeInForce: Optional[str] = None
|
||||||
positionFill: str | None
|
positionFill: Optional[str] = None
|
||||||
reason: str
|
reason: str
|
||||||
longPositionCloseout: LongPositionCloseout | None
|
longPositionCloseout: LongPositionCloseout | None
|
||||||
longOrderFillTransaction: dict | None
|
longOrderFillTransaction: Optional[dict] = None
|
||||||
|
|
||||||
|
|
||||||
class OrderCreate(BaseModel):
|
class OrderCreate(BaseModel):
|
||||||
|
@ -677,12 +677,12 @@ class TradeDetailsTrade(BaseModel):
|
||||||
state: str
|
state: str
|
||||||
currentUnits: str
|
currentUnits: str
|
||||||
realizedPL: str
|
realizedPL: str
|
||||||
closingTransactionIDs: list[str] | None
|
closingTransactionIDs: Optional[list[str]] = []
|
||||||
financing: str
|
financing: str
|
||||||
dividendAdjustment: str
|
dividendAdjustment: str
|
||||||
closeTime: str | None
|
closeTime: Optional[str] = None
|
||||||
averageClosePrice: str | None
|
averageClosePrice: Optional[str] = None
|
||||||
clientExtensions: ClientExtensions | None
|
clientExtensions: Optional[ClientExtensions] = None
|
||||||
|
|
||||||
|
|
||||||
class TradeDetails(BaseModel):
|
class TradeDetails(BaseModel):
|
||||||
|
@ -733,10 +733,10 @@ TradeCloseSchema = {
|
||||||
|
|
||||||
|
|
||||||
class TradeCRCDO(BaseModel):
|
class TradeCRCDO(BaseModel):
|
||||||
takeProfitOrderCancelTransaction: OrderTransaction
|
takeProfitOrderCancelTransaction: Optional[OrderTransaction]
|
||||||
takeProfitOrderTransaction: OrderTransaction
|
takeProfitOrderTransaction: Optional[OrderTransaction]
|
||||||
stopLossOrderCancelTransaction: OrderTransaction
|
stopLossOrderCancelTransaction: Optional[OrderTransaction]
|
||||||
stopLossOrderTransaction: OrderTransaction
|
stopLossOrderTransaction: Optional[OrderTransaction]
|
||||||
relatedTransactionIDs: list[str]
|
relatedTransactionIDs: list[str]
|
||||||
lastTransactionID: str
|
lastTransactionID: str
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue