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

Allow for trading of fractional shares. #295

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions pyrh/robinhood.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def place_market_buy_order(
instrument_URL (str): The RH URL of the instrument
symbol (str): The ticker symbol of the instrument
time_in_force (str): 'GFD' or 'GTC' (day or until cancelled)
quantity (int): Number of shares to buy
quantity (float): Number of shares to buy

Returns:
(:obj:`requests.request`): result from `orders` put command
Expand Down Expand Up @@ -721,7 +721,7 @@ def place_limit_buy_order(
symbol (str): The ticker symbol of the instrument
time_in_force (str): 'GFD' or 'GTC' (day or until cancelled)
price (float): The max price you're willing to pay per share
quantity (int): Number of shares to buy
quantity (float): Number of shares to buy

Returns:
(:obj:`requests.request`): result from `orders` put command
Expand Down Expand Up @@ -757,7 +757,7 @@ def place_stop_loss_buy_order(
symbol (str): The ticker symbol of the instrument
time_in_force (str): 'GFD' or 'GTC' (day or until cancelled)
stop_price (float): The price at which this becomes a market order
quantity (int): Number of shares to buy
quantity (float): Number of shares to buy

Returns:
(:obj:`requests.request`): result from `orders` put command
Expand Down Expand Up @@ -795,7 +795,7 @@ def place_stop_limit_buy_order(
time_in_force (str): 'GFD' or 'GTC' (day or until cancelled)
stop_price (float): The price at which this becomes a limit order
price (float): The max price you're willing to pay per share
quantity (int): Number of shares to buy
quantity (float): Number of shares to buy

Returns:
(:obj:`requests.request`): result from `orders` put command
Expand Down Expand Up @@ -826,7 +826,7 @@ def place_market_sell_order(
instrument_URL (str): The RH URL of the instrument
symbol (str): The ticker symbol of the instrument
time_in_force (str): 'GFD' or 'GTC' (day or until cancelled)
quantity (int): Number of shares to sell
quantity (float): Number of shares to sell

Returns:
(:obj:`requests.request`): result from `orders` put command
Expand Down Expand Up @@ -861,7 +861,7 @@ def place_limit_sell_order(
symbol (str): The ticker symbol of the instrument
time_in_force (str): 'GFD' or 'GTC' (day or until cancelled)
price (float): The minimum price you're willing to get per share
quantity (int): Number of shares to sell
quantity (float): Number of shares to sell

Returns:
(:obj:`requests.request`): result from `orders` put command
Expand Down Expand Up @@ -897,7 +897,7 @@ def place_stop_loss_sell_order(
symbol (str): The ticker symbol of the instrument
time_in_force (str): 'GFD' or 'GTC' (day or until cancelled)
stop_price (float): The price at which this becomes a market order
quantity (int): Number of shares to sell
quantity (float): Number of shares to sell

Returns:
(:obj:`requests.request`): result from `orders` put command
Expand Down Expand Up @@ -935,7 +935,7 @@ def place_stop_limit_sell_order(
time_in_force (str): 'GFD' or 'GTC' (day or until cancelled)
stop_price (float): The price at which this becomes a limit order
price (float): The max price you're willing to get per share
quantity (int): Number of shares to sell
quantity (float): Number of shares to sell

Returns:
(:obj:`requests.request`): result from `orders` put command
Expand Down Expand Up @@ -1097,8 +1097,6 @@ def submit_sell_order( # noqa: C901
if quantity is None:
raise (ValueError("No quantity specified in call to submit_sell_order"))

quantity = int(quantity)

if quantity <= 0:
raise (
ValueError(
Expand Down Expand Up @@ -1172,7 +1170,7 @@ def submit_buy_order( # noqa: C901
price (float): The share price you'll accept
stop_price (float): The price at which the order becomes a
market or limit order
quantity (int): The number of shares to buy/sell
quantity (float): The number of shares to buy/sell
side (str): BUY or sell

Returns:
Expand Down Expand Up @@ -1277,8 +1275,6 @@ def submit_buy_order( # noqa: C901
if quantity is None:
raise (ValueError("No quantity specified in call to submit_buy_order"))

quantity = int(quantity)

if quantity <= 0:
raise (
ValueError(
Expand Down