Indicators, talib, how to use it with binance api?

0
def funciones(var, var1):
#resta volumen nuevo menos volumen viejo
volumen = float(var1[1]) - float(var[2])
#saca porcentaje del precio desde ke se lanzo el script
preciopor = ((float(var1[0])/float(var[1]))*100)-100
#pasa porcentaje a 3 digitos
porcentaje = format(preciopor, '.2f')
#extrae los precios historicos en velas de 1 hora desde hace 60 dias
klines = client.get_historical_klines(var[0], Client.KLINE_INTERVAL_1HOUR, "10 day ago UTC")
lista = []
lista1 = []
lista2 = []
suma = 0
#agrega los precios de cierre a una lista para extraer las resistencias
for x in klines:
    lista.append(x[4])'

with this code I get the prices of a specific currency, 10 days ago, now what I'm interested in is putting it in a numy.array to be able to use it with the TA-lib library, but I do not take it, I'm doing like this

listas = np.array([lista])

and when I want to use TA-lib looking for a mobile Media with

output = SMA(lista1, timeperiod=25)

I miss this error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "talib/_abstract.pxi", line 352, in talib._ta_lib.Function.__call__
  File "talib/_abstract.pxi", line 383, in talib._ta_lib.Function.__call_function
  File "/usr/local/lib/python2.7/dist-packages/talib/__init__.py", line 24, in wrapper
    return func(*args, **kwargs)
  File "talib/_func.pxi", line 9908, in talib._ta_lib.SMA
TypeError: only length-1 arrays can be converted to Python scalars
    
asked by Rafael Hidalgo 29.03.2018 в 01:45
source

0 answers