I have been following the example provided in the docs shown here, but I keep running into the same errors which state:
ValidationError: 1 validation error for Order
commission
field required (type=value_error.missing)
Has anyone else encountered something similar/do you have a solution for this?
Here’s the code: (virtually taken directly from the example above, with the same module imports).
market_order_data = MarketOrderRequest(
symbol="DOGE/USD",
qty=1,
side=OrderSide.BUY,
time_in_force=TimeInForce.GTC,
commission=1
)
# Market order
market_order = broker_client.submit_order_for_account(
account_id=account_id,
order_data=market_order_data
)
With the following errors
---------------------------------------------------------------------------
ValidationError Traceback (most recent call last)
<ipython-input-26-cf45673b0e09> in <module>()
21 market_order = broker_client.submit_order_for_account(
22 account_id=account_id,
---> 23 order_data=market_order_data
24 )
25 #except:
~/anaconda3/lib/python3.7/site-packages/alpaca/broker/client.py in submit_order_for_account(self, account_id, order_data)
1515 return response
1516
-> 1517 return Order(**response)
1518
1519 def get_orders_for_account(
~/anaconda3/lib/python3.7/site-packages/alpaca/trading/models.py in __init__(self, **data)
184
185 def __init__(self, **data: Any) -> None:
--> 186 if "order_class" not in data or data["order_class"] == "":
187 data["order_class"] = OrderClass.SIMPLE
188
~/anaconda3/lib/python3.7/site-packages/pydantic/main.cpython-37m-darwin.so in pydantic.main.BaseModel.__init__()
ValidationError: 1 validation error for Order
commission
field required (type=value_error.missing)