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

Public Member Functions

def __init__ (self, name)
 
def createCopy (self)
 Description : More...
 
def setColumnsTitle (self, askOpen=None, askHigh=None, askLow=None, askClose=None, bidOpen=None, bidHigh=None, bidLow=None, bidClose=None, date=None, dateFormat=None, volume=None, splitDaysHours=False, days=None, hours=None)
 Description : More...
 
def read (self, path)
 Description : More...
 
def setBaseTimeframe (self, timeframe=dt.timedelta(minutes=1))
 Description : More...
 
def fillMissingData (self, model="constant")
 Description : More...
 
def shiftMarketTime (self, timeshift=0)
 Description : More...
 
def setMarketTimeZone (self, timezone=0)
 Description : More...
 
def setDataTimeZone (self, timezone=0)
 Description : More...
 
def setMarketState (self)
 Description : More...
 
def resampleData (self, newTimeFrame, name=None)
 Description : More...
 
- Public Member Functions inherited from SPREAD
def spreadModel (self, model="constant", apply="bid", parameters={"spread" :0.0001})
 Description : More...
 

Public Attributes

 name
 
 dataTimeZone
 
 marketTimeZone
 
 marketOpeningHour
 
 marketLunch
 
 marketBreakList
 
 marketClosingHour
 
 daysOfWeek
 
 vacations
 
 askOpen
 
 askHigh
 
 askLow
 
 askClose
 
 bidOpen
 
 bidHigh
 
 bidLow
 
 bidClose
 
 date
 
 volume
 
 marketStatus
 
 sampled
 

Detailed Description


Q26 - QuanTester module - PRICE object.

Description :

Examples :

Planned developments :

Known bugs :

Member Function Documentation

◆ createCopy()

def createCopy (   self)

Description :

Returns a deep copy of current PRICE object

Parameters :

None 

Returns :

PRICE object 

◆ fillMissingData()

def fillMissingData (   self,
  model = "constant" 
)

Description :

Function that allows to fill the missing data so that it exists a price data candle for 
every time step from the beginning to the end of the dataframe. 
Note : More models will be implemented in a close future...

Parameters :

- model [str] = "constant" : 
    - "constant" : Fill the candles using the last known price 
                   (the standard model, to be used when data quality is good) 

Returns :

None 

◆ read()

def read (   self,
  path 
)

Description :

Reads the historical dataset, given its path. The dataset have to 
be a csv file. 

Parameters :

path [str] : 
    The dataset path+name

Returns :

None

◆ resampleData()

def resampleData (   self,
  newTimeFrame,
  name = None 
)

Description :

This function allows to re-sample candle data following the typical sampling method 
used by trading platforms. Once resampled, the PRICE object obtains the status 
sampled = True. 

Parameters :

- newTimeFrame [str] : 
    New sampling timeframe in format : "HH:MM". The new sampling timeframe has to be 
    time larger than the before sampling timeframe. 
- name [str] = None : 
    To make the data readable in the standard way by the STRATEGY classes 
    via the function .getHistoricalData, the name of the sampled data should be 
    the exact same as the corresponding SYMBOL name and the base dataset name. 

Returns :

None 

◆ setBaseTimeframe()

def setBaseTimeframe (   self,
  timeframe = dt.timedelta(minutes = 1) 
)

Description :

Function allowing to define the base timeframe of the PRICE object.

Parameters :

- timeframe [datetime.timedelta] = timedelta(minutes = 1) 

Returns :

None 

◆ setColumnsTitle()

def setColumnsTitle (   self,
  askOpen = None,
  askHigh = None,
  askLow = None,
  askClose = None,
  bidOpen = None,
  bidHigh = None,
  bidLow = None,
  bidClose = None,
  date = None,
  dateFormat = None,
  volume = None,
  splitDaysHours = False,
  days = None,
  hours = None 
)

Description :

This function allows to define the columns names in the file.  

Parameters :

- askOpen [str] = None : 
    ask open datafile column name 
- askHigh [str] = None : 
    ask high datafile column name 
- askLow [str] = None : 
    ask low datafile column name 
- askClose [str] = None : 
    ask close datafile column name 
- bidOpen [str] = None : 
    bid open datafile column name 
- bidHigh [str] = None : 
    bid high datafile column name 
- bidLow [str] = None : 
    bid low datafile column name 
- bidClose [str] = None : 
    bid close datafile column name 
- date [str] = None : 
    date datafile column name. Only if days and hours are specified in 
    the same column. Example : 2021-03-18 23:57:12 
- dateFormat [str] = None : 
    date format associated to the date strings in the datafile. 
    See more here : https://docs.python.org/3.6/library/datetime.html#strftime-and-strptime-behavior 
    Note : Even if days and hours are separated, the date format should be defined as if they were 
    only separated by a space. 
