tedchou12 / webull

Unofficial APIs for Webull.
MIT License
597 stars 181 forks source link

Fractional Share Purchase by 'MKT' place_order #333

Open cjszk opened 2 years ago

cjszk commented 2 years ago

Fractional Share Purchase Support - Currently when calling wb.place_order(), it casts the 'quant' value to an int, rounding it. The endpoint accepts a 'float' value for MKT orders to purchase fractional shares.

data = {
            'action': action,
            'comboType': 'NORMAL',
            'orderType': orderType,
            'outsideRegularTradingHour': outsideRegularTradingHour,
            'quantity': int(quant), # changing this to float(quant) works to execute fractional share purchase.
            'serialId': str(uuid.uuid4()),
            'tickerId': tId,
            'timeInForce': enforce
        }
tedchou12 commented 1 year ago

let me give it a try, I think it is an easy fix.

tedchou12 commented 1 year ago

338

tedchou12 commented 1 year ago

@cjszk Could you give this branch a try?