Example
Example Python plugin for phBot Crypto
from phBot import *
import talib
import numpy
EX_COINBASE = 0
EX_BINANCE = 1
EX_ALPACA = 2
EX_GEMINI = 3
EX_ALPACA_C = 4
EX_KRAKEN = 5
def signal(ex, pair):
bars = get_bars(ex, pair, 86400)
if bars:
close = numpy.array([x['c'] for x in bars])
rsi = talib.RSI(close)
print('Python: %s -> %s %f %f %f %f %f' % (pair, bars[-1]['t'], bars[-1]['o'], bars[-1]['h'], bars[-1]['l'], bars[-1]['c'], bars[-1]['v']))
return None
def update(ex, pair, last, avg, size, target):
print('Python: %s -> last: %f avg: %f size: %f target: %f' % (pair, last, avg, size, target))
return True
def finished():
pass
Last updated