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:
-
symbolSymbol - Financial instrument class Symbol class or any subclass of it. -
ramRAM - RAM instance -
orderOrder - Trade orderClass Attributes:
-
namestr - A name for the strategy. -
accountAccount - Account instance. -
mt5MetaTrader - MetaTrader instance. -
configConfig - Config instance.
__init__
def __init__(*, symbol: Symbol, ram: RAM = None)
Initializes the order object and RAM instance
Arguments:
symbolSymbol - Financial instrumentramRAM - 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_typeOrderType - Type of orderkwargs- 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_typeOrderType - Type of orderparams- parameters to be saved with the tradekwargs- keyword arguments as required for the specific trader