Quant::Framework::Spot::DatabaseAPI
The API class which we can query feed database.
This class acts as a facade to the functions available in the DB. That is to say that that actual API is expressed by the functions in the DB.
Each function available here has a function with same name inside the db.
If any of the functions fail due to any reason it will cause an exception thrown straight from DBI layer.
The prefix used to create name of the table `feed.tick` which will contain spot, timestamp and underlying columns.
Return database handle. If db_handle is a normal reference, it will be used directly. If it is a code-ref, it will be invoked to get the database handle.
The underlying symbol for which this API will fetch data
If this argument is set, all tick and OHLC data will have their value inverted. This is useful when we have EURUSD feeds information but want to have data for USDEUR underlying.
In case there are official and non-official OHLC values for an underlying, this flag specifies which type of data we want
Returns ticks in the given interval.
get ticks from feed db filtered by - start_time, end_time - All ticks between <start_time> and <end_time>
Returns ArrayRef[Quant::Framework::Spot::Tick]
Find the first tick which breaches a barrier
get ticks from feed db filtered by - start_time, limit - <limit> number of ticks starting from <start_time>
get ticks from feed db filtered by - end_time, limit - <limit> number ticks before <end_time>
get a valid tick at time given or not a valid tick before a given time. Accept argument - end_time - Time at which we want the tick - allow_inconsistent - if this is passed then we get the last available tick, we do not care if its a valid ick or not.
Returns Quant::Framework::Spot::Tick
get tick from feed db after the time given. - start_time - the first tick after <start_time>
get ticks from feed db filtered by - start_time, end_time, limit - all ticks between <start_time> and <end_time> and limit to <limit> entries. This method is appropriate for charting applications where a limited number of prices are going to be displayed.
This method returns reference to the list of OHLC for the specified period. Accepts following arguments:
Compute OHLC starting from the specified time. Note, that if start_time is not at the beginning of the unit used by the source table (minutes, hour, or days depending on aggregation_period) it will be aligned to the start of the next unit. But timestamp of the returned OHLC may be pointing to earlier moment of time, e.g. for weekly and monthly OHLC it will point to the start of week or month, even though actual OHLC value may be computed from the middle of week or month.
Compute OHLC till specified time. Note, that it will be aligned so timestamp would be multiple of aggregation_period.
Compute OHLCs for periods of the specified duration.
if period is less than a minute, then feed.tick table is used a the source
if period is from one minute and less than an hour, then feed.ohlc_minutely is used as source. Using period that is not multiple of a minute is not wise as returned data may not make much sense.
if period is one hour or more, but less than a day, then feed.ohlc_hourly is used as source of data. Don't use intervals that not multiple of an hour.
if period is a day or more, then ohlc_daily is used as the source of data. Don't use intervals that are not multiple of a day. If number of days is 7 then end_time will be aligned to the end of the week, and all intevals will start at the start of the week (first interval may not actually start at the start of the week, although timestamp in OHLC will indicate that it is). If number of days is 30 then end_time will be aligned to the end of the month and all intervals will start at the start of the month (except maybe the first one).
If interval is multiple of a day, than method will use official daily OHLC if underlying has daily OHLC. It will never set official property or returned OHLC objects though.
Method returns reference to a list of Quant::Framework::Spot::OHLC
This method returns reference to list of daily OHLC for the specified period. First and last OHLC maybe computed for the part of the day using ticks in feed.tick table and not precomputed daily OHLC, so these two are non-official OHLC. The rest of OHLCs may be official, but official attribute won't be set on them. Method accepts the following parameters:
Compute OHLCs starting from the specified time
Compute OHLCs till the specified moment of time
Method returns reference to a list of Quant::Framework::Spot::OHLC objects
Returns OHLC in the given start/end period
Returns daily OHLC values for the period starting from given date till today.
To install Quant::Framework, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Quant::Framework
CPAN shell
perl -MCPAN -e shell install Quant::Framework
For more information on module installation, please visit the detailed CPAN module installation guide.