BondOrderMixin#
- class swordfish.plugins.backtest.BondOrderMixin#
- final submit_bond_order(code, time, order_type, settlement_speed, bid_price, bid_quantity, ask_price, ask_quantity, direct, order_id, channel, /, label=None, account_type=AccountType.DEFAULT)#
Submit a bond order.
- Parameters:
code (str) – A STRING scalar representing the option symbol.
time (Timestamp) – A TIMESTAMP scalar indicating the order timestamp.
order_type (int) –
An INT scalar specifying the order type. Possible values are:
0: A Market order.
9: For automated orders, the buy/sell direction can only be set to 1 or 2.
settlement_speed (int) – An INT scalar indiacting the settlement speed.
bid_price (float) – A FLOAT scalar indicating buy order price.
bid_quantity (int) – An INT scalar indicating the buy order quantity.
ask_price (float) – A FLOAT scalar indicating sell order price.
ask_quantity (int) – An INT scalar indicating the sell order quantity.
direct (int) – An INT scalar indicating the order direction.
order_id (int) – An INT scalar indicating the order id.
channel (str) – A STRING scalar indicating the channel number.
label (str, optional) – A STRING scalar indicating the label assigned to the order for classification.
account_type (AccountType, optional) –
The account type. Available values include:
SPOT: Cash account
STOCK: Stock account
FUTURES: Futures account
OPTION: Options account
- final update_position(symbol, quantity, price=None)#
Update positions and return the order ID. This interface can only be called in simulated trading mode.
- Parameters:
symbol (str) – A STRING scalar, indicating the instrument.
quantity (int) – An INT scalar, positive to increase position, negative to decrease position.
price (float, optional) – A DOUBLE scalar, indicating the trade price. If set to 0 or left empty, the latest market price is used.