You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from alpaca.trading.client import TradingClient
from alpaca.trading.requests import MarketOrderRequest
from alpaca.trading.enums import OrderSide, TimeInForce
trading_client = TradingClient('api-key', 'secret-key', paper=True)
# preparing orders
market_order_data = MarketOrderRequest(
symbol="SPY",
qty=0.023,
side=OrderSide.BUY,
time_in_force=TimeInForce.DAY
)
# Market order
market_order = trading_client.submit_order(
order_data=market_order_data
)
Code above produces error: alpaca.common.exceptions.APIError: {"code":40010001,"message":"qty must be integer"}
When trying notional instead of qty causes error: alpaca.common.exceptions.APIError: {"code":40010001,"message":"qty is required"}
Expected Behavior
above code should produce a market order request
SDK Version I encountered this issue in
alpaca-py version: 0.5.4
Steps To Reproduce
1. poetry new market_order_test
2. poetry add alpaca-py
3. run following example with poetry run python test.py:
`
from alpaca.trading.client import TradingClient
from alpaca.trading.requests import MarketOrderRequest
from alpaca.trading.enums import OrderSide, TimeInForce
trading_client = TradingClient('api-key', 'secret-key', paper=True)
# preparing orders
market_order_data = MarketOrderRequest(
symbol="SPY",
qty=0.023,
side=OrderSide.BUY,
time_in_force=TimeInForce.DAY
)
# Market order
market_order = trading_client.submit_order(
order_data=market_order_data
)
`
Filled out the Steps to Reproduce section?
I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.
I was able to resolve this issue by resetting the paper trade account. This issue may be marked as close.
Should be in docs possibly as a troubleshoot to reset paper trade account with this issue or other similar.
Agree with @markolonius , I was having similar "qty is required" issue when notional value is specified on "BTC/USD" and the issue is gone when the paper trading account is reset.
Is there an existing issue for this?
Current Behavior
Using code from example in creating-an-order does not work.
Code above produces error:
alpaca.common.exceptions.APIError: {"code":40010001,"message":"qty must be integer"}
When trying
notional
instead ofqty
causes error:alpaca.common.exceptions.APIError: {"code":40010001,"message":"qty is required"}
Expected Behavior
above code should produce a market order request
SDK Version I encountered this issue in
alpaca-py version: 0.5.4
Steps To Reproduce
Filled out the Steps to Reproduce section?
Anything else?
seems similar to alpacahq/alpaca-trade-api-python#404
The text was updated successfully, but these errors were encountered: