CryptoOrderMixin#

class swordfish.plugins.backtest.CryptoOrderMixin#
final submit_crypto_order(code, exchange, time, order_type, order_price, stop_loss_price, take_profit_price, quantity, direct, slippage, order_validity, expiration_time, /, label=None, account_type=AccountType.DEFAULT)#

Submit an cryptocurrency order.

Parameters:
  • code (str) – A STRING scalar, representing the crypto code.

  • exchange (str) – A STRING scalar, representing the exchange code.

  • time (Timestamp) – A TIMESTAMP scalar, representing the order timestamp.

  • order_type (int) –

    An INT scalar, representing the order type:

    • 5: Limit order (default).

    • 0: Market order, submitted at daily price limits, following time-priority rules.

  • order_price (float) – A FLOAT scalar, representing the order price.

  • stop_loss_price (float) – A FLOAT scalar, representing the stop-loss price.

  • take_profit_price (float) – A FLOAT scalar, representing the take-profit price.

  • quantity (int) – An INT scalar, representing the order quantity.

  • direct (int) –

    An INT scalar, representing the buy/sell direction:

    • 1: Buy open

    • 2: Sell open

    • 3: Sell close

    • 4: Buy close

  • slippage (float) – FLOAT, representing slippage.

  • order_validity (int) –

    An INT scalar, representing order validity:

    • 0: Valid for the day (default)

    • 1: Immediate full execution or cancel (FOK)

    • 2: Immediate partial execution, remaining canceled (FAK)

  • expiration_time (Timestamp) – A TIMESTAMP scalar, representing the order expiration time.

  • label (str, optional) – A STRING scalar, a tag for categorizing the order.

  • account_type (AccountType, optional) –

    An Enum value representing the account type:

    • SPOT: Cash account

    • STOCK: Stock account

    • FUTURES: Futures account

    • OPTION: Options account