RedisBackend

This is an implementation for the backend, which handles all calls to redis It also formats input and output formatting to make it more usable for our case

Source:

Methods

(static) buySecurity(user, tickerSymbol, price, quantity)

Fires the buySecurity script. module:LuaScripts.buySecurity

Parameters:
Name Type Description
user string
tickerSymbol string
price number
quantity number
Source:

(static) createUser(username, password)

Fires the CreateUser script

Parameters:
Name Type Description
username string
password string
Source:

(static) getAllTrades(username)

Gets all the trades for a user

Parameters:
Name Type Description
username string
Source:

(static) getPortfolio(username)

Gets the portfolio for a user

Parameters:
Name Type Description
username string
Source:

(static) init()

The init function initializes the Redis connection and creates promisified of redis operations like EVAL,GET and FLUSHALL

Source:

(static) reset()

Clears the entire redis database mostly only used to create a clean instance while testing

Source:

(static) sellSecurity(user, tickerSymbol, price, quantity)

Fires the sellSecurity script. module:LuaScripts.sellSecurity

Parameters:
Name Type Description
user string
tickerSymbol string
price number
quantity number
Source:

(static) updateSecurity(tradeId, user, tickerSymbolopt, priceopt, quantityopt, typeopt, isDeleteopt)

Fires the sellSecurity script. module:LuaScripts.sellSecurity

Parameters:
Name Type Attributes Description
tradeId string
user string
tickerSymbol string <optional>
price number <optional>
quantity number <optional>
type 'B' | 'S' <optional>
isDelete boolean <optional>
Source:

(static) userAuthorizer(username, password, cb)

Authorizes a user using the auth.{username}:{password} key in redis

Parameters:
Name Type Description
username string
password string
cb

Callback for Async User Authorization in express-basic-auth package

Source: