Q26 ALPHA-TRADING SYSTEM
Public Member Functions | Public Attributes | List of all members
CLIENT_MAIN Class Reference

Public Member Functions

def __init__ (self, brokerName, accountNumber=0)
 
def connect (self, configFile=None)
 LISTEN METHODS. More...
 
def checkConnection (self)
 
def disconnect (self)
 
def newContract (self, contractName, configFile=None)
 CONTRACT DEFINITION METHODS. More...
 
def removeContract (self, contractName)
 
def getHistoricalData (self, contractName, dateIni, dateEnd, timeframe, onlyOpen=True)
 CONTRACT DATA METHODS. More...
 
def getLastPrice (self, contractName)
 
def placeOrder (self, contractName, action="long", orderType="bracket", volume=0.1, stoploss=None, takeprofit=None, lmtPrice=None, auxPrice=None)
 TRADING ORDER METHODS. More...
 
def editSLOrder (self, contractName, order, stoploss=None)
 
def editTPOrder (self, contractName, order, takeprofit=None)
 
def cancelOrder (self, contractName, order)
 
def cancelLastOrder (self, n=1)
 
def readPositions (self)
 
def closePosition (self, contractName, order=None)
 
def closeAllPositions (self)
 
def getPositionInfo (self, contractName)
 
- Public Member Functions inherited from SYSTEM
def write_log (self, action, nargs, args, kwargs, result)
 
def init_write_log (self, action, nargs, args, kwargs, mode="a")
 
def init (function)
 
def message (function)
 
def error (function)
 
def step (function)
 
def placeOrder (function)
 
def closePosition (function)
 
def editSLOrder (function)
 
def editTPOrder (function)
 
def cancelOrder (function)
 
def getActivePositions (function)
 
def getHistoricalData (function)
 
def getLastPrice (function)
 

Public Attributes

 broker
 
 refNumber
 
 api
 
 contractsList
 
 configFile_connexion
 
 configFile_contract
 
 database
 
 trading_log_actions
 

Member Function Documentation

◆ cancelLastOrder()

def cancelLastOrder (   self,
  n = 1 
)
Function that cancel the last-n specific order. 

◆ cancelOrder()

def cancelOrder (   self,
  contractName,
  order 
)
Function that allows to cancel an order that have been previously placed but not 
executed yet on a given contract and to a given broker.  

◆ checkConnection()

def checkConnection (   self)
Function that check if the Broker's api object is connected to the broker. 

◆ closeAllPositions()

def closeAllPositions (   self)
Function that close positions for every existing contract 

◆ closePosition()

def closePosition (   self,
  contractName,
  order = None 
)
Function that close a specific position on a given contract. 

◆ connect()

def connect (   self,
  configFile = None 
)

LISTEN METHODS.

CONNECTION METHODS

Function that connect the instance to the broker's API and 
fill the associated api object. 
Variables : 
    brokerName [str]  : Name of the broker to connect 
    configFile [dict] : Dictionnary that contains the broker's connection informations 

◆ disconnect()

def disconnect (   self)
If connected, this function disconnect the broker's API object from the server. 

◆ editSLOrder()

def editSLOrder (   self,
  contractName,
  order,
  stoploss = None 
)
Function that allows to edit the stoploss of a bracket order 

◆ editTPOrder()

def editTPOrder (   self,
  contractName,
  order,
  takeprofit = None 
)
Function that allows to edit the takeprofit of a bracket order 

◆ getHistoricalData()

def getHistoricalData (   self,
  contractName,
  dateIni,
  dateEnd,
  timeframe,
  onlyOpen = True 
)

CONTRACT DATA METHODS.

Function that returns an historical dataset for the selected contract. 

◆ getLastPrice()

def getLastPrice (   self,
  contractName 
)
Function that returns the last existing price for the selected contract. 

◆ getPositionInfo()

def getPositionInfo (   self,
  contractName 
)
Function that returns informations on a global position for a specified contract. 

◆ newContract()

def newContract (   self,
  contractName,
  configFile = None 
)

CONTRACT DEFINITION METHODS.

Function that allows to define a new contract object compatible with a selected 
broker. 

◆ placeOrder()

def placeOrder (   self,
  contractName,
  action = "long",
  orderType = "bracket",
  volume = 0.1,
  stoploss = None,
  takeprofit = None,
  lmtPrice = None,
  auxPrice = None 
)

TRADING ORDER METHODS.

Function that allows to place an order with a selected contract object, on a selected 
broker.  
This function returns a list of 3 orders (with respect to the following order): 
    - A market order 
    - The limit takeprofit order 
    - The stoploss order 

◆ readPositions()

def readPositions (   self)
Function that returns the positions informations opened by the current client account.  

◆ removeContract()

def removeContract (   self,
  contractName 
)
Function that allows to remove a contract existing in the contractsList object. 

The documentation for this class was generated from the following file: