rosspalmer / bitQuant

Bitcoin data gathering, backtesting, and algorithmic trading solution
MIT License
23 stars 9 forks source link

Error related to int type adjustment #16

Open multidis opened 9 years ago

multidis commented 9 years ago

When trades_to_price is given start-argument of numpy.int64 type instead of the base int type, "buffer size mismatch" exception is raised. Int64 from numpy apparently appear very commonly in datetime to epoch conversions.

Example: using trades within a set number of hours prior to the latest timestamp;

read_start_unixt = trd['timestamp'].max() - nhours_to_read*3600
dfpr = bq.trades_to_price('30min', start=read_start_unixt)

This raises an error unless:

read_start_unixt = int(trd['timestamp'].max() - nhours_to_read*3600)

Suggestion: Include int() conversion in the sql_to_df function if start argument is not a string, around here.

PS: Took some debugging since the error looked quite obscure (at least for a non-python person).