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
When I place a sell order, I would like to check if the sell order is filled or not.
But when paper trading, the filled_at attribute of the order remains None and is not updated.
For instance, I place an order for buying Bitcoin:
for X in CLIENT.get_all_positions():
if X.symbol == "BTCUSD" :
BITCOIN_QTY = float(X.qty)
print( BITCOIN_QTY)
BITCOIN_SELL_DATA = MarketOrderRequest( symbol="BTCUSD" , qty=BITCOIN_QTY, side=OrderSide.SELL ,
time_in_force=TimeInForce.GTC)
SELL_BITCOIN = CLIENT.submit_order(order_data=BITCOIN_SELL_DATA)
from datetime import sleep
sleep(5)
print(SELL_BITCOIN)
As seen, this prints the filled_at attribute as:
filled_at': None
How do we check if an order is filled or not?
Expected Behavior
When you run the following code with your API keys, the filled_at attribute of SELL_BITCOIN must differ from None. However, it remains None even after the order is filled. How do we trace if the order is filled or not?
CLIENT = TradingClient( api_key=' ', secret_key=' ', paper=True)
BITCOIN_MONEY = 2000
from alpaca.trading.requests import MarketOrderRequest
from alpaca.trading.enums import OrderSide, TimeInForce
BITCOIN_BUY_DATA = MarketOrderRequest( symbol="BTC/USD" , notional=BITCOIN_MONEY , side=OrderSide.BUY ,
time_in_force=TimeInForce.GTC)
BUY_BITCOIN = CLIENT.submit_order(order_data=BITCOIN_BUY_DATA)
from datetime import sleep
sleep(10)
for X in CLIENT.get_all_positions():
if X.symbol == "BTCUSD" :
BITCOIN_QTY = float(X.qty)
print( BITCOIN_QTY)
BITCOIN_SELL_DATA = MarketOrderRequest( symbol="BTCUSD" , qty=BITCOIN_QTY, side=OrderSide.SELL ,
time_in_force=TimeInForce.GTC)
SELL_BITCOIN = CLIENT.submit_order(order_data=BITCOIN_SELL_DATA)
from datetime import sleep
sleep(5)
print(SELL_BITCOIN)
Why is the filled_at attribute of SELL_BITCOINNone?
SDK Version I encountered this issue in
alpaca-py 0.30.1
Steps To Reproduce
Run the following code with your API keys:
CLIENT = TradingClient( api_key=' ', secret_key=' ', paper=True)
BITCOIN_MONEY = 2000
from alpaca.trading.requests import MarketOrderRequest
from alpaca.trading.enums import OrderSide, TimeInForce
BITCOIN_BUY_DATA = MarketOrderRequest( symbol="BTC/USD" , notional=BITCOIN_MONEY , side=OrderSide.BUY ,
time_in_force=TimeInForce.GTC)
BUY_BITCOIN = CLIENT.submit_order(order_data=BITCOIN_BUY_DATA)
from datetime import sleep
sleep(10)
for X in CLIENT.get_all_positions():
if X.symbol == "BTCUSD" :
BITCOIN_QTY = float(X.qty)
print( BITCOIN_QTY)
BITCOIN_SELL_DATA = MarketOrderRequest( symbol="BTCUSD" , qty=BITCOIN_QTY, side=OrderSide.SELL ,
time_in_force=TimeInForce.GTC)
SELL_BITCOIN = CLIENT.submit_order(order_data=BITCOIN_SELL_DATA)
sleep(10)
print(SELL_BITCOIN)
Why is the filled_at attribute of the sell order None?
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.
Anything else?
No response
The text was updated successfully, but these errors were encountered:
@avrenli2 to check the latest status of an order after submitting, could you please use CLIENT.get_order_by_id(order_id= SELL_BITCOIN .id) [1] to fetch the latest order info from server?
Is there an existing issue for this?
Current Behavior
When I place a sell order, I would like to check if the sell order is filled or not.
But when paper trading, the filled_at attribute of the order remains None and is not updated.
For instance, I place an order for buying Bitcoin:
After buying the asset, I submit a sell order:
As seen, this prints the filled_at attribute as:
filled_at': None
How do we check if an order is filled or not?
Expected Behavior
When you run the following code with your API keys, the filled_at attribute of SELL_BITCOIN must differ from None. However, it remains None even after the order is filled. How do we trace if the order is filled or not?
Why is the filled_at attribute of SELL_BITCOIN None?
SDK Version I encountered this issue in
alpaca-py 0.30.1
Steps To Reproduce
Run the following code with your API keys:
Why is the filled_at attribute of the sell order None?
Filled out the Steps to Reproduce section?
Anything else?
No response
The text was updated successfully, but these errors were encountered: