Esempio n. 1
0
    from Market import Market
    import matplotlib
    matplotlib.use('Agg')
    import matplotlib.pyplot as plt
    client = MongoClient("mongodb://115.28.4.59:27017")
    market = Market(client.trans.cnbtc, client.depths.cnbtc, client.trans_stat.cnbtc_min, client.trans_stat.cnbtc_hr, client.trans_stat.cnbtc_index)
    now = datetime.now()
    index_list = market.getMarketTrendIndexInLastN(60 * 24)
    index_480 = [x['index_480'] for x in index_list]
    index_240 = [x['index_240'] for x in index_list]
    index_120 = [x['index_120'] for x in index_list]
    index_60 = [x['index_60'] for x in index_list]
    t = [x['date'] for x in index_list]
    plt.figure(1, figsize=(15, 15))

    price_list = market.getMALastNMin(60 * 24, 10)

    plt.subplot(511)
    plt.plot(t, index_60, '-')
    plt.title("Market Trend with N = 60 min")
    plt.grid()

    plt.subplot(512)
    plt.plot(t, index_120, '-')
    plt.title("Market Trend with N = 120 min")
    plt.grid()

    plt.subplot(513)
    plt.plot(t, index_240, '-')
    plt.title("Market Trend with N = 240 min")
    plt.grid()
Esempio n. 2
0
    matplotlib.use('Agg')
    import matplotlib.pyplot as plt
    client = MongoClient("mongodb://115.28.4.59:27017")
    market = Market(client.trans.cnbtc, client.depths.cnbtc,
                    client.trans_stat.cnbtc_min, client.trans_stat.cnbtc_hr,
                    client.trans_stat.cnbtc_index)
    now = datetime.now()
    index_list = market.getMarketTrendIndexInLastN(60 * 24)
    index_480 = [x['index_480'] for x in index_list]
    index_240 = [x['index_240'] for x in index_list]
    index_120 = [x['index_120'] for x in index_list]
    index_60 = [x['index_60'] for x in index_list]
    t = [x['date'] for x in index_list]
    plt.figure(1, figsize=(15, 15))

    price_list = market.getMALastNMin(60 * 24, 10)

    plt.subplot(511)
    plt.plot(t, index_60, '-')
    plt.title("Market Trend with N = 60 min")
    plt.grid()

    plt.subplot(512)
    plt.plot(t, index_120, '-')
    plt.title("Market Trend with N = 120 min")
    plt.grid()

    plt.subplot(513)
    plt.plot(t, index_240, '-')
    plt.title("Market Trend with N = 240 min")
    plt.grid()