<s> """<STR_LIT>""" <EOL> import datetime <EOL> import common <EOL> from pyalgotrade . bitcoincharts import barfeed <EOL> from pyalgotrade . utils import dt <EOL> class TestCase ( common . TestCase ) : <EOL> def testLoadNoFilter ( self ) : <EOL> feed = barfeed . CSVTradeFeed ( ) <EOL> feed . addBarsFromCSV ( common . get_data_file_path ( "<STR_LIT>" ) ) <EOL> loaded = [ ( dateTime , bars ) for dateTime , bars in feed ] <EOL> self . assertEquals ( len ( loaded ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] , dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:9> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getDateTime ( ) , dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:9> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getClose ( ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getPrice ( ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getVolume ( ) , <NUM_LIT:1.0> ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:0> ] , dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> , <NUM_LIT:8> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:5> ) ) ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getDateTime ( ) , dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> , <NUM_LIT:8> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:5> ) ) ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getClose ( ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getPrice ( ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getVolume ( ) , <NUM_LIT> ) <EOL> def testLoadFilterFrom ( self ) : <EOL> feed = barfeed . CSVTradeFeed ( ) <EOL> feed . addBarsFromCSV ( common . get_data_file_path ( "<STR_LIT>" ) , "<STR_LIT>" , fromDateTime = dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> ) ) ) <EOL> loaded = [ ( dateTime , bars ) for dateTime , bars in feed ] <EOL> self . assertEquals ( len ( loaded ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] , dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT> ) ) ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getDateTime ( ) , dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT> ) ) ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getClose ( ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getPrice ( ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getVolume ( ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:0> ] , dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> , <NUM_LIT:8> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:5> ) ) ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getDateTime ( ) , dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> , <NUM_LIT:8> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:5> ) ) ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getClose ( ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getPrice ( ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getVolume ( ) , <NUM_LIT> ) <EOL> def testLoadFilterFromAndTo ( self ) : <EOL> feed = barfeed . CSVTradeFeed ( ) <EOL> feed . addBarsFromCSV ( common . get_data_file_path ( "<STR_LIT>" ) , "<STR_LIT>" , fromDateTime = dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> ) ) , toDateTime = datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> ) ) <EOL> loaded = [ ( dateTime , bars ) for dateTime , bars in feed ] <EOL> self . assertEquals ( len ( loaded ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] , dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT> ) ) ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getDateTime ( ) , dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT> ) ) ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getClose ( ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getVolume ( ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:0> ] , dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT:30> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getDateTime ( ) , dt . as_utc ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT:30> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) ) ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getClose ( ) , <NUM_LIT> ) <EOL> self . assertEquals ( loaded [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] [ "<STR_LIT>" ] . getVolume ( ) , <NUM_LIT:20> ) </s>
