Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't execute fractional orders during extended trading hours? #547

Open
lukmisch opened this issue Feb 13, 2025 · 3 comments
Open

Can't execute fractional orders during extended trading hours? #547

lukmisch opened this issue Feb 13, 2025 · 3 comments

Comments

@lukmisch
Copy link

lukmisch commented Feb 13, 2025

Hello! I am having difficulty executing fractional limit orders during extended trading hours. I have Gold and would like to utilize extended trading in my code. I've tried order(), order_buy_fractional_by_price(), and order_buy_fractional_by_quantity(), being careful to pass the correct parameters for extendedHours and market_hours.

These work for regular hours, but returns this for extended hours orders:
{'non_field_errors': ['Limit order quantity cannot include fractional shares.']}

I find this odd because I can execute fractional limit buys from my phone or Robinhood website during extended hours. Why isn't it working via my code?

Here is a test payload of $1 of TSLA I am sending before calling request_post() via Robin Stocks. I removed the account field for security:

{
  'instrument': 'https://api.robinhood.com/instruments/e39ed23a-7bd1-4587-b060-71988d9ef483/',
  'symbol': 'TSLA',
  'price': 355.5,
  'ask_price': 355.5,
  'bid_ask_timestamp': '2025-02-13 17:16:05.612863',
  'bid_price': 355.39,
  'quantity': 0.00281413,
  'ref_id': 'de24b474-7843-402b-a730-61010ae3dffa',
  'type': 'limit',
  'time_in_force': 'gfd',
  'trigger': 'immediate',
  'side': 'buy',
  'market_hours': 'extended_hours',
  'extended_hours': True,
  'order_form_version': 4
}  

I've noticed that when sending payloads through Robinhood website using Inspect Element to monitor network traffic during extended hours for successful fractional limits, there are a lot more fields in the payload. Not sure if that plays a factor or not.

@Adelantado
Copy link

It's been a while since I looked into this but as far as I remember, only whole shares not fractional, will get queered and processed during extended hours.
Fractional shares will either fail / get rejected, or queered till next day market opening, not sure.

@lukmisch
Copy link
Author

It's been a while since I looked into this but as far as I remember, only whole shares not fractional, will get queered and processed during extended hours. Fractional shares will either fail / get rejected, or queered till next day market opening, not sure.

Right. The orders are getting rejected unless it’s whole shares. But I can execute fractional limit orders during extended hours via the website and on my phone Robinhood app perfectly fine, so perhaps there’s a way to send an HTTP request with the Robin Stocks api to do it through code as well?

@Adelantado
Copy link

Yes, U are right, I saw something funky about it too. Never got that involved with after hours trading due that same reason.

I would share that if for A or B, if a fractional order does not get executed before 4 pm, I cancel it as I do not want it lingering till market opens next morning.

I do place some after hours trades when in need ( always whole shares ), but they are set up manually and submitted thru the app; didn't know you could set up after hours fractional manually. Thanks for the tip !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants