Cannot place a trade with fractional quantities of shares


I have a problem with creating an order with fractional amounts of shares for S&P500 companies(which are available for fractional trading). Everytime I place an order with my script it says that everything is correct and then there is no order on the dashboard. Even though there is no problem with making the same order with manual trader for paper account. The script even executes block of code responsible for buying stocks, so I think that the function itself is accepting input with floating point numbers, but not executing it properly. Here are troublesome blocks of code in Python:

Example Code

        price = si.get_live_price(stock)
        amount = round(one_company_cap/price, 2)
        create_order(stock, amount, 'buy', 'market', 'gtc')
        print("Buying {} of {} for {}".format(amount, stock, price))
        print('Exception made. Probably lacking data for {}'.format(stock))
        pass   ```
and create order() looks like this:

def create_order(symbol, qty, side, type, time_in_force):
    data = {

I’m not sure but according to documentation fractional values in the qty field allowed only for the market/day order type and time-in-force combination.

Oh, I didn’t notice that, thank you very much. I’ll try changing it.

Just tried it, and it worked perfectly. Thank you again, my friend

I also add this around my code to make sure Alpaca allows fractions for symbols I am trading. Item is my stock ticker

if item in fractionable:
order = api.submit_order(symbol=item, notional=amt_to_sell, side=“sell”)

And this is how I set fractionable in my code
apca_assets = api.list_assets()
fractionable = [asset.symbol for asset in apca_assets if asset.fractionable]