Skip to content

零股

提醒

下單前必須先登入及啟用憑證

下單

下單

IContract contract = _api.Contracts.Stocks["TSE"]["2890"];
var order = new StockOrder()
{
    price = 15.7,
    quantity = 3,
    action = Action.Buy,
    price_type = StockPriceType.LMT,
    order_type = StockOrderType.ROD,
    order_lot = StockOrderLot.IntradayOdd,
    first_sell = StockFirstSell.No,
    custom_field = "test"
};

trade = _api.PlaceOrder(contract, order)

Out

{
    contract={
        security_type=STK, 
        code=2890, 
        symbol=TSE2890, 
        exchange=TSE, 
        limit_up=19, 
        limit_down=15.6, 
        reference=17.3, 
        margin_trading_balance=0, 
        short_selling_balance=0, 
        update_date=2023/02/22, 
        category=17, 
        day_trade=Yes, 
        name=永豐金
    }, 
    order={
        action=Buy, 
        price=15.7, 
        quantity=3, 
        price_type=LMT, 
        order_type=ROD, 
        order_lot=IntradayOdd, 
        order_cond=Cash, 
        id=9f4ac056, 
        seqno=777526, 
        ordno=I4329, 
        account={
            account_type=S, 
            person_id=, 
            broker_id=9A95, 
            account_id=, 
            signed=True, 
            username=
        }, 
        custom_field=test, 
        ca=
    }, 
    status={
        id=9f4ac056, 
        status=PendingSubmit, 
        status_code=0, 
        order_ts=1675840497.615093, 
        msg=委託成功, 
        modified_ts=0, 
        modified_price=0, 
        deal_quantity=0, 
        cancel_quantity=0
    }
}

改單

注意

零股不能進行改價

UpdateOrder 只能用來減少原委託單的委託數量。

In

_trade = _api.UpdateOrder(_trade, quantity:1);
_api.UpdateStatus();
Console.WriteLine(_trade);

Out

{
    contract={
        security_type=STK, 
        code=2890, 
        symbol=TSE2890, 
        exchange=TSE, 
        limit_up=19, 
        limit_down=15.6, 
        reference=17.3, 
        margin_trading_balance=0, 
        short_selling_balance=0, 
        update_date=2023/02/22, 
        category=17, 
        day_trade=Yes, 
        name=永豐金
    }, 
    order={
        action=Buy, 
        price=15.7, 
        quantity=3, 
        price_type=LMT, 
        order_type=ROD, 
        order_lot=IntradayOdd, 
        order_cond=Cash, 
        id=9f4ac056, 
        seqno=777526, 
        ordno=I4329, 
        account={
            account_type=S, 
            person_id=, 
            broker_id=9A95, 
            account_id=, 
            signed=True, 
            username=
        }, 
        custom_field=test, 
        ca=
    }, 
    status={
        id=9f4ac056, 
        status=Submitted, 
        status_code=00, 
        order_ts=1675840497.615093, 
        modified_ts=0, 
        modified_price=0, 
        deal_quantity=0, 
        cancel_quantity=1,
        deals=[]
    }
}

刪單

刪單

_trade = _api.CancelOrder(_trade);
_api.UpdateStatus();
Console.WriteLine(_trade);

Out

{
    contract={
        security_type=STK, 
        code=2890, 
        symbol=TSE2890, 
        exchange=TSE, 
        limit_up=19, 
        limit_down=15.6, 
        reference=17.3, 
        margin_trading_balance=0, 
        short_selling_balance=0, 
        update_date=2023/02/22, 
        category=17, 
        day_trade=Yes, 
        name=永豐金
    }, 
    order={
        action=Buy, 
        price=15.7, 
        quantity=3, 
        price_type=LMT, 
        order_type=ROD, 
        order_lot=IntradayOdd, 
        order_cond=Cash, 
        id=ae83136d, 
        seqno=785653, 
        ordno=I9143, 
        account={
            account_type=S, 
            person_id=, 
            broker_id=9A95, 
            account_id=, 
            signed=True
        }, 
        custom_field=test, 
        ca=
    }, 
    status={
        id=ae83136d, 
        status=Cancelled, 
        status_code=00, 
        order_ts=1.6770374E+09, 
        modified_ts=1.6770374E+09, 
        modified_price=0, 
        deal_quantity=0, 
        cancel_quantity=3, 
        deals=[]
    }
}