What is K2?

K2 Explained

History Repeats Itself. Iconic, but undeniable, K2 leverages this phenomenon in the finance world. Never before have we had access to such vast amounts of information. However, it is impossible to analyze over a zettabyte of online data by hand. Computer automation is a necessity. Through intelligent data analysis programmed in K2, users can comb through vast amounts of data to determine if their investment predictions would have held up in the past and therefore in the future.

K2 is a cutting edge investment backtesting algorithm. It is the crossroads between the world of finance and the world of programming by bridging the gap between the two fields. What sets K2 apart is the API that enables user interaction. It provides a framework for testing finance predictions by backtesting these algorithms (designed easily with our API) with existing data.

View Demo
K2 Results

"Your strategy, our analysis"

See how the K2 framework is applied to analyzing investment strategy. All backtesting is done with real world data.








Step 4: PROFIT!



def algo(data, assets):capital, shares = assets price = data.current_price() short_period, long_period, threshold = 5, 20, 0.01 if data.shorter_than(long_period): return 0 trend = data.moving_averages(short_period, long_period) account = Account(assets) return account.buy(trend*capital/price) if trend > threshold else account.sell(trend*shares) if trend < -threshold else 0
Sharpe Ratio



Backtest your data minute by minute against historical cryptocurrency prices


See how your algorithm ranks according to a variety of financial benchmarks such as ROI, Alpha, Beta, Sharpe ratio, etc...


Trade your algorithm on the market


Our API allows investors to leverage the full capabilities of K2. The API bridges the gap between our backend algorithm and the user interaction.

Accounts Functions
Function Parameter Parameter TYPE Description
initialization assets tuple Takes parameter assets, a 2-tuple representing capital and shares, respectively
buy(shares) shares float Opens a Long position with avilable capital, buying a specified amount of shares
sell(shares) shares float Closes a Long position with avilable shares, selling a specified amount
valuel(price) price float Returns net value of portfolio given by sum of capital and value of shares
Accounts Examples

Account((1000, 0)) returns an instance of the Account class with an initial capital of 1000 and 0 initial shares

account.buy(1.5) returns +1.5, assuming that the user can afford this. If this exceeds the capital avilable, then the output is the amount of capital avilable

account.value(10000) returns the sum of initial capital and the value of the shares held, where the number of shares is multiplied by 10000

Data Functions
Function Parameter Parameter TYPE Description
initialization dataframe DataFrame Passsed as an input to the user's algorithm
current_price() None None Returns weighted average of currency across most recent interval
historical_price(days_ago) days_ago int Returns weighted average of currency across specified interval
current() None None Returns dictionary of current currency information across most recent interval. Indexed by date, volume, open, close, high, low, weightedAverage.
historical(days_ago) days_ago int Returns dictionary of currency information across specified interval. Indexed by date, volume, open, close, high, low, weightedAverage.
historical_range(start_prev, end_prev) start_prev, end_prev int, int Returns Pandas DataFrame containing historical currency information across specified range of intervals.
historical_average(days) days int Returns average price of currency across specified number of intervals
moving_averages(short_period, long_period) short_period, long_period int, int Returns percent change of average price with respect to specified short period and long period
short_than(days) days int Returns boolean value indicating whether data is available for specified number of intervals
Data Examples

data.current_price() returns a real value representing the current price for a specified currency

data.historical_price(100) returns a list of weighed average price data for the past 100 intervals

data.current() returns a mapping giving information about the specified currency over the most recent interval

data.historical(100) returns a mapping giving information about the specified curency over the past 100 intervals

data.historical_range(100,50) returns a Pandas DataFrame containing historical information about the specified currency between 100 days ago and 50 days ago

data.historical_average(14) returns the average price of a specified currency over the past 14 days

data.moving_averages(5,20) returns the percent change between the historical average over the past 5 days and that over the past 20 days

data.shorter_than(20) returns whether or not the data object has fewer than 20 entries