Avoid Day Trading

Hello everyone!

I am currently writing my buying and selling functions and need some input from everyone else.

So we all know that unless we have a day trading account we cannot buy and then sell a stock in the same day right?
Because of this, im trying to find the easiest way to check each position i have and make sure a buy order wasnt placed that day.

The only way i see it getting done is taking each position and comparing its order for the filled date and compare that date to today. If its not, then sell away, if it is then hold on.

How is everyone else verifying that a stock is ready for selling?

Thanks,
John

1 Like

Yeah, I have a function in my sell conditions to check for this:
export const isDayOld = stock => moment().diff(moment(stock.filled_at), 'days') >= 1;

1 Like

You can now query all the fills of the day using Activities API. Use activity_type=FILL

Alternative is to use List Order API and check status = “filled” or “partially_filled”, within the same day and symbol.