Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I feed in my own data into PyAlgoTrade?

I'm trying to use PyAlogoTrade's event profiler

However I don't want to use data from yahoo!finance, I want to use my own but can't figure out how to parse in the CSV, it is in the format:

Timestamp      Low  Open   Close       High        BTC_vol     USD_vol       [8]      [9]
2013-11-23 00  800  860    847.666666  886.876543  853.833333   6195.334452  5248330  0
2013-11-24 00  745  847.5  815.01      860         831.255     10785.94131   8680720  0

The complete CSV is here

I want to do something like:

def main(plot):
    instruments = ["AA", "AES", "AIG"]
    feed = yahoofinance.build_feed(instruments, 2008, 2009, ".")

Then replace yahoofinance.build_feed(instruments, 2008, 2009, ".") with my CSV

I tried:

import csv

with open( 'FinexBTCDaily.csv', 'rb' ) as csvfile:
     data = csv.reader( csvfile )

def main( plot ):
    feed = data

But it throws an attribute error. Any ideas how to do this?

like image 632
David Hancock Avatar asked May 03 '16 12:05

David Hancock


1 Answers

I suggest to create your own Rowparser and Feed, which is much easier than it sounds, have a look here: yahoofeed

This also allows you to work with intraday data and cleanup the data if needed, like your timestamp.

Another possibility, of course, would be to parse your file and save it, so it looks like a yahoo feed. In your case, you would have to adapt the columns and the Timestamp.

like image 55
Fari Avatar answered Sep 18 '22 14:09

Fari