The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Quant::Framework::Spot - Used to store/retrieve spot prices into/from local Redis storage

SYNOPSIS

Used to store/retrieve spot prices into/from local Redis storage You will need to provide the module with a code reference which will be used in exception cases where local redis is empty and a request to read spot price is received. In this case, module will use the given code references to fetch spot price from a secondary storage (this can be a database). If you omit for_date parameter, you will fetch latest spot price.

    use Quant::Framework::Spot;

    my $foo = Quant::Framework::Spot->new({
        symbol => 'GDAXI',
        for_date => Date::Utility->new('2016-09-11 12:29:10')
    });

    ...

SUBROUTINES/METHODS

$self->spot_tick

Get last tick value for symbol from Redis or feed database. It will rebuild value from feed db if it is not present in cache.

This method will fall back to database if no data is found in Redis cache. In this case, Redis will be populated with the data read from db.

spot_tick_hash

 Returns a hash reference denoting available fields in the spot_tick       

tick_at

This method receives a timestamp and an option for inconsistency. Returns the tick for current symbol at the given time. If inconssitency is enabled and there is no tick at that moment, the latest tick before that time is returned. `allow_inconsistent` parameters determines how the case should be handled when there is no tick at the exact requested timestamp. If value of this parameter is `1`, then the code will return tick at or before the given timestamp. If it is passed as `0`, the code will return any tick at or after given timestamp.

closing_tick_on

Get the market closing tick for a given date.

Example : $underlying->closing_tick_on("10-Jan-00");

$self->set_spot_tick($value)

Save last tick value for symbol in Redis. Returns true if operation was successfull, false overwise. Tick value should be a hash reference like this:

{ epoch => $unix_timestamp, quote => $last_price, }

You will need to provide the module with a code reference which will be used in exception cases where local redis is empty and a request to read spot price is received. In this case, module will use the given code references to fetch spot price from a secondary storage (this can be a database).

spot_quote

What is the current spot price for this underlying?

spot_time

The epoch timestamp of the latest recorded tick in the system

spot_age

The age in seconds of the latest tick