GBDataMachine ¶
Description ¶
Converts the data from the
["Date",
"Price"]
to wanted interval period prices.
Watch for the PriceData DataFrame and the BollingerData Dataframe for more details.
Code ¶
-
class
GBDataMachine.
GBDataMachine
( data : Optional [ pandas.core.generic.NDFrame ] = None , interval : int = 15 , movingAverageSize : int = 30 ) ¶ -
-
append
( epochTime : float , price : float , shouldPrint : bool = False ) ¶ -
Appends new (epochTime, price) into the Dataframes.
- Parameters
-
-
epochTime ( float ) – timestamp of the price
-
price ( float ) – price
-
-
appendDataframe
( dataFrame : pandas.core.frame.DataFrame ) ¶ -
Same as parseToInterval but with a different name
-
appendFilename
( fileName : str ) ¶ -
Appends a file into the data machine.
- Parameters
-
fileName ( str ) – name of the file
-
appendFormated
( date : float , open : float , high : float , low : float , close : float ) ¶ -
Appends an already formated row to the data machine
- Parameters
-
-
date ( float ) – epoch time in seconds
-
open ( float ) – open price
-
high ( float ) – high price
-
low ( float ) – low price
-
close ( float ) – close price
-
-
convertForGraphicViews
( ) ¶ -
Convert data and format it for GraphViewer .
- Returns
-
(DataFrame containing data for Plot 1, Same for Plot 2)
- Return type
-
(pandas.DataFrame, pandas.DataFrame)
-
currentBollingerValue
( ) ¶ -
Prints the current/last bollinger value
-
classmethod
fromDataframe
( data : pandas.core.generic.NDFrame , interval : int = 15 , movingAverageSize : int = 30 ) ¶ -
Constructor starting from a filename.
- Parameters
-
-
data ( gen.NDFrame ) – Structure containing prices and dates.
-
interval ( int ) – Time gap between each price (in min).
-
movingAverageSize ( int ) – Number of data taken into account to calculate a moving average.
-
-
classmethod
fromFilename
( fileName : str , interval : int = 15 , movingAverageSize : int = 30 ) ¶ -
Constructor starting from a filename.
- Parameters
-
-
fileName ( str ) – Name of the file containing the data.
-
interval ( int ) – Time gap between each price (in min).
-
movingAverageSize ( int ) – Number of data taken into account to calculate a moving average.
-
-
intervalClosed
( ) ¶ -
Returns if an iteration has just been closed
-
lastPrice
( ) ¶ -
Returns the last close price
-
memoryUsage
( ) ¶ -
Returns memory usage
- Returns
-
memory usage
- Return type
-
int
-
parseToInterval
( data : pandas.core.frame.DataFrame ) ¶ -
Parses the given dataframe to the data machine
- Parameters
-
data ( pandas.DataFrame ) – dataframe containing the dates and prices
-
printPrices
( ) ¶ -
Prints prices data
-
update
( shouldPrint : bool = False ) ¶ -
Updates the GBDataMachine and computes bollinger bands, moving averages, …
- Parameters
-
shouldPrint ( bool ) – specify if the updates operations should be displayed or not
-