Files
aiomql/docs/trader.md
T
Ichinga Samuel 027f9fd8de add docs
2023-10-11 09:49:06 +01:00

2.0 KiB

aiomql.trader

Trader class module. Handles the creation of an order and the placing of trades

Trader Objects

class Trader()

Base class for creating a Trader object. Handles the creation of an order and the placing of trades

Attributes:

  • symbol Symbol - Financial instrument class Symbol class or any subclass of it.

  • ram RAM - RAM instance

  • order Order - Trade order

    Class Attributes:

  • name str - A name for the strategy.

  • account Account - Account instance.

  • mt5 MetaTrader - MetaTrader instance.

  • config Config - Config instance.

__init__

def __init__(*, symbol: Symbol, ram: RAM = None)

Initializes the order object and RAM instance

Arguments:

  • symbol Symbol - Financial instrument
  • ram RAM - Risk Assessment and Management instance

create_order

async def create_order(*, order_type: OrderType, **kwargs)

Complete the order object with the required values. Creates a simple order. Uses the ram instance to set the volume.

Arguments:

  • order_type OrderType - Type of order
  • kwargs - keyword arguments as required for the specific trader

set_order_limits

async def set_order_limits(pips: float)

Sets the stop loss and take profit for the order. This method uses pips as defined for forex instruments.

Arguments:

  • pips - Target pips

place_trade

async def place_trade(order_type: OrderType, params: dict = None, **kwargs)

Places a trade based on the order_type.

Arguments:

  • order_type OrderType - Type of order
  • params - parameters to be saved with the trade
  • kwargs - keyword arguments as required for the specific trader