Exemplo n.º 1
0
def print_chart(exchange, symbol, timeframe):

    print("\n" + exchange.name + ' ' + symbol + ' ' + timeframe + ' chart:')

    # get a list of ohlcv candles
    ohlcv = exchange.fetch_ohlcv(symbol, timeframe)

    # get the ohlCv (closing price, index == 4)
    series = [x[index] for x in ohlcv]
    time = [t[0] for t in ohlcv]

    tframe = pd.DataFrame(time)
    frame = pd.DataFrame(series)
    #print("enter")
    print("\n" + frame[-2:].to_string())
    print("\n" + tframe[-2:].to_string())

    #ts = pd.Series(frame[-150:], tframe[-150:])
    #ts = ts.cumsum()
    #ts.plot()

    #ts = pd.Series(np.random.randn(1000),
    #index=pd.date_range('1/1/2000', periods=1000))

    #ts = ts.cumsum()
    fig = plt.figure()
    #plt.plot(1,1)
    #plt.show()

    # print the chart
    print("\n" +
          asciichart.plot(series[-150:], {'height': 20}))  # print the chart

    last = ohlcv[len(ohlcv) - 1][index]  # last closing price
    return last
Exemplo n.º 2
0
def print_chart(exchange, symbol, timeframe):

    print("\n" + exchange.name + ' ' + timeframe + 'chart: ')

    # get a list of ohlcv candles
    ohlcv = exchange.fetch_ohlcv(symbol, timeframe)

    # get the attribute we are interested in
    index = 2
    series = [x[index] for x in ohlcv]

    # print chart
    print("\n" + asciichart.plot(series[-120:], {'height': 20}))
Exemplo n.º 3
0
def print_chart(exchange, symbol, timeframe):

    print("\n" + exchange.name + ' ' + symbol + ' ' + timeframe + ' chart:')

    # get a list of ohlcv candles
    ohlcv = exchange.fetch_ohlcv(symbol, timeframe)

    # get the ohlCv (closing price, index == 4)
    series = [x[index] for x in ohlcv]

    # print the chart
    print("\n" + asciichart.plot(series[-length:], {'height': height}))  # print the chart

    last = ohlcv[len(ohlcv) - 1][index]  # last closing price
    return last
Exemplo n.º 4
0
def print_chart(exchange, symbol, timeframe):

    print("\n" + exchange.name + ' ' + symbol + ' ' + timeframe + ' chart:')

    # get a list of ohlcv candles
    ohlcv = exchange.fetch_ohlcv(symbol, timeframe)

    # get the ohlCv (closing price, index == 4)
    series = [x[index] for x in ohlcv]

    # print the chart
    print("\n" + asciichart.plot(series[-length:], {'height': height}))  # print the chart

    last = ohlcv[len(ohlcv) - 1][index]  # last closing price
    return last
Exemplo n.º 5
0
def tstamp(t):
    return datetime.datetime.fromtimestamp(t).strftime('%H:%M:%S.%f')

with open("arbs.json", "r") as f:
    arbs = json.load(f)

print(arbs.keys())

for path in arbs["path"]:
    print(path)

i = 0
for k, series in arbs["history"].items():
    print("Some timeseries")
    t = [tstamp(float(a["time"])) for a in series]
    z = [t[0], t[-1]]
    v = [float(a["value"]) * 1000 - 1000 for a in series]
    print(len(v))
    if max(v) < 2:
        continue
    print(plot(v))
    input()

    plt.ioff()
    plt.title(k)
    plt.plot(v)
    plt.ylabel('Profit per $1,000')
    plt.xlabel("{} to {}".format(z[0], z[1]))
    plt.savefig('charts/{}.png'.format(k), dpi=plt.gcf().dpi)
    plt.close()