- volume [str] = None : 
    volume datafile column name 
- splitDaysHours [bool] = False :
    put True if days and hours are not in the same column in the datafile. 
- days [str] = None : 
    days datafile column name. Only if splitDaysHours = True 
- hours [str] = None : 
    hours datafile column name. Only if splitDaysHours = True

Returns :

None 

◆ setDataTimeZone()

def setDataTimeZone (   self,
  timezone = 0 
)

Description :

Function that allows to define the timezone in which the data is printed 

Parameters :

- timezone [int] = 0 : 
    timezone in which the data will be printed

Returns :

None 

◆ setMarketState()

def setMarketState (   self)

Description :

Once defined the time zones, the open/close/breaks hours, this function 
fill the marketState list with "open" or "closed" for every candle. 

Parameters :

None

Returns :

None 

◆ setMarketTimeZone()

def setMarketTimeZone (   self,
  timezone = 0 
)

Description :

Allows to define the price time data time zone 
according to UTC+0. 

Parameters :

- timezone [int] = 0 : 
    market time zone in hours

Returns :

None 

◆ shiftMarketTime()

def shiftMarketTime (   self,
  timeshift = 0 
)

Description :

Function that allows to shift the market hours to make it fit with 
UTC+0 time if this is not already the case. 

Parameters :

- timeshift [int] = 0 : 
    timeshift in hours

Returns :

None 

Member Data Documentation

◆ askClose

askClose

Data list

Type : list(float)
Defaut value : list()
Description :
Close ask data list.

◆ askHigh

askHigh

Data list

Type : list(float)
Defaut value : list()
Description :
High ask data list.

◆ askLow

askLow

Data list

Type : list(float)
Defaut value : list()
Description :
Low ask data list.

◆ askOpen

askOpen

Data list

Type : list(float)
Defaut value : list()
Description :
Open ask data list.

◆ bidClose

bidClose

Data list

Type : list(float)
Defaut value : list()
Description :
Close bid data list.

◆ bidHigh

bidHigh

Data list

Type : list(float)
Defaut value : list()
Description :
High bid data list.

◆ bidLow

bidLow

Data list

Type : list(float)
Defaut value : list()
Description :
Low bid data list.

◆ bidOpen

bidOpen

Data list

Type : list(float)
Defaut value : list()
Description :
Open bid data list.

◆ dataTimeZone

dataTimeZone

Dataset time zone

Type : int
Defaut value : 0
Description :
Time zone at which the data have been aggregated. UTC+...

◆ date

date

Data list

Type : list(datetime)
Defaut value : list()
Description :
Date list.

◆ daysOfWeek

daysOfWeek

Days of week open market

Type : list(integer)
Defaut value : [0, 1, 2, 3, 4, 5, 6]
Description :
List of days in the week the market is usually open. 0 : Monday -> 6 : Sunday

◆ marketBreakList

marketBreakList

Market breaks list

Type : list(string)
Defaut value : list()
Description :
List of the different breaks during a day.
The variable format should follow : ["HH:MM-HH:MM", "...", ... ]. If there are no breaks within the day, let this variable as an empty list.

◆ marketClosingHour

marketClosingHour

Market closing hour

Type : string
Defaut value : "24:00"
Description :
Market closing hour in the local market time zone. The variable format should follow : "HH:MM". Note : If the market never close, the close hour should be : "24:00"

◆ marketLunch

marketLunch

Market lunch hour

Type : string
Defaut value : None
Description :
Lunch period in the local market hour. The variable format should follow : "HH:MM-HH:MM". If no lunch, let this variable to None.

◆ marketOpeningHour

marketOpeningHour

Market opening hour

Type : string
Defaut value : "00:00"
Description :
Market opening hour in the local market time zone. The variable format should follow : "HH:MM"

◆ marketStatus

marketStatus

Data list

Type : list(string)
Defaut value : list()
Description :
Market status list. It can be : "closed" or "open"

◆ marketTimeZone

marketTimeZone

Exchange market time zone

Type : int
Defaut value : 0
Description :
Exchange market time zone.
UTC+...

◆ name

name

Dataset name

Type : string
Description :
Dataset name. The dataset name should be the exact same of a SYMBOL name embedded in the PORTFOLIO.

◆ sampled

sampled

Is re-sampled data ?

Type : boolean
Defaut value : False
Description :
False if original data. True is sampled from sub resolution data

◆ vacations

vacations

Market vacations list

Type : list()
Defaut value : list()
Description :
List of vacations all along the simulation time. Note : this variable is not working yet.

◆ volume

volume

Data list

Type : list(float)
Defaut value : list()
Description :
Volume list.


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