Refactor execute_strategy into functions and send a price bound

This commit is contained in:
2022-11-10 19:52:52 +00:00
parent af9f874209
commit 8b52063473
3 changed files with 84 additions and 44 deletions

View File

@@ -61,8 +61,13 @@ class OANDAExchange(BaseExchange):
"positionFill": "DEFAULT",
}
}
if trade.type == "limit":
data["order"]["price"] = str(trade.price)
if trade.price is not None:
print("PRICE IS NOT NONE")
if trade.type == "limit":
data["order"]["price"] = str(trade.price)
elif trade.type == "market":
print("IS MARKET")
data["order"]["priceBound"] = str(trade.price)
r = orders.OrderCreate(self.account_id, data=data)
response = self.call(r)
trade.response = response