coin_pred

coin_pred / BitcoinPrediction / 1.1.0

README.md

When you get an AI · API that can predict the price transition of Bitcoin after 24 hours, What kind of app do you create?

What's kind of AI ?

From the chart of 70,000 Bitcoin transactions over the past two years, This model learned the price fluctuation rate of Bitcoin 24 hours later.

Accuracy?

The current model accuracy is 98%. (Performed 10-fold cross validation, derived hyperparameter with cross-validation minimum by Bayesian estimation. Correlation coefficient between true value and prediction: 0.98)

How do you trained this AI?

From now on, we created a price chart for the past month, a chart for one week, a chart for the day, a chart for one hour. From the created image group, we create features by CNN. By regression of Bitcoin price fluctuation percentage after 24 hours by SVM regression which added Lasso penalty term from this features, we succeeded in obtaining highly accurate prediction model while preventing over fitting.

Outputs

The prediction by this model is executed every hour, and the latest forecast result is always uploaded to the server and saved. If you call this API, you can get this latest forecast result quickly.

The forecast results obtained include price fluctuation rates every hour from now to 24 hours. In addition, the prediction results so far and the true price change rate are included from 24 hours ago to the present. By comparing the prediction result with the true value, you can check the fit of this model.

Example

import Algorithmia
import matplotlib.pyplot as plt
import datetime

input = "btc_fiat"
client = Algorithmia.client("YOUR_API_KEY")
algo = client.algo('coin_pred/BitcoinPrediction/0.1.0')

result = algo.pipe(input).result

if result["status"] == 1:

    print(result["message"])
    p_dict = result["predict"]
    p_start = result["predict_start"]
    p_end = result["predict_end"]

    t_dict = result["true"]
    t_start = result["true_start"]
    t_end = result["true_end"]

    interval = result["interval"]
    pair = result["pair"]

    plt_x_p = []
    plt_y_p = []
    for p in range(p_start, p_end + interval, interval):
        plt_x_p.append(p)
        plt_y_p.append(p_dict[str(p)])

    plt_x_t = []
    plt_y_t = []
    for t in range(t_start, t_end + interval, interval):
        plt_x_t.append(t)
        plt_y_t.append(t_dict[str(t)])

    plt.plot(plt_x_p, plt_y_p)
    plt.plot(plt_x_t, plt_y_t)
    plt.legend(["predicted value", "true value"])
    plt.ylabel("Rate of change (%)")
    a = datetime.datetime.fromtimestamp(t_start)
    b = datetime.datetime.fromtimestamp(t_end)
    c = datetime.datetime.fromtimestamp(p_end)
    plt.xticks([t_start, t_end, p_end], [a, b, c])
    plt.title(pair)

    plt.show()

Using this API, I created an account to graph the results and tweet them. Please follow and check the latest information! @btc_pred

Why are you learning chart images with CNN?

Whatever the traders, they always read the market psychology by looking at the charts and predict the future. Deep learning will be superior to traders in that it makes a cool judgment. In addition, many traders bring the knowledge of stocks and FX to Bitcoin, but Bitcoin tend to be Bitcoin, so it will be necessary to re-learn. (Traders and AI.)

Will rumors be reflected in the prediction results?

Information on exchanges and government announcements have not been entered into the model, so this model will not be reflected in forecasting. However, since price changes after major fluctuation by rumors are already learned, I think that it is possible to predict how to make a transition after a crash / rise, where it is likely to become a bottom price or a high price.

Are there any other crypto currency forecasts?

It is under development now!

A formula

rate of change(%) = {{price(now) - price(24 hours ago)} / price(24 hours ago)} * 100